cm-x300.c 15 KB

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