board-overo.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  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. static int overo_twl_gpio_setup(struct device *dev,
  405. unsigned gpio, unsigned ngpio)
  406. {
  407. omap2_hsmmc_init(mmc);
  408. overo_vmmc1_supply.dev = mmc[0].dev;
  409. return 0;
  410. }
  411. static struct twl4030_gpio_platform_data overo_gpio_data = {
  412. .gpio_base = OMAP_MAX_GPIO_LINES,
  413. .irq_base = TWL4030_GPIO_IRQ_BASE,
  414. .irq_end = TWL4030_GPIO_IRQ_END,
  415. .setup = overo_twl_gpio_setup,
  416. };
  417. static struct twl4030_usb_data overo_usb_data = {
  418. .usb_mode = T2_USB_MODE_ULPI,
  419. };
  420. static struct regulator_init_data overo_vmmc1 = {
  421. .constraints = {
  422. .min_uV = 1850000,
  423. .max_uV = 3150000,
  424. .valid_modes_mask = REGULATOR_MODE_NORMAL
  425. | REGULATOR_MODE_STANDBY,
  426. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  427. | REGULATOR_CHANGE_MODE
  428. | REGULATOR_CHANGE_STATUS,
  429. },
  430. .num_consumer_supplies = 1,
  431. .consumer_supplies = &overo_vmmc1_supply,
  432. };
  433. /* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
  434. static struct regulator_init_data overo_vdac = {
  435. .constraints = {
  436. .min_uV = 1800000,
  437. .max_uV = 1800000,
  438. .valid_modes_mask = REGULATOR_MODE_NORMAL
  439. | REGULATOR_MODE_STANDBY,
  440. .valid_ops_mask = REGULATOR_CHANGE_MODE
  441. | REGULATOR_CHANGE_STATUS,
  442. },
  443. .num_consumer_supplies = 1,
  444. .consumer_supplies = &overo_vdda_dac_supply,
  445. };
  446. /* VPLL2 for digital video outputs */
  447. static struct regulator_init_data overo_vpll2 = {
  448. .constraints = {
  449. .name = "VDVI",
  450. .min_uV = 1800000,
  451. .max_uV = 1800000,
  452. .valid_modes_mask = REGULATOR_MODE_NORMAL
  453. | REGULATOR_MODE_STANDBY,
  454. .valid_ops_mask = REGULATOR_CHANGE_MODE
  455. | REGULATOR_CHANGE_STATUS,
  456. },
  457. .num_consumer_supplies = ARRAY_SIZE(overo_vdds_dsi_supply),
  458. .consumer_supplies = overo_vdds_dsi_supply,
  459. };
  460. static struct twl4030_codec_audio_data overo_audio_data;
  461. static struct twl4030_codec_data overo_codec_data = {
  462. .audio_mclk = 26000000,
  463. .audio = &overo_audio_data,
  464. };
  465. static struct twl4030_platform_data overo_twldata = {
  466. .irq_base = TWL4030_IRQ_BASE,
  467. .irq_end = TWL4030_IRQ_END,
  468. .gpio = &overo_gpio_data,
  469. .usb = &overo_usb_data,
  470. .codec = &overo_codec_data,
  471. .vmmc1 = &overo_vmmc1,
  472. .vdac = &overo_vdac,
  473. .vpll2 = &overo_vpll2,
  474. };
  475. static struct i2c_board_info __initdata overo_i2c_boardinfo[] = {
  476. {
  477. I2C_BOARD_INFO("tps65950", 0x48),
  478. .flags = I2C_CLIENT_WAKE,
  479. .irq = INT_34XX_SYS_NIRQ,
  480. .platform_data = &overo_twldata,
  481. },
  482. };
  483. static int __init overo_i2c_init(void)
  484. {
  485. omap_register_i2c_bus(1, 2600, overo_i2c_boardinfo,
  486. ARRAY_SIZE(overo_i2c_boardinfo));
  487. /* i2c2 pins are used for gpio */
  488. omap_register_i2c_bus(3, 400, NULL, 0);
  489. return 0;
  490. }
  491. static struct spi_board_info overo_spi_board_info[] __initdata = {
  492. #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
  493. defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
  494. {
  495. .modalias = "ads7846",
  496. .bus_num = 1,
  497. .chip_select = 0,
  498. .max_speed_hz = 1500000,
  499. .controller_data = &ads7846_mcspi_config,
  500. .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN),
  501. .platform_data = &ads7846_config,
  502. },
  503. #endif
  504. #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
  505. defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
  506. {
  507. .modalias = "lgphilips_lb035q02_panel-spi",
  508. .bus_num = 1,
  509. .chip_select = 1,
  510. .max_speed_hz = 500000,
  511. .mode = SPI_MODE_3,
  512. },
  513. #endif
  514. };
  515. static int __init overo_spi_init(void)
  516. {
  517. overo_ads7846_init();
  518. spi_register_board_info(overo_spi_board_info,
  519. ARRAY_SIZE(overo_spi_board_info));
  520. return 0;
  521. }
  522. static void __init overo_init_early(void)
  523. {
  524. omap2_init_common_infrastructure();
  525. omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
  526. mt46h32m32lf6_sdrc_params);
  527. }
  528. static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
  529. .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
  530. .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
  531. .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
  532. .phy_reset = true,
  533. .reset_gpio_port[0] = -EINVAL,
  534. .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET,
  535. .reset_gpio_port[2] = -EINVAL
  536. };
  537. #ifdef CONFIG_OMAP_MUX
  538. static struct omap_board_mux board_mux[] __initdata = {
  539. { .reg_offset = OMAP_MUX_TERMINATOR },
  540. };
  541. #endif
  542. static struct omap_musb_board_data musb_board_data = {
  543. .interface_type = MUSB_INTERFACE_ULPI,
  544. .mode = MUSB_OTG,
  545. .power = 100,
  546. };
  547. static void __init overo_init(void)
  548. {
  549. omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  550. overo_i2c_init();
  551. omap_display_init(&overo_dss_data);
  552. omap_serial_init();
  553. overo_flash_init();
  554. usb_musb_init(&musb_board_data);
  555. usb_ehci_init(&ehci_pdata);
  556. overo_spi_init();
  557. overo_init_smsc911x();
  558. overo_display_init();
  559. /* Ensure SDRC pins are mux'd for self-refresh */
  560. omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
  561. omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
  562. if ((gpio_request(OVERO_GPIO_W2W_NRESET,
  563. "OVERO_GPIO_W2W_NRESET") == 0) &&
  564. (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) {
  565. gpio_export(OVERO_GPIO_W2W_NRESET, 0);
  566. gpio_set_value(OVERO_GPIO_W2W_NRESET, 0);
  567. udelay(10);
  568. gpio_set_value(OVERO_GPIO_W2W_NRESET, 1);
  569. } else {
  570. printk(KERN_ERR "could not obtain gpio for "
  571. "OVERO_GPIO_W2W_NRESET\n");
  572. }
  573. if ((gpio_request(OVERO_GPIO_BT_XGATE, "OVERO_GPIO_BT_XGATE") == 0) &&
  574. (gpio_direction_output(OVERO_GPIO_BT_XGATE, 0) == 0))
  575. gpio_export(OVERO_GPIO_BT_XGATE, 0);
  576. else
  577. printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_BT_XGATE\n");
  578. if ((gpio_request(OVERO_GPIO_BT_NRESET, "OVERO_GPIO_BT_NRESET") == 0) &&
  579. (gpio_direction_output(OVERO_GPIO_BT_NRESET, 1) == 0)) {
  580. gpio_export(OVERO_GPIO_BT_NRESET, 0);
  581. gpio_set_value(OVERO_GPIO_BT_NRESET, 0);
  582. mdelay(6);
  583. gpio_set_value(OVERO_GPIO_BT_NRESET, 1);
  584. } else {
  585. printk(KERN_ERR "could not obtain gpio for "
  586. "OVERO_GPIO_BT_NRESET\n");
  587. }
  588. if ((gpio_request(OVERO_GPIO_USBH_CPEN, "OVERO_GPIO_USBH_CPEN") == 0) &&
  589. (gpio_direction_output(OVERO_GPIO_USBH_CPEN, 1) == 0))
  590. gpio_export(OVERO_GPIO_USBH_CPEN, 0);
  591. else
  592. printk(KERN_ERR "could not obtain gpio for "
  593. "OVERO_GPIO_USBH_CPEN\n");
  594. }
  595. MACHINE_START(OVERO, "Gumstix Overo")
  596. .boot_params = 0x80000100,
  597. .reserve = omap_reserve,
  598. .map_io = omap3_map_io,
  599. .init_early = overo_init_early,
  600. .init_irq = omap_init_irq,
  601. .init_machine = overo_init,
  602. .timer = &omap_timer,
  603. MACHINE_END