board-4430sdp.c 11 KB

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