board-cm-t35.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823
  1. /*
  2. * board-cm-t35.c (CompuLab CM-T35 module)
  3. *
  4. * Copyright (C) 2009 CompuLab, Ltd.
  5. * Author: Mike Rapoport <mike@compulab.co.il>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * version 2 as published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  19. * 02110-1301 USA
  20. *
  21. */
  22. #include <linux/kernel.h>
  23. #include <linux/init.h>
  24. #include <linux/platform_device.h>
  25. #include <linux/input.h>
  26. #include <linux/input/matrix_keypad.h>
  27. #include <linux/delay.h>
  28. #include <linux/gpio.h>
  29. #include <linux/i2c/at24.h>
  30. #include <linux/i2c/twl.h>
  31. #include <linux/regulator/machine.h>
  32. #include <linux/mmc/host.h>
  33. #include <linux/spi/spi.h>
  34. #include <linux/spi/tdo24m.h>
  35. #include <asm/mach-types.h>
  36. #include <asm/mach/arch.h>
  37. #include <asm/mach/map.h>
  38. #include <plat/board.h>
  39. #include <plat/common.h>
  40. #include <plat/nand.h>
  41. #include <plat/gpmc.h>
  42. #include <plat/usb.h>
  43. #include <plat/display.h>
  44. #include <plat/panel-generic-dpi.h>
  45. #include <plat/mcspi.h>
  46. #include <mach/hardware.h>
  47. #include "mux.h"
  48. #include "sdram-micron-mt46h32m32lf-6.h"
  49. #include "hsmmc.h"
  50. #define CM_T35_GPIO_PENDOWN 57
  51. #define CM_T35_SMSC911X_CS 5
  52. #define CM_T35_SMSC911X_GPIO 163
  53. #define SB_T35_SMSC911X_CS 4
  54. #define SB_T35_SMSC911X_GPIO 65
  55. #define NAND_BLOCK_SIZE SZ_128K
  56. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  57. #include <linux/smsc911x.h>
  58. static struct smsc911x_platform_config cm_t35_smsc911x_config = {
  59. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  60. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  61. .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
  62. .phy_interface = PHY_INTERFACE_MODE_MII,
  63. };
  64. static struct resource cm_t35_smsc911x_resources[] = {
  65. {
  66. .flags = IORESOURCE_MEM,
  67. },
  68. {
  69. .start = OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO),
  70. .end = OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO),
  71. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  72. },
  73. };
  74. static struct platform_device cm_t35_smsc911x_device = {
  75. .name = "smsc911x",
  76. .id = 0,
  77. .num_resources = ARRAY_SIZE(cm_t35_smsc911x_resources),
  78. .resource = cm_t35_smsc911x_resources,
  79. .dev = {
  80. .platform_data = &cm_t35_smsc911x_config,
  81. },
  82. };
  83. static struct resource sb_t35_smsc911x_resources[] = {
  84. {
  85. .flags = IORESOURCE_MEM,
  86. },
  87. {
  88. .start = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO),
  89. .end = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO),
  90. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  91. },
  92. };
  93. static struct platform_device sb_t35_smsc911x_device = {
  94. .name = "smsc911x",
  95. .id = 1,
  96. .num_resources = ARRAY_SIZE(sb_t35_smsc911x_resources),
  97. .resource = sb_t35_smsc911x_resources,
  98. .dev = {
  99. .platform_data = &cm_t35_smsc911x_config,
  100. },
  101. };
  102. static void __init cm_t35_init_smsc911x(struct platform_device *dev,
  103. int cs, int irq_gpio)
  104. {
  105. unsigned long cs_mem_base;
  106. if (gpmc_cs_request(cs, SZ_16M, &cs_mem_base) < 0) {
  107. pr_err("CM-T35: Failed request for GPMC mem for smsc911x\n");
  108. return;
  109. }
  110. dev->resource[0].start = cs_mem_base + 0x0;
  111. dev->resource[0].end = cs_mem_base + 0xff;
  112. if ((gpio_request(irq_gpio, "ETH IRQ") == 0) &&
  113. (gpio_direction_input(irq_gpio) == 0)) {
  114. gpio_export(irq_gpio, 0);
  115. } else {
  116. pr_err("CM-T35: could not obtain gpio for SMSC911X IRQ\n");
  117. return;
  118. }
  119. platform_device_register(dev);
  120. }
  121. static void __init cm_t35_init_ethernet(void)
  122. {
  123. cm_t35_init_smsc911x(&cm_t35_smsc911x_device,
  124. CM_T35_SMSC911X_CS, CM_T35_SMSC911X_GPIO);
  125. cm_t35_init_smsc911x(&sb_t35_smsc911x_device,
  126. SB_T35_SMSC911X_CS, SB_T35_SMSC911X_GPIO);
  127. }
  128. #else
  129. static inline void __init cm_t35_init_ethernet(void) { return; }
  130. #endif
  131. #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  132. #include <linux/leds.h>
  133. static struct gpio_led cm_t35_leds[] = {
  134. [0] = {
  135. .gpio = 186,
  136. .name = "cm-t35:green",
  137. .default_trigger = "heartbeat",
  138. .active_low = 0,
  139. },
  140. };
  141. static struct gpio_led_platform_data cm_t35_led_pdata = {
  142. .num_leds = ARRAY_SIZE(cm_t35_leds),
  143. .leds = cm_t35_leds,
  144. };
  145. static struct platform_device cm_t35_led_device = {
  146. .name = "leds-gpio",
  147. .id = -1,
  148. .dev = {
  149. .platform_data = &cm_t35_led_pdata,
  150. },
  151. };
  152. static void __init cm_t35_init_led(void)
  153. {
  154. platform_device_register(&cm_t35_led_device);
  155. }
  156. #else
  157. static inline void cm_t35_init_led(void) {}
  158. #endif
  159. #if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
  160. #include <linux/mtd/mtd.h>
  161. #include <linux/mtd/nand.h>
  162. #include <linux/mtd/partitions.h>
  163. static struct mtd_partition cm_t35_nand_partitions[] = {
  164. {
  165. .name = "xloader",
  166. .offset = 0, /* Offset = 0x00000 */
  167. .size = 4 * NAND_BLOCK_SIZE,
  168. .mask_flags = MTD_WRITEABLE
  169. },
  170. {
  171. .name = "uboot",
  172. .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
  173. .size = 15 * NAND_BLOCK_SIZE,
  174. },
  175. {
  176. .name = "uboot environment",
  177. .offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */
  178. .size = 2 * NAND_BLOCK_SIZE,
  179. },
  180. {
  181. .name = "linux",
  182. .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
  183. .size = 32 * NAND_BLOCK_SIZE,
  184. },
  185. {
  186. .name = "rootfs",
  187. .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */
  188. .size = MTDPART_SIZ_FULL,
  189. },
  190. };
  191. static struct omap_nand_platform_data cm_t35_nand_data = {
  192. .parts = cm_t35_nand_partitions,
  193. .nr_parts = ARRAY_SIZE(cm_t35_nand_partitions),
  194. .dma_channel = -1, /* disable DMA in OMAP NAND driver */
  195. .cs = 0,
  196. };
  197. static void __init cm_t35_init_nand(void)
  198. {
  199. if (gpmc_nand_init(&cm_t35_nand_data) < 0)
  200. pr_err("CM-T35: Unable to register NAND device\n");
  201. }
  202. #else
  203. static inline void cm_t35_init_nand(void) {}
  204. #endif
  205. #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
  206. defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
  207. #include <linux/spi/ads7846.h>
  208. static struct omap2_mcspi_device_config ads7846_mcspi_config = {
  209. .turbo_mode = 0,
  210. .single_channel = 1, /* 0: slave, 1: master */
  211. };
  212. static int ads7846_get_pendown_state(void)
  213. {
  214. return !gpio_get_value(CM_T35_GPIO_PENDOWN);
  215. }
  216. static struct ads7846_platform_data ads7846_config = {
  217. .x_max = 0x0fff,
  218. .y_max = 0x0fff,
  219. .x_plate_ohms = 180,
  220. .pressure_max = 255,
  221. .debounce_max = 10,
  222. .debounce_tol = 3,
  223. .debounce_rep = 1,
  224. .get_pendown_state = ads7846_get_pendown_state,
  225. .keep_vref_on = 1,
  226. };
  227. static struct spi_board_info cm_t35_spi_board_info[] __initdata = {
  228. {
  229. .modalias = "ads7846",
  230. .bus_num = 1,
  231. .chip_select = 0,
  232. .max_speed_hz = 1500000,
  233. .controller_data = &ads7846_mcspi_config,
  234. .irq = OMAP_GPIO_IRQ(CM_T35_GPIO_PENDOWN),
  235. .platform_data = &ads7846_config,
  236. },
  237. };
  238. static void __init cm_t35_init_ads7846(void)
  239. {
  240. if ((gpio_request(CM_T35_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) &&
  241. (gpio_direction_input(CM_T35_GPIO_PENDOWN) == 0)) {
  242. gpio_export(CM_T35_GPIO_PENDOWN, 0);
  243. } else {
  244. pr_err("CM-T35: could not obtain gpio for ADS7846_PENDOWN\n");
  245. return;
  246. }
  247. spi_register_board_info(cm_t35_spi_board_info,
  248. ARRAY_SIZE(cm_t35_spi_board_info));
  249. }
  250. #else
  251. static inline void cm_t35_init_ads7846(void) {}
  252. #endif
  253. #define CM_T35_LCD_EN_GPIO 157
  254. #define CM_T35_LCD_BL_GPIO 58
  255. #define CM_T35_DVI_EN_GPIO 54
  256. static int lcd_bl_gpio;
  257. static int lcd_en_gpio;
  258. static int dvi_en_gpio;
  259. static int lcd_enabled;
  260. static int dvi_enabled;
  261. static int cm_t35_panel_enable_lcd(struct omap_dss_device *dssdev)
  262. {
  263. if (dvi_enabled) {
  264. printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
  265. return -EINVAL;
  266. }
  267. gpio_set_value(lcd_en_gpio, 1);
  268. gpio_set_value(lcd_bl_gpio, 1);
  269. lcd_enabled = 1;
  270. return 0;
  271. }
  272. static void cm_t35_panel_disable_lcd(struct omap_dss_device *dssdev)
  273. {
  274. lcd_enabled = 0;
  275. gpio_set_value(lcd_bl_gpio, 0);
  276. gpio_set_value(lcd_en_gpio, 0);
  277. }
  278. static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev)
  279. {
  280. if (lcd_enabled) {
  281. printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
  282. return -EINVAL;
  283. }
  284. gpio_set_value(dvi_en_gpio, 0);
  285. dvi_enabled = 1;
  286. return 0;
  287. }
  288. static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev)
  289. {
  290. gpio_set_value(dvi_en_gpio, 1);
  291. dvi_enabled = 0;
  292. }
  293. static int cm_t35_panel_enable_tv(struct omap_dss_device *dssdev)
  294. {
  295. return 0;
  296. }
  297. static void cm_t35_panel_disable_tv(struct omap_dss_device *dssdev)
  298. {
  299. }
  300. static struct panel_generic_dpi_data lcd_panel = {
  301. .name = "toppoly_tdo35s",
  302. .platform_enable = cm_t35_panel_enable_lcd,
  303. .platform_disable = cm_t35_panel_disable_lcd,
  304. };
  305. static struct omap_dss_device cm_t35_lcd_device = {
  306. .name = "lcd",
  307. .type = OMAP_DISPLAY_TYPE_DPI,
  308. .driver_name = "generic_dpi_panel",
  309. .data = &lcd_panel,
  310. .phy.dpi.data_lines = 18,
  311. };
  312. static struct panel_generic_dpi_data dvi_panel = {
  313. .name = "generic",
  314. .platform_enable = cm_t35_panel_enable_dvi,
  315. .platform_disable = cm_t35_panel_disable_dvi,
  316. };
  317. static struct omap_dss_device cm_t35_dvi_device = {
  318. .name = "dvi",
  319. .type = OMAP_DISPLAY_TYPE_DPI,
  320. .driver_name = "generic_dpi_panel",
  321. .data = &dvi_panel,
  322. .phy.dpi.data_lines = 24,
  323. };
  324. static struct omap_dss_device cm_t35_tv_device = {
  325. .name = "tv",
  326. .driver_name = "venc",
  327. .type = OMAP_DISPLAY_TYPE_VENC,
  328. .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
  329. .platform_enable = cm_t35_panel_enable_tv,
  330. .platform_disable = cm_t35_panel_disable_tv,
  331. };
  332. static struct omap_dss_device *cm_t35_dss_devices[] = {
  333. &cm_t35_lcd_device,
  334. &cm_t35_dvi_device,
  335. &cm_t35_tv_device,
  336. };
  337. static struct omap_dss_board_info cm_t35_dss_data = {
  338. .num_devices = ARRAY_SIZE(cm_t35_dss_devices),
  339. .devices = cm_t35_dss_devices,
  340. .default_device = &cm_t35_dvi_device,
  341. };
  342. static struct platform_device cm_t35_dss_device = {
  343. .name = "omapdss",
  344. .id = -1,
  345. .dev = {
  346. .platform_data = &cm_t35_dss_data,
  347. },
  348. };
  349. static struct omap2_mcspi_device_config tdo24m_mcspi_config = {
  350. .turbo_mode = 0,
  351. .single_channel = 1, /* 0: slave, 1: master */
  352. };
  353. static struct tdo24m_platform_data tdo24m_config = {
  354. .model = TDO35S,
  355. };
  356. static struct spi_board_info cm_t35_lcd_spi_board_info[] __initdata = {
  357. {
  358. .modalias = "tdo24m",
  359. .bus_num = 4,
  360. .chip_select = 0,
  361. .max_speed_hz = 1000000,
  362. .controller_data = &tdo24m_mcspi_config,
  363. .platform_data = &tdo24m_config,
  364. },
  365. };
  366. static void __init cm_t35_init_display(void)
  367. {
  368. int err;
  369. lcd_en_gpio = CM_T35_LCD_EN_GPIO;
  370. lcd_bl_gpio = CM_T35_LCD_BL_GPIO;
  371. dvi_en_gpio = CM_T35_DVI_EN_GPIO;
  372. spi_register_board_info(cm_t35_lcd_spi_board_info,
  373. ARRAY_SIZE(cm_t35_lcd_spi_board_info));
  374. err = gpio_request(lcd_en_gpio, "LCD RST");
  375. if (err) {
  376. pr_err("CM-T35: failed to get LCD reset GPIO\n");
  377. goto out;
  378. }
  379. err = gpio_request(lcd_bl_gpio, "LCD BL");
  380. if (err) {
  381. pr_err("CM-T35: failed to get LCD backlight control GPIO\n");
  382. goto err_lcd_bl;
  383. }
  384. err = gpio_request(dvi_en_gpio, "DVI EN");
  385. if (err) {
  386. pr_err("CM-T35: failed to get DVI reset GPIO\n");
  387. goto err_dvi_en;
  388. }
  389. gpio_export(lcd_en_gpio, 0);
  390. gpio_export(lcd_bl_gpio, 0);
  391. gpio_export(dvi_en_gpio, 0);
  392. gpio_direction_output(lcd_en_gpio, 0);
  393. gpio_direction_output(lcd_bl_gpio, 0);
  394. gpio_direction_output(dvi_en_gpio, 1);
  395. msleep(50);
  396. gpio_set_value(lcd_en_gpio, 1);
  397. err = platform_device_register(&cm_t35_dss_device);
  398. if (err) {
  399. pr_err("CM-T35: failed to register DSS device\n");
  400. goto err_dev_reg;
  401. }
  402. return;
  403. err_dev_reg:
  404. gpio_free(dvi_en_gpio);
  405. err_dvi_en:
  406. gpio_free(lcd_bl_gpio);
  407. err_lcd_bl:
  408. gpio_free(lcd_en_gpio);
  409. out:
  410. return;
  411. }
  412. static struct regulator_consumer_supply cm_t35_vmmc1_supply = {
  413. .supply = "vmmc",
  414. };
  415. static struct regulator_consumer_supply cm_t35_vsim_supply = {
  416. .supply = "vmmc_aux",
  417. };
  418. static struct regulator_consumer_supply cm_t35_vdac_supply = {
  419. .supply = "vdda_dac",
  420. .dev = &cm_t35_dss_device.dev,
  421. };
  422. static struct regulator_consumer_supply cm_t35_vdvi_supply = {
  423. .supply = "vdvi",
  424. .dev = &cm_t35_dss_device.dev,
  425. };
  426. /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
  427. static struct regulator_init_data cm_t35_vmmc1 = {
  428. .constraints = {
  429. .min_uV = 1850000,
  430. .max_uV = 3150000,
  431. .valid_modes_mask = REGULATOR_MODE_NORMAL
  432. | REGULATOR_MODE_STANDBY,
  433. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  434. | REGULATOR_CHANGE_MODE
  435. | REGULATOR_CHANGE_STATUS,
  436. },
  437. .num_consumer_supplies = 1,
  438. .consumer_supplies = &cm_t35_vmmc1_supply,
  439. };
  440. /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
  441. static struct regulator_init_data cm_t35_vsim = {
  442. .constraints = {
  443. .min_uV = 1800000,
  444. .max_uV = 3000000,
  445. .valid_modes_mask = REGULATOR_MODE_NORMAL
  446. | REGULATOR_MODE_STANDBY,
  447. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  448. | REGULATOR_CHANGE_MODE
  449. | REGULATOR_CHANGE_STATUS,
  450. },
  451. .num_consumer_supplies = 1,
  452. .consumer_supplies = &cm_t35_vsim_supply,
  453. };
  454. /* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
  455. static struct regulator_init_data cm_t35_vdac = {
  456. .constraints = {
  457. .min_uV = 1800000,
  458. .max_uV = 1800000,
  459. .valid_modes_mask = REGULATOR_MODE_NORMAL
  460. | REGULATOR_MODE_STANDBY,
  461. .valid_ops_mask = REGULATOR_CHANGE_MODE
  462. | REGULATOR_CHANGE_STATUS,
  463. },
  464. .num_consumer_supplies = 1,
  465. .consumer_supplies = &cm_t35_vdac_supply,
  466. };
  467. /* VPLL2 for digital video outputs */
  468. static struct regulator_init_data cm_t35_vpll2 = {
  469. .constraints = {
  470. .name = "VDVI",
  471. .min_uV = 1800000,
  472. .max_uV = 1800000,
  473. .valid_modes_mask = REGULATOR_MODE_NORMAL
  474. | REGULATOR_MODE_STANDBY,
  475. .valid_ops_mask = REGULATOR_CHANGE_MODE
  476. | REGULATOR_CHANGE_STATUS,
  477. },
  478. .num_consumer_supplies = 1,
  479. .consumer_supplies = &cm_t35_vdvi_supply,
  480. };
  481. static struct twl4030_usb_data cm_t35_usb_data = {
  482. .usb_mode = T2_USB_MODE_ULPI,
  483. };
  484. static uint32_t cm_t35_keymap[] = {
  485. KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_LEFT),
  486. KEY(1, 0, KEY_UP), KEY(1, 1, KEY_ENTER), KEY(1, 2, KEY_DOWN),
  487. KEY(2, 0, KEY_RIGHT), KEY(2, 1, KEY_C), KEY(2, 2, KEY_D),
  488. };
  489. static struct matrix_keymap_data cm_t35_keymap_data = {
  490. .keymap = cm_t35_keymap,
  491. .keymap_size = ARRAY_SIZE(cm_t35_keymap),
  492. };
  493. static struct twl4030_keypad_data cm_t35_kp_data = {
  494. .keymap_data = &cm_t35_keymap_data,
  495. .rows = 3,
  496. .cols = 3,
  497. .rep = 1,
  498. };
  499. static struct omap2_hsmmc_info mmc[] = {
  500. {
  501. .mmc = 1,
  502. .caps = MMC_CAP_4_BIT_DATA,
  503. .gpio_cd = -EINVAL,
  504. .gpio_wp = -EINVAL,
  505. },
  506. {
  507. .mmc = 2,
  508. .caps = MMC_CAP_4_BIT_DATA,
  509. .transceiver = 1,
  510. .gpio_cd = -EINVAL,
  511. .gpio_wp = -EINVAL,
  512. .ocr_mask = 0x00100000, /* 3.3V */
  513. },
  514. {} /* Terminator */
  515. };
  516. static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
  517. .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
  518. .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
  519. .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
  520. .phy_reset = true,
  521. .reset_gpio_port[0] = OMAP_MAX_GPIO_LINES + 6,
  522. .reset_gpio_port[1] = OMAP_MAX_GPIO_LINES + 7,
  523. .reset_gpio_port[2] = -EINVAL
  524. };
  525. static int cm_t35_twl_gpio_setup(struct device *dev, unsigned gpio,
  526. unsigned ngpio)
  527. {
  528. int wlan_rst = gpio + 2;
  529. if ((gpio_request(wlan_rst, "WLAN RST") == 0) &&
  530. (gpio_direction_output(wlan_rst, 1) == 0)) {
  531. gpio_export(wlan_rst, 0);
  532. udelay(10);
  533. gpio_set_value(wlan_rst, 0);
  534. udelay(10);
  535. gpio_set_value(wlan_rst, 1);
  536. } else {
  537. pr_err("CM-T35: could not obtain gpio for WiFi reset\n");
  538. }
  539. /* gpio + 0 is "mmc0_cd" (input/IRQ) */
  540. mmc[0].gpio_cd = gpio + 0;
  541. omap2_hsmmc_init(mmc);
  542. /* link regulators to MMC adapters */
  543. cm_t35_vmmc1_supply.dev = mmc[0].dev;
  544. cm_t35_vsim_supply.dev = mmc[0].dev;
  545. return 0;
  546. }
  547. static struct twl4030_gpio_platform_data cm_t35_gpio_data = {
  548. .gpio_base = OMAP_MAX_GPIO_LINES,
  549. .irq_base = TWL4030_GPIO_IRQ_BASE,
  550. .irq_end = TWL4030_GPIO_IRQ_END,
  551. .setup = cm_t35_twl_gpio_setup,
  552. };
  553. static struct twl4030_platform_data cm_t35_twldata = {
  554. .irq_base = TWL4030_IRQ_BASE,
  555. .irq_end = TWL4030_IRQ_END,
  556. /* platform_data for children goes here */
  557. .keypad = &cm_t35_kp_data,
  558. .usb = &cm_t35_usb_data,
  559. .gpio = &cm_t35_gpio_data,
  560. .vmmc1 = &cm_t35_vmmc1,
  561. .vsim = &cm_t35_vsim,
  562. .vdac = &cm_t35_vdac,
  563. .vpll2 = &cm_t35_vpll2,
  564. };
  565. static struct i2c_board_info __initdata cm_t35_i2c_boardinfo[] = {
  566. {
  567. I2C_BOARD_INFO("tps65930", 0x48),
  568. .flags = I2C_CLIENT_WAKE,
  569. .irq = INT_34XX_SYS_NIRQ,
  570. .platform_data = &cm_t35_twldata,
  571. },
  572. };
  573. static void __init cm_t35_init_i2c(void)
  574. {
  575. omap_register_i2c_bus(1, 2600, cm_t35_i2c_boardinfo,
  576. ARRAY_SIZE(cm_t35_i2c_boardinfo));
  577. }
  578. static struct omap_board_config_kernel cm_t35_config[] __initdata = {
  579. };
  580. static void __init cm_t35_init_irq(void)
  581. {
  582. omap_board_config = cm_t35_config;
  583. omap_board_config_size = ARRAY_SIZE(cm_t35_config);
  584. omap2_init_common_infrastructure();
  585. omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
  586. mt46h32m32lf6_sdrc_params);
  587. omap_init_irq();
  588. }
  589. static struct omap_board_mux board_mux[] __initdata = {
  590. /* nCS and IRQ for CM-T35 ethernet */
  591. OMAP3_MUX(GPMC_NCS5, OMAP_MUX_MODE0),
  592. OMAP3_MUX(UART3_CTS_RCTX, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
  593. /* nCS and IRQ for SB-T35 ethernet */
  594. OMAP3_MUX(GPMC_NCS4, OMAP_MUX_MODE0),
  595. OMAP3_MUX(GPMC_WAIT3, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
  596. /* PENDOWN GPIO */
  597. OMAP3_MUX(GPMC_NCS6, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
  598. /* mUSB */
  599. OMAP3_MUX(HSUSB0_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  600. OMAP3_MUX(HSUSB0_STP, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  601. OMAP3_MUX(HSUSB0_DIR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  602. OMAP3_MUX(HSUSB0_NXT, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  603. OMAP3_MUX(HSUSB0_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  604. OMAP3_MUX(HSUSB0_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  605. OMAP3_MUX(HSUSB0_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  606. OMAP3_MUX(HSUSB0_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  607. OMAP3_MUX(HSUSB0_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  608. OMAP3_MUX(HSUSB0_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  609. OMAP3_MUX(HSUSB0_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  610. OMAP3_MUX(HSUSB0_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  611. /* MMC 2 */
  612. OMAP3_MUX(SDMMC2_DAT4, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
  613. OMAP3_MUX(SDMMC2_DAT5, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
  614. OMAP3_MUX(SDMMC2_DAT6, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
  615. OMAP3_MUX(SDMMC2_DAT7, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
  616. /* McSPI 1 */
  617. OMAP3_MUX(MCSPI1_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  618. OMAP3_MUX(MCSPI1_SIMO, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  619. OMAP3_MUX(MCSPI1_SOMI, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  620. OMAP3_MUX(MCSPI1_CS0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
  621. /* McSPI 4 */
  622. OMAP3_MUX(MCBSP1_CLKR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
  623. OMAP3_MUX(MCBSP1_DX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
  624. OMAP3_MUX(MCBSP1_DR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
  625. OMAP3_MUX(MCBSP1_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT_PULLUP),
  626. /* McBSP 2 */
  627. OMAP3_MUX(MCBSP2_FSX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  628. OMAP3_MUX(MCBSP2_CLKX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  629. OMAP3_MUX(MCBSP2_DR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  630. OMAP3_MUX(MCBSP2_DX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  631. /* serial ports */
  632. OMAP3_MUX(MCBSP3_CLKX, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
  633. OMAP3_MUX(MCBSP3_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
  634. OMAP3_MUX(UART1_TX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  635. OMAP3_MUX(UART1_RX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  636. /* DSS */
  637. OMAP3_MUX(DSS_PCLK, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  638. OMAP3_MUX(DSS_HSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  639. OMAP3_MUX(DSS_VSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  640. OMAP3_MUX(DSS_ACBIAS, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  641. OMAP3_MUX(DSS_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  642. OMAP3_MUX(DSS_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  643. OMAP3_MUX(DSS_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  644. OMAP3_MUX(DSS_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  645. OMAP3_MUX(DSS_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  646. OMAP3_MUX(DSS_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  647. OMAP3_MUX(DSS_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  648. OMAP3_MUX(DSS_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  649. OMAP3_MUX(DSS_DATA8, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  650. OMAP3_MUX(DSS_DATA9, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  651. OMAP3_MUX(DSS_DATA10, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  652. OMAP3_MUX(DSS_DATA11, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  653. OMAP3_MUX(DSS_DATA12, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  654. OMAP3_MUX(DSS_DATA13, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  655. OMAP3_MUX(DSS_DATA14, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  656. OMAP3_MUX(DSS_DATA15, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  657. OMAP3_MUX(DSS_DATA16, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  658. OMAP3_MUX(DSS_DATA17, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  659. OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  660. OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  661. OMAP3_MUX(DSS_DATA20, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  662. OMAP3_MUX(DSS_DATA21, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  663. OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  664. OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  665. /* display controls */
  666. OMAP3_MUX(MCBSP1_FSR, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
  667. OMAP3_MUX(GPMC_NCS7, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
  668. OMAP3_MUX(GPMC_NCS3, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
  669. /* TPS IRQ */
  670. OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_WAKEUP_EN | \
  671. OMAP_PIN_INPUT_PULLUP),
  672. { .reg_offset = OMAP_MUX_TERMINATOR },
  673. };
  674. static struct omap_musb_board_data musb_board_data = {
  675. .interface_type = MUSB_INTERFACE_ULPI,
  676. .mode = MUSB_OTG,
  677. .power = 100,
  678. };
  679. static void __init cm_t35_init(void)
  680. {
  681. omap3_mux_init(board_mux, OMAP_PACKAGE_CUS);
  682. omap_serial_init();
  683. cm_t35_init_i2c();
  684. cm_t35_init_nand();
  685. cm_t35_init_ads7846();
  686. cm_t35_init_ethernet();
  687. cm_t35_init_led();
  688. cm_t35_init_display();
  689. usb_musb_init(&musb_board_data);
  690. usb_ehci_init(&ehci_pdata);
  691. }
  692. MACHINE_START(CM_T35, "Compulab CM-T35")
  693. .boot_params = 0x80000100,
  694. .map_io = omap3_map_io,
  695. .reserve = omap_reserve,
  696. .init_irq = cm_t35_init_irq,
  697. .init_machine = cm_t35_init,
  698. .timer = &omap_timer,
  699. MACHINE_END