board-4430sdp.c 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. /*
  2. * Board support file for OMAP4430 SDP.
  3. *
  4. * Copyright (C) 2009 Texas Instruments
  5. *
  6. * Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
  7. *
  8. * Based on mach-omap2/board-3430sdp.c
  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/io.h>
  18. #include <linux/gpio.h>
  19. #include <linux/usb/otg.h>
  20. #include <linux/spi/spi.h>
  21. #include <linux/i2c/twl.h>
  22. #include <linux/regulator/machine.h>
  23. #include <mach/hardware.h>
  24. #include <mach/omap4-common.h>
  25. #include <asm/mach-types.h>
  26. #include <asm/mach/arch.h>
  27. #include <asm/mach/map.h>
  28. #include <plat/board.h>
  29. #include <plat/common.h>
  30. #include <plat/control.h>
  31. #include <plat/timer-gp.h>
  32. #include <plat/usb.h>
  33. #include <plat/mmc.h>
  34. #include "hsmmc.h"
  35. #define ETH_KS8851_IRQ 34
  36. #define ETH_KS8851_POWER_ON 48
  37. #define ETH_KS8851_QUART 138
  38. static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
  39. {
  40. .modalias = "ks8851",
  41. .bus_num = 1,
  42. .chip_select = 0,
  43. .max_speed_hz = 24000000,
  44. .irq = ETH_KS8851_IRQ,
  45. },
  46. };
  47. static int omap_ethernet_init(void)
  48. {
  49. int status;
  50. /* Request of GPIO lines */
  51. status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
  52. if (status) {
  53. pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
  54. return status;
  55. }
  56. status = gpio_request(ETH_KS8851_QUART, "quart");
  57. if (status) {
  58. pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
  59. goto error1;
  60. }
  61. status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
  62. if (status) {
  63. pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
  64. goto error2;
  65. }
  66. /* Configuration of requested GPIO lines */
  67. status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
  68. if (status) {
  69. pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
  70. goto error3;
  71. }
  72. status = gpio_direction_output(ETH_KS8851_QUART, 1);
  73. if (status) {
  74. pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
  75. goto error3;
  76. }
  77. status = gpio_direction_input(ETH_KS8851_IRQ);
  78. if (status) {
  79. pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
  80. goto error3;
  81. }
  82. return 0;
  83. error3:
  84. gpio_free(ETH_KS8851_IRQ);
  85. error2:
  86. gpio_free(ETH_KS8851_QUART);
  87. error1:
  88. gpio_free(ETH_KS8851_POWER_ON);
  89. return status;
  90. }
  91. static struct platform_device sdp4430_lcd_device = {
  92. .name = "sdp4430_lcd",
  93. .id = -1,
  94. };
  95. static struct platform_device *sdp4430_devices[] __initdata = {
  96. &sdp4430_lcd_device,
  97. };
  98. static struct omap_lcd_config sdp4430_lcd_config __initdata = {
  99. .ctrl_name = "internal",
  100. };
  101. static struct omap_board_config_kernel sdp4430_config[] __initdata = {
  102. { OMAP_TAG_LCD, &sdp4430_lcd_config },
  103. };
  104. static void __init omap_4430sdp_init_irq(void)
  105. {
  106. omap_board_config = sdp4430_config;
  107. omap_board_config_size = ARRAY_SIZE(sdp4430_config);
  108. omap2_init_common_hw(NULL, NULL);
  109. #ifdef CONFIG_OMAP_32K_TIMER
  110. omap2_gp_clockevent_set_gptimer(1);
  111. #endif
  112. gic_init_irq();
  113. omap_gpio_init();
  114. }
  115. static struct omap_musb_board_data musb_board_data = {
  116. .interface_type = MUSB_INTERFACE_UTMI,
  117. .mode = MUSB_PERIPHERAL,
  118. .power = 100,
  119. };
  120. static struct omap2_hsmmc_info mmc[] = {
  121. {
  122. .mmc = 1,
  123. .wires = 8,
  124. .gpio_wp = -EINVAL,
  125. },
  126. {
  127. .mmc = 2,
  128. .wires = 8,
  129. .gpio_cd = -EINVAL,
  130. .gpio_wp = -EINVAL,
  131. .nonremovable = true,
  132. },
  133. {} /* Terminator */
  134. };
  135. static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
  136. {
  137. .supply = "vmmc",
  138. .dev_name = "mmci-omap-hs.0",
  139. },
  140. {
  141. .supply = "vmmc",
  142. .dev_name = "mmci-omap-hs.1",
  143. },
  144. };
  145. static int omap4_twl6030_hsmmc_late_init(struct device *dev)
  146. {
  147. int ret = 0;
  148. struct platform_device *pdev = container_of(dev,
  149. struct platform_device, dev);
  150. struct omap_mmc_platform_data *pdata = dev->platform_data;
  151. /* Setting MMC1 Card detect Irq */
  152. if (pdev->id == 0)
  153. pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
  154. MMCDETECT_INTR_OFFSET;
  155. return ret;
  156. }
  157. static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
  158. {
  159. struct omap_mmc_platform_data *pdata = dev->platform_data;
  160. pdata->init = omap4_twl6030_hsmmc_late_init;
  161. }
  162. static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
  163. {
  164. struct omap2_hsmmc_info *c;
  165. omap2_hsmmc_init(controllers);
  166. for (c = controllers; c->mmc; c++)
  167. omap4_twl6030_hsmmc_set_late_init(c->dev);
  168. return 0;
  169. }
  170. static struct regulator_init_data sdp4430_vaux1 = {
  171. .constraints = {
  172. .min_uV = 1000000,
  173. .max_uV = 3000000,
  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 sdp4430_vaux2 = {
  183. .constraints = {
  184. .min_uV = 1200000,
  185. .max_uV = 2800000,
  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 sdp4430_vaux3 = {
  195. .constraints = {
  196. .min_uV = 1000000,
  197. .max_uV = 3000000,
  198. .apply_uV = true,
  199. .valid_modes_mask = REGULATOR_MODE_NORMAL
  200. | REGULATOR_MODE_STANDBY,
  201. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  202. | REGULATOR_CHANGE_MODE
  203. | REGULATOR_CHANGE_STATUS,
  204. },
  205. };
  206. /* VMMC1 for MMC1 card */
  207. static struct regulator_init_data sdp4430_vmmc = {
  208. .constraints = {
  209. .min_uV = 1200000,
  210. .max_uV = 3000000,
  211. .apply_uV = true,
  212. .valid_modes_mask = REGULATOR_MODE_NORMAL
  213. | REGULATOR_MODE_STANDBY,
  214. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  215. | REGULATOR_CHANGE_MODE
  216. | REGULATOR_CHANGE_STATUS,
  217. },
  218. .num_consumer_supplies = 2,
  219. .consumer_supplies = sdp4430_vmmc_supply,
  220. };
  221. static struct regulator_init_data sdp4430_vpp = {
  222. .constraints = {
  223. .min_uV = 1800000,
  224. .max_uV = 2500000,
  225. .apply_uV = true,
  226. .valid_modes_mask = REGULATOR_MODE_NORMAL
  227. | REGULATOR_MODE_STANDBY,
  228. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  229. | REGULATOR_CHANGE_MODE
  230. | REGULATOR_CHANGE_STATUS,
  231. },
  232. };
  233. static struct regulator_init_data sdp4430_vusim = {
  234. .constraints = {
  235. .min_uV = 1200000,
  236. .max_uV = 2900000,
  237. .apply_uV = true,
  238. .valid_modes_mask = REGULATOR_MODE_NORMAL
  239. | REGULATOR_MODE_STANDBY,
  240. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  241. | REGULATOR_CHANGE_MODE
  242. | REGULATOR_CHANGE_STATUS,
  243. },
  244. };
  245. static struct regulator_init_data sdp4430_vana = {
  246. .constraints = {
  247. .min_uV = 2100000,
  248. .max_uV = 2100000,
  249. .apply_uV = true,
  250. .valid_modes_mask = REGULATOR_MODE_NORMAL
  251. | REGULATOR_MODE_STANDBY,
  252. .valid_ops_mask = REGULATOR_CHANGE_MODE
  253. | REGULATOR_CHANGE_STATUS,
  254. },
  255. };
  256. static struct regulator_init_data sdp4430_vcxio = {
  257. .constraints = {
  258. .min_uV = 1800000,
  259. .max_uV = 1800000,
  260. .apply_uV = true,
  261. .valid_modes_mask = REGULATOR_MODE_NORMAL
  262. | REGULATOR_MODE_STANDBY,
  263. .valid_ops_mask = REGULATOR_CHANGE_MODE
  264. | REGULATOR_CHANGE_STATUS,
  265. },
  266. };
  267. static struct regulator_init_data sdp4430_vdac = {
  268. .constraints = {
  269. .min_uV = 1800000,
  270. .max_uV = 1800000,
  271. .apply_uV = true,
  272. .valid_modes_mask = REGULATOR_MODE_NORMAL
  273. | REGULATOR_MODE_STANDBY,
  274. .valid_ops_mask = REGULATOR_CHANGE_MODE
  275. | REGULATOR_CHANGE_STATUS,
  276. },
  277. };
  278. static struct regulator_init_data sdp4430_vusb = {
  279. .constraints = {
  280. .min_uV = 3300000,
  281. .max_uV = 3300000,
  282. .apply_uV = true,
  283. .valid_modes_mask = REGULATOR_MODE_NORMAL
  284. | REGULATOR_MODE_STANDBY,
  285. .valid_ops_mask = REGULATOR_CHANGE_MODE
  286. | REGULATOR_CHANGE_STATUS,
  287. },
  288. };
  289. static struct twl4030_platform_data sdp4430_twldata = {
  290. .irq_base = TWL6030_IRQ_BASE,
  291. .irq_end = TWL6030_IRQ_END,
  292. /* Regulators */
  293. .vmmc = &sdp4430_vmmc,
  294. .vpp = &sdp4430_vpp,
  295. .vusim = &sdp4430_vusim,
  296. .vana = &sdp4430_vana,
  297. .vcxio = &sdp4430_vcxio,
  298. .vdac = &sdp4430_vdac,
  299. .vusb = &sdp4430_vusb,
  300. .vaux1 = &sdp4430_vaux1,
  301. .vaux2 = &sdp4430_vaux2,
  302. .vaux3 = &sdp4430_vaux3,
  303. };
  304. static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
  305. {
  306. I2C_BOARD_INFO("twl6030", 0x48),
  307. .flags = I2C_CLIENT_WAKE,
  308. .irq = OMAP44XX_IRQ_SYS_1N,
  309. .platform_data = &sdp4430_twldata,
  310. },
  311. };
  312. static int __init omap4_i2c_init(void)
  313. {
  314. /*
  315. * Phoenix Audio IC needs I2C1 to
  316. * start with 400 KHz or less
  317. */
  318. omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
  319. ARRAY_SIZE(sdp4430_i2c_boardinfo));
  320. omap_register_i2c_bus(2, 400, NULL, 0);
  321. omap_register_i2c_bus(3, 400, NULL, 0);
  322. omap_register_i2c_bus(4, 400, NULL, 0);
  323. return 0;
  324. }
  325. static void __init omap_4430sdp_init(void)
  326. {
  327. int status;
  328. omap4_i2c_init();
  329. platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
  330. omap_serial_init();
  331. omap4_twl6030_hsmmc_init(mmc);
  332. /* OMAP4 SDP uses internal transceiver so register nop transceiver */
  333. usb_nop_xceiv_register();
  334. /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
  335. if (!cpu_is_omap44xx())
  336. usb_musb_init(&musb_board_data);
  337. status = omap_ethernet_init();
  338. if (status) {
  339. pr_err("Ethernet initialization failed: %d\n", status);
  340. } else {
  341. sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
  342. spi_register_board_info(sdp4430_spi_board_info,
  343. ARRAY_SIZE(sdp4430_spi_board_info));
  344. }
  345. }
  346. static void __init omap_4430sdp_map_io(void)
  347. {
  348. omap2_set_globals_443x();
  349. omap44xx_map_common_io();
  350. }
  351. MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
  352. /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
  353. .phys_io = 0x48000000,
  354. .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
  355. .boot_params = 0x80000100,
  356. .map_io = omap_4430sdp_map_io,
  357. .init_irq = omap_4430sdp_init_irq,
  358. .init_machine = omap_4430sdp_init,
  359. .timer = &omap_timer,
  360. MACHINE_END