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