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