board-devkit8000.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. /*
  2. * board-devkit8000.c - TimLL Devkit8000
  3. *
  4. * Copyright (C) 2009 Kim Botherway
  5. * Copyright (C) 2010 Thomas Weber
  6. *
  7. * Modified from mach-omap2/board-omap3beagle.c
  8. *
  9. * Initial code: Syed Mohammed Khasim
  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/kernel.h>
  16. #include <linux/init.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/delay.h>
  19. #include <linux/err.h>
  20. #include <linux/clk.h>
  21. #include <linux/io.h>
  22. #include <linux/leds.h>
  23. #include <linux/gpio.h>
  24. #include <linux/input.h>
  25. #include <linux/gpio_keys.h>
  26. #include <linux/mtd/mtd.h>
  27. #include <linux/mtd/partitions.h>
  28. #include <linux/mtd/nand.h>
  29. #include <linux/regulator/machine.h>
  30. #include <linux/i2c/twl.h>
  31. #include <mach/hardware.h>
  32. #include <mach/id.h>
  33. #include <asm/mach-types.h>
  34. #include <asm/mach/arch.h>
  35. #include <asm/mach/map.h>
  36. #include <asm/mach/flash.h>
  37. #include <plat/board.h>
  38. #include <plat/common.h>
  39. #include <plat/gpmc.h>
  40. #include <plat/nand.h>
  41. #include <plat/usb.h>
  42. #include <plat/timer-gp.h>
  43. #include <plat/display.h>
  44. #include <plat/mcspi.h>
  45. #include <linux/input/matrix_keypad.h>
  46. #include <linux/spi/spi.h>
  47. #include <linux/spi/ads7846.h>
  48. #include <linux/dm9000.h>
  49. #include <linux/interrupt.h>
  50. #include "sdram-micron-mt46h32m32lf-6.h"
  51. #include "mux.h"
  52. #include "hsmmc.h"
  53. #define NAND_BLOCK_SIZE SZ_128K
  54. #define OMAP_DM9000_GPIO_IRQ 25
  55. #define OMAP3_DEVKIT_TS_GPIO 27
  56. static struct mtd_partition devkit8000_nand_partitions[] = {
  57. /* All the partition sizes are listed in terms of NAND block size */
  58. {
  59. .name = "X-Loader",
  60. .offset = 0,
  61. .size = 4 * NAND_BLOCK_SIZE,
  62. .mask_flags = MTD_WRITEABLE, /* force read-only */
  63. },
  64. {
  65. .name = "U-Boot",
  66. .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
  67. .size = 15 * NAND_BLOCK_SIZE,
  68. .mask_flags = MTD_WRITEABLE, /* force read-only */
  69. },
  70. {
  71. .name = "U-Boot Env",
  72. .offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */
  73. .size = 1 * NAND_BLOCK_SIZE,
  74. },
  75. {
  76. .name = "Kernel",
  77. .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
  78. .size = 32 * NAND_BLOCK_SIZE,
  79. },
  80. {
  81. .name = "File System",
  82. .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */
  83. .size = MTDPART_SIZ_FULL,
  84. },
  85. };
  86. static struct omap_nand_platform_data devkit8000_nand_data = {
  87. .options = NAND_BUSWIDTH_16,
  88. .parts = devkit8000_nand_partitions,
  89. .nr_parts = ARRAY_SIZE(devkit8000_nand_partitions),
  90. .dma_channel = -1, /* disable DMA in OMAP NAND driver */
  91. };
  92. static struct omap2_hsmmc_info mmc[] = {
  93. {
  94. .mmc = 1,
  95. .wires = 8,
  96. .gpio_wp = 29,
  97. },
  98. {} /* Terminator */
  99. };
  100. static int devkit8000_panel_enable_lcd(struct omap_dss_device *dssdev)
  101. {
  102. twl_i2c_write_u8(TWL4030_MODULE_GPIO, 0x80, REG_GPIODATADIR1);
  103. twl_i2c_write_u8(TWL4030_MODULE_LED, 0x0, 0x0);
  104. if (gpio_is_valid(dssdev->reset_gpio))
  105. gpio_set_value(dssdev->reset_gpio, 1);
  106. return 0;
  107. }
  108. static void devkit8000_panel_disable_lcd(struct omap_dss_device *dssdev)
  109. {
  110. if (gpio_is_valid(dssdev->reset_gpio))
  111. gpio_set_value(dssdev->reset_gpio, 0);
  112. }
  113. static int devkit8000_panel_enable_dvi(struct omap_dss_device *dssdev)
  114. {
  115. if (gpio_is_valid(dssdev->reset_gpio))
  116. gpio_set_value(dssdev->reset_gpio, 1);
  117. return 0;
  118. }
  119. static void devkit8000_panel_disable_dvi(struct omap_dss_device *dssdev)
  120. {
  121. if (gpio_is_valid(dssdev->reset_gpio))
  122. gpio_set_value(dssdev->reset_gpio, 0);
  123. }
  124. static struct regulator_consumer_supply devkit8000_vmmc1_supply =
  125. REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.0");
  126. /* ads7846 on SPI */
  127. static struct regulator_consumer_supply devkit8000_vio_supply =
  128. REGULATOR_SUPPLY("vcc", "spi2.0");
  129. static struct omap_dss_device devkit8000_lcd_device = {
  130. .name = "lcd",
  131. .driver_name = "generic_panel",
  132. .type = OMAP_DISPLAY_TYPE_DPI,
  133. .phy.dpi.data_lines = 24,
  134. .reset_gpio = -EINVAL, /* will be replaced */
  135. .platform_enable = devkit8000_panel_enable_lcd,
  136. .platform_disable = devkit8000_panel_disable_lcd,
  137. };
  138. static struct omap_dss_device devkit8000_dvi_device = {
  139. .name = "dvi",
  140. .driver_name = "generic_panel",
  141. .type = OMAP_DISPLAY_TYPE_DPI,
  142. .phy.dpi.data_lines = 24,
  143. .reset_gpio = -EINVAL, /* will be replaced */
  144. .platform_enable = devkit8000_panel_enable_dvi,
  145. .platform_disable = devkit8000_panel_disable_dvi,
  146. };
  147. static struct omap_dss_device devkit8000_tv_device = {
  148. .name = "tv",
  149. .driver_name = "venc",
  150. .type = OMAP_DISPLAY_TYPE_VENC,
  151. .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
  152. };
  153. static struct omap_dss_device *devkit8000_dss_devices[] = {
  154. &devkit8000_lcd_device,
  155. &devkit8000_dvi_device,
  156. &devkit8000_tv_device,
  157. };
  158. static struct omap_dss_board_info devkit8000_dss_data = {
  159. .num_devices = ARRAY_SIZE(devkit8000_dss_devices),
  160. .devices = devkit8000_dss_devices,
  161. .default_device = &devkit8000_lcd_device,
  162. };
  163. static struct platform_device devkit8000_dss_device = {
  164. .name = "omapdss",
  165. .id = -1,
  166. .dev = {
  167. .platform_data = &devkit8000_dss_data,
  168. },
  169. };
  170. static struct regulator_consumer_supply devkit8000_vdda_dac_supply =
  171. REGULATOR_SUPPLY("vdda_dac", "omapdss");
  172. static int board_keymap[] = {
  173. KEY(0, 0, KEY_1),
  174. KEY(1, 0, KEY_2),
  175. KEY(2, 0, KEY_3),
  176. KEY(0, 1, KEY_4),
  177. KEY(1, 1, KEY_5),
  178. KEY(2, 1, KEY_6),
  179. KEY(3, 1, KEY_F5),
  180. KEY(0, 2, KEY_7),
  181. KEY(1, 2, KEY_8),
  182. KEY(2, 2, KEY_9),
  183. KEY(3, 2, KEY_F6),
  184. KEY(0, 3, KEY_F7),
  185. KEY(1, 3, KEY_0),
  186. KEY(2, 3, KEY_F8),
  187. PERSISTENT_KEY(4, 5),
  188. KEY(4, 4, KEY_VOLUMEUP),
  189. KEY(5, 5, KEY_VOLUMEDOWN),
  190. 0
  191. };
  192. static struct matrix_keymap_data board_map_data = {
  193. .keymap = board_keymap,
  194. .keymap_size = ARRAY_SIZE(board_keymap),
  195. };
  196. static struct twl4030_keypad_data devkit8000_kp_data = {
  197. .keymap_data = &board_map_data,
  198. .rows = 6,
  199. .cols = 6,
  200. .rep = 1,
  201. };
  202. static struct gpio_led gpio_leds[];
  203. static int devkit8000_twl_gpio_setup(struct device *dev,
  204. unsigned gpio, unsigned ngpio)
  205. {
  206. omap_mux_init_gpio(29, OMAP_PIN_INPUT);
  207. /* gpio + 0 is "mmc0_cd" (input/IRQ) */
  208. mmc[0].gpio_cd = gpio + 0;
  209. omap2_hsmmc_init(mmc);
  210. /* link regulators to MMC adapters */
  211. devkit8000_vmmc1_supply.dev = mmc[0].dev;
  212. /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
  213. gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
  214. /* gpio + 1 is "LCD_PWREN" (out, active high) */
  215. devkit8000_lcd_device.reset_gpio = gpio + 1;
  216. gpio_request(devkit8000_lcd_device.reset_gpio, "LCD_PWREN");
  217. /* Disable until needed */
  218. gpio_direction_output(devkit8000_lcd_device.reset_gpio, 0);
  219. /* gpio + 7 is "DVI_PD" (out, active low) */
  220. devkit8000_dvi_device.reset_gpio = gpio + 7;
  221. gpio_request(devkit8000_dvi_device.reset_gpio, "DVI PowerDown");
  222. /* Disable until needed */
  223. gpio_direction_output(devkit8000_dvi_device.reset_gpio, 0);
  224. return 0;
  225. }
  226. static struct twl4030_gpio_platform_data devkit8000_gpio_data = {
  227. .gpio_base = OMAP_MAX_GPIO_LINES,
  228. .irq_base = TWL4030_GPIO_IRQ_BASE,
  229. .irq_end = TWL4030_GPIO_IRQ_END,
  230. .use_leds = true,
  231. .pullups = BIT(1),
  232. .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13)
  233. | BIT(15) | BIT(16) | BIT(17),
  234. .setup = devkit8000_twl_gpio_setup,
  235. };
  236. static struct regulator_consumer_supply devkit8000_vpll1_supply =
  237. REGULATOR_SUPPLY("vdds_dsi", "omapdss");
  238. /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
  239. static struct regulator_init_data devkit8000_vmmc1 = {
  240. .constraints = {
  241. .min_uV = 1850000,
  242. .max_uV = 3150000,
  243. .valid_modes_mask = REGULATOR_MODE_NORMAL
  244. | REGULATOR_MODE_STANDBY,
  245. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  246. | REGULATOR_CHANGE_MODE
  247. | REGULATOR_CHANGE_STATUS,
  248. },
  249. .num_consumer_supplies = 1,
  250. .consumer_supplies = &devkit8000_vmmc1_supply,
  251. };
  252. /* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
  253. static struct regulator_init_data devkit8000_vdac = {
  254. .constraints = {
  255. .min_uV = 1800000,
  256. .max_uV = 1800000,
  257. .valid_modes_mask = REGULATOR_MODE_NORMAL
  258. | REGULATOR_MODE_STANDBY,
  259. .valid_ops_mask = REGULATOR_CHANGE_MODE
  260. | REGULATOR_CHANGE_STATUS,
  261. },
  262. .num_consumer_supplies = 1,
  263. .consumer_supplies = &devkit8000_vdda_dac_supply,
  264. };
  265. /* VPLL1 for digital video outputs */
  266. static struct regulator_init_data devkit8000_vpll1 = {
  267. .constraints = {
  268. .min_uV = 1800000,
  269. .max_uV = 1800000,
  270. .valid_modes_mask = REGULATOR_MODE_NORMAL
  271. | REGULATOR_MODE_STANDBY,
  272. .valid_ops_mask = REGULATOR_CHANGE_MODE
  273. | REGULATOR_CHANGE_STATUS,
  274. },
  275. .num_consumer_supplies = 1,
  276. .consumer_supplies = &devkit8000_vpll1_supply,
  277. };
  278. /* VAUX4 for ads7846 and nubs */
  279. static struct regulator_init_data devkit8000_vio = {
  280. .constraints = {
  281. .min_uV = 1800000,
  282. .max_uV = 1800000,
  283. .apply_uV = true,
  284. .valid_modes_mask = REGULATOR_MODE_NORMAL
  285. | REGULATOR_MODE_STANDBY,
  286. .valid_ops_mask = REGULATOR_CHANGE_MODE
  287. | REGULATOR_CHANGE_STATUS,
  288. },
  289. .num_consumer_supplies = 1,
  290. .consumer_supplies = &devkit8000_vio_supply,
  291. };
  292. static struct twl4030_usb_data devkit8000_usb_data = {
  293. .usb_mode = T2_USB_MODE_ULPI,
  294. };
  295. static struct twl4030_codec_audio_data devkit8000_audio_data = {
  296. .audio_mclk = 26000000,
  297. };
  298. static struct twl4030_codec_data devkit8000_codec_data = {
  299. .audio_mclk = 26000000,
  300. .audio = &devkit8000_audio_data,
  301. };
  302. static struct twl4030_platform_data devkit8000_twldata = {
  303. .irq_base = TWL4030_IRQ_BASE,
  304. .irq_end = TWL4030_IRQ_END,
  305. /* platform_data for children goes here */
  306. .usb = &devkit8000_usb_data,
  307. .gpio = &devkit8000_gpio_data,
  308. .codec = &devkit8000_codec_data,
  309. .vmmc1 = &devkit8000_vmmc1,
  310. .vdac = &devkit8000_vdac,
  311. .vpll1 = &devkit8000_vpll1,
  312. .vio = &devkit8000_vio,
  313. .keypad = &devkit8000_kp_data,
  314. };
  315. static struct i2c_board_info __initdata devkit8000_i2c_boardinfo[] = {
  316. {
  317. I2C_BOARD_INFO("tps65930", 0x48),
  318. .flags = I2C_CLIENT_WAKE,
  319. .irq = INT_34XX_SYS_NIRQ,
  320. .platform_data = &devkit8000_twldata,
  321. },
  322. };
  323. static int __init devkit8000_i2c_init(void)
  324. {
  325. omap_register_i2c_bus(1, 2600, devkit8000_i2c_boardinfo,
  326. ARRAY_SIZE(devkit8000_i2c_boardinfo));
  327. /* Bus 3 is attached to the DVI port where devices like the pico DLP
  328. * projector don't work reliably with 400kHz */
  329. omap_register_i2c_bus(3, 400, NULL, 0);
  330. return 0;
  331. }
  332. static struct gpio_led gpio_leds[] = {
  333. {
  334. .name = "led1",
  335. .default_trigger = "heartbeat",
  336. .gpio = 186,
  337. .active_low = true,
  338. },
  339. {
  340. .name = "led2",
  341. .default_trigger = "mmc0",
  342. .gpio = 163,
  343. .active_low = true,
  344. },
  345. {
  346. .name = "ledB",
  347. .default_trigger = "none",
  348. .gpio = 153,
  349. .active_low = true,
  350. },
  351. {
  352. .name = "led3",
  353. .default_trigger = "none",
  354. .gpio = 164,
  355. .active_low = true,
  356. },
  357. };
  358. static struct gpio_led_platform_data gpio_led_info = {
  359. .leds = gpio_leds,
  360. .num_leds = ARRAY_SIZE(gpio_leds),
  361. };
  362. static struct platform_device leds_gpio = {
  363. .name = "leds-gpio",
  364. .id = -1,
  365. .dev = {
  366. .platform_data = &gpio_led_info,
  367. },
  368. };
  369. static struct gpio_keys_button gpio_buttons[] = {
  370. {
  371. .code = BTN_EXTRA,
  372. .gpio = 26,
  373. .desc = "user",
  374. .wakeup = 1,
  375. },
  376. };
  377. static struct gpio_keys_platform_data gpio_key_info = {
  378. .buttons = gpio_buttons,
  379. .nbuttons = ARRAY_SIZE(gpio_buttons),
  380. };
  381. static struct platform_device keys_gpio = {
  382. .name = "gpio-keys",
  383. .id = -1,
  384. .dev = {
  385. .platform_data = &gpio_key_info,
  386. },
  387. };
  388. static void __init devkit8000_init_irq(void)
  389. {
  390. omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
  391. mt46h32m32lf6_sdrc_params);
  392. omap_init_irq();
  393. #ifdef CONFIG_OMAP_32K_TIMER
  394. omap2_gp_clockevent_set_gptimer(12);
  395. #endif
  396. omap_gpio_init();
  397. }
  398. static void __init devkit8000_ads7846_init(void)
  399. {
  400. int gpio = OMAP3_DEVKIT_TS_GPIO;
  401. int ret;
  402. ret = gpio_request(gpio, "ads7846_pen_down");
  403. if (ret < 0) {
  404. printk(KERN_ERR "Failed to request GPIO %d for "
  405. "ads7846 pen down IRQ\n", gpio);
  406. return;
  407. }
  408. gpio_direction_input(gpio);
  409. }
  410. static int ads7846_get_pendown_state(void)
  411. {
  412. return !gpio_get_value(OMAP3_DEVKIT_TS_GPIO);
  413. }
  414. static struct ads7846_platform_data ads7846_config = {
  415. .x_max = 0x0fff,
  416. .y_max = 0x0fff,
  417. .x_plate_ohms = 180,
  418. .pressure_max = 255,
  419. .debounce_max = 10,
  420. .debounce_tol = 5,
  421. .debounce_rep = 1,
  422. .get_pendown_state = ads7846_get_pendown_state,
  423. .keep_vref_on = 1,
  424. .settle_delay_usecs = 150,
  425. };
  426. static struct omap2_mcspi_device_config ads7846_mcspi_config = {
  427. .turbo_mode = 0,
  428. .single_channel = 1, /* 0: slave, 1: master */
  429. };
  430. static struct spi_board_info devkit8000_spi_board_info[] __initdata = {
  431. {
  432. .modalias = "ads7846",
  433. .bus_num = 2,
  434. .chip_select = 0,
  435. .max_speed_hz = 1500000,
  436. .controller_data = &ads7846_mcspi_config,
  437. .irq = OMAP_GPIO_IRQ(OMAP3_DEVKIT_TS_GPIO),
  438. .platform_data = &ads7846_config,
  439. }
  440. };
  441. #define OMAP_DM9000_BASE 0x2c000000
  442. static struct resource omap_dm9000_resources[] = {
  443. [0] = {
  444. .start = OMAP_DM9000_BASE,
  445. .end = (OMAP_DM9000_BASE + 0x4 - 1),
  446. .flags = IORESOURCE_MEM,
  447. },
  448. [1] = {
  449. .start = (OMAP_DM9000_BASE + 0x400),
  450. .end = (OMAP_DM9000_BASE + 0x400 + 0x4 - 1),
  451. .flags = IORESOURCE_MEM,
  452. },
  453. [2] = {
  454. .start = OMAP_GPIO_IRQ(OMAP_DM9000_GPIO_IRQ),
  455. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
  456. },
  457. };
  458. static struct dm9000_plat_data omap_dm9000_platdata = {
  459. .flags = DM9000_PLATF_16BITONLY,
  460. };
  461. static struct platform_device omap_dm9000_dev = {
  462. .name = "dm9000",
  463. .id = -1,
  464. .num_resources = ARRAY_SIZE(omap_dm9000_resources),
  465. .resource = omap_dm9000_resources,
  466. .dev = {
  467. .platform_data = &omap_dm9000_platdata,
  468. },
  469. };
  470. static void __init omap_dm9000_init(void)
  471. {
  472. unsigned char *eth_addr = omap_dm9000_platdata.dev_addr;
  473. struct omap_die_id odi;
  474. if (gpio_request(OMAP_DM9000_GPIO_IRQ, "dm9000 irq") < 0) {
  475. printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ\n",
  476. OMAP_DM9000_GPIO_IRQ);
  477. return;
  478. }
  479. gpio_direction_input(OMAP_DM9000_GPIO_IRQ);
  480. /* init the mac address using DIE id */
  481. omap_get_die_id(&odi);
  482. eth_addr[0] = 0x02; /* locally administered */
  483. eth_addr[1] = odi.id_1 & 0xff;
  484. eth_addr[2] = (odi.id_0 & 0xff000000) >> 24;
  485. eth_addr[3] = (odi.id_0 & 0x00ff0000) >> 16;
  486. eth_addr[4] = (odi.id_0 & 0x0000ff00) >> 8;
  487. eth_addr[5] = (odi.id_0 & 0x000000ff);
  488. }
  489. static struct platform_device *devkit8000_devices[] __initdata = {
  490. &devkit8000_dss_device,
  491. &leds_gpio,
  492. &keys_gpio,
  493. &omap_dm9000_dev,
  494. };
  495. static void __init devkit8000_flash_init(void)
  496. {
  497. u8 cs = 0;
  498. u8 nandcs = GPMC_CS_NUM + 1;
  499. /* find out the chip-select on which NAND exists */
  500. while (cs < GPMC_CS_NUM) {
  501. u32 ret = 0;
  502. ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
  503. if ((ret & 0xC00) == 0x800) {
  504. printk(KERN_INFO "Found NAND on CS%d\n", cs);
  505. if (nandcs > GPMC_CS_NUM)
  506. nandcs = cs;
  507. }
  508. cs++;
  509. }
  510. if (nandcs > GPMC_CS_NUM) {
  511. printk(KERN_INFO "NAND: Unable to find configuration "
  512. "in GPMC\n ");
  513. return;
  514. }
  515. if (nandcs < GPMC_CS_NUM) {
  516. devkit8000_nand_data.cs = nandcs;
  517. printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
  518. if (gpmc_nand_init(&devkit8000_nand_data) < 0)
  519. printk(KERN_ERR "Unable to register NAND device\n");
  520. }
  521. }
  522. static struct omap_musb_board_data musb_board_data = {
  523. .interface_type = MUSB_INTERFACE_ULPI,
  524. .mode = MUSB_OTG,
  525. .power = 100,
  526. };
  527. static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
  528. .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
  529. .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
  530. .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
  531. .phy_reset = true,
  532. .reset_gpio_port[0] = -EINVAL,
  533. .reset_gpio_port[1] = -EINVAL,
  534. .reset_gpio_port[2] = -EINVAL
  535. };
  536. static struct omap_board_mux board_mux[] __initdata = {
  537. /* nCS and IRQ for Devkit8000 ethernet */
  538. OMAP3_MUX(GPMC_NCS6, OMAP_MUX_MODE0),
  539. OMAP3_MUX(ETK_D11, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
  540. /* McSPI 2*/
  541. OMAP3_MUX(MCSPI2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  542. OMAP3_MUX(MCSPI2_SIMO, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  543. OMAP3_MUX(MCSPI2_SOMI, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  544. OMAP3_MUX(MCSPI2_CS0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  545. OMAP3_MUX(MCSPI2_CS1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  546. /* PENDOWN GPIO */
  547. OMAP3_MUX(ETK_D13, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
  548. /* mUSB */
  549. OMAP3_MUX(HSUSB0_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  550. OMAP3_MUX(HSUSB0_STP, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  551. OMAP3_MUX(HSUSB0_DIR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  552. OMAP3_MUX(HSUSB0_NXT, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  553. OMAP3_MUX(HSUSB0_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  554. OMAP3_MUX(HSUSB0_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  555. OMAP3_MUX(HSUSB0_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  556. OMAP3_MUX(HSUSB0_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  557. OMAP3_MUX(HSUSB0_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  558. OMAP3_MUX(HSUSB0_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  559. OMAP3_MUX(HSUSB0_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  560. OMAP3_MUX(HSUSB0_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  561. /* USB 1 */
  562. OMAP3_MUX(ETK_CTL, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
  563. OMAP3_MUX(ETK_CLK, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT),
  564. OMAP3_MUX(ETK_D8, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
  565. OMAP3_MUX(ETK_D9, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
  566. OMAP3_MUX(ETK_D0, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
  567. OMAP3_MUX(ETK_D1, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
  568. OMAP3_MUX(ETK_D2, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
  569. OMAP3_MUX(ETK_D3, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
  570. OMAP3_MUX(ETK_D4, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
  571. OMAP3_MUX(ETK_D5, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
  572. OMAP3_MUX(ETK_D6, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
  573. OMAP3_MUX(ETK_D7, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
  574. /* MMC 1 */
  575. OMAP3_MUX(SDMMC1_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  576. OMAP3_MUX(SDMMC1_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  577. OMAP3_MUX(SDMMC1_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  578. OMAP3_MUX(SDMMC1_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  579. OMAP3_MUX(SDMMC1_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  580. OMAP3_MUX(SDMMC1_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  581. OMAP3_MUX(SDMMC1_DAT4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  582. OMAP3_MUX(SDMMC1_DAT5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  583. OMAP3_MUX(SDMMC1_DAT6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  584. OMAP3_MUX(SDMMC1_DAT7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  585. /* McBSP 2 */
  586. OMAP3_MUX(MCBSP2_FSX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  587. OMAP3_MUX(MCBSP2_CLKX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  588. OMAP3_MUX(MCBSP2_DR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  589. OMAP3_MUX(MCBSP2_DX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  590. /* I2C 1 */
  591. OMAP3_MUX(I2C1_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  592. OMAP3_MUX(I2C1_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  593. /* I2C 2 */
  594. OMAP3_MUX(I2C2_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  595. OMAP3_MUX(I2C2_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  596. /* I2C 3 */
  597. OMAP3_MUX(I2C3_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  598. OMAP3_MUX(I2C3_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  599. /* I2C 4 */
  600. OMAP3_MUX(I2C4_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  601. OMAP3_MUX(I2C4_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  602. /* serial ports */
  603. OMAP3_MUX(MCBSP3_CLKX, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
  604. OMAP3_MUX(MCBSP3_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
  605. OMAP3_MUX(UART1_TX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  606. OMAP3_MUX(UART1_RX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  607. /* DSS */
  608. OMAP3_MUX(DSS_PCLK, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  609. OMAP3_MUX(DSS_HSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  610. OMAP3_MUX(DSS_VSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  611. OMAP3_MUX(DSS_ACBIAS, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  612. OMAP3_MUX(DSS_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  613. OMAP3_MUX(DSS_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  614. OMAP3_MUX(DSS_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  615. OMAP3_MUX(DSS_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  616. OMAP3_MUX(DSS_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  617. OMAP3_MUX(DSS_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  618. OMAP3_MUX(DSS_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  619. OMAP3_MUX(DSS_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  620. OMAP3_MUX(DSS_DATA8, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  621. OMAP3_MUX(DSS_DATA9, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  622. OMAP3_MUX(DSS_DATA10, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  623. OMAP3_MUX(DSS_DATA11, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  624. OMAP3_MUX(DSS_DATA12, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  625. OMAP3_MUX(DSS_DATA13, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  626. OMAP3_MUX(DSS_DATA14, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  627. OMAP3_MUX(DSS_DATA15, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  628. OMAP3_MUX(DSS_DATA16, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  629. OMAP3_MUX(DSS_DATA17, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  630. OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  631. OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  632. OMAP3_MUX(DSS_DATA20, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  633. OMAP3_MUX(DSS_DATA21, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  634. OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  635. OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
  636. /* expansion port */
  637. /* McSPI 1 */
  638. OMAP3_MUX(MCSPI1_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  639. OMAP3_MUX(MCSPI1_SIMO, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  640. OMAP3_MUX(MCSPI1_SOMI, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  641. OMAP3_MUX(MCSPI1_CS0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
  642. OMAP3_MUX(MCSPI1_CS3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
  643. /* HDQ */
  644. OMAP3_MUX(HDQ_SIO, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  645. /* McSPI4 */
  646. OMAP3_MUX(MCBSP1_CLKR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
  647. OMAP3_MUX(MCBSP1_DX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
  648. OMAP3_MUX(MCBSP1_DR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
  649. OMAP3_MUX(MCBSP1_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT_PULLUP),
  650. /* MMC 2 */
  651. OMAP3_MUX(SDMMC2_DAT4, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
  652. OMAP3_MUX(SDMMC2_DAT5, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
  653. OMAP3_MUX(SDMMC2_DAT6, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
  654. OMAP3_MUX(SDMMC2_DAT7, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
  655. /* I2C3 */
  656. OMAP3_MUX(I2C3_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  657. OMAP3_MUX(I2C3_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
  658. OMAP3_MUX(MCBSP1_CLKX, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
  659. OMAP3_MUX(MCBSP_CLKS, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
  660. OMAP3_MUX(MCBSP1_FSR, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
  661. OMAP3_MUX(GPMC_NCS7, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
  662. OMAP3_MUX(GPMC_NCS3, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
  663. /* TPS IRQ */
  664. OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_WAKEUP_EN | \
  665. OMAP_PIN_INPUT_PULLUP),
  666. { .reg_offset = OMAP_MUX_TERMINATOR },
  667. };
  668. static void __init devkit8000_init(void)
  669. {
  670. omap3_mux_init(board_mux, OMAP_PACKAGE_CUS);
  671. omap_serial_init();
  672. omap_dm9000_init();
  673. devkit8000_i2c_init();
  674. platform_add_devices(devkit8000_devices,
  675. ARRAY_SIZE(devkit8000_devices));
  676. spi_register_board_info(devkit8000_spi_board_info,
  677. ARRAY_SIZE(devkit8000_spi_board_info));
  678. devkit8000_ads7846_init();
  679. usb_musb_init(&musb_board_data);
  680. usb_ehci_init(&ehci_pdata);
  681. devkit8000_flash_init();
  682. /* Ensure SDRC pins are mux'd for self-refresh */
  683. omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
  684. omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
  685. }
  686. MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000")
  687. .phys_io = 0x48000000,
  688. .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
  689. .boot_params = 0x80000100,
  690. .map_io = omap3_map_io,
  691. .reserve = omap_reserve,
  692. .init_irq = devkit8000_init_irq,
  693. .init_machine = devkit8000_init,
  694. .timer = &omap_timer,
  695. MACHINE_END