Commit | Line | Data |
---|---|---|
cf75d8d2 MR |
1 | /* |
2 | * linux/arch/arm/mach-pxa/cm-x300.c | |
3 | * | |
4 | * Support for the CompuLab CM-X300 modules | |
5 | * | |
14fd9e00 | 6 | * Copyright (C) 2008,2009 CompuLab Ltd. |
cf75d8d2 MR |
7 | * |
8 | * Mike Rapoport <mike@compulab.co.il> | |
14fd9e00 | 9 | * Igor Grinberg <grinberg@compulab.co.il> |
cf75d8d2 MR |
10 | * |
11 | * This program is free software; you can redistribute it and/or modify | |
12 | * it under the terms of the GNU General Public License version 2 as | |
13 | * published by the Free Software Foundation. | |
14 | */ | |
15 | ||
16 | #include <linux/module.h> | |
17 | #include <linux/kernel.h> | |
18 | #include <linux/interrupt.h> | |
19 | #include <linux/init.h> | |
b3d01da6 | 20 | #include <linux/delay.h> |
cf75d8d2 MR |
21 | #include <linux/platform_device.h> |
22 | ||
23 | #include <linux/gpio.h> | |
24 | #include <linux/dm9000.h> | |
25 | #include <linux/leds.h> | |
1858ced3 | 26 | #include <linux/rtc-v3020.h> |
cf75d8d2 MR |
27 | |
28 | #include <linux/i2c.h> | |
29 | #include <linux/i2c/pca953x.h> | |
30 | ||
9c017ca1 IG |
31 | #include <linux/mfd/da903x.h> |
32 | ||
83e560ee IG |
33 | #include <linux/spi/spi.h> |
34 | #include <linux/spi/spi_gpio.h> | |
35 | #include <linux/spi/tdo24m.h> | |
36 | ||
cf75d8d2 MR |
37 | #include <asm/mach-types.h> |
38 | #include <asm/mach/arch.h> | |
b5a5c474 | 39 | #include <asm/setup.h> |
cf75d8d2 | 40 | |
51c62982 | 41 | #include <mach/pxa300.h> |
edaa64c9 | 42 | #include <mach/pxa27x-udc.h> |
cf75d8d2 MR |
43 | #include <mach/pxafb.h> |
44 | #include <mach/mmc.h> | |
45 | #include <mach/ohci.h> | |
f0a83701 | 46 | #include <plat/i2c.h> |
82b95ecb | 47 | #include <plat/pxa3xx_nand.h> |
74e74def | 48 | #include <mach/audio.h> |
cf75d8d2 MR |
49 | |
50 | #include <asm/mach/map.h> | |
51 | ||
52 | #include "generic.h" | |
53 | ||
54 | #define CM_X300_ETH_PHYS 0x08000010 | |
55 | ||
0bff2fc3 MR |
56 | #define GPIO82_MMC_IRQ (82) |
57 | #define GPIO85_MMC_WP (85) | |
cf75d8d2 | 58 | |
0bff2fc3 | 59 | #define CM_X300_MMC_IRQ IRQ_GPIO(GPIO82_MMC_IRQ) |
cf75d8d2 | 60 | |
1858ced3 MR |
61 | #define GPIO95_RTC_CS (95) |
62 | #define GPIO96_RTC_WR (96) | |
63 | #define GPIO97_RTC_RD (97) | |
64 | #define GPIO98_RTC_IO (98) | |
65 | ||
def8252d | 66 | static mfp_cfg_t cm_x3xx_mfp_cfg[] __initdata = { |
cf75d8d2 MR |
67 | /* LCD */ |
68 | GPIO54_LCD_LDD_0, | |
69 | GPIO55_LCD_LDD_1, | |
70 | GPIO56_LCD_LDD_2, | |
71 | GPIO57_LCD_LDD_3, | |
72 | GPIO58_LCD_LDD_4, | |
73 | GPIO59_LCD_LDD_5, | |
74 | GPIO60_LCD_LDD_6, | |
75 | GPIO61_LCD_LDD_7, | |
76 | GPIO62_LCD_LDD_8, | |
77 | GPIO63_LCD_LDD_9, | |
78 | GPIO64_LCD_LDD_10, | |
79 | GPIO65_LCD_LDD_11, | |
80 | GPIO66_LCD_LDD_12, | |
81 | GPIO67_LCD_LDD_13, | |
82 | GPIO68_LCD_LDD_14, | |
83 | GPIO69_LCD_LDD_15, | |
84 | GPIO72_LCD_FCLK, | |
85 | GPIO73_LCD_LCLK, | |
86 | GPIO74_LCD_PCLK, | |
87 | GPIO75_LCD_BIAS, | |
88 | ||
89 | /* BTUART */ | |
90 | GPIO111_UART2_RTS, | |
91 | GPIO112_UART2_RXD | MFP_LPM_EDGE_FALL, | |
92 | GPIO113_UART2_TXD, | |
93 | GPIO114_UART2_CTS | MFP_LPM_EDGE_BOTH, | |
94 | ||
95 | /* STUART */ | |
96 | GPIO109_UART3_TXD, | |
97 | GPIO110_UART3_RXD | MFP_LPM_EDGE_FALL, | |
98 | ||
99 | /* AC97 */ | |
100 | GPIO23_AC97_nACRESET, | |
101 | GPIO24_AC97_SYSCLK, | |
102 | GPIO29_AC97_BITCLK, | |
103 | GPIO25_AC97_SDATA_IN_0, | |
104 | GPIO27_AC97_SDATA_OUT, | |
105 | GPIO28_AC97_SYNC, | |
106 | ||
107 | /* Keypad */ | |
108 | GPIO115_KP_MKIN_0 | MFP_LPM_EDGE_BOTH, | |
109 | GPIO116_KP_MKIN_1 | MFP_LPM_EDGE_BOTH, | |
110 | GPIO117_KP_MKIN_2 | MFP_LPM_EDGE_BOTH, | |
111 | GPIO118_KP_MKIN_3 | MFP_LPM_EDGE_BOTH, | |
112 | GPIO119_KP_MKIN_4 | MFP_LPM_EDGE_BOTH, | |
113 | GPIO120_KP_MKIN_5 | MFP_LPM_EDGE_BOTH, | |
114 | GPIO2_2_KP_MKIN_6 | MFP_LPM_EDGE_BOTH, | |
115 | GPIO3_2_KP_MKIN_7 | MFP_LPM_EDGE_BOTH, | |
116 | GPIO121_KP_MKOUT_0, | |
117 | GPIO122_KP_MKOUT_1, | |
118 | GPIO123_KP_MKOUT_2, | |
119 | GPIO124_KP_MKOUT_3, | |
120 | GPIO125_KP_MKOUT_4, | |
121 | GPIO4_2_KP_MKOUT_5, | |
122 | ||
123 | /* MMC1 */ | |
124 | GPIO3_MMC1_DAT0, | |
125 | GPIO4_MMC1_DAT1 | MFP_LPM_EDGE_BOTH, | |
126 | GPIO5_MMC1_DAT2, | |
127 | GPIO6_MMC1_DAT3, | |
128 | GPIO7_MMC1_CLK, | |
129 | GPIO8_MMC1_CMD, /* CMD0 for slot 0 */ | |
130 | ||
131 | /* MMC2 */ | |
132 | GPIO9_MMC2_DAT0, | |
133 | GPIO10_MMC2_DAT1 | MFP_LPM_EDGE_BOTH, | |
134 | GPIO11_MMC2_DAT2, | |
135 | GPIO12_MMC2_DAT3, | |
136 | GPIO13_MMC2_CLK, | |
137 | GPIO14_MMC2_CMD, | |
138 | ||
139 | /* FFUART */ | |
140 | GPIO30_UART1_RXD | MFP_LPM_EDGE_FALL, | |
141 | GPIO31_UART1_TXD, | |
142 | GPIO32_UART1_CTS, | |
143 | GPIO37_UART1_RTS, | |
144 | GPIO33_UART1_DCD, | |
145 | GPIO34_UART1_DSR | MFP_LPM_EDGE_FALL, | |
146 | GPIO35_UART1_RI, | |
147 | GPIO36_UART1_DTR, | |
148 | ||
149 | /* GPIOs */ | |
cf75d8d2 MR |
150 | GPIO82_GPIO | MFP_PULL_HIGH, /* MMC CD */ |
151 | GPIO85_GPIO, /* MMC WP */ | |
152 | GPIO99_GPIO, /* Ethernet IRQ */ | |
6f584cfa | 153 | |
1858ced3 MR |
154 | /* RTC GPIOs */ |
155 | GPIO95_GPIO, /* RTC CS */ | |
156 | GPIO96_GPIO, /* RTC WR */ | |
157 | GPIO97_GPIO, /* RTC RD */ | |
158 | GPIO98_GPIO, /* RTC IO */ | |
159 | ||
6f584cfa EM |
160 | /* Standard I2C */ |
161 | GPIO21_I2C_SCL, | |
162 | GPIO22_I2C_SDA, | |
cf75d8d2 MR |
163 | }; |
164 | ||
def8252d | 165 | static mfp_cfg_t cm_x3xx_rev_lt130_mfp_cfg[] __initdata = { |
55052ea2 IG |
166 | /* GPIOs */ |
167 | GPIO79_GPIO, /* LED */ | |
168 | GPIO77_GPIO, /* WiFi reset */ | |
169 | GPIO78_GPIO, /* BT reset */ | |
170 | }; | |
171 | ||
def8252d | 172 | static mfp_cfg_t cm_x3xx_rev_ge130_mfp_cfg[] __initdata = { |
55052ea2 IG |
173 | /* GPIOs */ |
174 | GPIO76_GPIO, /* LED */ | |
175 | GPIO71_GPIO, /* WiFi reset */ | |
176 | GPIO70_GPIO, /* BT reset */ | |
177 | }; | |
178 | ||
def8252d IG |
179 | static mfp_cfg_t cm_x310_mfp_cfg[] __initdata = { |
180 | /* USB PORT 2 */ | |
181 | ULPI_STP, | |
182 | ULPI_NXT, | |
183 | ULPI_DIR, | |
184 | GPIO30_ULPI_DATA_OUT_0, | |
185 | GPIO31_ULPI_DATA_OUT_1, | |
186 | GPIO32_ULPI_DATA_OUT_2, | |
187 | GPIO33_ULPI_DATA_OUT_3, | |
188 | GPIO34_ULPI_DATA_OUT_4, | |
189 | GPIO35_ULPI_DATA_OUT_5, | |
190 | GPIO36_ULPI_DATA_OUT_6, | |
191 | GPIO37_ULPI_DATA_OUT_7, | |
192 | GPIO38_ULPI_CLK, | |
193 | /* external PHY reset pin */ | |
194 | GPIO127_GPIO, | |
195 | ||
196 | /* USB PORT 3 */ | |
197 | GPIO77_USB_P3_1, | |
198 | GPIO78_USB_P3_2, | |
199 | GPIO79_USB_P3_3, | |
200 | GPIO80_USB_P3_4, | |
201 | GPIO81_USB_P3_5, | |
202 | GPIO82_USB_P3_6, | |
203 | GPIO0_2_USBH_PEN, | |
204 | }; | |
205 | ||
cf75d8d2 MR |
206 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
207 | static struct resource dm9000_resources[] = { | |
208 | [0] = { | |
209 | .start = CM_X300_ETH_PHYS, | |
210 | .end = CM_X300_ETH_PHYS + 0x3, | |
211 | .flags = IORESOURCE_MEM, | |
212 | }, | |
213 | [1] = { | |
214 | .start = CM_X300_ETH_PHYS + 0x4, | |
215 | .end = CM_X300_ETH_PHYS + 0x4 + 500, | |
216 | .flags = IORESOURCE_MEM, | |
217 | }, | |
218 | [2] = { | |
219 | .start = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO99)), | |
220 | .end = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO99)), | |
221 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | |
222 | } | |
223 | }; | |
224 | ||
225 | static struct dm9000_plat_data cm_x300_dm9000_platdata = { | |
bff22c9b | 226 | .flags = DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM, |
cf75d8d2 MR |
227 | }; |
228 | ||
229 | static struct platform_device dm9000_device = { | |
230 | .name = "dm9000", | |
231 | .id = 0, | |
232 | .num_resources = ARRAY_SIZE(dm9000_resources), | |
233 | .resource = dm9000_resources, | |
234 | .dev = { | |
235 | .platform_data = &cm_x300_dm9000_platdata, | |
236 | } | |
237 | ||
238 | }; | |
239 | ||
240 | static void __init cm_x300_init_dm9000(void) | |
241 | { | |
242 | platform_device_register(&dm9000_device); | |
243 | } | |
244 | #else | |
245 | static inline void cm_x300_init_dm9000(void) {} | |
246 | #endif | |
247 | ||
83e560ee | 248 | /* LCD */ |
cf75d8d2 MR |
249 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
250 | static struct pxafb_mode_info cm_x300_lcd_modes[] = { | |
251 | [0] = { | |
83e560ee | 252 | .pixclock = 38250, |
cf75d8d2 MR |
253 | .bpp = 16, |
254 | .xres = 480, | |
255 | .yres = 640, | |
256 | .hsync_len = 8, | |
257 | .vsync_len = 2, | |
258 | .left_margin = 8, | |
83e560ee | 259 | .upper_margin = 2, |
cf75d8d2 MR |
260 | .right_margin = 24, |
261 | .lower_margin = 4, | |
262 | .cmap_greyscale = 0, | |
263 | }, | |
264 | [1] = { | |
265 | .pixclock = 153800, | |
266 | .bpp = 16, | |
267 | .xres = 240, | |
268 | .yres = 320, | |
269 | .hsync_len = 8, | |
270 | .vsync_len = 2, | |
271 | .left_margin = 8, | |
272 | .upper_margin = 2, | |
273 | .right_margin = 88, | |
274 | .lower_margin = 2, | |
275 | .cmap_greyscale = 0, | |
276 | }, | |
277 | }; | |
278 | ||
279 | static struct pxafb_mach_info cm_x300_lcd = { | |
280 | .modes = cm_x300_lcd_modes, | |
83e560ee | 281 | .num_modes = ARRAY_SIZE(cm_x300_lcd_modes), |
cf75d8d2 MR |
282 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, |
283 | }; | |
284 | ||
285 | static void __init cm_x300_init_lcd(void) | |
286 | { | |
287 | set_pxa_fb_info(&cm_x300_lcd); | |
288 | } | |
289 | #else | |
290 | static inline void cm_x300_init_lcd(void) {} | |
291 | #endif | |
292 | ||
83e560ee IG |
293 | #if defined(CONFIG_SPI_GPIO) || defined(CONFIG_SPI_GPIO_MODULE) |
294 | #define GPIO_LCD_BASE (144) | |
295 | #define GPIO_LCD_DIN (GPIO_LCD_BASE + 8) /* aux_gpio3_0 */ | |
296 | #define GPIO_LCD_DOUT (GPIO_LCD_BASE + 9) /* aux_gpio3_1 */ | |
297 | #define GPIO_LCD_SCL (GPIO_LCD_BASE + 10) /* aux_gpio3_2 */ | |
298 | #define GPIO_LCD_CS (GPIO_LCD_BASE + 11) /* aux_gpio3_3 */ | |
299 | #define LCD_SPI_BUS_NUM (1) | |
300 | ||
301 | static struct spi_gpio_platform_data cm_x300_spi_gpio_pdata = { | |
302 | .sck = GPIO_LCD_SCL, | |
303 | .mosi = GPIO_LCD_DIN, | |
304 | .miso = GPIO_LCD_DOUT, | |
305 | .num_chipselect = 1, | |
306 | }; | |
307 | ||
308 | static struct platform_device cm_x300_spi_gpio = { | |
309 | .name = "spi_gpio", | |
310 | .id = LCD_SPI_BUS_NUM, | |
311 | .dev = { | |
312 | .platform_data = &cm_x300_spi_gpio_pdata, | |
313 | }, | |
314 | }; | |
315 | ||
316 | static struct tdo24m_platform_data cm_x300_tdo24m_pdata = { | |
317 | .model = TDO35S, | |
318 | }; | |
319 | ||
320 | static struct spi_board_info cm_x300_spi_devices[] __initdata = { | |
321 | { | |
322 | .modalias = "tdo24m", | |
323 | .max_speed_hz = 1000000, | |
324 | .bus_num = LCD_SPI_BUS_NUM, | |
325 | .chip_select = 0, | |
326 | .controller_data = (void *) GPIO_LCD_CS, | |
327 | .platform_data = &cm_x300_tdo24m_pdata, | |
328 | }, | |
329 | }; | |
330 | ||
331 | static void __init cm_x300_init_spi(void) | |
332 | { | |
333 | spi_register_board_info(cm_x300_spi_devices, | |
334 | ARRAY_SIZE(cm_x300_spi_devices)); | |
335 | platform_device_register(&cm_x300_spi_gpio); | |
336 | } | |
337 | #else | |
338 | static inline void cm_x300_init_spi(void) {} | |
339 | #endif | |
340 | ||
74e74def IG |
341 | #if defined(CONFIG_SND_PXA2XX_LIB_AC97) |
342 | static void __init cm_x300_init_ac97(void) | |
343 | { | |
344 | pxa_set_ac97_info(NULL); | |
345 | } | |
346 | #else | |
347 | static inline void cm_x300_init_ac97(void) {} | |
348 | #endif | |
349 | ||
cf75d8d2 MR |
350 | #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE) |
351 | static struct mtd_partition cm_x300_nand_partitions[] = { | |
352 | [0] = { | |
353 | .name = "OBM", | |
354 | .offset = 0, | |
355 | .size = SZ_256K, | |
356 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | |
357 | }, | |
358 | [1] = { | |
359 | .name = "U-Boot", | |
360 | .offset = MTDPART_OFS_APPEND, | |
361 | .size = SZ_256K, | |
362 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | |
363 | }, | |
364 | [2] = { | |
365 | .name = "Environment", | |
366 | .offset = MTDPART_OFS_APPEND, | |
367 | .size = SZ_256K, | |
368 | }, | |
369 | [3] = { | |
370 | .name = "reserved", | |
371 | .offset = MTDPART_OFS_APPEND, | |
372 | .size = SZ_256K + SZ_1M, | |
373 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | |
374 | }, | |
375 | [4] = { | |
376 | .name = "kernel", | |
377 | .offset = MTDPART_OFS_APPEND, | |
378 | .size = SZ_4M, | |
379 | }, | |
380 | [5] = { | |
381 | .name = "fs", | |
382 | .offset = MTDPART_OFS_APPEND, | |
383 | .size = MTDPART_SIZ_FULL, | |
384 | }, | |
385 | }; | |
386 | ||
387 | static struct pxa3xx_nand_platform_data cm_x300_nand_info = { | |
388 | .enable_arbiter = 1, | |
b3992b66 | 389 | .keep_config = 1, |
cf75d8d2 MR |
390 | .parts = cm_x300_nand_partitions, |
391 | .nr_parts = ARRAY_SIZE(cm_x300_nand_partitions), | |
392 | }; | |
393 | ||
394 | static void __init cm_x300_init_nand(void) | |
395 | { | |
396 | pxa3xx_set_nand_info(&cm_x300_nand_info); | |
397 | } | |
398 | #else | |
399 | static inline void cm_x300_init_nand(void) {} | |
400 | #endif | |
401 | ||
402 | #if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE) | |
0bff2fc3 MR |
403 | static struct pxamci_platform_data cm_x300_mci_platform_data = { |
404 | .detect_delay = 20, | |
405 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | |
406 | .gpio_card_detect = GPIO82_MMC_IRQ, | |
407 | .gpio_card_ro = GPIO85_MMC_WP, | |
408 | .gpio_power = -1, | |
409 | }; | |
410 | ||
411 | /* The second MMC slot of CM-X300 is hardwired to Libertas card and has | |
cf75d8d2 | 412 | no detection/ro pins */ |
0bff2fc3 MR |
413 | static int cm_x300_mci2_init(struct device *dev, |
414 | irq_handler_t cm_x300_detect_int, | |
415 | void *data) | |
cf75d8d2 MR |
416 | { |
417 | return 0; | |
418 | } | |
419 | ||
0bff2fc3 | 420 | static void cm_x300_mci2_exit(struct device *dev, void *data) |
cf75d8d2 MR |
421 | { |
422 | } | |
423 | ||
0bff2fc3 | 424 | static struct pxamci_platform_data cm_x300_mci2_platform_data = { |
7a648256 RJ |
425 | .detect_delay = 20, |
426 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | |
0bff2fc3 MR |
427 | .init = cm_x300_mci2_init, |
428 | .exit = cm_x300_mci2_exit, | |
7a648256 RJ |
429 | .gpio_card_detect = -1, |
430 | .gpio_card_ro = -1, | |
431 | .gpio_power = -1, | |
cf75d8d2 MR |
432 | }; |
433 | ||
cf75d8d2 MR |
434 | static void __init cm_x300_init_mmc(void) |
435 | { | |
436 | pxa_set_mci_info(&cm_x300_mci_platform_data); | |
437 | pxa3xx_set_mci2_info(&cm_x300_mci2_platform_data); | |
438 | } | |
439 | #else | |
440 | static inline void cm_x300_init_mmc(void) {} | |
441 | #endif | |
442 | ||
443 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | |
edaa64c9 IG |
444 | static int cm_x300_ohci_init(struct device *dev) |
445 | { | |
446 | if (cpu_is_pxa300()) | |
447 | UP2OCR = UP2OCR_HXS | |
448 | | UP2OCR_HXOE | UP2OCR_DMPDE | UP2OCR_DPPDE; | |
449 | ||
450 | return 0; | |
451 | } | |
452 | ||
cf75d8d2 MR |
453 | static struct pxaohci_platform_data cm_x300_ohci_platform_data = { |
454 | .port_mode = PMM_PERPORT_MODE, | |
edaa64c9 IG |
455 | .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW, |
456 | .init = cm_x300_ohci_init, | |
cf75d8d2 | 457 | }; |
097b5334 | 458 | |
cf75d8d2 MR |
459 | static void __init cm_x300_init_ohci(void) |
460 | { | |
461 | pxa_set_ohci_info(&cm_x300_ohci_platform_data); | |
462 | } | |
463 | #else | |
464 | static inline void cm_x300_init_ohci(void) {} | |
465 | #endif | |
466 | ||
467 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | |
468 | static struct gpio_led cm_x300_leds[] = { | |
469 | [0] = { | |
470 | .name = "cm-x300:green", | |
471 | .default_trigger = "heartbeat", | |
cf75d8d2 MR |
472 | .active_low = 1, |
473 | }, | |
474 | }; | |
475 | ||
476 | static struct gpio_led_platform_data cm_x300_gpio_led_pdata = { | |
477 | .num_leds = ARRAY_SIZE(cm_x300_leds), | |
478 | .leds = cm_x300_leds, | |
479 | }; | |
480 | ||
481 | static struct platform_device cm_x300_led_device = { | |
482 | .name = "leds-gpio", | |
483 | .id = -1, | |
484 | .dev = { | |
485 | .platform_data = &cm_x300_gpio_led_pdata, | |
486 | }, | |
487 | }; | |
488 | ||
489 | static void __init cm_x300_init_leds(void) | |
490 | { | |
55052ea2 IG |
491 | if (system_rev < 130) |
492 | cm_x300_leds[0].gpio = 79; | |
493 | else | |
494 | cm_x300_leds[0].gpio = 76; | |
495 | ||
cf75d8d2 MR |
496 | platform_device_register(&cm_x300_led_device); |
497 | } | |
498 | #else | |
499 | static inline void cm_x300_init_leds(void) {} | |
500 | #endif | |
501 | ||
502 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | |
503 | /* PCA9555 */ | |
504 | static struct pca953x_platform_data cm_x300_gpio_ext_pdata_0 = { | |
505 | .gpio_base = 128, | |
506 | }; | |
507 | ||
508 | static struct pca953x_platform_data cm_x300_gpio_ext_pdata_1 = { | |
509 | .gpio_base = 144, | |
510 | }; | |
511 | ||
512 | static struct i2c_board_info cm_x300_gpio_ext_info[] = { | |
513 | [0] = { | |
514 | I2C_BOARD_INFO("pca9555", 0x24), | |
515 | .platform_data = &cm_x300_gpio_ext_pdata_0, | |
516 | }, | |
517 | [1] = { | |
518 | I2C_BOARD_INFO("pca9555", 0x25), | |
519 | .platform_data = &cm_x300_gpio_ext_pdata_1, | |
520 | }, | |
521 | }; | |
522 | ||
523 | static void __init cm_x300_init_i2c(void) | |
524 | { | |
525 | pxa_set_i2c_info(NULL); | |
526 | i2c_register_board_info(0, cm_x300_gpio_ext_info, | |
527 | ARRAY_SIZE(cm_x300_gpio_ext_info)); | |
528 | } | |
529 | #else | |
530 | static inline void cm_x300_init_i2c(void) {} | |
531 | #endif | |
532 | ||
1858ced3 MR |
533 | #if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE) |
534 | struct v3020_platform_data cm_x300_v3020_pdata = { | |
535 | .use_gpio = 1, | |
536 | .gpio_cs = GPIO95_RTC_CS, | |
537 | .gpio_wr = GPIO96_RTC_WR, | |
538 | .gpio_rd = GPIO97_RTC_RD, | |
539 | .gpio_io = GPIO98_RTC_IO, | |
540 | }; | |
541 | ||
542 | static struct platform_device cm_x300_rtc_device = { | |
543 | .name = "v3020", | |
544 | .id = -1, | |
545 | .dev = { | |
546 | .platform_data = &cm_x300_v3020_pdata, | |
547 | } | |
548 | }; | |
549 | ||
550 | static void __init cm_x300_init_rtc(void) | |
551 | { | |
552 | platform_device_register(&cm_x300_rtc_device); | |
553 | } | |
554 | #else | |
555 | static inline void cm_x300_init_rtc(void) {} | |
556 | #endif | |
557 | ||
9c017ca1 IG |
558 | /* DA9030 */ |
559 | struct da903x_subdev_info cm_x300_da9030_subdevs[] = { | |
560 | { | |
561 | .name = "da903x-backlight", | |
562 | .id = DA9030_ID_WLED, | |
563 | } | |
564 | }; | |
565 | ||
566 | static struct da903x_platform_data cm_x300_da9030_info = { | |
567 | .num_subdevs = ARRAY_SIZE(cm_x300_da9030_subdevs), | |
568 | .subdevs = cm_x300_da9030_subdevs, | |
569 | }; | |
570 | ||
571 | static struct i2c_board_info cm_x300_pmic_info = { | |
572 | I2C_BOARD_INFO("da9030", 0x49), | |
573 | .irq = IRQ_GPIO(0), | |
574 | .platform_data = &cm_x300_da9030_info, | |
575 | }; | |
576 | ||
577 | static struct i2c_pxa_platform_data cm_x300_pwr_i2c_info = { | |
578 | .use_pio = 1, | |
579 | }; | |
580 | ||
581 | static void __init cm_x300_init_da9030(void) | |
582 | { | |
583 | pxa3xx_set_i2c_power_info(&cm_x300_pwr_i2c_info); | |
584 | i2c_register_board_info(1, &cm_x300_pmic_info, 1); | |
585 | } | |
586 | ||
b3d01da6 IG |
587 | static void __init cm_x300_init_wi2wi(void) |
588 | { | |
589 | int bt_reset, wlan_en; | |
590 | int err; | |
591 | ||
592 | if (system_rev < 130) { | |
593 | wlan_en = 77; | |
594 | bt_reset = 78; | |
595 | } else { | |
596 | wlan_en = 71; | |
597 | bt_reset = 70; | |
598 | } | |
599 | ||
600 | /* Libertas and CSR reset */ | |
601 | err = gpio_request(wlan_en, "wlan en"); | |
602 | if (err) { | |
603 | pr_err("CM-X300: failed to request wlan en gpio: %d\n", err); | |
604 | } else { | |
605 | gpio_direction_output(wlan_en, 1); | |
606 | gpio_free(wlan_en); | |
607 | } | |
608 | ||
609 | err = gpio_request(bt_reset, "bt reset"); | |
610 | if (err) { | |
611 | pr_err("CM-X300: failed to request bt reset gpio: %d\n", err); | |
612 | } else { | |
613 | gpio_direction_output(bt_reset, 1); | |
614 | udelay(10); | |
615 | gpio_set_value(bt_reset, 0); | |
616 | udelay(10); | |
617 | gpio_set_value(bt_reset, 1); | |
618 | gpio_free(bt_reset); | |
619 | } | |
620 | } | |
621 | ||
622 | /* MFP */ | |
55052ea2 | 623 | static void __init cm_x300_init_mfp(void) |
cf75d8d2 MR |
624 | { |
625 | /* board-processor specific GPIO initialization */ | |
def8252d | 626 | pxa3xx_mfp_config(ARRAY_AND_SIZE(cm_x3xx_mfp_cfg)); |
cf75d8d2 | 627 | |
55052ea2 | 628 | if (system_rev < 130) |
def8252d | 629 | pxa3xx_mfp_config(ARRAY_AND_SIZE(cm_x3xx_rev_lt130_mfp_cfg)); |
55052ea2 | 630 | else |
def8252d IG |
631 | pxa3xx_mfp_config(ARRAY_AND_SIZE(cm_x3xx_rev_ge130_mfp_cfg)); |
632 | ||
633 | if (cpu_is_pxa310()) | |
634 | pxa3xx_mfp_config(ARRAY_AND_SIZE(cm_x310_mfp_cfg)); | |
55052ea2 IG |
635 | } |
636 | ||
637 | static void __init cm_x300_init(void) | |
638 | { | |
639 | cm_x300_init_mfp(); | |
640 | ||
cc155c6f RK |
641 | pxa_set_ffuart_info(NULL); |
642 | pxa_set_btuart_info(NULL); | |
643 | pxa_set_stuart_info(NULL); | |
644 | ||
9c017ca1 | 645 | cm_x300_init_da9030(); |
cf75d8d2 MR |
646 | cm_x300_init_dm9000(); |
647 | cm_x300_init_lcd(); | |
648 | cm_x300_init_ohci(); | |
649 | cm_x300_init_mmc(); | |
650 | cm_x300_init_nand(); | |
651 | cm_x300_init_leds(); | |
652 | cm_x300_init_i2c(); | |
83e560ee | 653 | cm_x300_init_spi(); |
1858ced3 | 654 | cm_x300_init_rtc(); |
74e74def | 655 | cm_x300_init_ac97(); |
b3d01da6 | 656 | cm_x300_init_wi2wi(); |
cf75d8d2 MR |
657 | } |
658 | ||
b5a5c474 MR |
659 | static void __init cm_x300_fixup(struct machine_desc *mdesc, struct tag *tags, |
660 | char **cmdline, struct meminfo *mi) | |
661 | { | |
662 | mi->nr_banks = 2; | |
663 | mi->bank[0].start = 0xa0000000; | |
664 | mi->bank[0].node = 0; | |
665 | mi->bank[0].size = (64*1024*1024); | |
666 | mi->bank[1].start = 0xc0000000; | |
667 | mi->bank[1].node = 0; | |
668 | mi->bank[1].size = (64*1024*1024); | |
669 | } | |
670 | ||
cf75d8d2 MR |
671 | MACHINE_START(CM_X300, "CM-X300 module") |
672 | .phys_io = 0x40000000, | |
673 | .boot_params = 0xa0000100, | |
674 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
675 | .map_io = pxa_map_io, | |
676 | .init_irq = pxa3xx_init_irq, | |
677 | .timer = &pxa_timer, | |
678 | .init_machine = cm_x300_init, | |
b5a5c474 | 679 | .fixup = cm_x300_fixup, |
cf75d8d2 | 680 | MACHINE_END |