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