board-4430sdp.c 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  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. #define ETH_KS8851_IRQ 34
  34. #define ETH_KS8851_POWER_ON 48
  35. #define ETH_KS8851_QUART 138
  36. static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
  37. {
  38. .modalias = "ks8851",
  39. .bus_num = 1,
  40. .chip_select = 0,
  41. .max_speed_hz = 24000000,
  42. .irq = ETH_KS8851_IRQ,
  43. },
  44. };
  45. static int omap_ethernet_init(void)
  46. {
  47. int status;
  48. /* Request of GPIO lines */
  49. status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
  50. if (status) {
  51. pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
  52. return status;
  53. }
  54. status = gpio_request(ETH_KS8851_QUART, "quart");
  55. if (status) {
  56. pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
  57. goto error1;
  58. }
  59. status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
  60. if (status) {
  61. pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
  62. goto error2;
  63. }
  64. /* Configuration of requested GPIO lines */
  65. status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
  66. if (status) {
  67. pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
  68. goto error3;
  69. }
  70. status = gpio_direction_output(ETH_KS8851_QUART, 1);
  71. if (status) {
  72. pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
  73. goto error3;
  74. }
  75. status = gpio_direction_input(ETH_KS8851_IRQ);
  76. if (status) {
  77. pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
  78. goto error3;
  79. }
  80. return 0;
  81. error3:
  82. gpio_free(ETH_KS8851_IRQ);
  83. error2:
  84. gpio_free(ETH_KS8851_QUART);
  85. error1:
  86. gpio_free(ETH_KS8851_POWER_ON);
  87. return status;
  88. }
  89. static struct platform_device sdp4430_lcd_device = {
  90. .name = "sdp4430_lcd",
  91. .id = -1,
  92. };
  93. static struct platform_device *sdp4430_devices[] __initdata = {
  94. &sdp4430_lcd_device,
  95. };
  96. static struct omap_lcd_config sdp4430_lcd_config __initdata = {
  97. .ctrl_name = "internal",
  98. };
  99. static struct omap_board_config_kernel sdp4430_config[] __initdata = {
  100. { OMAP_TAG_LCD, &sdp4430_lcd_config },
  101. };
  102. static void __init omap_4430sdp_init_irq(void)
  103. {
  104. omap_board_config = sdp4430_config;
  105. omap_board_config_size = ARRAY_SIZE(sdp4430_config);
  106. omap2_init_common_hw(NULL, NULL);
  107. #ifdef CONFIG_OMAP_32K_TIMER
  108. omap2_gp_clockevent_set_gptimer(1);
  109. #endif
  110. gic_init_irq();
  111. omap_gpio_init();
  112. }
  113. static struct omap_musb_board_data musb_board_data = {
  114. .interface_type = MUSB_INTERFACE_UTMI,
  115. .mode = MUSB_PERIPHERAL,
  116. .power = 100,
  117. };
  118. static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
  119. {
  120. .supply = "vmmc",
  121. },
  122. {
  123. .supply = "vmmc",
  124. },
  125. {
  126. .supply = "vmmc",
  127. },
  128. {
  129. .supply = "vmmc",
  130. },
  131. {
  132. .supply = "vmmc",
  133. },
  134. };
  135. static struct regulator_init_data sdp4430_vaux1 = {
  136. .constraints = {
  137. .min_uV = 1000000,
  138. .max_uV = 3000000,
  139. .apply_uV = true,
  140. .valid_modes_mask = REGULATOR_MODE_NORMAL
  141. | REGULATOR_MODE_STANDBY,
  142. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  143. | REGULATOR_CHANGE_MODE
  144. | REGULATOR_CHANGE_STATUS,
  145. },
  146. };
  147. static struct regulator_init_data sdp4430_vaux2 = {
  148. .constraints = {
  149. .min_uV = 1200000,
  150. .max_uV = 2800000,
  151. .apply_uV = true,
  152. .valid_modes_mask = REGULATOR_MODE_NORMAL
  153. | REGULATOR_MODE_STANDBY,
  154. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  155. | REGULATOR_CHANGE_MODE
  156. | REGULATOR_CHANGE_STATUS,
  157. },
  158. };
  159. static struct regulator_init_data sdp4430_vaux3 = {
  160. .constraints = {
  161. .min_uV = 1000000,
  162. .max_uV = 3000000,
  163. .apply_uV = true,
  164. .valid_modes_mask = REGULATOR_MODE_NORMAL
  165. | REGULATOR_MODE_STANDBY,
  166. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  167. | REGULATOR_CHANGE_MODE
  168. | REGULATOR_CHANGE_STATUS,
  169. },
  170. };
  171. /* VMMC1 for MMC1 card */
  172. static struct regulator_init_data sdp4430_vmmc = {
  173. .constraints = {
  174. .min_uV = 1200000,
  175. .max_uV = 3000000,
  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. .num_consumer_supplies = 5,
  184. .consumer_supplies = sdp4430_vmmc_supply,
  185. };
  186. static struct regulator_init_data sdp4430_vpp = {
  187. .constraints = {
  188. .min_uV = 1800000,
  189. .max_uV = 2500000,
  190. .apply_uV = true,
  191. .valid_modes_mask = REGULATOR_MODE_NORMAL
  192. | REGULATOR_MODE_STANDBY,
  193. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  194. | REGULATOR_CHANGE_MODE
  195. | REGULATOR_CHANGE_STATUS,
  196. },
  197. };
  198. static struct regulator_init_data sdp4430_vusim = {
  199. .constraints = {
  200. .min_uV = 1200000,
  201. .max_uV = 2900000,
  202. .apply_uV = true,
  203. .valid_modes_mask = REGULATOR_MODE_NORMAL
  204. | REGULATOR_MODE_STANDBY,
  205. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  206. | REGULATOR_CHANGE_MODE
  207. | REGULATOR_CHANGE_STATUS,
  208. },
  209. };
  210. static struct regulator_init_data sdp4430_vana = {
  211. .constraints = {
  212. .min_uV = 2100000,
  213. .max_uV = 2100000,
  214. .apply_uV = true,
  215. .valid_modes_mask = REGULATOR_MODE_NORMAL
  216. | REGULATOR_MODE_STANDBY,
  217. .valid_ops_mask = REGULATOR_CHANGE_MODE
  218. | REGULATOR_CHANGE_STATUS,
  219. },
  220. };
  221. static struct regulator_init_data sdp4430_vcxio = {
  222. .constraints = {
  223. .min_uV = 1800000,
  224. .max_uV = 1800000,
  225. .apply_uV = true,
  226. .valid_modes_mask = REGULATOR_MODE_NORMAL
  227. | REGULATOR_MODE_STANDBY,
  228. .valid_ops_mask = REGULATOR_CHANGE_MODE
  229. | REGULATOR_CHANGE_STATUS,
  230. },
  231. };
  232. static struct regulator_init_data sdp4430_vdac = {
  233. .constraints = {
  234. .min_uV = 1800000,
  235. .max_uV = 1800000,
  236. .apply_uV = true,
  237. .valid_modes_mask = REGULATOR_MODE_NORMAL
  238. | REGULATOR_MODE_STANDBY,
  239. .valid_ops_mask = REGULATOR_CHANGE_MODE
  240. | REGULATOR_CHANGE_STATUS,
  241. },
  242. };
  243. static struct regulator_init_data sdp4430_vusb = {
  244. .constraints = {
  245. .min_uV = 3300000,
  246. .max_uV = 3300000,
  247. .apply_uV = true,
  248. .valid_modes_mask = REGULATOR_MODE_NORMAL
  249. | REGULATOR_MODE_STANDBY,
  250. .valid_ops_mask = REGULATOR_CHANGE_MODE
  251. | REGULATOR_CHANGE_STATUS,
  252. },
  253. };
  254. static struct twl4030_platform_data sdp4430_twldata = {
  255. .irq_base = TWL6030_IRQ_BASE,
  256. .irq_end = TWL6030_IRQ_END,
  257. /* Regulators */
  258. .vmmc = &sdp4430_vmmc,
  259. .vpp = &sdp4430_vpp,
  260. .vusim = &sdp4430_vusim,
  261. .vana = &sdp4430_vana,
  262. .vcxio = &sdp4430_vcxio,
  263. .vdac = &sdp4430_vdac,
  264. .vusb = &sdp4430_vusb,
  265. .vaux1 = &sdp4430_vaux1,
  266. .vaux2 = &sdp4430_vaux2,
  267. .vaux3 = &sdp4430_vaux3,
  268. };
  269. static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
  270. {
  271. I2C_BOARD_INFO("twl6030", 0x48),
  272. .flags = I2C_CLIENT_WAKE,
  273. .irq = OMAP44XX_IRQ_SYS_1N,
  274. .platform_data = &sdp4430_twldata,
  275. },
  276. };
  277. static int __init omap4_i2c_init(void)
  278. {
  279. /*
  280. * Phoenix Audio IC needs I2C1 to
  281. * start with 400 KHz or less
  282. */
  283. omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
  284. ARRAY_SIZE(sdp4430_i2c_boardinfo));
  285. omap_register_i2c_bus(2, 400, NULL, 0);
  286. omap_register_i2c_bus(3, 400, NULL, 0);
  287. omap_register_i2c_bus(4, 400, NULL, 0);
  288. return 0;
  289. }
  290. static void __init omap_4430sdp_init(void)
  291. {
  292. int status;
  293. omap4_i2c_init();
  294. platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
  295. omap_serial_init();
  296. /* OMAP4 SDP uses internal transceiver so register nop transceiver */
  297. usb_nop_xceiv_register();
  298. /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
  299. if (!cpu_is_omap44xx())
  300. usb_musb_init(&musb_board_data);
  301. status = omap_ethernet_init();
  302. if (status) {
  303. pr_err("Ethernet initialization failed: %d\n", status);
  304. } else {
  305. sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
  306. spi_register_board_info(sdp4430_spi_board_info,
  307. ARRAY_SIZE(sdp4430_spi_board_info));
  308. }
  309. }
  310. static void __init omap_4430sdp_map_io(void)
  311. {
  312. omap2_set_globals_443x();
  313. omap44xx_map_common_io();
  314. }
  315. MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
  316. /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
  317. .phys_io = 0x48000000,
  318. .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
  319. .boot_params = 0x80000100,
  320. .map_io = omap_4430sdp_map_io,
  321. .init_irq = omap_4430sdp_init_irq,
  322. .init_machine = omap_4430sdp_init,
  323. .timer = &omap_timer,
  324. MACHINE_END