board-4430sdp.c 17 KB

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