cm-x300.c 16 KB

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