diff options
-rw-r--r-- | arch/arm/mach-shmobile/clock-r8a7740.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/dma-register.h | 84 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/gpio.h | 32 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/r8a7740.h | 16 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/setup-r8a7740.c | 273 |
5 files changed, 414 insertions, 1 deletions
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c index 7b9e4ab34fa2..daf3eace5dcf 100644 --- a/arch/arm/mach-shmobile/clock-r8a7740.c +++ b/arch/arm/mach-shmobile/clock-r8a7740.c | |||
@@ -463,6 +463,7 @@ enum { | |||
463 | 463 | ||
464 | MSTP230, | 464 | MSTP230, |
465 | MSTP222, | 465 | MSTP222, |
466 | MSTP218, MSTP217, MSTP216, MSTP214, | ||
466 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, | 467 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, |
467 | 468 | ||
468 | MSTP329, MSTP328, MSTP323, MSTP320, | 469 | MSTP329, MSTP328, MSTP323, MSTP320, |
@@ -485,6 +486,10 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
485 | 486 | ||
486 | [MSTP230] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 30, 0), /* SCIFA6 */ | 487 | [MSTP230] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 30, 0), /* SCIFA6 */ |
487 | [MSTP222] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */ | 488 | [MSTP222] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */ |
489 | [MSTP218] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC1 */ | ||
490 | [MSTP217] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* DMAC2 */ | ||
491 | [MSTP216] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 16, 0), /* DMAC3 */ | ||
492 | [MSTP214] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 14, 0), /* USBDMAC */ | ||
488 | [MSTP207] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */ | 493 | [MSTP207] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */ |
489 | [MSTP206] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */ | 494 | [MSTP206] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */ |
490 | [MSTP204] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */ | 495 | [MSTP204] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */ |
@@ -563,7 +568,10 @@ static struct clk_lookup lookups[] = { | |||
563 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), | 568 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), |
564 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), | 569 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), |
565 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), | 570 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), |
566 | 571 | CLKDEV_DEV_ID("sh-dma-engine.3", &mstp_clks[MSTP214]), | |
572 | CLKDEV_DEV_ID("sh-dma-engine.2", &mstp_clks[MSTP216]), | ||
573 | CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]), | ||
574 | CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), | ||
567 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]), | 575 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]), |
568 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]), | 576 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]), |
569 | 577 | ||
diff --git a/arch/arm/mach-shmobile/include/mach/dma-register.h b/arch/arm/mach-shmobile/include/mach/dma-register.h new file mode 100644 index 000000000000..97c40bd9b94f --- /dev/null +++ b/arch/arm/mach-shmobile/include/mach/dma-register.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | * SH-ARM CPU-specific DMA definitions, used by both DMA drivers | ||
3 | * | ||
4 | * Copyright (C) 2012 Renesas Solutions Corp | ||
5 | * | ||
6 | * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | ||
7 | * | ||
8 | * Based on arch/sh/include/cpu-sh4/cpu/dma-register.h | ||
9 | * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | |||
16 | #ifndef DMA_REGISTER_H | ||
17 | #define DMA_REGISTER_H | ||
18 | |||
19 | /* | ||
20 | * Direct Memory Access Controller | ||
21 | */ | ||
22 | |||
23 | /* Transmit sizes and respective CHCR register values */ | ||
24 | enum { | ||
25 | XMIT_SZ_8BIT = 0, | ||
26 | XMIT_SZ_16BIT = 1, | ||
27 | XMIT_SZ_32BIT = 2, | ||
28 | XMIT_SZ_64BIT = 7, | ||
29 | XMIT_SZ_128BIT = 3, | ||
30 | XMIT_SZ_256BIT = 4, | ||
31 | XMIT_SZ_512BIT = 5, | ||
32 | }; | ||
33 | |||
34 | /* log2(size / 8) - used to calculate number of transfers */ | ||
35 | static const unsigned int dma_ts_shift[] = { | ||
36 | [XMIT_SZ_8BIT] = 0, | ||
37 | [XMIT_SZ_16BIT] = 1, | ||
38 | [XMIT_SZ_32BIT] = 2, | ||
39 | [XMIT_SZ_64BIT] = 3, | ||
40 | [XMIT_SZ_128BIT] = 4, | ||
41 | [XMIT_SZ_256BIT] = 5, | ||
42 | [XMIT_SZ_512BIT] = 6, | ||
43 | }; | ||
44 | |||
45 | #define TS_LOW_BIT 0x3 /* --xx */ | ||
46 | #define TS_HI_BIT 0xc /* xx-- */ | ||
47 | |||
48 | #define TS_LOW_SHIFT (3) | ||
49 | #define TS_HI_SHIFT (20 - 2) /* 2 bits for shifted low TS */ | ||
50 | |||
51 | #define TS_INDEX2VAL(i) \ | ||
52 | ((((i) & TS_LOW_BIT) << TS_LOW_SHIFT) |\ | ||
53 | (((i) & TS_HI_BIT) << TS_HI_SHIFT)) | ||
54 | |||
55 | #define CHCR_TX(xmit_sz) (DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL((xmit_sz))) | ||
56 | #define CHCR_RX(xmit_sz) (DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL((xmit_sz))) | ||
57 | |||
58 | |||
59 | /* | ||
60 | * USB High-Speed DMAC | ||
61 | */ | ||
62 | /* Transmit sizes and respective CHCR register values */ | ||
63 | enum { | ||
64 | USBTS_XMIT_SZ_8BYTE = 0, | ||
65 | USBTS_XMIT_SZ_16BYTE = 1, | ||
66 | USBTS_XMIT_SZ_32BYTE = 2, | ||
67 | }; | ||
68 | |||
69 | /* log2(size / 8) - used to calculate number of transfers */ | ||
70 | static const unsigned int dma_usbts_shift[] = { | ||
71 | [USBTS_XMIT_SZ_8BYTE] = 3, | ||
72 | [USBTS_XMIT_SZ_16BYTE] = 4, | ||
73 | [USBTS_XMIT_SZ_32BYTE] = 5, | ||
74 | }; | ||
75 | |||
76 | #define USBTS_LOW_BIT 0x3 /* --xx */ | ||
77 | #define USBTS_HI_BIT 0x0 /* ---- */ | ||
78 | |||
79 | #define USBTS_LOW_SHIFT 6 | ||
80 | #define USBTS_HI_SHIFT 0 | ||
81 | |||
82 | #define USBTS_INDEX2VAL(i) (((i) & 3) << 6) | ||
83 | |||
84 | #endif /* DMA_REGISTER_H */ | ||
diff --git a/arch/arm/mach-shmobile/include/mach/gpio.h b/arch/arm/mach-shmobile/include/mach/gpio.h index de795b42232a..844507d937cb 100644 --- a/arch/arm/mach-shmobile/include/mach/gpio.h +++ b/arch/arm/mach-shmobile/include/mach/gpio.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/sh_pfc.h> | 15 | #include <linux/sh_pfc.h> |
16 | #include <linux/io.h> | ||
16 | 17 | ||
17 | #ifdef CONFIG_GPIOLIB | 18 | #ifdef CONFIG_GPIOLIB |
18 | 19 | ||
@@ -27,4 +28,35 @@ static inline int irq_to_gpio(unsigned int irq) | |||
27 | 28 | ||
28 | #endif /* CONFIG_GPIOLIB */ | 29 | #endif /* CONFIG_GPIOLIB */ |
29 | 30 | ||
31 | /* | ||
32 | * FIXME !! | ||
33 | * | ||
34 | * current gpio frame work doesn't have | ||
35 | * the method to control only pull up/down/free. | ||
36 | * this function should be replaced by correct gpio function | ||
37 | */ | ||
38 | static inline void __init gpio_direction_none(u32 addr) | ||
39 | { | ||
40 | __raw_writeb(0x00, addr); | ||
41 | } | ||
42 | |||
43 | static inline void __init gpio_request_pullup(u32 addr) | ||
44 | { | ||
45 | u8 data = __raw_readb(addr); | ||
46 | |||
47 | data &= 0x0F; | ||
48 | data |= 0xC0; | ||
49 | __raw_writeb(data, addr); | ||
50 | } | ||
51 | |||
52 | static inline void __init gpio_request_pulldown(u32 addr) | ||
53 | { | ||
54 | u8 data = __raw_readb(addr); | ||
55 | |||
56 | data &= 0x0F; | ||
57 | data |= 0xA0; | ||
58 | |||
59 | __raw_writeb(data, addr); | ||
60 | } | ||
61 | |||
30 | #endif /* __ASM_ARCH_GPIO_H */ | 62 | #endif /* __ASM_ARCH_GPIO_H */ |
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7740.h b/arch/arm/mach-shmobile/include/mach/r8a7740.h index 6468fcc5ee49..8bd7b9c136a1 100644 --- a/arch/arm/mach-shmobile/include/mach/r8a7740.h +++ b/arch/arm/mach-shmobile/include/mach/r8a7740.h | |||
@@ -588,4 +588,20 @@ enum { | |||
588 | GPIO_FN_TRACEAUD_FROM_MEMC, | 588 | GPIO_FN_TRACEAUD_FROM_MEMC, |
589 | }; | 589 | }; |
590 | 590 | ||
591 | /* DMA slave IDs */ | ||
592 | enum { | ||
593 | SHDMA_SLAVE_INVALID, | ||
594 | SHDMA_SLAVE_SDHI0_RX, | ||
595 | SHDMA_SLAVE_SDHI0_TX, | ||
596 | SHDMA_SLAVE_SDHI1_RX, | ||
597 | SHDMA_SLAVE_SDHI1_TX, | ||
598 | SHDMA_SLAVE_SDHI2_RX, | ||
599 | SHDMA_SLAVE_SDHI2_TX, | ||
600 | SHDMA_SLAVE_FSIA_RX, | ||
601 | SHDMA_SLAVE_FSIA_TX, | ||
602 | SHDMA_SLAVE_FSIB_TX, | ||
603 | SHDMA_SLAVE_USBHS_TX, | ||
604 | SHDMA_SLAVE_USBHS_RX, | ||
605 | }; | ||
606 | |||
591 | #endif /* __ASM_R8A7740_H__ */ | 607 | #endif /* __ASM_R8A7740_H__ */ |
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c index 366311b3dc73..48d7bbf0d2e2 100644 --- a/arch/arm/mach-shmobile/setup-r8a7740.c +++ b/arch/arm/mach-shmobile/setup-r8a7740.c | |||
@@ -24,7 +24,10 @@ | |||
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/serial_sci.h> | 26 | #include <linux/serial_sci.h> |
27 | #include <linux/sh_dma.h> | ||
27 | #include <linux/sh_timer.h> | 28 | #include <linux/sh_timer.h> |
29 | #include <linux/dma-mapping.h> | ||
30 | #include <mach/dma-register.h> | ||
28 | #include <mach/r8a7740.h> | 31 | #include <mach/r8a7740.h> |
29 | #include <mach/common.h> | 32 | #include <mach/common.h> |
30 | #include <mach/irqs.h> | 33 | #include <mach/irqs.h> |
@@ -276,6 +279,272 @@ static struct platform_device *r8a7740_early_devices[] __initdata = { | |||
276 | &cmt10_device, | 279 | &cmt10_device, |
277 | }; | 280 | }; |
278 | 281 | ||
282 | /* DMA */ | ||
283 | static const struct sh_dmae_slave_config r8a7740_dmae_slaves[] = { | ||
284 | { | ||
285 | .slave_id = SHDMA_SLAVE_SDHI0_TX, | ||
286 | .addr = 0xe6850030, | ||
287 | .chcr = CHCR_TX(XMIT_SZ_16BIT), | ||
288 | .mid_rid = 0xc1, | ||
289 | }, { | ||
290 | .slave_id = SHDMA_SLAVE_SDHI0_RX, | ||
291 | .addr = 0xe6850030, | ||
292 | .chcr = CHCR_RX(XMIT_SZ_16BIT), | ||
293 | .mid_rid = 0xc2, | ||
294 | }, { | ||
295 | .slave_id = SHDMA_SLAVE_SDHI1_TX, | ||
296 | .addr = 0xe6860030, | ||
297 | .chcr = CHCR_TX(XMIT_SZ_16BIT), | ||
298 | .mid_rid = 0xc9, | ||
299 | }, { | ||
300 | .slave_id = SHDMA_SLAVE_SDHI1_RX, | ||
301 | .addr = 0xe6860030, | ||
302 | .chcr = CHCR_RX(XMIT_SZ_16BIT), | ||
303 | .mid_rid = 0xca, | ||
304 | }, { | ||
305 | .slave_id = SHDMA_SLAVE_SDHI2_TX, | ||
306 | .addr = 0xe6870030, | ||
307 | .chcr = CHCR_TX(XMIT_SZ_16BIT), | ||
308 | .mid_rid = 0xcd, | ||
309 | }, { | ||
310 | .slave_id = SHDMA_SLAVE_SDHI2_RX, | ||
311 | .addr = 0xe6870030, | ||
312 | .chcr = CHCR_RX(XMIT_SZ_16BIT), | ||
313 | .mid_rid = 0xce, | ||
314 | }, { | ||
315 | .slave_id = SHDMA_SLAVE_FSIA_TX, | ||
316 | .addr = 0xfe1f0024, | ||
317 | .chcr = CHCR_TX(XMIT_SZ_32BIT), | ||
318 | .mid_rid = 0xb1, | ||
319 | }, { | ||
320 | .slave_id = SHDMA_SLAVE_FSIA_RX, | ||
321 | .addr = 0xfe1f0020, | ||
322 | .chcr = CHCR_RX(XMIT_SZ_32BIT), | ||
323 | .mid_rid = 0xb2, | ||
324 | }, { | ||
325 | .slave_id = SHDMA_SLAVE_FSIB_TX, | ||
326 | .addr = 0xfe1f0064, | ||
327 | .chcr = CHCR_TX(XMIT_SZ_32BIT), | ||
328 | .mid_rid = 0xb5, | ||
329 | }, | ||
330 | }; | ||
331 | |||
332 | #define DMA_CHANNEL(a, b, c) \ | ||
333 | { \ | ||
334 | .offset = a, \ | ||
335 | .dmars = b, \ | ||
336 | .dmars_bit = c, \ | ||
337 | .chclr_offset = (0x220 - 0x20) + a \ | ||
338 | } | ||
339 | |||
340 | static const struct sh_dmae_channel r8a7740_dmae_channels[] = { | ||
341 | DMA_CHANNEL(0x00, 0, 0), | ||
342 | DMA_CHANNEL(0x10, 0, 8), | ||
343 | DMA_CHANNEL(0x20, 4, 0), | ||
344 | DMA_CHANNEL(0x30, 4, 8), | ||
345 | DMA_CHANNEL(0x50, 8, 0), | ||
346 | DMA_CHANNEL(0x60, 8, 8), | ||
347 | }; | ||
348 | |||
349 | static struct sh_dmae_pdata dma_platform_data = { | ||
350 | .slave = r8a7740_dmae_slaves, | ||
351 | .slave_num = ARRAY_SIZE(r8a7740_dmae_slaves), | ||
352 | .channel = r8a7740_dmae_channels, | ||
353 | .channel_num = ARRAY_SIZE(r8a7740_dmae_channels), | ||
354 | .ts_low_shift = TS_LOW_SHIFT, | ||
355 | .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT, | ||
356 | .ts_high_shift = TS_HI_SHIFT, | ||
357 | .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT, | ||
358 | .ts_shift = dma_ts_shift, | ||
359 | .ts_shift_num = ARRAY_SIZE(dma_ts_shift), | ||
360 | .dmaor_init = DMAOR_DME, | ||
361 | .chclr_present = 1, | ||
362 | }; | ||
363 | |||
364 | /* Resource order important! */ | ||
365 | static struct resource r8a7740_dmae0_resources[] = { | ||
366 | { | ||
367 | /* Channel registers and DMAOR */ | ||
368 | .start = 0xfe008020, | ||
369 | .end = 0xfe00828f, | ||
370 | .flags = IORESOURCE_MEM, | ||
371 | }, | ||
372 | { | ||
373 | /* DMARSx */ | ||
374 | .start = 0xfe009000, | ||
375 | .end = 0xfe00900b, | ||
376 | .flags = IORESOURCE_MEM, | ||
377 | }, | ||
378 | { | ||
379 | .name = "error_irq", | ||
380 | .start = evt2irq(0x20c0), | ||
381 | .end = evt2irq(0x20c0), | ||
382 | .flags = IORESOURCE_IRQ, | ||
383 | }, | ||
384 | { | ||
385 | /* IRQ for channels 0-5 */ | ||
386 | .start = evt2irq(0x2000), | ||
387 | .end = evt2irq(0x20a0), | ||
388 | .flags = IORESOURCE_IRQ, | ||
389 | }, | ||
390 | }; | ||
391 | |||
392 | /* Resource order important! */ | ||
393 | static struct resource r8a7740_dmae1_resources[] = { | ||
394 | { | ||
395 | /* Channel registers and DMAOR */ | ||
396 | .start = 0xfe018020, | ||
397 | .end = 0xfe01828f, | ||
398 | .flags = IORESOURCE_MEM, | ||
399 | }, | ||
400 | { | ||
401 | /* DMARSx */ | ||
402 | .start = 0xfe019000, | ||
403 | .end = 0xfe01900b, | ||
404 | .flags = IORESOURCE_MEM, | ||
405 | }, | ||
406 | { | ||
407 | .name = "error_irq", | ||
408 | .start = evt2irq(0x21c0), | ||
409 | .end = evt2irq(0x21c0), | ||
410 | .flags = IORESOURCE_IRQ, | ||
411 | }, | ||
412 | { | ||
413 | /* IRQ for channels 0-5 */ | ||
414 | .start = evt2irq(0x2100), | ||
415 | .end = evt2irq(0x21a0), | ||
416 | .flags = IORESOURCE_IRQ, | ||
417 | }, | ||
418 | }; | ||
419 | |||
420 | /* Resource order important! */ | ||
421 | static struct resource r8a7740_dmae2_resources[] = { | ||
422 | { | ||
423 | /* Channel registers and DMAOR */ | ||
424 | .start = 0xfe028020, | ||
425 | .end = 0xfe02828f, | ||
426 | .flags = IORESOURCE_MEM, | ||
427 | }, | ||
428 | { | ||
429 | /* DMARSx */ | ||
430 | .start = 0xfe029000, | ||
431 | .end = 0xfe02900b, | ||
432 | .flags = IORESOURCE_MEM, | ||
433 | }, | ||
434 | { | ||
435 | .name = "error_irq", | ||
436 | .start = evt2irq(0x22c0), | ||
437 | .end = evt2irq(0x22c0), | ||
438 | .flags = IORESOURCE_IRQ, | ||
439 | }, | ||
440 | { | ||
441 | /* IRQ for channels 0-5 */ | ||
442 | .start = evt2irq(0x2200), | ||
443 | .end = evt2irq(0x22a0), | ||
444 | .flags = IORESOURCE_IRQ, | ||
445 | }, | ||
446 | }; | ||
447 | |||
448 | static struct platform_device dma0_device = { | ||
449 | .name = "sh-dma-engine", | ||
450 | .id = 0, | ||
451 | .resource = r8a7740_dmae0_resources, | ||
452 | .num_resources = ARRAY_SIZE(r8a7740_dmae0_resources), | ||
453 | .dev = { | ||
454 | .platform_data = &dma_platform_data, | ||
455 | }, | ||
456 | }; | ||
457 | |||
458 | static struct platform_device dma1_device = { | ||
459 | .name = "sh-dma-engine", | ||
460 | .id = 1, | ||
461 | .resource = r8a7740_dmae1_resources, | ||
462 | .num_resources = ARRAY_SIZE(r8a7740_dmae1_resources), | ||
463 | .dev = { | ||
464 | .platform_data = &dma_platform_data, | ||
465 | }, | ||
466 | }; | ||
467 | |||
468 | static struct platform_device dma2_device = { | ||
469 | .name = "sh-dma-engine", | ||
470 | .id = 2, | ||
471 | .resource = r8a7740_dmae2_resources, | ||
472 | .num_resources = ARRAY_SIZE(r8a7740_dmae2_resources), | ||
473 | .dev = { | ||
474 | .platform_data = &dma_platform_data, | ||
475 | }, | ||
476 | }; | ||
477 | |||
478 | /* USB-DMAC */ | ||
479 | static const struct sh_dmae_channel r8a7740_usb_dma_channels[] = { | ||
480 | { | ||
481 | .offset = 0, | ||
482 | }, { | ||
483 | .offset = 0x20, | ||
484 | }, | ||
485 | }; | ||
486 | |||
487 | static const struct sh_dmae_slave_config r8a7740_usb_dma_slaves[] = { | ||
488 | { | ||
489 | .slave_id = SHDMA_SLAVE_USBHS_TX, | ||
490 | .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE), | ||
491 | }, { | ||
492 | .slave_id = SHDMA_SLAVE_USBHS_RX, | ||
493 | .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE), | ||
494 | }, | ||
495 | }; | ||
496 | |||
497 | static struct sh_dmae_pdata usb_dma_platform_data = { | ||
498 | .slave = r8a7740_usb_dma_slaves, | ||
499 | .slave_num = ARRAY_SIZE(r8a7740_usb_dma_slaves), | ||
500 | .channel = r8a7740_usb_dma_channels, | ||
501 | .channel_num = ARRAY_SIZE(r8a7740_usb_dma_channels), | ||
502 | .ts_low_shift = USBTS_LOW_SHIFT, | ||
503 | .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT, | ||
504 | .ts_high_shift = USBTS_HI_SHIFT, | ||
505 | .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT, | ||
506 | .ts_shift = dma_usbts_shift, | ||
507 | .ts_shift_num = ARRAY_SIZE(dma_usbts_shift), | ||
508 | .dmaor_init = DMAOR_DME, | ||
509 | .chcr_offset = 0x14, | ||
510 | .chcr_ie_bit = 1 << 5, | ||
511 | .dmaor_is_32bit = 1, | ||
512 | .needs_tend_set = 1, | ||
513 | .no_dmars = 1, | ||
514 | .slave_only = 1, | ||
515 | }; | ||
516 | |||
517 | static struct resource r8a7740_usb_dma_resources[] = { | ||
518 | { | ||
519 | /* Channel registers and DMAOR */ | ||
520 | .start = 0xe68a0020, | ||
521 | .end = 0xe68a0064 - 1, | ||
522 | .flags = IORESOURCE_MEM, | ||
523 | }, | ||
524 | { | ||
525 | /* VCR/SWR/DMICR */ | ||
526 | .start = 0xe68a0000, | ||
527 | .end = 0xe68a0014 - 1, | ||
528 | .flags = IORESOURCE_MEM, | ||
529 | }, | ||
530 | { | ||
531 | /* IRQ for channels */ | ||
532 | .start = evt2irq(0x0a00), | ||
533 | .end = evt2irq(0x0a00), | ||
534 | .flags = IORESOURCE_IRQ, | ||
535 | }, | ||
536 | }; | ||
537 | |||
538 | static struct platform_device usb_dma_device = { | ||
539 | .name = "sh-dma-engine", | ||
540 | .id = 3, | ||
541 | .resource = r8a7740_usb_dma_resources, | ||
542 | .num_resources = ARRAY_SIZE(r8a7740_usb_dma_resources), | ||
543 | .dev = { | ||
544 | .platform_data = &usb_dma_platform_data, | ||
545 | }, | ||
546 | }; | ||
547 | |||
279 | /* I2C */ | 548 | /* I2C */ |
280 | static struct resource i2c0_resources[] = { | 549 | static struct resource i2c0_resources[] = { |
281 | [0] = { | 550 | [0] = { |
@@ -322,6 +591,10 @@ static struct platform_device i2c1_device = { | |||
322 | static struct platform_device *r8a7740_late_devices[] __initdata = { | 591 | static struct platform_device *r8a7740_late_devices[] __initdata = { |
323 | &i2c0_device, | 592 | &i2c0_device, |
324 | &i2c1_device, | 593 | &i2c1_device, |
594 | &dma0_device, | ||
595 | &dma1_device, | ||
596 | &dma2_device, | ||
597 | &usb_dma_device, | ||
325 | }; | 598 | }; |
326 | 599 | ||
327 | /* | 600 | /* |