board-omap4panda.c 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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/usb.h>
  36. #include <plat/mmc.h>
  37. #include "hsmmc.h"
  38. #include "timer-gp.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. static int omap4_twl6030_hsmmc_late_init(struct device *dev)
  91. {
  92. int ret = 0;
  93. struct platform_device *pdev = container_of(dev,
  94. struct platform_device, dev);
  95. struct omap_mmc_platform_data *pdata = dev->platform_data;
  96. /* Setting MMC1 Card detect Irq */
  97. if (pdev->id == 0)
  98. pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
  99. MMCDETECT_INTR_OFFSET;
  100. return ret;
  101. }
  102. static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
  103. {
  104. struct omap_mmc_platform_data *pdata;
  105. /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
  106. if (!dev) {
  107. pr_err("Failed omap4_twl6030_hsmmc_set_late_init\n");
  108. return;
  109. }
  110. pdata = dev->platform_data;
  111. pdata->init = omap4_twl6030_hsmmc_late_init;
  112. }
  113. static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
  114. {
  115. struct omap2_hsmmc_info *c;
  116. omap2_hsmmc_init(controllers);
  117. for (c = controllers; c->mmc; c++)
  118. omap4_twl6030_hsmmc_set_late_init(c->dev);
  119. return 0;
  120. }
  121. static struct regulator_init_data omap4_panda_vaux1 = {
  122. .constraints = {
  123. .min_uV = 1000000,
  124. .max_uV = 3000000,
  125. .apply_uV = true,
  126. .valid_modes_mask = REGULATOR_MODE_NORMAL
  127. | REGULATOR_MODE_STANDBY,
  128. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  129. | REGULATOR_CHANGE_MODE
  130. | REGULATOR_CHANGE_STATUS,
  131. },
  132. };
  133. static struct regulator_init_data omap4_panda_vaux2 = {
  134. .constraints = {
  135. .min_uV = 1200000,
  136. .max_uV = 2800000,
  137. .apply_uV = true,
  138. .valid_modes_mask = REGULATOR_MODE_NORMAL
  139. | REGULATOR_MODE_STANDBY,
  140. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  141. | REGULATOR_CHANGE_MODE
  142. | REGULATOR_CHANGE_STATUS,
  143. },
  144. };
  145. static struct regulator_init_data omap4_panda_vaux3 = {
  146. .constraints = {
  147. .min_uV = 1000000,
  148. .max_uV = 3000000,
  149. .apply_uV = true,
  150. .valid_modes_mask = REGULATOR_MODE_NORMAL
  151. | REGULATOR_MODE_STANDBY,
  152. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  153. | REGULATOR_CHANGE_MODE
  154. | REGULATOR_CHANGE_STATUS,
  155. },
  156. };
  157. /* VMMC1 for MMC1 card */
  158. static struct regulator_init_data omap4_panda_vmmc = {
  159. .constraints = {
  160. .min_uV = 1200000,
  161. .max_uV = 3000000,
  162. .apply_uV = true,
  163. .valid_modes_mask = REGULATOR_MODE_NORMAL
  164. | REGULATOR_MODE_STANDBY,
  165. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  166. | REGULATOR_CHANGE_MODE
  167. | REGULATOR_CHANGE_STATUS,
  168. },
  169. .num_consumer_supplies = 1,
  170. .consumer_supplies = omap4_panda_vmmc_supply,
  171. };
  172. static struct regulator_init_data omap4_panda_vpp = {
  173. .constraints = {
  174. .min_uV = 1800000,
  175. .max_uV = 2500000,
  176. .apply_uV = true,
  177. .valid_modes_mask = REGULATOR_MODE_NORMAL
  178. | REGULATOR_MODE_STANDBY,
  179. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  180. | REGULATOR_CHANGE_MODE
  181. | REGULATOR_CHANGE_STATUS,
  182. },
  183. };
  184. static struct regulator_init_data omap4_panda_vusim = {
  185. .constraints = {
  186. .min_uV = 1200000,
  187. .max_uV = 2900000,
  188. .apply_uV = true,
  189. .valid_modes_mask = REGULATOR_MODE_NORMAL
  190. | REGULATOR_MODE_STANDBY,
  191. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  192. | REGULATOR_CHANGE_MODE
  193. | REGULATOR_CHANGE_STATUS,
  194. },
  195. };
  196. static struct regulator_init_data omap4_panda_vana = {
  197. .constraints = {
  198. .min_uV = 2100000,
  199. .max_uV = 2100000,
  200. .apply_uV = true,
  201. .valid_modes_mask = REGULATOR_MODE_NORMAL
  202. | REGULATOR_MODE_STANDBY,
  203. .valid_ops_mask = REGULATOR_CHANGE_MODE
  204. | REGULATOR_CHANGE_STATUS,
  205. },
  206. };
  207. static struct regulator_init_data omap4_panda_vcxio = {
  208. .constraints = {
  209. .min_uV = 1800000,
  210. .max_uV = 1800000,
  211. .apply_uV = true,
  212. .valid_modes_mask = REGULATOR_MODE_NORMAL
  213. | REGULATOR_MODE_STANDBY,
  214. .valid_ops_mask = REGULATOR_CHANGE_MODE
  215. | REGULATOR_CHANGE_STATUS,
  216. },
  217. };
  218. static struct regulator_init_data omap4_panda_vdac = {
  219. .constraints = {
  220. .min_uV = 1800000,
  221. .max_uV = 1800000,
  222. .apply_uV = true,
  223. .valid_modes_mask = REGULATOR_MODE_NORMAL
  224. | REGULATOR_MODE_STANDBY,
  225. .valid_ops_mask = REGULATOR_CHANGE_MODE
  226. | REGULATOR_CHANGE_STATUS,
  227. },
  228. };
  229. static struct regulator_init_data omap4_panda_vusb = {
  230. .constraints = {
  231. .min_uV = 3300000,
  232. .max_uV = 3300000,
  233. .apply_uV = true,
  234. .valid_modes_mask = REGULATOR_MODE_NORMAL
  235. | REGULATOR_MODE_STANDBY,
  236. .valid_ops_mask = REGULATOR_CHANGE_MODE
  237. | REGULATOR_CHANGE_STATUS,
  238. },
  239. };
  240. static struct twl4030_platform_data omap4_panda_twldata = {
  241. .irq_base = TWL6030_IRQ_BASE,
  242. .irq_end = TWL6030_IRQ_END,
  243. /* Regulators */
  244. .vmmc = &omap4_panda_vmmc,
  245. .vpp = &omap4_panda_vpp,
  246. .vusim = &omap4_panda_vusim,
  247. .vana = &omap4_panda_vana,
  248. .vcxio = &omap4_panda_vcxio,
  249. .vdac = &omap4_panda_vdac,
  250. .vusb = &omap4_panda_vusb,
  251. .vaux1 = &omap4_panda_vaux1,
  252. .vaux2 = &omap4_panda_vaux2,
  253. .vaux3 = &omap4_panda_vaux3,
  254. };
  255. static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo[] = {
  256. {
  257. I2C_BOARD_INFO("twl6030", 0x48),
  258. .flags = I2C_CLIENT_WAKE,
  259. .irq = OMAP44XX_IRQ_SYS_1N,
  260. .platform_data = &omap4_panda_twldata,
  261. },
  262. };
  263. static int __init omap4_panda_i2c_init(void)
  264. {
  265. /*
  266. * Phoenix Audio IC needs I2C1 to
  267. * start with 400 KHz or less
  268. */
  269. omap_register_i2c_bus(1, 400, omap4_panda_i2c_boardinfo,
  270. ARRAY_SIZE(omap4_panda_i2c_boardinfo));
  271. omap_register_i2c_bus(2, 400, NULL, 0);
  272. omap_register_i2c_bus(3, 400, NULL, 0);
  273. omap_register_i2c_bus(4, 400, NULL, 0);
  274. return 0;
  275. }
  276. static void __init omap4_panda_init(void)
  277. {
  278. omap4_panda_i2c_init();
  279. platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
  280. omap_serial_init();
  281. omap4_twl6030_hsmmc_init(mmc);
  282. /* OMAP4 Panda uses internal transceiver so register nop transceiver */
  283. usb_nop_xceiv_register();
  284. /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
  285. if (!cpu_is_omap44xx())
  286. usb_musb_init(&musb_board_data);
  287. }
  288. static void __init omap4_panda_map_io(void)
  289. {
  290. omap2_set_globals_443x();
  291. omap44xx_map_common_io();
  292. }
  293. MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
  294. /* Maintainer: David Anders - Texas Instruments Inc */
  295. .phys_io = 0x48000000,
  296. .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
  297. .boot_params = 0x80000100,
  298. .map_io = omap4_panda_map_io,
  299. .init_irq = omap4_panda_init_irq,
  300. .init_machine = omap4_panda_init,
  301. .timer = &omap_timer,
  302. MACHINE_END