board-omap3beagle.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. /*
  2. * linux/arch/arm/mach-omap2/board-omap3beagle.c
  3. *
  4. * Copyright (C) 2008 Texas Instruments
  5. *
  6. * Modified from mach-omap2/board-3430sdp.c
  7. *
  8. * Initial code: Syed Mohammed Khasim
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/delay.h>
  18. #include <linux/err.h>
  19. #include <linux/clk.h>
  20. #include <linux/io.h>
  21. #include <linux/leds.h>
  22. #include <linux/gpio.h>
  23. #include <linux/input.h>
  24. #include <linux/gpio_keys.h>
  25. #include <linux/opp.h>
  26. #include <linux/mtd/mtd.h>
  27. #include <linux/mtd/partitions.h>
  28. #include <linux/mtd/nand.h>
  29. #include <linux/mmc/host.h>
  30. #include <linux/regulator/machine.h>
  31. #include <linux/i2c/twl.h>
  32. #include <mach/hardware.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/display.h>
  40. #include <plat/panel-generic-dpi.h>
  41. #include <plat/gpmc.h>
  42. #include <plat/nand.h>
  43. #include <plat/usb.h>
  44. #include <plat/omap_device.h>
  45. #include "mux.h"
  46. #include "hsmmc.h"
  47. #include "timer-gp.h"
  48. #include "pm.h"
  49. #define NAND_BLOCK_SIZE SZ_128K
  50. /*
  51. * OMAP3 Beagle revision
  52. * Run time detection of Beagle revision is done by reading GPIO.
  53. * GPIO ID -
  54. * AXBX = GPIO173, GPIO172, GPIO171: 1 1 1
  55. * C1_3 = GPIO173, GPIO172, GPIO171: 1 1 0
  56. * C4 = GPIO173, GPIO172, GPIO171: 1 0 1
  57. * XM = GPIO173, GPIO172, GPIO171: 0 0 0
  58. */
  59. enum {
  60. OMAP3BEAGLE_BOARD_UNKN = 0,
  61. OMAP3BEAGLE_BOARD_AXBX,
  62. OMAP3BEAGLE_BOARD_C1_3,
  63. OMAP3BEAGLE_BOARD_C4,
  64. OMAP3BEAGLE_BOARD_XM,
  65. };
  66. static u8 omap3_beagle_version;
  67. static u8 omap3_beagle_get_rev(void)
  68. {
  69. return omap3_beagle_version;
  70. }
  71. static void __init omap3_beagle_init_rev(void)
  72. {
  73. int ret;
  74. u16 beagle_rev = 0;
  75. omap_mux_init_gpio(171, OMAP_PIN_INPUT_PULLUP);
  76. omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP);
  77. omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP);
  78. ret = gpio_request(171, "rev_id_0");
  79. if (ret < 0)
  80. goto fail0;
  81. ret = gpio_request(172, "rev_id_1");
  82. if (ret < 0)
  83. goto fail1;
  84. ret = gpio_request(173, "rev_id_2");
  85. if (ret < 0)
  86. goto fail2;
  87. gpio_direction_input(171);
  88. gpio_direction_input(172);
  89. gpio_direction_input(173);
  90. beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1)
  91. | (gpio_get_value(173) << 2);
  92. switch (beagle_rev) {
  93. case 7:
  94. printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
  95. omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
  96. break;
  97. case 6:
  98. printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
  99. omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
  100. break;
  101. case 5:
  102. printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
  103. omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
  104. break;
  105. case 0:
  106. printk(KERN_INFO "OMAP3 Beagle Rev: xM\n");
  107. omap3_beagle_version = OMAP3BEAGLE_BOARD_XM;
  108. break;
  109. default:
  110. printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev);
  111. omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
  112. }
  113. return;
  114. fail2:
  115. gpio_free(172);
  116. fail1:
  117. gpio_free(171);
  118. fail0:
  119. printk(KERN_ERR "Unable to get revision detection GPIO pins\n");
  120. omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
  121. return;
  122. }
  123. static struct mtd_partition omap3beagle_nand_partitions[] = {
  124. /* All the partition sizes are listed in terms of NAND block size */
  125. {
  126. .name = "X-Loader",
  127. .offset = 0,
  128. .size = 4 * NAND_BLOCK_SIZE,
  129. .mask_flags = MTD_WRITEABLE, /* force read-only */
  130. },
  131. {
  132. .name = "U-Boot",
  133. .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
  134. .size = 15 * NAND_BLOCK_SIZE,
  135. .mask_flags = MTD_WRITEABLE, /* force read-only */
  136. },
  137. {
  138. .name = "U-Boot Env",
  139. .offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */
  140. .size = 1 * NAND_BLOCK_SIZE,
  141. },
  142. {
  143. .name = "Kernel",
  144. .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
  145. .size = 32 * NAND_BLOCK_SIZE,
  146. },
  147. {
  148. .name = "File System",
  149. .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */
  150. .size = MTDPART_SIZ_FULL,
  151. },
  152. };
  153. static struct omap_nand_platform_data omap3beagle_nand_data = {
  154. .options = NAND_BUSWIDTH_16,
  155. .parts = omap3beagle_nand_partitions,
  156. .nr_parts = ARRAY_SIZE(omap3beagle_nand_partitions),
  157. .dma_channel = -1, /* disable DMA in OMAP NAND driver */
  158. .nand_setup = NULL,
  159. .dev_ready = NULL,
  160. };
  161. /* DSS */
  162. static int beagle_enable_dvi(struct omap_dss_device *dssdev)
  163. {
  164. if (gpio_is_valid(dssdev->reset_gpio))
  165. gpio_set_value(dssdev->reset_gpio, 1);
  166. return 0;
  167. }
  168. static void beagle_disable_dvi(struct omap_dss_device *dssdev)
  169. {
  170. if (gpio_is_valid(dssdev->reset_gpio))
  171. gpio_set_value(dssdev->reset_gpio, 0);
  172. }
  173. static struct panel_generic_dpi_data dvi_panel = {
  174. .name = "generic",
  175. .platform_enable = beagle_enable_dvi,
  176. .platform_disable = beagle_disable_dvi,
  177. };
  178. static struct omap_dss_device beagle_dvi_device = {
  179. .type = OMAP_DISPLAY_TYPE_DPI,
  180. .name = "dvi",
  181. .driver_name = "generic_dpi_panel",
  182. .data = &dvi_panel,
  183. .phy.dpi.data_lines = 24,
  184. .reset_gpio = -EINVAL,
  185. };
  186. static struct omap_dss_device beagle_tv_device = {
  187. .name = "tv",
  188. .driver_name = "venc",
  189. .type = OMAP_DISPLAY_TYPE_VENC,
  190. .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
  191. };
  192. static struct omap_dss_device *beagle_dss_devices[] = {
  193. &beagle_dvi_device,
  194. &beagle_tv_device,
  195. };
  196. static struct omap_dss_board_info beagle_dss_data = {
  197. .num_devices = ARRAY_SIZE(beagle_dss_devices),
  198. .devices = beagle_dss_devices,
  199. .default_device = &beagle_dvi_device,
  200. };
  201. static struct regulator_consumer_supply beagle_vdac_supply =
  202. REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
  203. static struct regulator_consumer_supply beagle_vdvi_supplies[] = {
  204. REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
  205. REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
  206. };
  207. static void __init beagle_display_init(void)
  208. {
  209. int r;
  210. r = gpio_request(beagle_dvi_device.reset_gpio, "DVI reset");
  211. if (r < 0) {
  212. printk(KERN_ERR "Unable to get DVI reset GPIO\n");
  213. return;
  214. }
  215. gpio_direction_output(beagle_dvi_device.reset_gpio, 0);
  216. }
  217. #include "sdram-micron-mt46h32m32lf-6.h"
  218. static struct omap2_hsmmc_info mmc[] = {
  219. {
  220. .mmc = 1,
  221. .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
  222. .gpio_wp = 29,
  223. },
  224. {} /* Terminator */
  225. };
  226. static struct regulator_consumer_supply beagle_vmmc1_supply = {
  227. .supply = "vmmc",
  228. };
  229. static struct regulator_consumer_supply beagle_vsim_supply = {
  230. .supply = "vmmc_aux",
  231. };
  232. static struct gpio_led gpio_leds[];
  233. static int beagle_twl_gpio_setup(struct device *dev,
  234. unsigned gpio, unsigned ngpio)
  235. {
  236. int r;
  237. if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) {
  238. mmc[0].gpio_wp = -EINVAL;
  239. } else if ((omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C1_3) ||
  240. (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C4)) {
  241. omap_mux_init_gpio(23, OMAP_PIN_INPUT);
  242. mmc[0].gpio_wp = 23;
  243. } else {
  244. omap_mux_init_gpio(29, OMAP_PIN_INPUT);
  245. }
  246. /* gpio + 0 is "mmc0_cd" (input/IRQ) */
  247. mmc[0].gpio_cd = gpio + 0;
  248. omap2_hsmmc_init(mmc);
  249. /* link regulators to MMC adapters */
  250. beagle_vmmc1_supply.dev = mmc[0].dev;
  251. beagle_vsim_supply.dev = mmc[0].dev;
  252. /* REVISIT: need ehci-omap hooks for external VBUS
  253. * power switch and overcurrent detect
  254. */
  255. if (omap3_beagle_get_rev() != OMAP3BEAGLE_BOARD_XM) {
  256. r = gpio_request(gpio + 1, "EHCI_nOC");
  257. if (!r) {
  258. r = gpio_direction_input(gpio + 1);
  259. if (r)
  260. gpio_free(gpio + 1);
  261. }
  262. if (r)
  263. pr_err("%s: unable to configure EHCI_nOC\n", __func__);
  264. }
  265. /*
  266. * TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, XM active
  267. * high / others active low)
  268. */
  269. gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR");
  270. if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM)
  271. gpio_direction_output(gpio + TWL4030_GPIO_MAX, 1);
  272. else
  273. gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
  274. /* DVI reset GPIO is different between beagle revisions */
  275. if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM)
  276. beagle_dvi_device.reset_gpio = 129;
  277. else
  278. beagle_dvi_device.reset_gpio = 170;
  279. /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
  280. gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
  281. /*
  282. * gpio + 1 on Xm controls the TFP410's enable line (active low)
  283. * gpio + 2 control varies depending on the board rev as follows:
  284. * P7/P8 revisions(prototype): Camera EN
  285. * A2+ revisions (production): LDO (supplies DVI, serial, led blocks)
  286. */
  287. if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) {
  288. r = gpio_request(gpio + 1, "nDVI_PWR_EN");
  289. if (!r) {
  290. r = gpio_direction_output(gpio + 1, 0);
  291. if (r)
  292. gpio_free(gpio + 1);
  293. }
  294. if (r)
  295. pr_err("%s: unable to configure nDVI_PWR_EN\n",
  296. __func__);
  297. r = gpio_request(gpio + 2, "DVI_LDO_EN");
  298. if (!r) {
  299. r = gpio_direction_output(gpio + 2, 1);
  300. if (r)
  301. gpio_free(gpio + 2);
  302. }
  303. if (r)
  304. pr_err("%s: unable to configure DVI_LDO_EN\n",
  305. __func__);
  306. }
  307. return 0;
  308. }
  309. static struct twl4030_gpio_platform_data beagle_gpio_data = {
  310. .gpio_base = OMAP_MAX_GPIO_LINES,
  311. .irq_base = TWL4030_GPIO_IRQ_BASE,
  312. .irq_end = TWL4030_GPIO_IRQ_END,
  313. .use_leds = true,
  314. .pullups = BIT(1),
  315. .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13)
  316. | BIT(15) | BIT(16) | BIT(17),
  317. .setup = beagle_twl_gpio_setup,
  318. };
  319. /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
  320. static struct regulator_init_data beagle_vmmc1 = {
  321. .constraints = {
  322. .min_uV = 1850000,
  323. .max_uV = 3150000,
  324. .valid_modes_mask = REGULATOR_MODE_NORMAL
  325. | REGULATOR_MODE_STANDBY,
  326. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  327. | REGULATOR_CHANGE_MODE
  328. | REGULATOR_CHANGE_STATUS,
  329. },
  330. .num_consumer_supplies = 1,
  331. .consumer_supplies = &beagle_vmmc1_supply,
  332. };
  333. /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
  334. static struct regulator_init_data beagle_vsim = {
  335. .constraints = {
  336. .min_uV = 1800000,
  337. .max_uV = 3000000,
  338. .valid_modes_mask = REGULATOR_MODE_NORMAL
  339. | REGULATOR_MODE_STANDBY,
  340. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  341. | REGULATOR_CHANGE_MODE
  342. | REGULATOR_CHANGE_STATUS,
  343. },
  344. .num_consumer_supplies = 1,
  345. .consumer_supplies = &beagle_vsim_supply,
  346. };
  347. /* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
  348. static struct regulator_init_data beagle_vdac = {
  349. .constraints = {
  350. .min_uV = 1800000,
  351. .max_uV = 1800000,
  352. .valid_modes_mask = REGULATOR_MODE_NORMAL
  353. | REGULATOR_MODE_STANDBY,
  354. .valid_ops_mask = REGULATOR_CHANGE_MODE
  355. | REGULATOR_CHANGE_STATUS,
  356. },
  357. .num_consumer_supplies = 1,
  358. .consumer_supplies = &beagle_vdac_supply,
  359. };
  360. /* VPLL2 for digital video outputs */
  361. static struct regulator_init_data beagle_vpll2 = {
  362. .constraints = {
  363. .name = "VDVI",
  364. .min_uV = 1800000,
  365. .max_uV = 1800000,
  366. .valid_modes_mask = REGULATOR_MODE_NORMAL
  367. | REGULATOR_MODE_STANDBY,
  368. .valid_ops_mask = REGULATOR_CHANGE_MODE
  369. | REGULATOR_CHANGE_STATUS,
  370. },
  371. .num_consumer_supplies = ARRAY_SIZE(beagle_vdvi_supplies),
  372. .consumer_supplies = beagle_vdvi_supplies,
  373. };
  374. static struct twl4030_usb_data beagle_usb_data = {
  375. .usb_mode = T2_USB_MODE_ULPI,
  376. };
  377. static struct twl4030_codec_audio_data beagle_audio_data;
  378. static struct twl4030_codec_data beagle_codec_data = {
  379. .audio_mclk = 26000000,
  380. .audio = &beagle_audio_data,
  381. };
  382. static struct twl4030_platform_data beagle_twldata = {
  383. .irq_base = TWL4030_IRQ_BASE,
  384. .irq_end = TWL4030_IRQ_END,
  385. /* platform_data for children goes here */
  386. .usb = &beagle_usb_data,
  387. .gpio = &beagle_gpio_data,
  388. .codec = &beagle_codec_data,
  389. .vmmc1 = &beagle_vmmc1,
  390. .vsim = &beagle_vsim,
  391. .vdac = &beagle_vdac,
  392. .vpll2 = &beagle_vpll2,
  393. };
  394. static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
  395. {
  396. I2C_BOARD_INFO("twl4030", 0x48),
  397. .flags = I2C_CLIENT_WAKE,
  398. .irq = INT_34XX_SYS_NIRQ,
  399. .platform_data = &beagle_twldata,
  400. },
  401. };
  402. static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
  403. {
  404. I2C_BOARD_INFO("eeprom", 0x50),
  405. },
  406. };
  407. static int __init omap3_beagle_i2c_init(void)
  408. {
  409. omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo,
  410. ARRAY_SIZE(beagle_i2c_boardinfo));
  411. /* Bus 3 is attached to the DVI port where devices like the pico DLP
  412. * projector don't work reliably with 400kHz */
  413. omap_register_i2c_bus(3, 100, beagle_i2c_eeprom, ARRAY_SIZE(beagle_i2c_eeprom));
  414. return 0;
  415. }
  416. static struct gpio_led gpio_leds[] = {
  417. {
  418. .name = "beagleboard::usr0",
  419. .default_trigger = "heartbeat",
  420. .gpio = 150,
  421. },
  422. {
  423. .name = "beagleboard::usr1",
  424. .default_trigger = "mmc0",
  425. .gpio = 149,
  426. },
  427. {
  428. .name = "beagleboard::pmu_stat",
  429. .gpio = -EINVAL, /* gets replaced */
  430. .active_low = true,
  431. },
  432. };
  433. static struct gpio_led_platform_data gpio_led_info = {
  434. .leds = gpio_leds,
  435. .num_leds = ARRAY_SIZE(gpio_leds),
  436. };
  437. static struct platform_device leds_gpio = {
  438. .name = "leds-gpio",
  439. .id = -1,
  440. .dev = {
  441. .platform_data = &gpio_led_info,
  442. },
  443. };
  444. static struct gpio_keys_button gpio_buttons[] = {
  445. {
  446. .code = BTN_EXTRA,
  447. .gpio = 7,
  448. .desc = "user",
  449. .wakeup = 1,
  450. },
  451. };
  452. static struct gpio_keys_platform_data gpio_key_info = {
  453. .buttons = gpio_buttons,
  454. .nbuttons = ARRAY_SIZE(gpio_buttons),
  455. };
  456. static struct platform_device keys_gpio = {
  457. .name = "gpio-keys",
  458. .id = -1,
  459. .dev = {
  460. .platform_data = &gpio_key_info,
  461. },
  462. };
  463. static void __init omap3_beagle_init_early(void)
  464. {
  465. omap2_init_common_infrastructure();
  466. omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
  467. mt46h32m32lf6_sdrc_params);
  468. }
  469. static void __init omap3_beagle_init_irq(void)
  470. {
  471. omap_init_irq();
  472. #ifdef CONFIG_OMAP_32K_TIMER
  473. omap2_gp_clockevent_set_gptimer(12);
  474. #endif
  475. }
  476. static struct platform_device *omap3_beagle_devices[] __initdata = {
  477. &leds_gpio,
  478. &keys_gpio,
  479. };
  480. static void __init omap3beagle_flash_init(void)
  481. {
  482. u8 cs = 0;
  483. u8 nandcs = GPMC_CS_NUM + 1;
  484. /* find out the chip-select on which NAND exists */
  485. while (cs < GPMC_CS_NUM) {
  486. u32 ret = 0;
  487. ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
  488. if ((ret & 0xC00) == 0x800) {
  489. printk(KERN_INFO "Found NAND on CS%d\n", cs);
  490. if (nandcs > GPMC_CS_NUM)
  491. nandcs = cs;
  492. }
  493. cs++;
  494. }
  495. if (nandcs > GPMC_CS_NUM) {
  496. printk(KERN_INFO "NAND: Unable to find configuration "
  497. "in GPMC\n ");
  498. return;
  499. }
  500. if (nandcs < GPMC_CS_NUM) {
  501. omap3beagle_nand_data.cs = nandcs;
  502. printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
  503. if (gpmc_nand_init(&omap3beagle_nand_data) < 0)
  504. printk(KERN_ERR "Unable to register NAND device\n");
  505. }
  506. }
  507. static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
  508. .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
  509. .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
  510. .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
  511. .phy_reset = true,
  512. .reset_gpio_port[0] = -EINVAL,
  513. .reset_gpio_port[1] = 147,
  514. .reset_gpio_port[2] = -EINVAL
  515. };
  516. #ifdef CONFIG_OMAP_MUX
  517. static struct omap_board_mux board_mux[] __initdata = {
  518. { .reg_offset = OMAP_MUX_TERMINATOR },
  519. };
  520. #endif
  521. static struct omap_musb_board_data musb_board_data = {
  522. .interface_type = MUSB_INTERFACE_ULPI,
  523. .mode = MUSB_OTG,
  524. .power = 100,
  525. };
  526. static void __init beagle_opp_init(void)
  527. {
  528. int r = 0;
  529. /* Initialize the omap3 opp table */
  530. if (omap3_opp_init()) {
  531. pr_err("%s: opp default init failed\n", __func__);
  532. return;
  533. }
  534. /* Custom OPP enabled for XM */
  535. if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) {
  536. struct omap_hwmod *mh = omap_hwmod_lookup("mpu");
  537. struct omap_hwmod *dh = omap_hwmod_lookup("iva");
  538. struct device *dev;
  539. if (!mh || !dh) {
  540. pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n",
  541. __func__, mh, dh);
  542. return;
  543. }
  544. /* Enable MPU 1GHz and lower opps */
  545. dev = &mh->od->pdev.dev;
  546. r = opp_enable(dev, 800000000);
  547. /* TODO: MPU 1GHz needs SR and ABB */
  548. /* Enable IVA 800MHz and lower opps */
  549. dev = &dh->od->pdev.dev;
  550. r |= opp_enable(dev, 660000000);
  551. /* TODO: DSP 800MHz needs SR and ABB */
  552. if (r) {
  553. pr_err("%s: failed to enable higher opp %d\n",
  554. __func__, r);
  555. /*
  556. * Cleanup - disable the higher freqs - we dont care
  557. * about the results
  558. */
  559. dev = &mh->od->pdev.dev;
  560. opp_disable(dev, 800000000);
  561. dev = &dh->od->pdev.dev;
  562. opp_disable(dev, 660000000);
  563. }
  564. }
  565. return;
  566. }
  567. static void __init omap3_beagle_init(void)
  568. {
  569. omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  570. omap3_beagle_init_rev();
  571. omap3_beagle_i2c_init();
  572. platform_add_devices(omap3_beagle_devices,
  573. ARRAY_SIZE(omap3_beagle_devices));
  574. omap_display_init(&beagle_dss_data);
  575. omap_serial_init();
  576. omap_mux_init_gpio(170, OMAP_PIN_INPUT);
  577. gpio_request(170, "DVI_nPD");
  578. /* REVISIT leave DVI powered down until it's needed ... */
  579. gpio_direction_output(170, true);
  580. usb_musb_init(&musb_board_data);
  581. usbhs_init(&usbhs_bdata);
  582. omap3beagle_flash_init();
  583. /* Ensure SDRC pins are mux'd for self-refresh */
  584. omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
  585. omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
  586. beagle_display_init();
  587. beagle_opp_init();
  588. }
  589. MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
  590. /* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */
  591. .boot_params = 0x80000100,
  592. .reserve = omap_reserve,
  593. .map_io = omap3_map_io,
  594. .init_early = omap3_beagle_init_early,
  595. .init_irq = omap3_beagle_init_irq,
  596. .init_machine = omap3_beagle_init,
  597. .timer = &omap_timer,
  598. MACHINE_END