board-omap4panda.c 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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/gpio.h>
  23. #include <linux/usb/otg.h>
  24. #include <linux/i2c/twl.h>
  25. #include <linux/regulator/machine.h>
  26. #include <mach/hardware.h>
  27. #include <mach/omap4-common.h>
  28. #include <asm/mach-types.h>
  29. #include <asm/mach/arch.h>
  30. #include <asm/mach/map.h>
  31. #include <plat/board.h>
  32. #include <plat/common.h>
  33. #include <plat/control.h>
  34. #include <plat/timer-gp.h>
  35. #include <plat/usb.h>
  36. #include <plat/mmc.h>
  37. #include "hsmmc.h"
  38. static void __init omap4_panda_init_irq(void)
  39. {
  40. omap2_init_common_hw(NULL, NULL);
  41. gic_init_irq();
  42. omap_gpio_init();
  43. }
  44. static struct omap_musb_board_data musb_board_data = {
  45. .interface_type = MUSB_INTERFACE_UTMI,
  46. .mode = MUSB_PERIPHERAL,
  47. .power = 100,
  48. };
  49. static struct omap2_hsmmc_info mmc[] = {
  50. {
  51. .mmc = 1,
  52. .wires = 8,
  53. .gpio_wp = -EINVAL,
  54. },
  55. {} /* Terminator */
  56. };
  57. static struct regulator_consumer_supply omap4_panda_vmmc_supply[] = {
  58. {
  59. .supply = "vmmc",
  60. .dev_name = "mmci-omap-hs.0",
  61. },
  62. {
  63. .supply = "vmmc",
  64. .dev_name = "mmci-omap-hs.1",
  65. },
  66. };
  67. static int omap4_twl6030_hsmmc_late_init(struct device *dev)
  68. {
  69. int ret = 0;
  70. struct platform_device *pdev = container_of(dev,
  71. struct platform_device, dev);
  72. struct omap_mmc_platform_data *pdata = dev->platform_data;
  73. /* Setting MMC1 Card detect Irq */
  74. if (pdev->id == 0)
  75. pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
  76. MMCDETECT_INTR_OFFSET;
  77. return ret;
  78. }
  79. static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
  80. {
  81. struct omap_mmc_platform_data *pdata = dev->platform_data;
  82. pdata->init = omap4_twl6030_hsmmc_late_init;
  83. }
  84. static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
  85. {
  86. struct omap2_hsmmc_info *c;
  87. omap2_hsmmc_init(controllers);
  88. for (c = controllers; c->mmc; c++)
  89. omap4_twl6030_hsmmc_set_late_init(c->dev);
  90. return 0;
  91. }
  92. static struct regulator_init_data omap4_panda_vaux1 = {
  93. .constraints = {
  94. .min_uV = 1000000,
  95. .max_uV = 3000000,
  96. .apply_uV = true,
  97. .valid_modes_mask = REGULATOR_MODE_NORMAL
  98. | REGULATOR_MODE_STANDBY,
  99. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  100. | REGULATOR_CHANGE_MODE
  101. | REGULATOR_CHANGE_STATUS,
  102. },
  103. };
  104. static struct regulator_init_data omap4_panda_vaux2 = {
  105. .constraints = {
  106. .min_uV = 1200000,
  107. .max_uV = 2800000,
  108. .apply_uV = true,
  109. .valid_modes_mask = REGULATOR_MODE_NORMAL
  110. | REGULATOR_MODE_STANDBY,
  111. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  112. | REGULATOR_CHANGE_MODE
  113. | REGULATOR_CHANGE_STATUS,
  114. },
  115. };
  116. static struct regulator_init_data omap4_panda_vaux3 = {
  117. .constraints = {
  118. .min_uV = 1000000,
  119. .max_uV = 3000000,
  120. .apply_uV = true,
  121. .valid_modes_mask = REGULATOR_MODE_NORMAL
  122. | REGULATOR_MODE_STANDBY,
  123. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  124. | REGULATOR_CHANGE_MODE
  125. | REGULATOR_CHANGE_STATUS,
  126. },
  127. };
  128. /* VMMC1 for MMC1 card */
  129. static struct regulator_init_data omap4_panda_vmmc = {
  130. .constraints = {
  131. .min_uV = 1200000,
  132. .max_uV = 3000000,
  133. .apply_uV = true,
  134. .valid_modes_mask = REGULATOR_MODE_NORMAL
  135. | REGULATOR_MODE_STANDBY,
  136. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  137. | REGULATOR_CHANGE_MODE
  138. | REGULATOR_CHANGE_STATUS,
  139. },
  140. .num_consumer_supplies = 2,
  141. .consumer_supplies = omap4_panda_vmmc_supply,
  142. };
  143. static struct regulator_init_data omap4_panda_vpp = {
  144. .constraints = {
  145. .min_uV = 1800000,
  146. .max_uV = 2500000,
  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. static struct regulator_init_data omap4_panda_vusim = {
  156. .constraints = {
  157. .min_uV = 1200000,
  158. .max_uV = 2900000,
  159. .apply_uV = true,
  160. .valid_modes_mask = REGULATOR_MODE_NORMAL
  161. | REGULATOR_MODE_STANDBY,
  162. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  163. | REGULATOR_CHANGE_MODE
  164. | REGULATOR_CHANGE_STATUS,
  165. },
  166. };
  167. static struct regulator_init_data omap4_panda_vana = {
  168. .constraints = {
  169. .min_uV = 2100000,
  170. .max_uV = 2100000,
  171. .apply_uV = true,
  172. .valid_modes_mask = REGULATOR_MODE_NORMAL
  173. | REGULATOR_MODE_STANDBY,
  174. .valid_ops_mask = REGULATOR_CHANGE_MODE
  175. | REGULATOR_CHANGE_STATUS,
  176. },
  177. };
  178. static struct regulator_init_data omap4_panda_vcxio = {
  179. .constraints = {
  180. .min_uV = 1800000,
  181. .max_uV = 1800000,
  182. .apply_uV = true,
  183. .valid_modes_mask = REGULATOR_MODE_NORMAL
  184. | REGULATOR_MODE_STANDBY,
  185. .valid_ops_mask = REGULATOR_CHANGE_MODE
  186. | REGULATOR_CHANGE_STATUS,
  187. },
  188. };
  189. static struct regulator_init_data omap4_panda_vdac = {
  190. .constraints = {
  191. .min_uV = 1800000,
  192. .max_uV = 1800000,
  193. .apply_uV = true,
  194. .valid_modes_mask = REGULATOR_MODE_NORMAL
  195. | REGULATOR_MODE_STANDBY,
  196. .valid_ops_mask = REGULATOR_CHANGE_MODE
  197. | REGULATOR_CHANGE_STATUS,
  198. },
  199. };
  200. static struct regulator_init_data omap4_panda_vusb = {
  201. .constraints = {
  202. .min_uV = 3300000,
  203. .max_uV = 3300000,
  204. .apply_uV = true,
  205. .valid_modes_mask = REGULATOR_MODE_NORMAL
  206. | REGULATOR_MODE_STANDBY,
  207. .valid_ops_mask = REGULATOR_CHANGE_MODE
  208. | REGULATOR_CHANGE_STATUS,
  209. },
  210. };
  211. static struct twl4030_platform_data omap4_panda_twldata = {
  212. .irq_base = TWL6030_IRQ_BASE,
  213. .irq_end = TWL6030_IRQ_END,
  214. /* Regulators */
  215. .vmmc = &omap4_panda_vmmc,
  216. .vpp = &omap4_panda_vpp,
  217. .vusim = &omap4_panda_vusim,
  218. .vana = &omap4_panda_vana,
  219. .vcxio = &omap4_panda_vcxio,
  220. .vdac = &omap4_panda_vdac,
  221. .vusb = &omap4_panda_vusb,
  222. .vaux1 = &omap4_panda_vaux1,
  223. .vaux2 = &omap4_panda_vaux2,
  224. .vaux3 = &omap4_panda_vaux3,
  225. };
  226. static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo[] = {
  227. {
  228. I2C_BOARD_INFO("twl6030", 0x48),
  229. .flags = I2C_CLIENT_WAKE,
  230. .irq = OMAP44XX_IRQ_SYS_1N,
  231. .platform_data = &omap4_panda_twldata,
  232. },
  233. };
  234. static int __init omap4_panda_i2c_init(void)
  235. {
  236. /*
  237. * Phoenix Audio IC needs I2C1 to
  238. * start with 400 KHz or less
  239. */
  240. omap_register_i2c_bus(1, 400, omap4_panda_i2c_boardinfo,
  241. ARRAY_SIZE(omap4_panda_i2c_boardinfo));
  242. omap_register_i2c_bus(2, 400, NULL, 0);
  243. omap_register_i2c_bus(3, 400, NULL, 0);
  244. omap_register_i2c_bus(4, 400, NULL, 0);
  245. return 0;
  246. }
  247. static void __init omap4_panda_init(void)
  248. {
  249. int status;
  250. omap4_panda_i2c_init();
  251. omap_serial_init();
  252. omap4_twl6030_hsmmc_init(mmc);
  253. /* OMAP4 Panda uses internal transceiver so register nop transceiver */
  254. usb_nop_xceiv_register();
  255. /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
  256. if (!cpu_is_omap44xx())
  257. usb_musb_init(&musb_board_data);
  258. }
  259. static void __init omap4_panda_map_io(void)
  260. {
  261. omap2_set_globals_443x();
  262. omap44xx_map_common_io();
  263. }
  264. MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
  265. /* Maintainer: David Anders - Texas Instruments Inc */
  266. .phys_io = 0x48000000,
  267. .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
  268. .boot_params = 0x80000100,
  269. .map_io = omap4_panda_map_io,
  270. .init_irq = omap4_panda_init_irq,
  271. .init_machine = omap4_panda_init,
  272. .timer = &omap_timer,
  273. MACHINE_END