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