/arch/arm/mach-msm/board-halibut.c
C | 482 lines | 412 code | 53 blank | 17 comment | 2 complexity | 6a7324eb00415da45b343de3eb5d04b0 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
1/* linux/arch/arm/mach-msm/board-halibut.c
2 *
3 * Copyright (C) 2007 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/platform_device.h>
20#include <linux/input.h>
21#include <linux/io.h>
22#include <linux/delay.h>
23#include <linux/bootmem.h>
24
25#include <mach/hardware.h>
26#include <mach/irqs.h>
27#include <mach/gpio.h>
28#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <asm/mach/flash.h>
32#include <asm/setup.h>
33
34#include <mach/irqs.h>
35#include <mach/board.h>
36#include <mach/msm_iomap.h>
37#include <mach/msm_hsusb.h>
38#include <mach/camera.h>
39
40#include <linux/mtd/nand.h>
41#include <linux/mtd/partitions.h>
42#include <linux/i2c.h>
43#include <linux/android_pmem.h>
44#include <linux/usb/android_composite.h>
45
46#include "devices.h"
47#include "board-halibut.h"
48#include "proc_comm.h"
49
50static struct resource smc91x_resources[] = {
51 [0] = {
52 .start = 0x9C004300,
53 .end = 0x9C004400,
54 .flags = IORESOURCE_MEM,
55 },
56 [1] = {
57 .start = MSM_GPIO_TO_INT(49),
58 .end = MSM_GPIO_TO_INT(49),
59 .flags = IORESOURCE_IRQ,
60 },
61};
62
63static struct platform_device smc91x_device = {
64 .name = "smc91x",
65 .id = 0,
66 .num_resources = ARRAY_SIZE(smc91x_resources),
67 .resource = smc91x_resources,
68};
69
70static struct i2c_board_info i2c_devices[] = {
71#ifdef CONFIG_MT9D112
72 {
73 I2C_BOARD_INFO("mt9d112", 0x78 >> 1),
74 },
75#endif
76#ifdef CONFIG_S5K3E2FX
77 {
78 I2C_BOARD_INFO("s5k3e2fx", 0x20 >> 1),
79 },
80#endif
81#ifdef CONFIG_MT9P012
82 {
83 I2C_BOARD_INFO("mt9p012", 0x6C >> 1),
84 },
85#endif
86#if defined(CONFIG_MT9T013) || defined(CONFIG_SENSORS_MT9T013)
87 {
88 I2C_BOARD_INFO("mt9t013", 0x6C), // 0x78>>1
89 },
90#endif
91};
92
93#ifdef CONFIG_MSM_CAMERA
94static uint32_t camera_off_gpio_table[] = {
95 /* parallel CAMERA interfaces */
96 PCOM_GPIO_CFG(0, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT0 */
97 PCOM_GPIO_CFG(1, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT1 */
98 PCOM_GPIO_CFG(2, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT2 */
99 PCOM_GPIO_CFG(3, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT3 */
100 PCOM_GPIO_CFG(4, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT4 */
101 PCOM_GPIO_CFG(5, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT5 */
102 PCOM_GPIO_CFG(6, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT6 */
103 PCOM_GPIO_CFG(7, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT7 */
104 PCOM_GPIO_CFG(8, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT8 */
105 PCOM_GPIO_CFG(9, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT9 */
106 PCOM_GPIO_CFG(10, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT10 */
107 PCOM_GPIO_CFG(11, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT11 */
108 PCOM_GPIO_CFG(12, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* PCLK */
109 PCOM_GPIO_CFG(13, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* HSYNC_IN */
110 PCOM_GPIO_CFG(14, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* VSYNC_IN */
111 PCOM_GPIO_CFG(15, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), /* MCLK */
112};
113
114static uint32_t camera_on_gpio_table[] = {
115 /* parallel CAMERA interfaces */
116 PCOM_GPIO_CFG(0, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT0 */
117 PCOM_GPIO_CFG(1, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT1 */
118 PCOM_GPIO_CFG(2, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT2 */
119 PCOM_GPIO_CFG(3, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT3 */
120 PCOM_GPIO_CFG(4, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT4 */
121 PCOM_GPIO_CFG(5, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT5 */
122 PCOM_GPIO_CFG(6, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT6 */
123 PCOM_GPIO_CFG(7, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT7 */
124 PCOM_GPIO_CFG(8, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT8 */
125 PCOM_GPIO_CFG(9, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT9 */
126 PCOM_GPIO_CFG(10, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT10 */
127 PCOM_GPIO_CFG(11, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT11 */
128 PCOM_GPIO_CFG(12, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_16MA), /* PCLK */
129 PCOM_GPIO_CFG(13, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* HSYNC_IN */
130 PCOM_GPIO_CFG(14, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* VSYNC_IN */
131 PCOM_GPIO_CFG(15, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_16MA), /* MCLK */
132};
133
134static void config_gpio_table(uint32_t *table, int len)
135{
136 int n;
137 unsigned id;
138 for (n = 0; n < len; n++) {
139 id = table[n];
140 msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &id, 0);
141 }
142}
143
144static void config_camera_on_gpios(void)
145{
146 config_gpio_table(camera_on_gpio_table,
147 ARRAY_SIZE(camera_on_gpio_table));
148}
149
150static void config_camera_off_gpios(void)
151{
152 config_gpio_table(camera_off_gpio_table,
153 ARRAY_SIZE(camera_off_gpio_table));
154}
155
156static struct msm_camera_device_platform_data msm_camera_device_data = {
157 .camera_gpio_on = config_camera_on_gpios,
158 .camera_gpio_off = config_camera_off_gpios,
159 .ioext.mdcphy = MSM_MDC_PHYS,
160 .ioext.mdcsz = MSM_MDC_SIZE,
161 .ioext.appphy = MSM_CLK_CTL_PHYS,
162 .ioext.appsz = MSM_CLK_CTL_SIZE,
163};
164
165#ifdef CONFIG_MT9D112
166static struct msm_camera_sensor_info msm_camera_sensor_mt9d112_data = {
167 .sensor_name = "mt9d112",
168 .sensor_reset = 89,
169 .sensor_pwd = 85,
170 .vcm_pwd = 0,
171 .pdata = &msm_camera_device_data,
172};
173
174static struct platform_device msm_camera_sensor_mt9d112 = {
175 .name = "msm_camera_mt9d112",
176 .dev = {
177 .platform_data = &msm_camera_sensor_mt9d112_data,
178 },
179};
180#endif
181
182#ifdef CONFIG_S5K3E2FX
183static struct msm_camera_sensor_info msm_camera_sensor_s5k3e2fx_data = {
184 .sensor_name = "s5k3e2fx",
185 .sensor_reset = 89,
186 .sensor_pwd = 85,
187 .vcm_pwd = 0,
188 .pdata = &msm_camera_device_data,
189};
190
191static struct platform_device msm_camera_sensor_s5k3e2fx = {
192 .name = "msm_camera_s5k3e2fx",
193 .dev = {
194 .platform_data = &msm_camera_sensor_s5k3e2fx_data,
195 },
196};
197#endif
198
199#ifdef CONFIG_MT9P012
200static struct msm_camera_sensor_info msm_camera_sensor_mt9p012_data = {
201 .sensor_name = "mt9p012",
202 .sensor_reset = 89,
203 .sensor_pwd = 85,
204 .vcm_pwd = 88,
205 .pdata = &msm_camera_device_data,
206};
207
208static struct platform_device msm_camera_sensor_mt9p012 = {
209 .name = "msm_camera_mt9p012",
210 .dev = {
211 .platform_data = &msm_camera_sensor_mt9p012_data,
212 },
213};
214#endif
215
216#ifdef CONFIG_MT9T013
217static struct msm_camera_sensor_info msm_camera_sensor_mt9t013_data = {
218 .sensor_name = "mt9t013",
219 .sensor_reset = 89,
220 .sensor_pwd = 85,
221 .vcm_pwd = 0,
222 .pdata = &msm_camera_device_data,
223};
224
225static struct platform_device msm_camera_sensor_mt9t013 = {
226 .name = "msm_camera_mt9t013",
227 .dev = {
228 .platform_data = &msm_camera_sensor_mt9t013_data,
229 },
230};
231#endif
232#endif /*CONFIG_MSM_CAMERA*/
233
234#define SND(desc, num) { .name = #desc, .id = num }
235static struct snd_endpoint snd_endpoints_list[] = {
236 SND(HANDSET, 0),
237 SND(HEADSET, 2),
238 SND(SPEAKER, 6),
239 SND(BT, 12),
240 SND(CURRENT, 25),
241};
242#undef SND
243
244static struct msm_snd_endpoints halibut_snd_endpoints = {
245 .endpoints = snd_endpoints_list,
246 .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
247};
248
249static struct platform_device halibut_snd = {
250 .name = "msm_snd",
251 .id = -1,
252 .dev = {
253 .platform_data = &halibut_snd_endpoints
254 },
255};
256
257static struct android_pmem_platform_data android_pmem_pdata = {
258 .name = "pmem",
259 .start = MSM_PMEM_MDP_BASE,
260 .size = MSM_PMEM_MDP_SIZE,
261 .no_allocator = 0,
262 .cached = 1,
263};
264
265static struct android_pmem_platform_data android_pmem_camera_pdata = {
266 .name = "pmem_camera",
267 .start = MSM_PMEM_CAMERA_BASE,
268 .size = MSM_PMEM_CAMERA_SIZE,
269 .no_allocator = 1,
270 .cached = 1,
271};
272
273static struct android_pmem_platform_data android_pmem_adsp_pdata = {
274 .name = "pmem_adsp",
275 .start = MSM_PMEM_ADSP_BASE,
276 .size = MSM_PMEM_ADSP_SIZE,
277 .no_allocator = 0,
278 .cached = 0,
279};
280
281static struct android_pmem_platform_data android_pmem_gpu0_pdata = {
282 .name = "pmem_gpu0",
283 .start = MSM_PMEM_GPU0_BASE,
284 .size = MSM_PMEM_GPU0_SIZE,
285 .no_allocator = 1,
286 .cached = 0,
287};
288
289static struct android_pmem_platform_data android_pmem_gpu1_pdata = {
290 .name = "pmem_gpu1",
291 .start = MSM_PMEM_GPU1_BASE,
292 .size = MSM_PMEM_GPU1_SIZE,
293 .no_allocator = 1,
294 .cached = 0,
295};
296
297static struct platform_device android_pmem_device = {
298 .name = "android_pmem",
299 .id = 0,
300 .dev = { .platform_data = &android_pmem_pdata },
301};
302
303static struct platform_device android_pmem_adsp_device = {
304 .name = "android_pmem",
305 .id = 1,
306 .dev = { .platform_data = &android_pmem_adsp_pdata },
307};
308
309static struct platform_device android_pmem_gpu0_device = {
310 .name = "android_pmem",
311 .id = 2,
312 .dev = { .platform_data = &android_pmem_gpu0_pdata },
313};
314
315static struct platform_device android_pmem_gpu1_device = {
316 .name = "android_pmem",
317 .id = 3,
318 .dev = { .platform_data = &android_pmem_gpu1_pdata },
319};
320
321static struct platform_device android_pmem_camera_device = {
322 .name = "android_pmem",
323 .id = 4,
324 .dev = { .platform_data = &android_pmem_camera_pdata },
325};
326
327static int halibut_phy_init_seq[] = { 0x1D, 0x0D, 0x1D, 0x10, -1 };
328
329static struct msm_hsusb_platform_data msm_hsusb_pdata = {
330 .phy_init_seq = halibut_phy_init_seq,
331};
332
333static struct usb_mass_storage_platform_data mass_storage_pdata = {
334 .nluns = 1,
335 .vendor = "Qualcomm",
336 .product = "Halibut",
337 .release = 0x0100,
338};
339
340static struct platform_device usb_mass_storage_device = {
341 .name = "usb_mass_storage",
342 .id = -1,
343 .dev = {
344 .platform_data = &mass_storage_pdata,
345 },
346};
347
348static char *usb_functions[] = { "usb_mass_storage" };
349static char *usb_functions_adb[] = { "usb_mass_storage", "adb" };
350
351static struct android_usb_product usb_products[] = {
352 {
353 .product_id = 0x0c01,
354 .num_functions = ARRAY_SIZE(usb_functions),
355 .functions = usb_functions,
356 },
357 {
358 .product_id = 0x0c02,
359 .num_functions = ARRAY_SIZE(usb_functions_adb),
360 .functions = usb_functions_adb,
361 },
362};
363
364static struct android_usb_platform_data android_usb_pdata = {
365 .vendor_id = 0x18d1,
366 .product_id = 0x0c01,
367 .version = 0x0100,
368 .serial_number = "42",
369 .product_name = "Halibutdroid",
370 .manufacturer_name = "Qualcomm",
371 .num_products = ARRAY_SIZE(usb_products),
372 .products = usb_products,
373 .num_functions = ARRAY_SIZE(usb_functions_adb),
374 .functions = usb_functions_adb,
375};
376
377static struct platform_device android_usb_device = {
378 .name = "android_usb",
379 .id = -1,
380 .dev = {
381 .platform_data = &android_usb_pdata,
382 },
383};
384
385static struct platform_device fish_battery_device = {
386 .name = "fish_battery",
387};
388
389static struct platform_device *devices[] __initdata = {
390#if !defined(CONFIG_MSM_SERIAL_DEBUGGER)
391 &msm_device_uart3,
392#endif
393 &msm_device_smd,
394 &msm_device_nand,
395 &msm_device_hsusb,
396 &usb_mass_storage_device,
397 &android_usb_device,
398 &msm_device_i2c,
399 &smc91x_device,
400 &halibut_snd,
401#ifdef CONFIG_MT9T013
402 &msm_camera_sensor_mt9t013,
403#endif
404#ifdef CONFIG_MT9D112
405 &msm_camera_sensor_mt9d112,
406#endif
407#ifdef CONFIG_S5K3E2FX
408 &msm_camera_sensor_s5k3e2fx,
409#endif
410#ifdef CONFIG_MT9P012
411 &msm_camera_sensor_mt9p012,
412#endif
413 &android_pmem_device,
414 &android_pmem_adsp_device,
415 &android_pmem_gpu0_device,
416 &android_pmem_gpu1_device,
417 &android_pmem_camera_device,
418 &fish_battery_device,
419};
420
421extern struct sys_timer msm_timer;
422
423static void __init halibut_init_irq(void)
424{
425 msm_init_irq();
426}
427
428static struct msm_acpu_clock_platform_data halibut_clock_data = {
429 .acpu_switch_time_us = 50,
430 .max_speed_delta_khz = 256000,
431 .vdd_switch_time_us = 62,
432 .power_collapse_khz = 19200000,
433 .wait_for_irq_khz = 128000000,
434};
435
436extern void msm_serial_debug_init(unsigned int base, int irq,
437 struct device *clk_device, int signal_irq);
438
439static void __init halibut_init(void)
440{
441#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
442 msm_serial_debug_init(MSM_UART3_PHYS, INT_UART3,
443 &msm_device_uart3.dev, 1);
444#endif
445 msm_device_hsusb.dev.platform_data = &msm_hsusb_pdata;
446 msm_acpu_clock_init(&halibut_clock_data);
447#ifdef CONFIG_MSM_CAMERA
448 config_camera_off_gpios(); /* might not be necessary */
449#endif
450 i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
451 platform_add_devices(devices, ARRAY_SIZE(devices));
452 i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
453 msm_hsusb_set_vbus_state(1);
454}
455
456static void __init halibut_fixup(struct machine_desc *desc, struct tag *tags,
457 char **cmdline, struct meminfo *mi)
458{
459 mi->nr_banks = 1;
460 mi->bank[0].start = PHYS_OFFSET;
461 mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET);
462 mi->bank[0].size = (101*1024*1024);
463}
464
465static void __init halibut_map_io(void)
466{
467 msm_map_common_io();
468 msm_clock_init(msm_clocks_7x01a, msm_num_clocks_7x01a);
469}
470
471MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)")
472#ifdef CONFIG_MSM_DEBUG_UART
473 .phys_io = MSM_DEBUG_UART_PHYS,
474 .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
475#endif
476 .boot_params = 0x10000100,
477 .fixup = halibut_fixup,
478 .map_io = halibut_map_io,
479 .init_irq = halibut_init_irq,
480 .init_machine = halibut_init,
481 .timer = &msm_timer,
482MACHINE_END