board-omap3beagle.c 16 KB

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