board-sh7757lcr.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. /*
  2. * Renesas R0P7757LC0012RL Support.
  3. *
  4. * Copyright (C) 2009 - 2010 Renesas Solutions Corp.
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/init.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/gpio.h>
  13. #include <linux/irq.h>
  14. #include <linux/regulator/fixed.h>
  15. #include <linux/regulator/machine.h>
  16. #include <linux/spi/spi.h>
  17. #include <linux/spi/flash.h>
  18. #include <linux/io.h>
  19. #include <linux/mfd/tmio.h>
  20. #include <linux/mmc/host.h>
  21. #include <linux/mmc/sh_mmcif.h>
  22. #include <linux/mmc/sh_mobile_sdhi.h>
  23. #include <linux/sh_eth.h>
  24. #include <linux/sh_intc.h>
  25. #include <linux/usb/renesas_usbhs.h>
  26. #include <cpu/sh7757.h>
  27. #include <asm/heartbeat.h>
  28. static struct resource heartbeat_resource = {
  29. .start = 0xffec005c, /* PUDR */
  30. .end = 0xffec005c,
  31. .flags = IORESOURCE_MEM | IORESOURCE_MEM_8BIT,
  32. };
  33. static unsigned char heartbeat_bit_pos[] = { 0, 1, 2, 3 };
  34. static struct heartbeat_data heartbeat_data = {
  35. .bit_pos = heartbeat_bit_pos,
  36. .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
  37. .flags = HEARTBEAT_INVERTED,
  38. };
  39. static struct platform_device heartbeat_device = {
  40. .name = "heartbeat",
  41. .id = -1,
  42. .dev = {
  43. .platform_data = &heartbeat_data,
  44. },
  45. .num_resources = 1,
  46. .resource = &heartbeat_resource,
  47. };
  48. /* Fast Ethernet */
  49. #define GBECONT 0xffc10100
  50. #define GBECONT_RMII1 BIT(17)
  51. #define GBECONT_RMII0 BIT(16)
  52. static void sh7757_eth_set_mdio_gate(void *addr)
  53. {
  54. if (((unsigned long)addr & 0x00000fff) < 0x0800)
  55. writel(readl(GBECONT) | GBECONT_RMII0, GBECONT);
  56. else
  57. writel(readl(GBECONT) | GBECONT_RMII1, GBECONT);
  58. }
  59. static struct resource sh_eth0_resources[] = {
  60. {
  61. .start = 0xfef00000,
  62. .end = 0xfef001ff,
  63. .flags = IORESOURCE_MEM,
  64. }, {
  65. .start = evt2irq(0xc80),
  66. .end = evt2irq(0xc80),
  67. .flags = IORESOURCE_IRQ,
  68. },
  69. };
  70. static struct sh_eth_plat_data sh7757_eth0_pdata = {
  71. .phy = 1,
  72. .edmac_endian = EDMAC_LITTLE_ENDIAN,
  73. .set_mdio_gate = sh7757_eth_set_mdio_gate,
  74. };
  75. static struct platform_device sh7757_eth0_device = {
  76. .name = "sh7757-ether",
  77. .resource = sh_eth0_resources,
  78. .id = 0,
  79. .num_resources = ARRAY_SIZE(sh_eth0_resources),
  80. .dev = {
  81. .platform_data = &sh7757_eth0_pdata,
  82. },
  83. };
  84. static struct resource sh_eth1_resources[] = {
  85. {
  86. .start = 0xfef00800,
  87. .end = 0xfef009ff,
  88. .flags = IORESOURCE_MEM,
  89. }, {
  90. .start = evt2irq(0xc80),
  91. .end = evt2irq(0xc80),
  92. .flags = IORESOURCE_IRQ,
  93. },
  94. };
  95. static struct sh_eth_plat_data sh7757_eth1_pdata = {
  96. .phy = 1,
  97. .edmac_endian = EDMAC_LITTLE_ENDIAN,
  98. .set_mdio_gate = sh7757_eth_set_mdio_gate,
  99. };
  100. static struct platform_device sh7757_eth1_device = {
  101. .name = "sh7757-ether",
  102. .resource = sh_eth1_resources,
  103. .id = 1,
  104. .num_resources = ARRAY_SIZE(sh_eth1_resources),
  105. .dev = {
  106. .platform_data = &sh7757_eth1_pdata,
  107. },
  108. };
  109. static void sh7757_eth_giga_set_mdio_gate(void *addr)
  110. {
  111. if (((unsigned long)addr & 0x00000fff) < 0x0800) {
  112. gpio_set_value(GPIO_PTT4, 1);
  113. writel(readl(GBECONT) & ~GBECONT_RMII0, GBECONT);
  114. } else {
  115. gpio_set_value(GPIO_PTT4, 0);
  116. writel(readl(GBECONT) & ~GBECONT_RMII1, GBECONT);
  117. }
  118. }
  119. static struct resource sh_eth_giga0_resources[] = {
  120. {
  121. .start = 0xfee00000,
  122. .end = 0xfee007ff,
  123. .flags = IORESOURCE_MEM,
  124. }, {
  125. /* TSU */
  126. .start = 0xfee01800,
  127. .end = 0xfee01fff,
  128. .flags = IORESOURCE_MEM,
  129. }, {
  130. .start = evt2irq(0x2960),
  131. .end = evt2irq(0x2960),
  132. .flags = IORESOURCE_IRQ,
  133. },
  134. };
  135. static struct sh_eth_plat_data sh7757_eth_giga0_pdata = {
  136. .phy = 18,
  137. .edmac_endian = EDMAC_LITTLE_ENDIAN,
  138. .set_mdio_gate = sh7757_eth_giga_set_mdio_gate,
  139. .phy_interface = PHY_INTERFACE_MODE_RGMII_ID,
  140. };
  141. static struct platform_device sh7757_eth_giga0_device = {
  142. .name = "sh7757-gether",
  143. .resource = sh_eth_giga0_resources,
  144. .id = 2,
  145. .num_resources = ARRAY_SIZE(sh_eth_giga0_resources),
  146. .dev = {
  147. .platform_data = &sh7757_eth_giga0_pdata,
  148. },
  149. };
  150. static struct resource sh_eth_giga1_resources[] = {
  151. {
  152. .start = 0xfee00800,
  153. .end = 0xfee00fff,
  154. .flags = IORESOURCE_MEM,
  155. }, {
  156. /* TSU */
  157. .start = 0xfee01800,
  158. .end = 0xfee01fff,
  159. .flags = IORESOURCE_MEM,
  160. }, {
  161. .start = evt2irq(0x2980),
  162. .end = evt2irq(0x2980),
  163. .flags = IORESOURCE_IRQ,
  164. },
  165. };
  166. static struct sh_eth_plat_data sh7757_eth_giga1_pdata = {
  167. .phy = 19,
  168. .edmac_endian = EDMAC_LITTLE_ENDIAN,
  169. .set_mdio_gate = sh7757_eth_giga_set_mdio_gate,
  170. .phy_interface = PHY_INTERFACE_MODE_RGMII_ID,
  171. };
  172. static struct platform_device sh7757_eth_giga1_device = {
  173. .name = "sh7757-gether",
  174. .resource = sh_eth_giga1_resources,
  175. .id = 3,
  176. .num_resources = ARRAY_SIZE(sh_eth_giga1_resources),
  177. .dev = {
  178. .platform_data = &sh7757_eth_giga1_pdata,
  179. },
  180. };
  181. /* Fixed 3.3V regulator to be used by SDHI0, MMCIF */
  182. static struct regulator_consumer_supply fixed3v3_power_consumers[] =
  183. {
  184. REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
  185. REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
  186. REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
  187. REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
  188. };
  189. /* SH_MMCIF */
  190. static struct resource sh_mmcif_resources[] = {
  191. [0] = {
  192. .start = 0xffcb0000,
  193. .end = 0xffcb00ff,
  194. .flags = IORESOURCE_MEM,
  195. },
  196. [1] = {
  197. .start = evt2irq(0x1c60),
  198. .flags = IORESOURCE_IRQ,
  199. },
  200. [2] = {
  201. .start = evt2irq(0x1c80),
  202. .flags = IORESOURCE_IRQ,
  203. },
  204. };
  205. static struct sh_mmcif_plat_data sh_mmcif_plat = {
  206. .sup_pclk = 0x0f,
  207. .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA |
  208. MMC_CAP_NONREMOVABLE,
  209. .ocr = MMC_VDD_32_33 | MMC_VDD_33_34,
  210. .slave_id_tx = SHDMA_SLAVE_MMCIF_TX,
  211. .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
  212. };
  213. static struct platform_device sh_mmcif_device = {
  214. .name = "sh_mmcif",
  215. .id = 0,
  216. .dev = {
  217. .platform_data = &sh_mmcif_plat,
  218. },
  219. .num_resources = ARRAY_SIZE(sh_mmcif_resources),
  220. .resource = sh_mmcif_resources,
  221. };
  222. /* SDHI0 */
  223. static struct tmio_mmc_data sdhi_info = {
  224. .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI_TX,
  225. .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI_RX,
  226. .capabilities = MMC_CAP_SD_HIGHSPEED,
  227. };
  228. static struct resource sdhi_resources[] = {
  229. [0] = {
  230. .start = 0xffe50000,
  231. .end = 0xffe500ff,
  232. .flags = IORESOURCE_MEM,
  233. },
  234. [1] = {
  235. .start = evt2irq(0x480),
  236. .flags = IORESOURCE_IRQ,
  237. },
  238. };
  239. static struct platform_device sdhi_device = {
  240. .name = "sh_mobile_sdhi",
  241. .num_resources = ARRAY_SIZE(sdhi_resources),
  242. .resource = sdhi_resources,
  243. .id = 0,
  244. .dev = {
  245. .platform_data = &sdhi_info,
  246. },
  247. };
  248. static int usbhs0_get_id(struct platform_device *pdev)
  249. {
  250. return USBHS_GADGET;
  251. }
  252. static struct renesas_usbhs_platform_info usb0_data = {
  253. .platform_callback = {
  254. .get_id = usbhs0_get_id,
  255. },
  256. .driver_param = {
  257. .buswait_bwait = 5,
  258. }
  259. };
  260. static struct resource usb0_resources[] = {
  261. [0] = {
  262. .start = 0xfe450000,
  263. .end = 0xfe4501ff,
  264. .flags = IORESOURCE_MEM,
  265. },
  266. [1] = {
  267. .start = evt2irq(0x840),
  268. .end = evt2irq(0x840),
  269. .flags = IORESOURCE_IRQ,
  270. },
  271. };
  272. static struct platform_device usb0_device = {
  273. .name = "renesas_usbhs",
  274. .id = 0,
  275. .dev = {
  276. .platform_data = &usb0_data,
  277. },
  278. .num_resources = ARRAY_SIZE(usb0_resources),
  279. .resource = usb0_resources,
  280. };
  281. static struct platform_device *sh7757lcr_devices[] __initdata = {
  282. &heartbeat_device,
  283. &sh7757_eth0_device,
  284. &sh7757_eth1_device,
  285. &sh7757_eth_giga0_device,
  286. &sh7757_eth_giga1_device,
  287. &sh_mmcif_device,
  288. &sdhi_device,
  289. &usb0_device,
  290. };
  291. static struct flash_platform_data spi_flash_data = {
  292. .name = "m25p80",
  293. .type = "m25px64",
  294. };
  295. static struct spi_board_info spi_board_info[] = {
  296. {
  297. .modalias = "m25p80",
  298. .max_speed_hz = 25000000,
  299. .bus_num = 0,
  300. .chip_select = 1,
  301. .platform_data = &spi_flash_data,
  302. },
  303. };
  304. static int __init sh7757lcr_devices_setup(void)
  305. {
  306. regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
  307. ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
  308. /* RGMII (PTA) */
  309. gpio_request(GPIO_FN_ET0_MDC, NULL);
  310. gpio_request(GPIO_FN_ET0_MDIO, NULL);
  311. gpio_request(GPIO_FN_ET1_MDC, NULL);
  312. gpio_request(GPIO_FN_ET1_MDIO, NULL);
  313. /* ONFI (PTB, PTZ) */
  314. gpio_request(GPIO_FN_ON_NRE, NULL);
  315. gpio_request(GPIO_FN_ON_NWE, NULL);
  316. gpio_request(GPIO_FN_ON_NWP, NULL);
  317. gpio_request(GPIO_FN_ON_NCE0, NULL);
  318. gpio_request(GPIO_FN_ON_R_B0, NULL);
  319. gpio_request(GPIO_FN_ON_ALE, NULL);
  320. gpio_request(GPIO_FN_ON_CLE, NULL);
  321. gpio_request(GPIO_FN_ON_DQ7, NULL);
  322. gpio_request(GPIO_FN_ON_DQ6, NULL);
  323. gpio_request(GPIO_FN_ON_DQ5, NULL);
  324. gpio_request(GPIO_FN_ON_DQ4, NULL);
  325. gpio_request(GPIO_FN_ON_DQ3, NULL);
  326. gpio_request(GPIO_FN_ON_DQ2, NULL);
  327. gpio_request(GPIO_FN_ON_DQ1, NULL);
  328. gpio_request(GPIO_FN_ON_DQ0, NULL);
  329. /* IRQ8 to 0 (PTB, PTC) */
  330. gpio_request(GPIO_FN_IRQ8, NULL);
  331. gpio_request(GPIO_FN_IRQ7, NULL);
  332. gpio_request(GPIO_FN_IRQ6, NULL);
  333. gpio_request(GPIO_FN_IRQ5, NULL);
  334. gpio_request(GPIO_FN_IRQ4, NULL);
  335. gpio_request(GPIO_FN_IRQ3, NULL);
  336. gpio_request(GPIO_FN_IRQ2, NULL);
  337. gpio_request(GPIO_FN_IRQ1, NULL);
  338. gpio_request(GPIO_FN_IRQ0, NULL);
  339. /* SPI0 (PTD) */
  340. gpio_request(GPIO_FN_SP0_MOSI, NULL);
  341. gpio_request(GPIO_FN_SP0_MISO, NULL);
  342. gpio_request(GPIO_FN_SP0_SCK, NULL);
  343. gpio_request(GPIO_FN_SP0_SCK_FB, NULL);
  344. gpio_request(GPIO_FN_SP0_SS0, NULL);
  345. gpio_request(GPIO_FN_SP0_SS1, NULL);
  346. gpio_request(GPIO_FN_SP0_SS2, NULL);
  347. gpio_request(GPIO_FN_SP0_SS3, NULL);
  348. /* RMII 0/1 (PTE, PTF) */
  349. gpio_request(GPIO_FN_RMII0_CRS_DV, NULL);
  350. gpio_request(GPIO_FN_RMII0_TXD1, NULL);
  351. gpio_request(GPIO_FN_RMII0_TXD0, NULL);
  352. gpio_request(GPIO_FN_RMII0_TXEN, NULL);
  353. gpio_request(GPIO_FN_RMII0_REFCLK, NULL);
  354. gpio_request(GPIO_FN_RMII0_RXD1, NULL);
  355. gpio_request(GPIO_FN_RMII0_RXD0, NULL);
  356. gpio_request(GPIO_FN_RMII0_RX_ER, NULL);
  357. gpio_request(GPIO_FN_RMII1_CRS_DV, NULL);
  358. gpio_request(GPIO_FN_RMII1_TXD1, NULL);
  359. gpio_request(GPIO_FN_RMII1_TXD0, NULL);
  360. gpio_request(GPIO_FN_RMII1_TXEN, NULL);
  361. gpio_request(GPIO_FN_RMII1_REFCLK, NULL);
  362. gpio_request(GPIO_FN_RMII1_RXD1, NULL);
  363. gpio_request(GPIO_FN_RMII1_RXD0, NULL);
  364. gpio_request(GPIO_FN_RMII1_RX_ER, NULL);
  365. /* eMMC (PTG) */
  366. gpio_request(GPIO_FN_MMCCLK, NULL);
  367. gpio_request(GPIO_FN_MMCCMD, NULL);
  368. gpio_request(GPIO_FN_MMCDAT7, NULL);
  369. gpio_request(GPIO_FN_MMCDAT6, NULL);
  370. gpio_request(GPIO_FN_MMCDAT5, NULL);
  371. gpio_request(GPIO_FN_MMCDAT4, NULL);
  372. gpio_request(GPIO_FN_MMCDAT3, NULL);
  373. gpio_request(GPIO_FN_MMCDAT2, NULL);
  374. gpio_request(GPIO_FN_MMCDAT1, NULL);
  375. gpio_request(GPIO_FN_MMCDAT0, NULL);
  376. /* LPC (PTG, PTH, PTQ, PTU) */
  377. gpio_request(GPIO_FN_SERIRQ, NULL);
  378. gpio_request(GPIO_FN_LPCPD, NULL);
  379. gpio_request(GPIO_FN_LDRQ, NULL);
  380. gpio_request(GPIO_FN_WP, NULL);
  381. gpio_request(GPIO_FN_FMS0, NULL);
  382. gpio_request(GPIO_FN_LAD3, NULL);
  383. gpio_request(GPIO_FN_LAD2, NULL);
  384. gpio_request(GPIO_FN_LAD1, NULL);
  385. gpio_request(GPIO_FN_LAD0, NULL);
  386. gpio_request(GPIO_FN_LFRAME, NULL);
  387. gpio_request(GPIO_FN_LRESET, NULL);
  388. gpio_request(GPIO_FN_LCLK, NULL);
  389. gpio_request(GPIO_FN_LGPIO7, NULL);
  390. gpio_request(GPIO_FN_LGPIO6, NULL);
  391. gpio_request(GPIO_FN_LGPIO5, NULL);
  392. gpio_request(GPIO_FN_LGPIO4, NULL);
  393. /* SPI1 (PTH) */
  394. gpio_request(GPIO_FN_SP1_MOSI, NULL);
  395. gpio_request(GPIO_FN_SP1_MISO, NULL);
  396. gpio_request(GPIO_FN_SP1_SCK, NULL);
  397. gpio_request(GPIO_FN_SP1_SCK_FB, NULL);
  398. gpio_request(GPIO_FN_SP1_SS0, NULL);
  399. gpio_request(GPIO_FN_SP1_SS1, NULL);
  400. /* SDHI (PTI) */
  401. gpio_request(GPIO_FN_SD_WP, NULL);
  402. gpio_request(GPIO_FN_SD_CD, NULL);
  403. gpio_request(GPIO_FN_SD_CLK, NULL);
  404. gpio_request(GPIO_FN_SD_CMD, NULL);
  405. gpio_request(GPIO_FN_SD_D3, NULL);
  406. gpio_request(GPIO_FN_SD_D2, NULL);
  407. gpio_request(GPIO_FN_SD_D1, NULL);
  408. gpio_request(GPIO_FN_SD_D0, NULL);
  409. /* SCIF3/4 (PTJ, PTW) */
  410. gpio_request(GPIO_FN_RTS3, NULL);
  411. gpio_request(GPIO_FN_CTS3, NULL);
  412. gpio_request(GPIO_FN_TXD3, NULL);
  413. gpio_request(GPIO_FN_RXD3, NULL);
  414. gpio_request(GPIO_FN_RTS4, NULL);
  415. gpio_request(GPIO_FN_RXD4, NULL);
  416. gpio_request(GPIO_FN_TXD4, NULL);
  417. gpio_request(GPIO_FN_CTS4, NULL);
  418. /* SERMUX (PTK, PTL, PTO, PTV) */
  419. gpio_request(GPIO_FN_COM2_TXD, NULL);
  420. gpio_request(GPIO_FN_COM2_RXD, NULL);
  421. gpio_request(GPIO_FN_COM2_RTS, NULL);
  422. gpio_request(GPIO_FN_COM2_CTS, NULL);
  423. gpio_request(GPIO_FN_COM2_DTR, NULL);
  424. gpio_request(GPIO_FN_COM2_DSR, NULL);
  425. gpio_request(GPIO_FN_COM2_DCD, NULL);
  426. gpio_request(GPIO_FN_COM2_RI, NULL);
  427. gpio_request(GPIO_FN_RAC_RXD, NULL);
  428. gpio_request(GPIO_FN_RAC_RTS, NULL);
  429. gpio_request(GPIO_FN_RAC_CTS, NULL);
  430. gpio_request(GPIO_FN_RAC_DTR, NULL);
  431. gpio_request(GPIO_FN_RAC_DSR, NULL);
  432. gpio_request(GPIO_FN_RAC_DCD, NULL);
  433. gpio_request(GPIO_FN_RAC_TXD, NULL);
  434. gpio_request(GPIO_FN_COM1_TXD, NULL);
  435. gpio_request(GPIO_FN_COM1_RXD, NULL);
  436. gpio_request(GPIO_FN_COM1_RTS, NULL);
  437. gpio_request(GPIO_FN_COM1_CTS, NULL);
  438. writeb(0x10, 0xfe470000); /* SMR0: SerMux mode 0 */
  439. /* IIC (PTM, PTR, PTS) */
  440. gpio_request(GPIO_FN_SDA7, NULL);
  441. gpio_request(GPIO_FN_SCL7, NULL);
  442. gpio_request(GPIO_FN_SDA6, NULL);
  443. gpio_request(GPIO_FN_SCL6, NULL);
  444. gpio_request(GPIO_FN_SDA5, NULL);
  445. gpio_request(GPIO_FN_SCL5, NULL);
  446. gpio_request(GPIO_FN_SDA4, NULL);
  447. gpio_request(GPIO_FN_SCL4, NULL);
  448. gpio_request(GPIO_FN_SDA3, NULL);
  449. gpio_request(GPIO_FN_SCL3, NULL);
  450. gpio_request(GPIO_FN_SDA2, NULL);
  451. gpio_request(GPIO_FN_SCL2, NULL);
  452. gpio_request(GPIO_FN_SDA1, NULL);
  453. gpio_request(GPIO_FN_SCL1, NULL);
  454. gpio_request(GPIO_FN_SDA0, NULL);
  455. gpio_request(GPIO_FN_SCL0, NULL);
  456. /* USB (PTN) */
  457. gpio_request(GPIO_FN_VBUS_EN, NULL);
  458. gpio_request(GPIO_FN_VBUS_OC, NULL);
  459. /* SGPIO1/0 (PTN, PTO) */
  460. gpio_request(GPIO_FN_SGPIO1_CLK, NULL);
  461. gpio_request(GPIO_FN_SGPIO1_LOAD, NULL);
  462. gpio_request(GPIO_FN_SGPIO1_DI, NULL);
  463. gpio_request(GPIO_FN_SGPIO1_DO, NULL);
  464. gpio_request(GPIO_FN_SGPIO0_CLK, NULL);
  465. gpio_request(GPIO_FN_SGPIO0_LOAD, NULL);
  466. gpio_request(GPIO_FN_SGPIO0_DI, NULL);
  467. gpio_request(GPIO_FN_SGPIO0_DO, NULL);
  468. /* WDT (PTN) */
  469. gpio_request(GPIO_FN_SUB_CLKIN, NULL);
  470. /* System (PTT) */
  471. gpio_request(GPIO_FN_STATUS1, NULL);
  472. gpio_request(GPIO_FN_STATUS0, NULL);
  473. /* PWMX (PTT) */
  474. gpio_request(GPIO_FN_PWMX1, NULL);
  475. gpio_request(GPIO_FN_PWMX0, NULL);
  476. /* R-SPI (PTV) */
  477. gpio_request(GPIO_FN_R_SPI_MOSI, NULL);
  478. gpio_request(GPIO_FN_R_SPI_MISO, NULL);
  479. gpio_request(GPIO_FN_R_SPI_RSPCK, NULL);
  480. gpio_request(GPIO_FN_R_SPI_SSL0, NULL);
  481. gpio_request(GPIO_FN_R_SPI_SSL1, NULL);
  482. /* EVC (PTV, PTW) */
  483. gpio_request(GPIO_FN_EVENT7, NULL);
  484. gpio_request(GPIO_FN_EVENT6, NULL);
  485. gpio_request(GPIO_FN_EVENT5, NULL);
  486. gpio_request(GPIO_FN_EVENT4, NULL);
  487. gpio_request(GPIO_FN_EVENT3, NULL);
  488. gpio_request(GPIO_FN_EVENT2, NULL);
  489. gpio_request(GPIO_FN_EVENT1, NULL);
  490. gpio_request(GPIO_FN_EVENT0, NULL);
  491. /* LED for heartbeat */
  492. gpio_request(GPIO_PTU3, NULL);
  493. gpio_direction_output(GPIO_PTU3, 1);
  494. gpio_request(GPIO_PTU2, NULL);
  495. gpio_direction_output(GPIO_PTU2, 1);
  496. gpio_request(GPIO_PTU1, NULL);
  497. gpio_direction_output(GPIO_PTU1, 1);
  498. gpio_request(GPIO_PTU0, NULL);
  499. gpio_direction_output(GPIO_PTU0, 1);
  500. /* control for MDIO of Gigabit Ethernet */
  501. gpio_request(GPIO_PTT4, NULL);
  502. gpio_direction_output(GPIO_PTT4, 1);
  503. /* control for eMMC */
  504. gpio_request(GPIO_PTT7, NULL); /* eMMC_RST# */
  505. gpio_direction_output(GPIO_PTT7, 0);
  506. gpio_request(GPIO_PTT6, NULL); /* eMMC_INDEX# */
  507. gpio_direction_output(GPIO_PTT6, 0);
  508. gpio_request(GPIO_PTT5, NULL); /* eMMC_PRST# */
  509. gpio_direction_output(GPIO_PTT5, 1);
  510. /* register SPI device information */
  511. spi_register_board_info(spi_board_info,
  512. ARRAY_SIZE(spi_board_info));
  513. /* General platform */
  514. return platform_add_devices(sh7757lcr_devices,
  515. ARRAY_SIZE(sh7757lcr_devices));
  516. }
  517. arch_initcall(sh7757lcr_devices_setup);
  518. /* Initialize IRQ setting */
  519. void __init init_sh7757lcr_IRQ(void)
  520. {
  521. plat_irq_setup_pins(IRQ_MODE_IRQ7654);
  522. plat_irq_setup_pins(IRQ_MODE_IRQ3210);
  523. }
  524. /* Initialize the board */
  525. static void __init sh7757lcr_setup(char **cmdline_p)
  526. {
  527. printk(KERN_INFO "Renesas R0P7757LC0012RL support.\n");
  528. }
  529. static int sh7757lcr_mode_pins(void)
  530. {
  531. int value = 0;
  532. /* These are the factory default settings of S3 (Low active).
  533. * If you change these dip switches then you will need to
  534. * adjust the values below as well.
  535. */
  536. value |= MODE_PIN0; /* Clock Mode: 1 */
  537. return value;
  538. }
  539. /* The Machine Vector */
  540. static struct sh_machine_vector mv_sh7757lcr __initmv = {
  541. .mv_name = "SH7757LCR",
  542. .mv_setup = sh7757lcr_setup,
  543. .mv_init_irq = init_sh7757lcr_IRQ,
  544. .mv_mode_pins = sh7757lcr_mode_pins,
  545. };