board-omap4panda.c 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. /*
  2. * Board support file for OMAP4430 based PandaBoard.
  3. *
  4. * Copyright (C) 2010 Texas Instruments
  5. *
  6. * Author: David Anders <x0132446@ti.com>
  7. *
  8. * Based on mach-omap2/board-4430sdp.c
  9. *
  10. * Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
  11. *
  12. * Based on mach-omap2/board-3430sdp.c
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License version 2 as
  16. * published by the Free Software Foundation.
  17. */
  18. #include <linux/kernel.h>
  19. #include <linux/init.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/io.h>
  22. #include <linux/leds.h>
  23. #include <linux/gpio.h>
  24. #include <linux/usb/otg.h>
  25. #include <linux/i2c/twl.h>
  26. #include <linux/regulator/machine.h>
  27. #include <mach/hardware.h>
  28. #include <mach/omap4-common.h>
  29. #include <asm/mach-types.h>
  30. #include <asm/mach/arch.h>
  31. #include <asm/mach/map.h>
  32. #include <plat/board.h>
  33. #include <plat/common.h>
  34. #include <plat/control.h>
  35. #include <plat/timer-gp.h>
  36. #include <plat/usb.h>
  37. #include <plat/mmc.h>
  38. #include "hsmmc.h"
  39. static struct gpio_led gpio_leds[] = {
  40. {
  41. .name = "pandaboard::status1",
  42. .default_trigger = "heartbeat",
  43. .gpio = 7,
  44. },
  45. {
  46. .name = "pandaboard::status2",
  47. .default_trigger = "mmc0",
  48. .gpio = 8,
  49. },
  50. };
  51. static struct gpio_led_platform_data gpio_led_info = {
  52. .leds = gpio_leds,
  53. .num_leds = ARRAY_SIZE(gpio_leds),
  54. };
  55. static struct platform_device leds_gpio = {
  56. .name = "leds-gpio",
  57. .id = -1,
  58. .dev = {
  59. .platform_data = &gpio_led_info,
  60. },
  61. };
  62. static struct platform_device *panda_devices[] __initdata = {
  63. &leds_gpio,
  64. };
  65. static void __init omap4_panda_init_irq(void)
  66. {
  67. omap2_init_common_hw(NULL, NULL);
  68. gic_init_irq();
  69. omap_gpio_init();
  70. }
  71. static struct omap_musb_board_data musb_board_data = {
  72. .interface_type = MUSB_INTERFACE_UTMI,
  73. .mode = MUSB_PERIPHERAL,
  74. .power = 100,
  75. };
  76. static struct omap2_hsmmc_info mmc[] = {
  77. {
  78. .mmc = 1,
  79. .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
  80. .gpio_wp = -EINVAL,
  81. },
  82. {} /* Terminator */
  83. };
  84. static struct regulator_consumer_supply omap4_panda_vmmc_supply[] = {
  85. {
  86. .supply = "vmmc",
  87. .dev_name = "mmci-omap-hs.0",
  88. },
  89. {
  90. .supply = "vmmc",
  91. .dev_name = "mmci-omap-hs.1",
  92. },
  93. };
  94. static int omap4_twl6030_hsmmc_late_init(struct device *dev)
  95. {
  96. int ret = 0;
  97. struct platform_device *pdev = container_of(dev,
  98. struct platform_device, dev);
  99. struct omap_mmc_platform_data *pdata = dev->platform_data;
  100. /* Setting MMC1 Card detect Irq */
  101. if (pdev->id == 0)
  102. pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
  103. MMCDETECT_INTR_OFFSET;
  104. return ret;
  105. }
  106. static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
  107. {
  108. struct omap_mmc_platform_data *pdata = dev->platform_data;
  109. pdata->init = omap4_twl6030_hsmmc_late_init;
  110. }
  111. static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
  112. {
  113. struct omap2_hsmmc_info *c;
  114. omap2_hsmmc_init(controllers);
  115. for (c = controllers; c->mmc; c++)
  116. omap4_twl6030_hsmmc_set_late_init(c->dev);
  117. return 0;
  118. }
  119. static struct regulator_init_data omap4_panda_vaux1 = {
  120. .constraints = {
  121. .min_uV = 1000000,
  122. .max_uV = 3000000,
  123. .apply_uV = true,
  124. .valid_modes_mask = REGULATOR_MODE_NORMAL
  125. | REGULATOR_MODE_STANDBY,
  126. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  127. | REGULATOR_CHANGE_MODE
  128. | REGULATOR_CHANGE_STATUS,
  129. },
  130. };
  131. static struct regulator_init_data omap4_panda_vaux2 = {
  132. .constraints = {
  133. .min_uV = 1200000,
  134. .max_uV = 2800000,
  135. .apply_uV = true,
  136. .valid_modes_mask = REGULATOR_MODE_NORMAL
  137. | REGULATOR_MODE_STANDBY,
  138. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  139. | REGULATOR_CHANGE_MODE
  140. | REGULATOR_CHANGE_STATUS,
  141. },
  142. };
  143. static struct regulator_init_data omap4_panda_vaux3 = {
  144. .constraints = {
  145. .min_uV = 1000000,
  146. .max_uV = 3000000,
  147. .apply_uV = true,
  148. .valid_modes_mask = REGULATOR_MODE_NORMAL
  149. | REGULATOR_MODE_STANDBY,
  150. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  151. | REGULATOR_CHANGE_MODE
  152. | REGULATOR_CHANGE_STATUS,
  153. },
  154. };
  155. /* VMMC1 for MMC1 card */
  156. static struct regulator_init_data omap4_panda_vmmc = {
  157. .constraints = {
  158. .min_uV = 1200000,
  159. .max_uV = 3000000,
  160. .apply_uV = true,
  161. .valid_modes_mask = REGULATOR_MODE_NORMAL
  162. | REGULATOR_MODE_STANDBY,
  163. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  164. | REGULATOR_CHANGE_MODE
  165. | REGULATOR_CHANGE_STATUS,
  166. },
  167. .num_consumer_supplies = 2,
  168. .consumer_supplies = omap4_panda_vmmc_supply,
  169. };
  170. static struct regulator_init_data omap4_panda_vpp = {
  171. .constraints = {
  172. .min_uV = 1800000,
  173. .max_uV = 2500000,
  174. .apply_uV = true,
  175. .valid_modes_mask = REGULATOR_MODE_NORMAL
  176. | REGULATOR_MODE_STANDBY,
  177. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  178. | REGULATOR_CHANGE_MODE
  179. | REGULATOR_CHANGE_STATUS,
  180. },
  181. };
  182. static struct regulator_init_data omap4_panda_vusim = {
  183. .constraints = {
  184. .min_uV = 1200000,
  185. .max_uV = 2900000,
  186. .apply_uV = true,
  187. .valid_modes_mask = REGULATOR_MODE_NORMAL
  188. | REGULATOR_MODE_STANDBY,
  189. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  190. | REGULATOR_CHANGE_MODE
  191. | REGULATOR_CHANGE_STATUS,
  192. },
  193. };
  194. static struct regulator_init_data omap4_panda_vana = {
  195. .constraints = {
  196. .min_uV = 2100000,
  197. .max_uV = 2100000,
  198. .apply_uV = true,
  199. .valid_modes_mask = REGULATOR_MODE_NORMAL
  200. | REGULATOR_MODE_STANDBY,
  201. .valid_ops_mask = REGULATOR_CHANGE_MODE
  202. | REGULATOR_CHANGE_STATUS,
  203. },
  204. };
  205. static struct regulator_init_data omap4_panda_vcxio = {
  206. .constraints = {
  207. .min_uV = 1800000,
  208. .max_uV = 1800000,
  209. .apply_uV = true,
  210. .valid_modes_mask = REGULATOR_MODE_NORMAL
  211. | REGULATOR_MODE_STANDBY,
  212. .valid_ops_mask = REGULATOR_CHANGE_MODE
  213. | REGULATOR_CHANGE_STATUS,
  214. },
  215. };
  216. static struct regulator_init_data omap4_panda_vdac = {
  217. .constraints = {
  218. .min_uV = 1800000,
  219. .max_uV = 1800000,
  220. .apply_uV = true,
  221. .valid_modes_mask = REGULATOR_MODE_NORMAL
  222. | REGULATOR_MODE_STANDBY,
  223. .valid_ops_mask = REGULATOR_CHANGE_MODE
  224. | REGULATOR_CHANGE_STATUS,
  225. },
  226. };
  227. static struct regulator_init_data omap4_panda_vusb = {
  228. .constraints = {
  229. .min_uV = 3300000,
  230. .max_uV = 3300000,
  231. .apply_uV = true,
  232. .valid_modes_mask = REGULATOR_MODE_NORMAL
  233. | REGULATOR_MODE_STANDBY,
  234. .valid_ops_mask = REGULATOR_CHANGE_MODE
  235. | REGULATOR_CHANGE_STATUS,
  236. },
  237. };
  238. static struct twl4030_platform_data omap4_panda_twldata = {
  239. .irq_base = TWL6030_IRQ_BASE,
  240. .irq_end = TWL6030_IRQ_END,
  241. /* Regulators */
  242. .vmmc = &omap4_panda_vmmc,
  243. .vpp = &omap4_panda_vpp,
  244. .vusim = &omap4_panda_vusim,
  245. .vana = &omap4_panda_vana,
  246. .vcxio = &omap4_panda_vcxio,
  247. .vdac = &omap4_panda_vdac,
  248. .vusb = &omap4_panda_vusb,
  249. .vaux1 = &omap4_panda_vaux1,
  250. .vaux2 = &omap4_panda_vaux2,
  251. .vaux3 = &omap4_panda_vaux3,
  252. };
  253. static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo[] = {
  254. {
  255. I2C_BOARD_INFO("twl6030", 0x48),
  256. .flags = I2C_CLIENT_WAKE,
  257. .irq = OMAP44XX_IRQ_SYS_1N,
  258. .platform_data = &omap4_panda_twldata,
  259. },
  260. };
  261. static int __init omap4_panda_i2c_init(void)
  262. {
  263. /*
  264. * Phoenix Audio IC needs I2C1 to
  265. * start with 400 KHz or less
  266. */
  267. omap_register_i2c_bus(1, 400, omap4_panda_i2c_boardinfo,
  268. ARRAY_SIZE(omap4_panda_i2c_boardinfo));
  269. omap_register_i2c_bus(2, 400, NULL, 0);
  270. omap_register_i2c_bus(3, 400, NULL, 0);
  271. omap_register_i2c_bus(4, 400, NULL, 0);
  272. return 0;
  273. }
  274. static void __init omap4_panda_init(void)
  275. {
  276. omap4_panda_i2c_init();
  277. platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
  278. omap_serial_init();
  279. omap4_twl6030_hsmmc_init(mmc);
  280. /* OMAP4 Panda uses internal transceiver so register nop transceiver */
  281. usb_nop_xceiv_register();
  282. /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
  283. if (!cpu_is_omap44xx())
  284. usb_musb_init(&musb_board_data);
  285. }
  286. static void __init omap4_panda_map_io(void)
  287. {
  288. omap2_set_globals_443x();
  289. omap44xx_map_common_io();
  290. }
  291. MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
  292. /* Maintainer: David Anders - Texas Instruments Inc */
  293. .phys_io = 0x48000000,
  294. .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
  295. .boot_params = 0x80000100,
  296. .map_io = omap4_panda_map_io,
  297. .init_irq = omap4_panda_init_irq,
  298. .init_machine = omap4_panda_init,
  299. .timer = &omap_timer,
  300. MACHINE_END