board-4430sdp.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  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/gpio_keys.h>
  23. #include <linux/regulator/machine.h>
  24. #include <linux/leds.h>
  25. #include <linux/leds_pwm.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/usb.h>
  34. #include <plat/mmc.h>
  35. #include <plat/omap4-keypad.h>
  36. #include <plat/display.h>
  37. #include "mux.h"
  38. #include "hsmmc.h"
  39. #include "timer-gp.h"
  40. #include "control.h"
  41. #define ETH_KS8851_IRQ 34
  42. #define ETH_KS8851_POWER_ON 48
  43. #define ETH_KS8851_QUART 138
  44. #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
  45. #define OMAP4_SFH7741_ENABLE_GPIO 188
  46. #define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
  47. #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
  48. static const int sdp4430_keymap[] = {
  49. KEY(0, 0, KEY_E),
  50. KEY(0, 1, KEY_R),
  51. KEY(0, 2, KEY_T),
  52. KEY(0, 3, KEY_HOME),
  53. KEY(0, 4, KEY_F5),
  54. KEY(0, 5, KEY_UNKNOWN),
  55. KEY(0, 6, KEY_I),
  56. KEY(0, 7, KEY_LEFTSHIFT),
  57. KEY(1, 0, KEY_D),
  58. KEY(1, 1, KEY_F),
  59. KEY(1, 2, KEY_G),
  60. KEY(1, 3, KEY_SEND),
  61. KEY(1, 4, KEY_F6),
  62. KEY(1, 5, KEY_UNKNOWN),
  63. KEY(1, 6, KEY_K),
  64. KEY(1, 7, KEY_ENTER),
  65. KEY(2, 0, KEY_X),
  66. KEY(2, 1, KEY_C),
  67. KEY(2, 2, KEY_V),
  68. KEY(2, 3, KEY_END),
  69. KEY(2, 4, KEY_F7),
  70. KEY(2, 5, KEY_UNKNOWN),
  71. KEY(2, 6, KEY_DOT),
  72. KEY(2, 7, KEY_CAPSLOCK),
  73. KEY(3, 0, KEY_Z),
  74. KEY(3, 1, KEY_KPPLUS),
  75. KEY(3, 2, KEY_B),
  76. KEY(3, 3, KEY_F1),
  77. KEY(3, 4, KEY_F8),
  78. KEY(3, 5, KEY_UNKNOWN),
  79. KEY(3, 6, KEY_O),
  80. KEY(3, 7, KEY_SPACE),
  81. KEY(4, 0, KEY_W),
  82. KEY(4, 1, KEY_Y),
  83. KEY(4, 2, KEY_U),
  84. KEY(4, 3, KEY_F2),
  85. KEY(4, 4, KEY_VOLUMEUP),
  86. KEY(4, 5, KEY_UNKNOWN),
  87. KEY(4, 6, KEY_L),
  88. KEY(4, 7, KEY_LEFT),
  89. KEY(5, 0, KEY_S),
  90. KEY(5, 1, KEY_H),
  91. KEY(5, 2, KEY_J),
  92. KEY(5, 3, KEY_F3),
  93. KEY(5, 4, KEY_F9),
  94. KEY(5, 5, KEY_VOLUMEDOWN),
  95. KEY(5, 6, KEY_M),
  96. KEY(5, 7, KEY_RIGHT),
  97. KEY(6, 0, KEY_Q),
  98. KEY(6, 1, KEY_A),
  99. KEY(6, 2, KEY_N),
  100. KEY(6, 3, KEY_BACK),
  101. KEY(6, 4, KEY_BACKSPACE),
  102. KEY(6, 5, KEY_UNKNOWN),
  103. KEY(6, 6, KEY_P),
  104. KEY(6, 7, KEY_UP),
  105. KEY(7, 0, KEY_PROG1),
  106. KEY(7, 1, KEY_PROG2),
  107. KEY(7, 2, KEY_PROG3),
  108. KEY(7, 3, KEY_PROG4),
  109. KEY(7, 4, KEY_F4),
  110. KEY(7, 5, KEY_UNKNOWN),
  111. KEY(7, 6, KEY_OK),
  112. KEY(7, 7, KEY_DOWN),
  113. };
  114. static struct matrix_keymap_data sdp4430_keymap_data = {
  115. .keymap = sdp4430_keymap,
  116. .keymap_size = ARRAY_SIZE(sdp4430_keymap),
  117. };
  118. static struct omap4_keypad_platform_data sdp4430_keypad_data = {
  119. .keymap_data = &sdp4430_keymap_data,
  120. .rows = 8,
  121. .cols = 8,
  122. };
  123. static struct gpio_led sdp4430_gpio_leds[] = {
  124. {
  125. .name = "omap4:green:debug0",
  126. .gpio = 61,
  127. },
  128. {
  129. .name = "omap4:green:debug1",
  130. .gpio = 30,
  131. },
  132. {
  133. .name = "omap4:green:debug2",
  134. .gpio = 7,
  135. },
  136. {
  137. .name = "omap4:green:debug3",
  138. .gpio = 8,
  139. },
  140. {
  141. .name = "omap4:green:debug4",
  142. .gpio = 50,
  143. },
  144. {
  145. .name = "omap4:blue:user",
  146. .gpio = 169,
  147. },
  148. {
  149. .name = "omap4:red:user",
  150. .gpio = 170,
  151. },
  152. {
  153. .name = "omap4:green:user",
  154. .gpio = 139,
  155. },
  156. };
  157. static struct gpio_keys_button sdp4430_gpio_keys[] = {
  158. {
  159. .desc = "Proximity Sensor",
  160. .type = EV_SW,
  161. .code = SW_FRONT_PROXIMITY,
  162. .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
  163. .active_low = 0,
  164. }
  165. };
  166. static struct gpio_led_platform_data sdp4430_led_data = {
  167. .leds = sdp4430_gpio_leds,
  168. .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
  169. };
  170. static struct led_pwm sdp4430_pwm_leds[] = {
  171. {
  172. .name = "omap4:green:chrg",
  173. .pwm_id = 1,
  174. .max_brightness = 255,
  175. .pwm_period_ns = 7812500,
  176. },
  177. };
  178. static struct led_pwm_platform_data sdp4430_pwm_data = {
  179. .num_leds = ARRAY_SIZE(sdp4430_pwm_leds),
  180. .leds = sdp4430_pwm_leds,
  181. };
  182. static struct platform_device sdp4430_leds_pwm = {
  183. .name = "leds_pwm",
  184. .id = -1,
  185. .dev = {
  186. .platform_data = &sdp4430_pwm_data,
  187. },
  188. };
  189. static int omap_prox_activate(struct device *dev)
  190. {
  191. gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
  192. return 0;
  193. }
  194. static void omap_prox_deactivate(struct device *dev)
  195. {
  196. gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
  197. }
  198. static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
  199. .buttons = sdp4430_gpio_keys,
  200. .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
  201. .enable = omap_prox_activate,
  202. .disable = omap_prox_deactivate,
  203. };
  204. static struct platform_device sdp4430_gpio_keys_device = {
  205. .name = "gpio-keys",
  206. .id = -1,
  207. .dev = {
  208. .platform_data = &sdp4430_gpio_keys_data,
  209. },
  210. };
  211. static struct platform_device sdp4430_leds_gpio = {
  212. .name = "leds-gpio",
  213. .id = -1,
  214. .dev = {
  215. .platform_data = &sdp4430_led_data,
  216. },
  217. };
  218. static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
  219. {
  220. .modalias = "ks8851",
  221. .bus_num = 1,
  222. .chip_select = 0,
  223. .max_speed_hz = 24000000,
  224. .irq = ETH_KS8851_IRQ,
  225. },
  226. };
  227. static int omap_ethernet_init(void)
  228. {
  229. int status;
  230. /* Request of GPIO lines */
  231. status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
  232. if (status) {
  233. pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
  234. return status;
  235. }
  236. status = gpio_request(ETH_KS8851_QUART, "quart");
  237. if (status) {
  238. pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
  239. goto error1;
  240. }
  241. status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
  242. if (status) {
  243. pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
  244. goto error2;
  245. }
  246. /* Configuration of requested GPIO lines */
  247. status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
  248. if (status) {
  249. pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
  250. goto error3;
  251. }
  252. status = gpio_direction_output(ETH_KS8851_QUART, 1);
  253. if (status) {
  254. pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
  255. goto error3;
  256. }
  257. status = gpio_direction_input(ETH_KS8851_IRQ);
  258. if (status) {
  259. pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
  260. goto error3;
  261. }
  262. return 0;
  263. error3:
  264. gpio_free(ETH_KS8851_IRQ);
  265. error2:
  266. gpio_free(ETH_KS8851_QUART);
  267. error1:
  268. gpio_free(ETH_KS8851_POWER_ON);
  269. return status;
  270. }
  271. static struct platform_device sdp4430_lcd_device = {
  272. .name = "sdp4430_lcd",
  273. .id = -1,
  274. };
  275. static struct platform_device *sdp4430_devices[] __initdata = {
  276. &sdp4430_lcd_device,
  277. &sdp4430_gpio_keys_device,
  278. &sdp4430_leds_gpio,
  279. &sdp4430_leds_pwm,
  280. };
  281. static struct omap_lcd_config sdp4430_lcd_config __initdata = {
  282. .ctrl_name = "internal",
  283. };
  284. static struct omap_board_config_kernel sdp4430_config[] __initdata = {
  285. { OMAP_TAG_LCD, &sdp4430_lcd_config },
  286. };
  287. static void __init omap_4430sdp_init_early(void)
  288. {
  289. omap2_init_common_infrastructure();
  290. omap2_init_common_devices(NULL, NULL);
  291. #ifdef CONFIG_OMAP_32K_TIMER
  292. omap2_gp_clockevent_set_gptimer(1);
  293. #endif
  294. }
  295. static struct omap_musb_board_data musb_board_data = {
  296. .interface_type = MUSB_INTERFACE_UTMI,
  297. .mode = MUSB_OTG,
  298. .power = 100,
  299. };
  300. static struct twl4030_usb_data omap4_usbphy_data = {
  301. .phy_init = omap4430_phy_init,
  302. .phy_exit = omap4430_phy_exit,
  303. .phy_power = omap4430_phy_power,
  304. .phy_set_clock = omap4430_phy_set_clk,
  305. };
  306. static struct omap2_hsmmc_info mmc[] = {
  307. {
  308. .mmc = 2,
  309. .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
  310. .gpio_cd = -EINVAL,
  311. .gpio_wp = -EINVAL,
  312. .nonremovable = true,
  313. .ocr_mask = MMC_VDD_29_30,
  314. },
  315. {
  316. .mmc = 1,
  317. .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
  318. .gpio_wp = -EINVAL,
  319. },
  320. {} /* Terminator */
  321. };
  322. static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
  323. {
  324. .supply = "vmmc",
  325. .dev_name = "omap_hsmmc.1",
  326. },
  327. };
  328. static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
  329. {
  330. .supply = "vmmc",
  331. .dev_name = "omap_hsmmc.0",
  332. },
  333. };
  334. static int omap4_twl6030_hsmmc_late_init(struct device *dev)
  335. {
  336. int ret = 0;
  337. struct platform_device *pdev = container_of(dev,
  338. struct platform_device, dev);
  339. struct omap_mmc_platform_data *pdata = dev->platform_data;
  340. /* Setting MMC1 Card detect Irq */
  341. if (pdev->id == 0) {
  342. ret = twl6030_mmc_card_detect_config();
  343. if (ret)
  344. pr_err("Failed configuring MMC1 card detect\n");
  345. pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
  346. MMCDETECT_INTR_OFFSET;
  347. pdata->slots[0].card_detect = twl6030_mmc_card_detect;
  348. }
  349. return ret;
  350. }
  351. static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
  352. {
  353. struct omap_mmc_platform_data *pdata;
  354. /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
  355. if (!dev) {
  356. pr_err("Failed %s\n", __func__);
  357. return;
  358. }
  359. pdata = dev->platform_data;
  360. pdata->init = omap4_twl6030_hsmmc_late_init;
  361. }
  362. static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
  363. {
  364. struct omap2_hsmmc_info *c;
  365. omap2_hsmmc_init(controllers);
  366. for (c = controllers; c->mmc; c++)
  367. omap4_twl6030_hsmmc_set_late_init(c->dev);
  368. return 0;
  369. }
  370. static struct regulator_init_data sdp4430_vaux1 = {
  371. .constraints = {
  372. .min_uV = 1000000,
  373. .max_uV = 3000000,
  374. .apply_uV = true,
  375. .valid_modes_mask = REGULATOR_MODE_NORMAL
  376. | REGULATOR_MODE_STANDBY,
  377. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  378. | REGULATOR_CHANGE_MODE
  379. | REGULATOR_CHANGE_STATUS,
  380. },
  381. .num_consumer_supplies = 1,
  382. .consumer_supplies = sdp4430_vaux_supply,
  383. };
  384. static struct regulator_init_data sdp4430_vaux2 = {
  385. .constraints = {
  386. .min_uV = 1200000,
  387. .max_uV = 2800000,
  388. .apply_uV = true,
  389. .valid_modes_mask = REGULATOR_MODE_NORMAL
  390. | REGULATOR_MODE_STANDBY,
  391. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  392. | REGULATOR_CHANGE_MODE
  393. | REGULATOR_CHANGE_STATUS,
  394. },
  395. };
  396. static struct regulator_init_data sdp4430_vaux3 = {
  397. .constraints = {
  398. .min_uV = 1000000,
  399. .max_uV = 3000000,
  400. .apply_uV = true,
  401. .valid_modes_mask = REGULATOR_MODE_NORMAL
  402. | REGULATOR_MODE_STANDBY,
  403. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  404. | REGULATOR_CHANGE_MODE
  405. | REGULATOR_CHANGE_STATUS,
  406. },
  407. };
  408. /* VMMC1 for MMC1 card */
  409. static struct regulator_init_data sdp4430_vmmc = {
  410. .constraints = {
  411. .min_uV = 1200000,
  412. .max_uV = 3000000,
  413. .apply_uV = true,
  414. .valid_modes_mask = REGULATOR_MODE_NORMAL
  415. | REGULATOR_MODE_STANDBY,
  416. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  417. | REGULATOR_CHANGE_MODE
  418. | REGULATOR_CHANGE_STATUS,
  419. },
  420. .num_consumer_supplies = 1,
  421. .consumer_supplies = sdp4430_vmmc_supply,
  422. };
  423. static struct regulator_init_data sdp4430_vpp = {
  424. .constraints = {
  425. .min_uV = 1800000,
  426. .max_uV = 2500000,
  427. .apply_uV = true,
  428. .valid_modes_mask = REGULATOR_MODE_NORMAL
  429. | REGULATOR_MODE_STANDBY,
  430. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  431. | REGULATOR_CHANGE_MODE
  432. | REGULATOR_CHANGE_STATUS,
  433. },
  434. };
  435. static struct regulator_init_data sdp4430_vusim = {
  436. .constraints = {
  437. .min_uV = 1200000,
  438. .max_uV = 2900000,
  439. .apply_uV = true,
  440. .valid_modes_mask = REGULATOR_MODE_NORMAL
  441. | REGULATOR_MODE_STANDBY,
  442. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  443. | REGULATOR_CHANGE_MODE
  444. | REGULATOR_CHANGE_STATUS,
  445. },
  446. };
  447. static struct regulator_init_data sdp4430_vana = {
  448. .constraints = {
  449. .min_uV = 2100000,
  450. .max_uV = 2100000,
  451. .valid_modes_mask = REGULATOR_MODE_NORMAL
  452. | REGULATOR_MODE_STANDBY,
  453. .valid_ops_mask = REGULATOR_CHANGE_MODE
  454. | REGULATOR_CHANGE_STATUS,
  455. },
  456. };
  457. static struct regulator_init_data sdp4430_vcxio = {
  458. .constraints = {
  459. .min_uV = 1800000,
  460. .max_uV = 1800000,
  461. .valid_modes_mask = REGULATOR_MODE_NORMAL
  462. | REGULATOR_MODE_STANDBY,
  463. .valid_ops_mask = REGULATOR_CHANGE_MODE
  464. | REGULATOR_CHANGE_STATUS,
  465. },
  466. };
  467. static struct regulator_init_data sdp4430_vdac = {
  468. .constraints = {
  469. .min_uV = 1800000,
  470. .max_uV = 1800000,
  471. .valid_modes_mask = REGULATOR_MODE_NORMAL
  472. | REGULATOR_MODE_STANDBY,
  473. .valid_ops_mask = REGULATOR_CHANGE_MODE
  474. | REGULATOR_CHANGE_STATUS,
  475. },
  476. };
  477. static struct regulator_init_data sdp4430_vusb = {
  478. .constraints = {
  479. .min_uV = 3300000,
  480. .max_uV = 3300000,
  481. .apply_uV = true,
  482. .valid_modes_mask = REGULATOR_MODE_NORMAL
  483. | REGULATOR_MODE_STANDBY,
  484. .valid_ops_mask = REGULATOR_CHANGE_MODE
  485. | REGULATOR_CHANGE_STATUS,
  486. },
  487. };
  488. static struct twl4030_platform_data sdp4430_twldata = {
  489. .irq_base = TWL6030_IRQ_BASE,
  490. .irq_end = TWL6030_IRQ_END,
  491. /* Regulators */
  492. .vmmc = &sdp4430_vmmc,
  493. .vpp = &sdp4430_vpp,
  494. .vusim = &sdp4430_vusim,
  495. .vana = &sdp4430_vana,
  496. .vcxio = &sdp4430_vcxio,
  497. .vdac = &sdp4430_vdac,
  498. .vusb = &sdp4430_vusb,
  499. .vaux1 = &sdp4430_vaux1,
  500. .vaux2 = &sdp4430_vaux2,
  501. .vaux3 = &sdp4430_vaux3,
  502. .usb = &omap4_usbphy_data
  503. };
  504. static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
  505. {
  506. I2C_BOARD_INFO("twl6030", 0x48),
  507. .flags = I2C_CLIENT_WAKE,
  508. .irq = OMAP44XX_IRQ_SYS_1N,
  509. .platform_data = &sdp4430_twldata,
  510. },
  511. };
  512. static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
  513. {
  514. I2C_BOARD_INFO("tmp105", 0x48),
  515. },
  516. {
  517. I2C_BOARD_INFO("bh1780", 0x29),
  518. },
  519. };
  520. static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
  521. {
  522. I2C_BOARD_INFO("hmc5843", 0x1e),
  523. },
  524. };
  525. static int __init omap4_i2c_init(void)
  526. {
  527. /*
  528. * Phoenix Audio IC needs I2C1 to
  529. * start with 400 KHz or less
  530. */
  531. omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
  532. ARRAY_SIZE(sdp4430_i2c_boardinfo));
  533. omap_register_i2c_bus(2, 400, NULL, 0);
  534. omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
  535. ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
  536. omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
  537. ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
  538. return 0;
  539. }
  540. static void __init omap_sfh7741prox_init(void)
  541. {
  542. int error;
  543. error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741");
  544. if (error < 0) {
  545. pr_err("%s:failed to request GPIO %d, error %d\n",
  546. __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
  547. return;
  548. }
  549. error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
  550. if (error < 0) {
  551. pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
  552. __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
  553. gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
  554. }
  555. }
  556. static void sdp4430_hdmi_mux_init(void)
  557. {
  558. /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
  559. omap_mux_init_signal("hdmi_hpd",
  560. OMAP_PIN_INPUT_PULLUP);
  561. omap_mux_init_signal("hdmi_cec",
  562. OMAP_PIN_INPUT_PULLUP);
  563. /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
  564. omap_mux_init_signal("hdmi_ddc_scl",
  565. OMAP_PIN_INPUT_PULLUP);
  566. omap_mux_init_signal("hdmi_ddc_sda",
  567. OMAP_PIN_INPUT_PULLUP);
  568. }
  569. static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
  570. {
  571. int status;
  572. status = gpio_request_one(HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH,
  573. "hdmi_gpio_hpd");
  574. if (status) {
  575. pr_err("Cannot request GPIO %d\n", HDMI_GPIO_HPD);
  576. return status;
  577. }
  578. status = gpio_request_one(HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH,
  579. "hdmi_gpio_ls_oe");
  580. if (status) {
  581. pr_err("Cannot request GPIO %d\n", HDMI_GPIO_LS_OE);
  582. goto error1;
  583. }
  584. return 0;
  585. error1:
  586. gpio_free(HDMI_GPIO_HPD);
  587. return status;
  588. }
  589. static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev)
  590. {
  591. gpio_free(HDMI_GPIO_LS_OE);
  592. gpio_free(HDMI_GPIO_HPD);
  593. }
  594. static struct omap_dss_device sdp4430_hdmi_device = {
  595. .name = "hdmi",
  596. .driver_name = "hdmi_panel",
  597. .type = OMAP_DISPLAY_TYPE_HDMI,
  598. .platform_enable = sdp4430_panel_enable_hdmi,
  599. .platform_disable = sdp4430_panel_disable_hdmi,
  600. .channel = OMAP_DSS_CHANNEL_DIGIT,
  601. };
  602. static struct omap_dss_device *sdp4430_dss_devices[] = {
  603. &sdp4430_hdmi_device,
  604. };
  605. static struct omap_dss_board_info sdp4430_dss_data = {
  606. .num_devices = ARRAY_SIZE(sdp4430_dss_devices),
  607. .devices = sdp4430_dss_devices,
  608. .default_device = &sdp4430_hdmi_device,
  609. };
  610. void omap_4430sdp_display_init(void)
  611. {
  612. sdp4430_hdmi_mux_init();
  613. omap_display_init(&sdp4430_dss_data);
  614. }
  615. #ifdef CONFIG_OMAP_MUX
  616. static struct omap_board_mux board_mux[] __initdata = {
  617. OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
  618. { .reg_offset = OMAP_MUX_TERMINATOR },
  619. };
  620. #else
  621. #define board_mux NULL
  622. #endif
  623. static void __init omap_4430sdp_init(void)
  624. {
  625. int status;
  626. int package = OMAP_PACKAGE_CBS;
  627. if (omap_rev() == OMAP4430_REV_ES1_0)
  628. package = OMAP_PACKAGE_CBL;
  629. omap4_mux_init(board_mux, package);
  630. omap_board_config = sdp4430_config;
  631. omap_board_config_size = ARRAY_SIZE(sdp4430_config);
  632. omap4_i2c_init();
  633. omap_sfh7741prox_init();
  634. platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
  635. omap_serial_init();
  636. omap4_twl6030_hsmmc_init(mmc);
  637. usb_musb_init(&musb_board_data);
  638. status = omap_ethernet_init();
  639. if (status) {
  640. pr_err("Ethernet initialization failed: %d\n", status);
  641. } else {
  642. sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
  643. spi_register_board_info(sdp4430_spi_board_info,
  644. ARRAY_SIZE(sdp4430_spi_board_info));
  645. }
  646. status = omap4_keyboard_init(&sdp4430_keypad_data);
  647. if (status)
  648. pr_err("Keypad initialization failed: %d\n", status);
  649. omap_4430sdp_display_init();
  650. }
  651. static void __init omap_4430sdp_map_io(void)
  652. {
  653. omap2_set_globals_443x();
  654. omap44xx_map_common_io();
  655. }
  656. MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
  657. /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
  658. .boot_params = 0x80000100,
  659. .reserve = omap_reserve,
  660. .map_io = omap_4430sdp_map_io,
  661. .init_early = omap_4430sdp_init_early,
  662. .init_irq = gic_init_irq,
  663. .init_machine = omap_4430sdp_init,
  664. .timer = &omap_timer,
  665. MACHINE_END