board-overo.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  1. /*
  2. * board-overo.c (Gumstix Overo)
  3. *
  4. * Initial code: Steve Sakoman <steve@sakoman.com>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * version 2 as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  18. * 02110-1301 USA
  19. *
  20. */
  21. #include <linux/clk.h>
  22. #include <linux/delay.h>
  23. #include <linux/err.h>
  24. #include <linux/init.h>
  25. #include <linux/io.h>
  26. #include <linux/kernel.h>
  27. #include <linux/platform_device.h>
  28. #include <linux/i2c/twl.h>
  29. #include <linux/regulator/machine.h>
  30. #include <linux/regulator/fixed.h>
  31. #include <linux/spi/spi.h>
  32. #include <linux/mtd/mtd.h>
  33. #include <linux/mtd/nand.h>
  34. #include <linux/mtd/partitions.h>
  35. #include <linux/mmc/host.h>
  36. #include <asm/mach-types.h>
  37. #include <asm/mach/arch.h>
  38. #include <asm/mach/flash.h>
  39. #include <asm/mach/map.h>
  40. #include <plat/board.h>
  41. #include <plat/common.h>
  42. #include <plat/display.h>
  43. #include <plat/panel-generic-dpi.h>
  44. #include <mach/gpio.h>
  45. #include <plat/gpmc.h>
  46. #include <mach/hardware.h>
  47. #include <plat/nand.h>
  48. #include <plat/mcspi.h>
  49. #include <plat/mux.h>
  50. #include <plat/usb.h>
  51. #include "mux.h"
  52. #include "sdram-micron-mt46h32m32lf-6.h"
  53. #include "hsmmc.h"
  54. #define OVERO_GPIO_BT_XGATE 15
  55. #define OVERO_GPIO_W2W_NRESET 16
  56. #define OVERO_GPIO_PENDOWN 114
  57. #define OVERO_GPIO_BT_NRESET 164
  58. #define OVERO_GPIO_USBH_CPEN 168
  59. #define OVERO_GPIO_USBH_NRESET 183
  60. #define NAND_BLOCK_SIZE SZ_128K
  61. #define OVERO_SMSC911X_CS 5
  62. #define OVERO_SMSC911X_GPIO 176
  63. #define OVERO_SMSC911X2_CS 4
  64. #define OVERO_SMSC911X2_GPIO 65
  65. #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
  66. defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
  67. #include <linux/spi/ads7846.h>
  68. static struct omap2_mcspi_device_config ads7846_mcspi_config = {
  69. .turbo_mode = 0,
  70. .single_channel = 1, /* 0: slave, 1: master */
  71. };
  72. static int ads7846_get_pendown_state(void)
  73. {
  74. return !gpio_get_value(OVERO_GPIO_PENDOWN);
  75. }
  76. static struct ads7846_platform_data ads7846_config = {
  77. .x_max = 0x0fff,
  78. .y_max = 0x0fff,
  79. .x_plate_ohms = 180,
  80. .pressure_max = 255,
  81. .debounce_max = 10,
  82. .debounce_tol = 3,
  83. .debounce_rep = 1,
  84. .get_pendown_state = ads7846_get_pendown_state,
  85. .keep_vref_on = 1,
  86. };
  87. /* fixed regulator for ads7846 */
  88. static struct regulator_consumer_supply ads7846_supply =
  89. REGULATOR_SUPPLY("vcc", "spi1.0");
  90. static struct regulator_init_data vads7846_regulator = {
  91. .constraints = {
  92. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  93. },
  94. .num_consumer_supplies = 1,
  95. .consumer_supplies = &ads7846_supply,
  96. };
  97. static struct fixed_voltage_config vads7846 = {
  98. .supply_name = "vads7846",
  99. .microvolts = 3300000, /* 3.3V */
  100. .gpio = -EINVAL,
  101. .startup_delay = 0,
  102. .init_data = &vads7846_regulator,
  103. };
  104. static struct platform_device vads7846_device = {
  105. .name = "reg-fixed-voltage",
  106. .id = 1,
  107. .dev = {
  108. .platform_data = &vads7846,
  109. },
  110. };
  111. static void __init overo_ads7846_init(void)
  112. {
  113. if ((gpio_request(OVERO_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) &&
  114. (gpio_direction_input(OVERO_GPIO_PENDOWN) == 0)) {
  115. gpio_export(OVERO_GPIO_PENDOWN, 0);
  116. } else {
  117. printk(KERN_ERR "could not obtain gpio for ADS7846_PENDOWN\n");
  118. return;
  119. }
  120. platform_device_register(&vads7846_device);
  121. }
  122. #else
  123. static inline void __init overo_ads7846_init(void) { return; }
  124. #endif
  125. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  126. #include <linux/smsc911x.h>
  127. static struct resource overo_smsc911x_resources[] = {
  128. {
  129. .name = "smsc911x-memory",
  130. .flags = IORESOURCE_MEM,
  131. },
  132. {
  133. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  134. },
  135. };
  136. static struct resource overo_smsc911x2_resources[] = {
  137. {
  138. .name = "smsc911x2-memory",
  139. .flags = IORESOURCE_MEM,
  140. },
  141. {
  142. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  143. },
  144. };
  145. static struct smsc911x_platform_config overo_smsc911x_config = {
  146. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  147. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  148. .flags = SMSC911X_USE_32BIT ,
  149. .phy_interface = PHY_INTERFACE_MODE_MII,
  150. };
  151. static struct platform_device overo_smsc911x_device = {
  152. .name = "smsc911x",
  153. .id = 0,
  154. .num_resources = ARRAY_SIZE(overo_smsc911x_resources),
  155. .resource = overo_smsc911x_resources,
  156. .dev = {
  157. .platform_data = &overo_smsc911x_config,
  158. },
  159. };
  160. static struct platform_device overo_smsc911x2_device = {
  161. .name = "smsc911x",
  162. .id = 1,
  163. .num_resources = ARRAY_SIZE(overo_smsc911x2_resources),
  164. .resource = overo_smsc911x2_resources,
  165. .dev = {
  166. .platform_data = &overo_smsc911x_config,
  167. },
  168. };
  169. static struct platform_device *smsc911x_devices[] = {
  170. &overo_smsc911x_device,
  171. &overo_smsc911x2_device,
  172. };
  173. static inline void __init overo_init_smsc911x(void)
  174. {
  175. unsigned long cs_mem_base, cs_mem_base2;
  176. /* set up first smsc911x chip */
  177. if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
  178. printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n");
  179. return;
  180. }
  181. overo_smsc911x_resources[0].start = cs_mem_base + 0x0;
  182. overo_smsc911x_resources[0].end = cs_mem_base + 0xff;
  183. if ((gpio_request(OVERO_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
  184. (gpio_direction_input(OVERO_SMSC911X_GPIO) == 0)) {
  185. gpio_export(OVERO_SMSC911X_GPIO, 0);
  186. } else {
  187. printk(KERN_ERR "could not obtain gpio for SMSC911X IRQ\n");
  188. return;
  189. }
  190. overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO);
  191. overo_smsc911x_resources[1].end = 0;
  192. /* set up second smsc911x chip */
  193. if (gpmc_cs_request(OVERO_SMSC911X2_CS, SZ_16M, &cs_mem_base2) < 0) {
  194. printk(KERN_ERR "Failed request for GPMC mem for smsc911x2\n");
  195. return;
  196. }
  197. overo_smsc911x2_resources[0].start = cs_mem_base2 + 0x0;
  198. overo_smsc911x2_resources[0].end = cs_mem_base2 + 0xff;
  199. if ((gpio_request(OVERO_SMSC911X2_GPIO, "SMSC911X2 IRQ") == 0) &&
  200. (gpio_direction_input(OVERO_SMSC911X2_GPIO) == 0)) {
  201. gpio_export(OVERO_SMSC911X2_GPIO, 0);
  202. } else {
  203. printk(KERN_ERR "could not obtain gpio for SMSC911X2 IRQ\n");
  204. return;
  205. }
  206. overo_smsc911x2_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X2_GPIO);
  207. overo_smsc911x2_resources[1].end = 0;
  208. platform_add_devices(smsc911x_devices, ARRAY_SIZE(smsc911x_devices));
  209. }
  210. #else
  211. static inline void __init overo_init_smsc911x(void) { return; }
  212. #endif
  213. /* DSS */
  214. static int lcd_enabled;
  215. static int dvi_enabled;
  216. #define OVERO_GPIO_LCD_EN 144
  217. #define OVERO_GPIO_LCD_BL 145
  218. static void __init overo_display_init(void)
  219. {
  220. if ((gpio_request(OVERO_GPIO_LCD_EN, "OVERO_GPIO_LCD_EN") == 0) &&
  221. (gpio_direction_output(OVERO_GPIO_LCD_EN, 1) == 0))
  222. gpio_export(OVERO_GPIO_LCD_EN, 0);
  223. else
  224. printk(KERN_ERR "could not obtain gpio for "
  225. "OVERO_GPIO_LCD_EN\n");
  226. if ((gpio_request(OVERO_GPIO_LCD_BL, "OVERO_GPIO_LCD_BL") == 0) &&
  227. (gpio_direction_output(OVERO_GPIO_LCD_BL, 1) == 0))
  228. gpio_export(OVERO_GPIO_LCD_BL, 0);
  229. else
  230. printk(KERN_ERR "could not obtain gpio for "
  231. "OVERO_GPIO_LCD_BL\n");
  232. }
  233. static int overo_panel_enable_dvi(struct omap_dss_device *dssdev)
  234. {
  235. if (lcd_enabled) {
  236. printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
  237. return -EINVAL;
  238. }
  239. dvi_enabled = 1;
  240. return 0;
  241. }
  242. static void overo_panel_disable_dvi(struct omap_dss_device *dssdev)
  243. {
  244. dvi_enabled = 0;
  245. }
  246. static struct panel_generic_dpi_data dvi_panel = {
  247. .name = "generic",
  248. .platform_enable = overo_panel_enable_dvi,
  249. .platform_disable = overo_panel_disable_dvi,
  250. };
  251. static struct omap_dss_device overo_dvi_device = {
  252. .name = "dvi",
  253. .type = OMAP_DISPLAY_TYPE_DPI,
  254. .driver_name = "generic_dpi_panel",
  255. .data = &dvi_panel,
  256. .phy.dpi.data_lines = 24,
  257. };
  258. static struct omap_dss_device overo_tv_device = {
  259. .name = "tv",
  260. .driver_name = "venc",
  261. .type = OMAP_DISPLAY_TYPE_VENC,
  262. .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
  263. };
  264. static int overo_panel_enable_lcd(struct omap_dss_device *dssdev)
  265. {
  266. if (dvi_enabled) {
  267. printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
  268. return -EINVAL;
  269. }
  270. gpio_set_value(OVERO_GPIO_LCD_EN, 1);
  271. gpio_set_value(OVERO_GPIO_LCD_BL, 1);
  272. lcd_enabled = 1;
  273. return 0;
  274. }
  275. static void overo_panel_disable_lcd(struct omap_dss_device *dssdev)
  276. {
  277. gpio_set_value(OVERO_GPIO_LCD_EN, 0);
  278. gpio_set_value(OVERO_GPIO_LCD_BL, 0);
  279. lcd_enabled = 0;
  280. }
  281. static struct panel_generic_dpi_data lcd43_panel = {
  282. .name = "samsung_lte430wq_f0c",
  283. .platform_enable = overo_panel_enable_lcd,
  284. .platform_disable = overo_panel_disable_lcd,
  285. };
  286. static struct omap_dss_device overo_lcd43_device = {
  287. .name = "lcd43",
  288. .type = OMAP_DISPLAY_TYPE_DPI,
  289. .driver_name = "generic_dpi_panel",
  290. .data = &lcd43_panel,
  291. .phy.dpi.data_lines = 24,
  292. };
  293. #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
  294. defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
  295. static struct omap_dss_device overo_lcd35_device = {
  296. .type = OMAP_DISPLAY_TYPE_DPI,
  297. .name = "lcd35",
  298. .driver_name = "lgphilips_lb035q02_panel",
  299. .phy.dpi.data_lines = 24,
  300. .platform_enable = overo_panel_enable_lcd,
  301. .platform_disable = overo_panel_disable_lcd,
  302. };
  303. #endif
  304. static struct omap_dss_device *overo_dss_devices[] = {
  305. &overo_dvi_device,
  306. &overo_tv_device,
  307. #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
  308. defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
  309. &overo_lcd35_device,
  310. #endif
  311. &overo_lcd43_device,
  312. };
  313. static struct omap_dss_board_info overo_dss_data = {
  314. .num_devices = ARRAY_SIZE(overo_dss_devices),
  315. .devices = overo_dss_devices,
  316. .default_device = &overo_dvi_device,
  317. };
  318. static struct regulator_consumer_supply overo_vdda_dac_supply =
  319. REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
  320. static struct regulator_consumer_supply overo_vdds_dsi_supply[] = {
  321. REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
  322. REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
  323. };
  324. static struct mtd_partition overo_nand_partitions[] = {
  325. {
  326. .name = "xloader",
  327. .offset = 0, /* Offset = 0x00000 */
  328. .size = 4 * NAND_BLOCK_SIZE,
  329. .mask_flags = MTD_WRITEABLE
  330. },
  331. {
  332. .name = "uboot",
  333. .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
  334. .size = 14 * NAND_BLOCK_SIZE,
  335. },
  336. {
  337. .name = "uboot environment",
  338. .offset = MTDPART_OFS_APPEND, /* Offset = 0x240000 */
  339. .size = 2 * NAND_BLOCK_SIZE,
  340. },
  341. {
  342. .name = "linux",
  343. .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
  344. .size = 32 * NAND_BLOCK_SIZE,
  345. },
  346. {
  347. .name = "rootfs",
  348. .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */
  349. .size = MTDPART_SIZ_FULL,
  350. },
  351. };
  352. static struct omap_nand_platform_data overo_nand_data = {
  353. .parts = overo_nand_partitions,
  354. .nr_parts = ARRAY_SIZE(overo_nand_partitions),
  355. .dma_channel = -1, /* disable DMA in OMAP NAND driver */
  356. };
  357. static void __init overo_flash_init(void)
  358. {
  359. u8 cs = 0;
  360. u8 nandcs = GPMC_CS_NUM + 1;
  361. /* find out the chip-select on which NAND exists */
  362. while (cs < GPMC_CS_NUM) {
  363. u32 ret = 0;
  364. ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
  365. if ((ret & 0xC00) == 0x800) {
  366. printk(KERN_INFO "Found NAND on CS%d\n", cs);
  367. if (nandcs > GPMC_CS_NUM)
  368. nandcs = cs;
  369. }
  370. cs++;
  371. }
  372. if (nandcs > GPMC_CS_NUM) {
  373. printk(KERN_INFO "NAND: Unable to find configuration "
  374. "in GPMC\n ");
  375. return;
  376. }
  377. if (nandcs < GPMC_CS_NUM) {
  378. overo_nand_data.cs = nandcs;
  379. printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
  380. if (gpmc_nand_init(&overo_nand_data) < 0)
  381. printk(KERN_ERR "Unable to register NAND device\n");
  382. }
  383. }
  384. static struct omap2_hsmmc_info mmc[] = {
  385. {
  386. .mmc = 1,
  387. .caps = MMC_CAP_4_BIT_DATA,
  388. .gpio_cd = -EINVAL,
  389. .gpio_wp = -EINVAL,
  390. },
  391. {
  392. .mmc = 2,
  393. .caps = MMC_CAP_4_BIT_DATA,
  394. .gpio_cd = -EINVAL,
  395. .gpio_wp = -EINVAL,
  396. .transceiver = true,
  397. .ocr_mask = 0x00100000, /* 3.3V */
  398. },
  399. {} /* Terminator */
  400. };
  401. static struct regulator_consumer_supply overo_vmmc1_supply = {
  402. .supply = "vmmc",
  403. };
  404. #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  405. #include <linux/leds.h>
  406. static struct gpio_led gpio_leds[] = {
  407. {
  408. .name = "overo:red:gpio21",
  409. .default_trigger = "heartbeat",
  410. .gpio = 21,
  411. .active_low = true,
  412. },
  413. {
  414. .name = "overo:blue:gpio22",
  415. .default_trigger = "none",
  416. .gpio = 22,
  417. .active_low = true,
  418. },
  419. {
  420. .name = "overo:blue:COM",
  421. .default_trigger = "mmc0",
  422. .gpio = -EINVAL, /* gets replaced */
  423. .active_low = true,
  424. },
  425. };
  426. static struct gpio_led_platform_data gpio_leds_pdata = {
  427. .leds = gpio_leds,
  428. .num_leds = ARRAY_SIZE(gpio_leds),
  429. };
  430. static struct platform_device gpio_leds_device = {
  431. .name = "leds-gpio",
  432. .id = -1,
  433. .dev = {
  434. .platform_data = &gpio_leds_pdata,
  435. },
  436. };
  437. static void __init overo_init_led(void)
  438. {
  439. platform_device_register(&gpio_leds_device);
  440. }
  441. #else
  442. static inline void __init overo_init_led(void) { return; }
  443. #endif
  444. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  445. #include <linux/input.h>
  446. #include <linux/gpio_keys.h>
  447. static struct gpio_keys_button gpio_buttons[] = {
  448. {
  449. .code = BTN_0,
  450. .gpio = 23,
  451. .desc = "button0",
  452. .wakeup = 1,
  453. },
  454. {
  455. .code = BTN_1,
  456. .gpio = 14,
  457. .desc = "button1",
  458. .wakeup = 1,
  459. },
  460. };
  461. static struct gpio_keys_platform_data gpio_keys_pdata = {
  462. .buttons = gpio_buttons,
  463. .nbuttons = ARRAY_SIZE(gpio_buttons),
  464. };
  465. static struct platform_device gpio_keys_device = {
  466. .name = "gpio-keys",
  467. .id = -1,
  468. .dev = {
  469. .platform_data = &gpio_keys_pdata,
  470. },
  471. };
  472. static void __init overo_init_keys(void)
  473. {
  474. platform_device_register(&gpio_keys_device);
  475. }
  476. #else
  477. static inline void __init overo_init_keys(void) { return; }
  478. #endif
  479. static int overo_twl_gpio_setup(struct device *dev,
  480. unsigned gpio, unsigned ngpio)
  481. {
  482. omap2_hsmmc_init(mmc);
  483. overo_vmmc1_supply.dev = mmc[0].dev;
  484. #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  485. /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
  486. gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
  487. #endif
  488. return 0;
  489. }
  490. static struct twl4030_gpio_platform_data overo_gpio_data = {
  491. .gpio_base = OMAP_MAX_GPIO_LINES,
  492. .irq_base = TWL4030_GPIO_IRQ_BASE,
  493. .irq_end = TWL4030_GPIO_IRQ_END,
  494. .use_leds = true,
  495. .setup = overo_twl_gpio_setup,
  496. };
  497. static struct twl4030_usb_data overo_usb_data = {
  498. .usb_mode = T2_USB_MODE_ULPI,
  499. };
  500. static struct regulator_init_data overo_vmmc1 = {
  501. .constraints = {
  502. .min_uV = 1850000,
  503. .max_uV = 3150000,
  504. .valid_modes_mask = REGULATOR_MODE_NORMAL
  505. | REGULATOR_MODE_STANDBY,
  506. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  507. | REGULATOR_CHANGE_MODE
  508. | REGULATOR_CHANGE_STATUS,
  509. },
  510. .num_consumer_supplies = 1,
  511. .consumer_supplies = &overo_vmmc1_supply,
  512. };
  513. /* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
  514. static struct regulator_init_data overo_vdac = {
  515. .constraints = {
  516. .min_uV = 1800000,
  517. .max_uV = 1800000,
  518. .valid_modes_mask = REGULATOR_MODE_NORMAL
  519. | REGULATOR_MODE_STANDBY,
  520. .valid_ops_mask = REGULATOR_CHANGE_MODE
  521. | REGULATOR_CHANGE_STATUS,
  522. },
  523. .num_consumer_supplies = 1,
  524. .consumer_supplies = &overo_vdda_dac_supply,
  525. };
  526. /* VPLL2 for digital video outputs */
  527. static struct regulator_init_data overo_vpll2 = {
  528. .constraints = {
  529. .name = "VDVI",
  530. .min_uV = 1800000,
  531. .max_uV = 1800000,
  532. .valid_modes_mask = REGULATOR_MODE_NORMAL
  533. | REGULATOR_MODE_STANDBY,
  534. .valid_ops_mask = REGULATOR_CHANGE_MODE
  535. | REGULATOR_CHANGE_STATUS,
  536. },
  537. .num_consumer_supplies = ARRAY_SIZE(overo_vdds_dsi_supply),
  538. .consumer_supplies = overo_vdds_dsi_supply,
  539. };
  540. static struct twl4030_codec_audio_data overo_audio_data;
  541. static struct twl4030_codec_data overo_codec_data = {
  542. .audio_mclk = 26000000,
  543. .audio = &overo_audio_data,
  544. };
  545. static struct twl4030_platform_data overo_twldata = {
  546. .irq_base = TWL4030_IRQ_BASE,
  547. .irq_end = TWL4030_IRQ_END,
  548. .gpio = &overo_gpio_data,
  549. .usb = &overo_usb_data,
  550. .codec = &overo_codec_data,
  551. .vmmc1 = &overo_vmmc1,
  552. .vdac = &overo_vdac,
  553. .vpll2 = &overo_vpll2,
  554. };
  555. static struct i2c_board_info __initdata overo_i2c_boardinfo[] = {
  556. {
  557. I2C_BOARD_INFO("tps65950", 0x48),
  558. .flags = I2C_CLIENT_WAKE,
  559. .irq = INT_34XX_SYS_NIRQ,
  560. .platform_data = &overo_twldata,
  561. },
  562. };
  563. static int __init overo_i2c_init(void)
  564. {
  565. omap_register_i2c_bus(1, 2600, overo_i2c_boardinfo,
  566. ARRAY_SIZE(overo_i2c_boardinfo));
  567. /* i2c2 pins are used for gpio */
  568. omap_register_i2c_bus(3, 400, NULL, 0);
  569. return 0;
  570. }
  571. static struct spi_board_info overo_spi_board_info[] __initdata = {
  572. #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
  573. defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
  574. {
  575. .modalias = "ads7846",
  576. .bus_num = 1,
  577. .chip_select = 0,
  578. .max_speed_hz = 1500000,
  579. .controller_data = &ads7846_mcspi_config,
  580. .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN),
  581. .platform_data = &ads7846_config,
  582. },
  583. #endif
  584. #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
  585. defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
  586. {
  587. .modalias = "lgphilips_lb035q02_panel-spi",
  588. .bus_num = 1,
  589. .chip_select = 1,
  590. .max_speed_hz = 500000,
  591. .mode = SPI_MODE_3,
  592. },
  593. #endif
  594. };
  595. static int __init overo_spi_init(void)
  596. {
  597. overo_ads7846_init();
  598. spi_register_board_info(overo_spi_board_info,
  599. ARRAY_SIZE(overo_spi_board_info));
  600. return 0;
  601. }
  602. static void __init overo_init_early(void)
  603. {
  604. omap2_init_common_infrastructure();
  605. omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
  606. mt46h32m32lf6_sdrc_params);
  607. }
  608. static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
  609. .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
  610. .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
  611. .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
  612. .phy_reset = true,
  613. .reset_gpio_port[0] = -EINVAL,
  614. .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET,
  615. .reset_gpio_port[2] = -EINVAL
  616. };
  617. #ifdef CONFIG_OMAP_MUX
  618. static struct omap_board_mux board_mux[] __initdata = {
  619. { .reg_offset = OMAP_MUX_TERMINATOR },
  620. };
  621. #endif
  622. static struct omap_musb_board_data musb_board_data = {
  623. .interface_type = MUSB_INTERFACE_ULPI,
  624. .mode = MUSB_OTG,
  625. .power = 100,
  626. };
  627. static void __init overo_init(void)
  628. {
  629. omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  630. overo_i2c_init();
  631. omap_display_init(&overo_dss_data);
  632. omap_serial_init();
  633. overo_flash_init();
  634. usb_musb_init(&musb_board_data);
  635. usbhs_init(&usbhs_bdata);
  636. overo_spi_init();
  637. overo_ads7846_init();
  638. overo_init_smsc911x();
  639. overo_display_init();
  640. overo_init_led();
  641. overo_init_keys();
  642. /* Ensure SDRC pins are mux'd for self-refresh */
  643. omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
  644. omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
  645. if ((gpio_request(OVERO_GPIO_W2W_NRESET,
  646. "OVERO_GPIO_W2W_NRESET") == 0) &&
  647. (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) {
  648. gpio_export(OVERO_GPIO_W2W_NRESET, 0);
  649. gpio_set_value(OVERO_GPIO_W2W_NRESET, 0);
  650. udelay(10);
  651. gpio_set_value(OVERO_GPIO_W2W_NRESET, 1);
  652. } else {
  653. printk(KERN_ERR "could not obtain gpio for "
  654. "OVERO_GPIO_W2W_NRESET\n");
  655. }
  656. if ((gpio_request(OVERO_GPIO_BT_XGATE, "OVERO_GPIO_BT_XGATE") == 0) &&
  657. (gpio_direction_output(OVERO_GPIO_BT_XGATE, 0) == 0))
  658. gpio_export(OVERO_GPIO_BT_XGATE, 0);
  659. else
  660. printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_BT_XGATE\n");
  661. if ((gpio_request(OVERO_GPIO_BT_NRESET, "OVERO_GPIO_BT_NRESET") == 0) &&
  662. (gpio_direction_output(OVERO_GPIO_BT_NRESET, 1) == 0)) {
  663. gpio_export(OVERO_GPIO_BT_NRESET, 0);
  664. gpio_set_value(OVERO_GPIO_BT_NRESET, 0);
  665. mdelay(6);
  666. gpio_set_value(OVERO_GPIO_BT_NRESET, 1);
  667. } else {
  668. printk(KERN_ERR "could not obtain gpio for "
  669. "OVERO_GPIO_BT_NRESET\n");
  670. }
  671. if ((gpio_request(OVERO_GPIO_USBH_CPEN, "OVERO_GPIO_USBH_CPEN") == 0) &&
  672. (gpio_direction_output(OVERO_GPIO_USBH_CPEN, 1) == 0))
  673. gpio_export(OVERO_GPIO_USBH_CPEN, 0);
  674. else
  675. printk(KERN_ERR "could not obtain gpio for "
  676. "OVERO_GPIO_USBH_CPEN\n");
  677. }
  678. MACHINE_START(OVERO, "Gumstix Overo")
  679. .boot_params = 0x80000100,
  680. .reserve = omap_reserve,
  681. .map_io = omap3_map_io,
  682. .init_early = overo_init_early,
  683. .init_irq = omap_init_irq,
  684. .init_machine = overo_init,
  685. .timer = &omap_timer,
  686. MACHINE_END