board-rx51-peripherals.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. /*
  2. * linux/arch/arm/mach-omap2/board-rx51-peripherals.c
  3. *
  4. * Copyright (C) 2008-2009 Nokia
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/input.h>
  14. #include <linux/input/matrix_keypad.h>
  15. #include <linux/spi/spi.h>
  16. #include <linux/i2c.h>
  17. #include <linux/i2c/twl4030.h>
  18. #include <linux/clk.h>
  19. #include <linux/delay.h>
  20. #include <linux/regulator/machine.h>
  21. #include <linux/gpio.h>
  22. #include <linux/gpio_keys.h>
  23. #include <linux/mmc/host.h>
  24. #include <plat/mcspi.h>
  25. #include <plat/mux.h>
  26. #include <plat/board.h>
  27. #include <plat/common.h>
  28. #include <plat/dma.h>
  29. #include <plat/gpmc.h>
  30. #include <plat/onenand.h>
  31. #include <plat/gpmc-smc91x.h>
  32. #include "mmc-twl4030.h"
  33. #define SYSTEM_REV_B_USES_VAUX3 0x1699
  34. #define SYSTEM_REV_S_USES_VAUX3 0x8
  35. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  36. #define RX51_GPIO_CAMERA_LENS_COVER 110
  37. #define RX51_GPIO_CAMERA_FOCUS 68
  38. #define RX51_GPIO_CAMERA_CAPTURE 69
  39. #define RX51_GPIO_KEYPAD_SLIDE 71
  40. #define RX51_GPIO_LOCK_BUTTON 113
  41. #define RX51_GPIO_PROXIMITY 89
  42. #define RX51_GPIO_DEBOUNCE_TIMEOUT 10
  43. static struct gpio_keys_button rx51_gpio_keys[] = {
  44. {
  45. .desc = "Camera Lens Cover",
  46. .type = EV_SW,
  47. .code = SW_CAMERA_LENS_COVER,
  48. .gpio = RX51_GPIO_CAMERA_LENS_COVER,
  49. .active_low = 1,
  50. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  51. }, {
  52. .desc = "Camera Focus",
  53. .type = EV_KEY,
  54. .code = KEY_CAMERA_FOCUS,
  55. .gpio = RX51_GPIO_CAMERA_FOCUS,
  56. .active_low = 1,
  57. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  58. }, {
  59. .desc = "Camera Capture",
  60. .type = EV_KEY,
  61. .code = KEY_CAMERA,
  62. .gpio = RX51_GPIO_CAMERA_CAPTURE,
  63. .active_low = 1,
  64. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  65. }, {
  66. .desc = "Lock Button",
  67. .type = EV_KEY,
  68. .code = KEY_SCREENLOCK,
  69. .gpio = RX51_GPIO_LOCK_BUTTON,
  70. .active_low = 1,
  71. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  72. }, {
  73. .desc = "Keypad Slide",
  74. .type = EV_SW,
  75. .code = SW_KEYPAD_SLIDE,
  76. .gpio = RX51_GPIO_KEYPAD_SLIDE,
  77. .active_low = 1,
  78. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  79. }, {
  80. .desc = "Proximity Sensor",
  81. .type = EV_SW,
  82. .code = SW_FRONT_PROXIMITY,
  83. .gpio = RX51_GPIO_PROXIMITY,
  84. .active_low = 0,
  85. .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
  86. }
  87. };
  88. static struct gpio_keys_platform_data rx51_gpio_keys_data = {
  89. .buttons = rx51_gpio_keys,
  90. .nbuttons = ARRAY_SIZE(rx51_gpio_keys),
  91. };
  92. static struct platform_device rx51_gpio_keys_device = {
  93. .name = "gpio-keys",
  94. .id = -1,
  95. .dev = {
  96. .platform_data = &rx51_gpio_keys_data,
  97. },
  98. };
  99. static void __init rx51_add_gpio_keys(void)
  100. {
  101. platform_device_register(&rx51_gpio_keys_device);
  102. }
  103. #else
  104. static void __init rx51_add_gpio_keys(void)
  105. {
  106. }
  107. #endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */
  108. static int board_keymap[] = {
  109. KEY(0, 0, KEY_Q),
  110. KEY(0, 1, KEY_O),
  111. KEY(0, 2, KEY_P),
  112. KEY(0, 3, KEY_COMMA),
  113. KEY(0, 4, KEY_BACKSPACE),
  114. KEY(0, 6, KEY_A),
  115. KEY(0, 7, KEY_S),
  116. KEY(1, 0, KEY_W),
  117. KEY(1, 1, KEY_D),
  118. KEY(1, 2, KEY_F),
  119. KEY(1, 3, KEY_G),
  120. KEY(1, 4, KEY_H),
  121. KEY(1, 5, KEY_J),
  122. KEY(1, 6, KEY_K),
  123. KEY(1, 7, KEY_L),
  124. KEY(2, 0, KEY_E),
  125. KEY(2, 1, KEY_DOT),
  126. KEY(2, 2, KEY_UP),
  127. KEY(2, 3, KEY_ENTER),
  128. KEY(2, 5, KEY_Z),
  129. KEY(2, 6, KEY_X),
  130. KEY(2, 7, KEY_C),
  131. KEY(3, 0, KEY_R),
  132. KEY(3, 1, KEY_V),
  133. KEY(3, 2, KEY_B),
  134. KEY(3, 3, KEY_N),
  135. KEY(3, 4, KEY_M),
  136. KEY(3, 5, KEY_SPACE),
  137. KEY(3, 6, KEY_SPACE),
  138. KEY(3, 7, KEY_LEFT),
  139. KEY(4, 0, KEY_T),
  140. KEY(4, 1, KEY_DOWN),
  141. KEY(4, 2, KEY_RIGHT),
  142. KEY(4, 4, KEY_LEFTCTRL),
  143. KEY(4, 5, KEY_RIGHTALT),
  144. KEY(4, 6, KEY_LEFTSHIFT),
  145. KEY(5, 0, KEY_Y),
  146. KEY(6, 0, KEY_U),
  147. KEY(7, 0, KEY_I),
  148. KEY(7, 1, KEY_F7),
  149. KEY(7, 2, KEY_F8),
  150. KEY(0xff, 2, KEY_F9),
  151. KEY(0xff, 4, KEY_F10),
  152. KEY(0xff, 5, KEY_F11),
  153. };
  154. static struct matrix_keymap_data board_map_data = {
  155. .keymap = board_keymap,
  156. .keymap_size = ARRAY_SIZE(board_keymap),
  157. };
  158. static struct twl4030_keypad_data rx51_kp_data = {
  159. .keymap_data = &board_map_data,
  160. .rows = 8,
  161. .cols = 8,
  162. .rep = 1,
  163. };
  164. static struct twl4030_madc_platform_data rx51_madc_data = {
  165. .irq_line = 1,
  166. };
  167. static struct twl4030_hsmmc_info mmc[] = {
  168. {
  169. .name = "external",
  170. .mmc = 1,
  171. .wires = 4,
  172. .cover_only = true,
  173. .gpio_cd = 160,
  174. .gpio_wp = -EINVAL,
  175. .power_saving = true,
  176. },
  177. {
  178. .name = "internal",
  179. .mmc = 2,
  180. .wires = 8,
  181. .gpio_cd = -EINVAL,
  182. .gpio_wp = -EINVAL,
  183. .nonremovable = true,
  184. .power_saving = true,
  185. },
  186. {} /* Terminator */
  187. };
  188. static struct regulator_consumer_supply rx51_vmmc1_supply = {
  189. .supply = "vmmc",
  190. };
  191. static struct regulator_consumer_supply rx51_vmmc2_supply = {
  192. .supply = "vmmc",
  193. };
  194. static struct regulator_consumer_supply rx51_vsim_supply = {
  195. .supply = "vmmc_aux",
  196. };
  197. static struct regulator_init_data rx51_vaux1 = {
  198. .constraints = {
  199. .name = "V28",
  200. .min_uV = 2800000,
  201. .max_uV = 2800000,
  202. .valid_modes_mask = REGULATOR_MODE_NORMAL
  203. | REGULATOR_MODE_STANDBY,
  204. .valid_ops_mask = REGULATOR_CHANGE_MODE
  205. | REGULATOR_CHANGE_STATUS,
  206. },
  207. };
  208. static struct regulator_init_data rx51_vaux2 = {
  209. .constraints = {
  210. .name = "VCSI",
  211. .min_uV = 1800000,
  212. .max_uV = 1800000,
  213. .valid_modes_mask = REGULATOR_MODE_NORMAL
  214. | REGULATOR_MODE_STANDBY,
  215. .valid_ops_mask = REGULATOR_CHANGE_MODE
  216. | REGULATOR_CHANGE_STATUS,
  217. },
  218. };
  219. /* VAUX3 - adds more power to VIO_18 rail */
  220. static struct regulator_init_data rx51_vaux3_cam = {
  221. .constraints = {
  222. .name = "VCAM_DIG_18",
  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 rx51_vaux3_mmc = {
  233. .constraints = {
  234. .name = "VMMC2_30",
  235. .min_uV = 2800000,
  236. .max_uV = 3000000,
  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. .num_consumer_supplies = 1,
  245. .consumer_supplies = &rx51_vmmc2_supply,
  246. };
  247. static struct regulator_init_data rx51_vaux4 = {
  248. .constraints = {
  249. .name = "VCAM_ANA_28",
  250. .min_uV = 2800000,
  251. .max_uV = 2800000,
  252. .apply_uV = true,
  253. .valid_modes_mask = REGULATOR_MODE_NORMAL
  254. | REGULATOR_MODE_STANDBY,
  255. .valid_ops_mask = REGULATOR_CHANGE_MODE
  256. | REGULATOR_CHANGE_STATUS,
  257. },
  258. };
  259. static struct regulator_init_data rx51_vmmc1 = {
  260. .constraints = {
  261. .min_uV = 1850000,
  262. .max_uV = 3150000,
  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 = &rx51_vmmc1_supply,
  271. };
  272. static struct regulator_init_data rx51_vmmc2 = {
  273. .constraints = {
  274. .name = "VMMC2_30",
  275. .min_uV = 1850000,
  276. .max_uV = 3150000,
  277. .apply_uV = true,
  278. .valid_modes_mask = REGULATOR_MODE_NORMAL
  279. | REGULATOR_MODE_STANDBY,
  280. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  281. | REGULATOR_CHANGE_MODE
  282. | REGULATOR_CHANGE_STATUS,
  283. },
  284. .num_consumer_supplies = 1,
  285. .consumer_supplies = &rx51_vmmc2_supply,
  286. };
  287. static struct regulator_init_data rx51_vsim = {
  288. .constraints = {
  289. .name = "VMMC2_IO_18",
  290. .min_uV = 1800000,
  291. .max_uV = 1800000,
  292. .apply_uV = true,
  293. .valid_modes_mask = REGULATOR_MODE_NORMAL
  294. | REGULATOR_MODE_STANDBY,
  295. .valid_ops_mask = REGULATOR_CHANGE_MODE
  296. | REGULATOR_CHANGE_STATUS,
  297. },
  298. .num_consumer_supplies = 1,
  299. .consumer_supplies = &rx51_vsim_supply,
  300. };
  301. static struct regulator_init_data rx51_vdac = {
  302. .constraints = {
  303. .min_uV = 1800000,
  304. .max_uV = 1800000,
  305. .valid_modes_mask = REGULATOR_MODE_NORMAL
  306. | REGULATOR_MODE_STANDBY,
  307. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  308. | REGULATOR_CHANGE_MODE
  309. | REGULATOR_CHANGE_STATUS,
  310. },
  311. };
  312. static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
  313. {
  314. /* FIXME this gpio setup is just a placeholder for now */
  315. gpio_request(gpio + 6, "backlight_pwm");
  316. gpio_direction_output(gpio + 6, 0);
  317. gpio_request(gpio + 7, "speaker_en");
  318. gpio_direction_output(gpio + 7, 1);
  319. /* set up MMC adapters, linking their regulators to them */
  320. twl4030_mmc_init(mmc);
  321. rx51_vmmc1_supply.dev = mmc[0].dev;
  322. rx51_vmmc2_supply.dev = mmc[1].dev;
  323. rx51_vsim_supply.dev = mmc[1].dev;
  324. return 0;
  325. }
  326. static struct twl4030_gpio_platform_data rx51_gpio_data = {
  327. .gpio_base = OMAP_MAX_GPIO_LINES,
  328. .irq_base = TWL4030_GPIO_IRQ_BASE,
  329. .irq_end = TWL4030_GPIO_IRQ_END,
  330. .pulldowns = BIT(0) | BIT(1) | BIT(2) | BIT(3)
  331. | BIT(4) | BIT(5)
  332. | BIT(8) | BIT(9) | BIT(10) | BIT(11)
  333. | BIT(12) | BIT(13) | BIT(14) | BIT(15)
  334. | BIT(16) | BIT(17) ,
  335. .setup = rx51_twlgpio_setup,
  336. };
  337. static struct twl4030_usb_data rx51_usb_data = {
  338. .usb_mode = T2_USB_MODE_ULPI,
  339. };
  340. static struct twl4030_ins sleep_on_seq[] __initdata = {
  341. /*
  342. * Turn off VDD1 and VDD2.
  343. */
  344. {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_OFF), 4},
  345. {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_OFF), 2},
  346. /*
  347. * And also turn off the OMAP3 PLLs and the sysclk output.
  348. */
  349. {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_OFF), 3},
  350. {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_OFF), 3},
  351. };
  352. static struct twl4030_script sleep_on_script __initdata = {
  353. .script = sleep_on_seq,
  354. .size = ARRAY_SIZE(sleep_on_seq),
  355. .flags = TWL4030_SLEEP_SCRIPT,
  356. };
  357. static struct twl4030_ins wakeup_seq[] __initdata = {
  358. /*
  359. * Reenable the OMAP3 PLLs.
  360. * Wakeup VDD1 and VDD2.
  361. * Reenable sysclk output.
  362. */
  363. {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_ACTIVE), 0x30},
  364. {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_ACTIVE), 0x30},
  365. {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_ACTIVE), 0x37},
  366. {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 3},
  367. };
  368. static struct twl4030_script wakeup_script __initdata = {
  369. .script = wakeup_seq,
  370. .size = ARRAY_SIZE(wakeup_seq),
  371. .flags = TWL4030_WAKEUP12_SCRIPT,
  372. };
  373. static struct twl4030_ins wakeup_p3_seq[] __initdata = {
  374. /*
  375. * Wakeup VDD1 (dummy to be able to insert a delay)
  376. * Enable CLKEN
  377. */
  378. {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_ACTIVE), 3},
  379. };
  380. static struct twl4030_script wakeup_p3_script __initdata = {
  381. .script = wakeup_p3_seq,
  382. .size = ARRAY_SIZE(wakeup_p3_seq),
  383. .flags = TWL4030_WAKEUP3_SCRIPT,
  384. };
  385. static struct twl4030_ins wrst_seq[] __initdata = {
  386. /*
  387. * Reset twl4030.
  388. * Reset VDD1 regulator.
  389. * Reset VDD2 regulator.
  390. * Reset VPLL1 regulator.
  391. * Enable sysclk output.
  392. * Reenable twl4030.
  393. */
  394. {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
  395. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 0, 1, RES_STATE_ACTIVE),
  396. 0x13},
  397. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 2, RES_STATE_WRST), 0x13},
  398. {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 3, RES_STATE_OFF), 0x13},
  399. {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD1, RES_STATE_WRST), 0x13},
  400. {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD2, RES_STATE_WRST), 0x13},
  401. {MSG_SINGULAR(DEV_GRP_NULL, RES_VPLL1, RES_STATE_WRST), 0x35},
  402. {MSG_SINGULAR(DEV_GRP_P1, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
  403. {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
  404. };
  405. static struct twl4030_script wrst_script __initdata = {
  406. .script = wrst_seq,
  407. .size = ARRAY_SIZE(wrst_seq),
  408. .flags = TWL4030_WRST_SCRIPT,
  409. };
  410. static struct twl4030_script *twl4030_scripts[] __initdata = {
  411. /* wakeup12 script should be loaded before sleep script, otherwise a
  412. board might hit retention before loading of wakeup script is
  413. completed. This can cause boot failures depending on timing issues.
  414. */
  415. &wakeup_script,
  416. &sleep_on_script,
  417. &wakeup_p3_script,
  418. &wrst_script,
  419. };
  420. static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
  421. { .resource = RES_VINTANA1, .devgroup = -1, .type = -1, .type2 = 1 },
  422. { .resource = RES_VINTANA2, .devgroup = -1, .type = -1, .type2 = 1 },
  423. { .resource = RES_VINTDIG, .devgroup = -1, .type = -1, .type2 = 1 },
  424. { .resource = RES_VMMC1, .devgroup = -1, .type = -1, .type2 = 3},
  425. { .resource = RES_VMMC2, .devgroup = DEV_GRP_NULL, .type = -1,
  426. .type2 = 3},
  427. { .resource = RES_VAUX1, .devgroup = -1, .type = -1, .type2 = 3},
  428. { .resource = RES_VAUX2, .devgroup = -1, .type = -1, .type2 = 3},
  429. { .resource = RES_VAUX3, .devgroup = -1, .type = -1, .type2 = 3},
  430. { .resource = RES_VAUX4, .devgroup = -1, .type = -1, .type2 = 3},
  431. { .resource = RES_VPLL2, .devgroup = -1, .type = -1, .type2 = 3},
  432. { .resource = RES_VDAC, .devgroup = -1, .type = -1, .type2 = 3},
  433. { .resource = RES_VSIM, .devgroup = DEV_GRP_NULL, .type = -1,
  434. .type2 = 3},
  435. { .resource = RES_CLKEN, .devgroup = DEV_GRP_P3, .type = -1,
  436. .type2 = 1 },
  437. { 0, 0},
  438. };
  439. static struct twl4030_power_data rx51_t2scripts_data __initdata = {
  440. .scripts = twl4030_scripts,
  441. .num = ARRAY_SIZE(twl4030_scripts),
  442. .resource_config = twl4030_rconfig,
  443. };
  444. static struct twl4030_platform_data rx51_twldata __initdata = {
  445. .irq_base = TWL4030_IRQ_BASE,
  446. .irq_end = TWL4030_IRQ_END,
  447. /* platform_data for children goes here */
  448. .gpio = &rx51_gpio_data,
  449. .keypad = &rx51_kp_data,
  450. .madc = &rx51_madc_data,
  451. .usb = &rx51_usb_data,
  452. .power = &rx51_t2scripts_data,
  453. .vaux1 = &rx51_vaux1,
  454. .vaux2 = &rx51_vaux2,
  455. .vaux4 = &rx51_vaux4,
  456. .vmmc1 = &rx51_vmmc1,
  457. .vsim = &rx51_vsim,
  458. .vdac = &rx51_vdac,
  459. };
  460. static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_1[] = {
  461. {
  462. I2C_BOARD_INFO("twl5030", 0x48),
  463. .flags = I2C_CLIENT_WAKE,
  464. .irq = INT_34XX_SYS_NIRQ,
  465. .platform_data = &rx51_twldata,
  466. },
  467. };
  468. static int __init rx51_i2c_init(void)
  469. {
  470. if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) ||
  471. system_rev >= SYSTEM_REV_B_USES_VAUX3)
  472. rx51_twldata.vaux3 = &rx51_vaux3_mmc;
  473. else {
  474. rx51_twldata.vaux3 = &rx51_vaux3_cam;
  475. rx51_twldata.vmmc2 = &rx51_vmmc2;
  476. }
  477. omap_register_i2c_bus(1, 2200, rx51_peripherals_i2c_board_info_1,
  478. ARRAY_SIZE(rx51_peripherals_i2c_board_info_1));
  479. omap_register_i2c_bus(2, 100, NULL, 0);
  480. omap_register_i2c_bus(3, 400, NULL, 0);
  481. return 0;
  482. }
  483. #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
  484. defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
  485. static struct mtd_partition onenand_partitions[] = {
  486. {
  487. .name = "bootloader",
  488. .offset = 0,
  489. .size = 0x20000,
  490. .mask_flags = MTD_WRITEABLE, /* Force read-only */
  491. },
  492. {
  493. .name = "config",
  494. .offset = MTDPART_OFS_APPEND,
  495. .size = 0x60000,
  496. },
  497. {
  498. .name = "log",
  499. .offset = MTDPART_OFS_APPEND,
  500. .size = 0x40000,
  501. },
  502. {
  503. .name = "kernel",
  504. .offset = MTDPART_OFS_APPEND,
  505. .size = 0x200000,
  506. },
  507. {
  508. .name = "initfs",
  509. .offset = MTDPART_OFS_APPEND,
  510. .size = 0x200000,
  511. },
  512. {
  513. .name = "rootfs",
  514. .offset = MTDPART_OFS_APPEND,
  515. .size = MTDPART_SIZ_FULL,
  516. },
  517. };
  518. static struct omap_onenand_platform_data board_onenand_data = {
  519. .cs = 0,
  520. .gpio_irq = 65,
  521. .parts = onenand_partitions,
  522. .nr_parts = ARRAY_SIZE(onenand_partitions),
  523. .flags = ONENAND_SYNC_READWRITE,
  524. };
  525. static void __init board_onenand_init(void)
  526. {
  527. gpmc_onenand_init(&board_onenand_data);
  528. }
  529. #else
  530. static inline void board_onenand_init(void)
  531. {
  532. }
  533. #endif
  534. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  535. static struct omap_smc91x_platform_data board_smc91x_data = {
  536. .cs = 1,
  537. .gpio_irq = 54,
  538. .gpio_pwrdwn = 86,
  539. .gpio_reset = 164,
  540. .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_HIGHLEVEL,
  541. };
  542. static void __init board_smc91x_init(void)
  543. {
  544. omap_cfg_reg(U8_34XX_GPIO54_DOWN);
  545. omap_cfg_reg(G25_34XX_GPIO86_OUT);
  546. omap_cfg_reg(H19_34XX_GPIO164_OUT);
  547. gpmc_smc91x_init(&board_smc91x_data);
  548. }
  549. #else
  550. static inline void board_smc91x_init(void)
  551. {
  552. }
  553. #endif
  554. void __init rx51_peripherals_init(void)
  555. {
  556. rx51_i2c_init();
  557. board_onenand_init();
  558. board_smc91x_init();
  559. rx51_add_gpio_keys();
  560. }