diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2014-01-06 03:32:54 -0500 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2014-02-03 20:25:00 -0500 |
commit | 2c578a1be846bde49cb0a916c20f526f27b59e89 (patch) | |
tree | 9f08c97bd50250da3fa89378dab191e0a0cb7125 /arch/arm/mach-shmobile | |
parent | f5b2947e4a6589f07d485ca149d606283294979f (diff) |
ARM: shmobile: r8a7790: add Audio DMAC support
R-Car H2 has many DMACs
(ex SYS-DMAC, 2D-DMAC, Audio-DMAC, USB-DMAC etc)
and, these DMAEngine needs DMA slave IDs to use it.
This patch adds new DMA slave ID list for r8a7790.
There, common part has RCAR_DMA_xxx prefix,
and Audio DMAC part has AUDIO_DMAC_SLAVE_xxx prefix.
Audio DMAC can be controlled via sh-dma-engine
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/r8a7790.h | 25 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/setup-r8a7790.c | 90 |
2 files changed, 115 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7790.h b/arch/arm/mach-shmobile/include/mach/r8a7790.h index 5fbfa28b40b6..2177325af22f 100644 --- a/arch/arm/mach-shmobile/include/mach/r8a7790.h +++ b/arch/arm/mach-shmobile/include/mach/r8a7790.h | |||
@@ -3,6 +3,31 @@ | |||
3 | 3 | ||
4 | #include <mach/rcar-gen2.h> | 4 | #include <mach/rcar-gen2.h> |
5 | 5 | ||
6 | /* DMA slave IDs */ | ||
7 | enum { | ||
8 | RCAR_DMA_SLAVE_INVALID, | ||
9 | AUDIO_DMAC_SLAVE_SSI0_TX, | ||
10 | AUDIO_DMAC_SLAVE_SSI0_RX, | ||
11 | AUDIO_DMAC_SLAVE_SSI1_TX, | ||
12 | AUDIO_DMAC_SLAVE_SSI1_RX, | ||
13 | AUDIO_DMAC_SLAVE_SSI2_TX, | ||
14 | AUDIO_DMAC_SLAVE_SSI2_RX, | ||
15 | AUDIO_DMAC_SLAVE_SSI3_TX, | ||
16 | AUDIO_DMAC_SLAVE_SSI3_RX, | ||
17 | AUDIO_DMAC_SLAVE_SSI4_TX, | ||
18 | AUDIO_DMAC_SLAVE_SSI4_RX, | ||
19 | AUDIO_DMAC_SLAVE_SSI5_TX, | ||
20 | AUDIO_DMAC_SLAVE_SSI5_RX, | ||
21 | AUDIO_DMAC_SLAVE_SSI6_TX, | ||
22 | AUDIO_DMAC_SLAVE_SSI6_RX, | ||
23 | AUDIO_DMAC_SLAVE_SSI7_TX, | ||
24 | AUDIO_DMAC_SLAVE_SSI7_RX, | ||
25 | AUDIO_DMAC_SLAVE_SSI8_TX, | ||
26 | AUDIO_DMAC_SLAVE_SSI8_RX, | ||
27 | AUDIO_DMAC_SLAVE_SSI9_TX, | ||
28 | AUDIO_DMAC_SLAVE_SSI9_RX, | ||
29 | }; | ||
30 | |||
6 | void r8a7790_add_standard_devices(void); | 31 | void r8a7790_add_standard_devices(void); |
7 | void r8a7790_add_dt_devices(void); | 32 | void r8a7790_add_dt_devices(void); |
8 | void r8a7790_clock_init(void); | 33 | void r8a7790_clock_init(void); |
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c index 6ab37aa1e919..c4616f0698c6 100644 --- a/arch/arm/mach-shmobile/setup-r8a7790.c +++ b/arch/arm/mach-shmobile/setup-r8a7790.c | |||
@@ -24,12 +24,100 @@ | |||
24 | #include <linux/platform_data/gpio-rcar.h> | 24 | #include <linux/platform_data/gpio-rcar.h> |
25 | #include <linux/platform_data/irq-renesas-irqc.h> | 25 | #include <linux/platform_data/irq-renesas-irqc.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> |
28 | #include <mach/common.h> | 29 | #include <mach/common.h> |
30 | #include <mach/dma-register.h> | ||
29 | #include <mach/irqs.h> | 31 | #include <mach/irqs.h> |
30 | #include <mach/r8a7790.h> | 32 | #include <mach/r8a7790.h> |
31 | #include <asm/mach/arch.h> | 33 | #include <asm/mach/arch.h> |
32 | 34 | ||
35 | /* Audio-DMAC */ | ||
36 | #define AUDIO_DMAC_SLAVE(_id, _addr, t, r) \ | ||
37 | { \ | ||
38 | .slave_id = AUDIO_DMAC_SLAVE_## _id ##_TX, \ | ||
39 | .addr = _addr + 0x8, \ | ||
40 | .chcr = CHCR_TX(XMIT_SZ_32BIT), \ | ||
41 | .mid_rid = t, \ | ||
42 | }, { \ | ||
43 | .slave_id = AUDIO_DMAC_SLAVE_## _id ##_RX, \ | ||
44 | .addr = _addr + 0xc, \ | ||
45 | .chcr = CHCR_RX(XMIT_SZ_32BIT), \ | ||
46 | .mid_rid = r, \ | ||
47 | } | ||
48 | |||
49 | static const struct sh_dmae_slave_config r8a7790_audio_dmac_slaves[] = { | ||
50 | AUDIO_DMAC_SLAVE(SSI0, 0xec241000, 0x01, 0x02), | ||
51 | AUDIO_DMAC_SLAVE(SSI1, 0xec241040, 0x03, 0x04), | ||
52 | AUDIO_DMAC_SLAVE(SSI2, 0xec241080, 0x05, 0x06), | ||
53 | AUDIO_DMAC_SLAVE(SSI3, 0xec2410c0, 0x07, 0x08), | ||
54 | AUDIO_DMAC_SLAVE(SSI4, 0xec241100, 0x09, 0x0a), | ||
55 | AUDIO_DMAC_SLAVE(SSI5, 0xec241140, 0x0b, 0x0c), | ||
56 | AUDIO_DMAC_SLAVE(SSI6, 0xec241180, 0x0d, 0x0e), | ||
57 | AUDIO_DMAC_SLAVE(SSI7, 0xec2411c0, 0x0f, 0x10), | ||
58 | AUDIO_DMAC_SLAVE(SSI8, 0xec241200, 0x11, 0x12), | ||
59 | AUDIO_DMAC_SLAVE(SSI9, 0xec241240, 0x13, 0x14), | ||
60 | }; | ||
61 | |||
62 | #define DMAE_CHANNEL(a, b) \ | ||
63 | { \ | ||
64 | .offset = (a) - 0x20, \ | ||
65 | .dmars = (a) - 0x20 + 0x40, \ | ||
66 | .chclr_bit = (b), \ | ||
67 | .chclr_offset = 0x80 - 0x20, \ | ||
68 | } | ||
69 | |||
70 | static const struct sh_dmae_channel r8a7790_audio_dmac_channels[] = { | ||
71 | DMAE_CHANNEL(0x8000, 0), | ||
72 | DMAE_CHANNEL(0x8080, 1), | ||
73 | DMAE_CHANNEL(0x8100, 2), | ||
74 | DMAE_CHANNEL(0x8180, 3), | ||
75 | DMAE_CHANNEL(0x8200, 4), | ||
76 | DMAE_CHANNEL(0x8280, 5), | ||
77 | DMAE_CHANNEL(0x8300, 6), | ||
78 | DMAE_CHANNEL(0x8380, 7), | ||
79 | DMAE_CHANNEL(0x8400, 8), | ||
80 | DMAE_CHANNEL(0x8480, 9), | ||
81 | DMAE_CHANNEL(0x8500, 10), | ||
82 | DMAE_CHANNEL(0x8580, 11), | ||
83 | DMAE_CHANNEL(0x8600, 12), | ||
84 | }; | ||
85 | |||
86 | static struct sh_dmae_pdata r8a7790_audio_dmac_platform_data = { | ||
87 | .slave = r8a7790_audio_dmac_slaves, | ||
88 | .slave_num = ARRAY_SIZE(r8a7790_audio_dmac_slaves), | ||
89 | .channel = r8a7790_audio_dmac_channels, | ||
90 | .channel_num = ARRAY_SIZE(r8a7790_audio_dmac_channels), | ||
91 | .ts_low_shift = TS_LOW_SHIFT, | ||
92 | .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT, | ||
93 | .ts_high_shift = TS_HI_SHIFT, | ||
94 | .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT, | ||
95 | .ts_shift = dma_ts_shift, | ||
96 | .ts_shift_num = ARRAY_SIZE(dma_ts_shift), | ||
97 | .dmaor_init = DMAOR_DME, | ||
98 | .chclr_present = 1, | ||
99 | .chclr_bitwise = 1, | ||
100 | }; | ||
101 | |||
102 | static struct resource r8a7790_audio_dmac_resources[] = { | ||
103 | /* Channel registers and DMAOR for low */ | ||
104 | DEFINE_RES_MEM(0xec700020, 0x8663 - 0x20), | ||
105 | DEFINE_RES_IRQ(gic_spi(346)), | ||
106 | DEFINE_RES_NAMED(gic_spi(320), 13, NULL, IORESOURCE_IRQ), | ||
107 | |||
108 | /* Channel registers and DMAOR for hi */ | ||
109 | DEFINE_RES_MEM(0xec720020, 0x8663 - 0x20), /* hi */ | ||
110 | DEFINE_RES_IRQ(gic_spi(347)), | ||
111 | DEFINE_RES_NAMED(gic_spi(333), 13, NULL, IORESOURCE_IRQ), | ||
112 | }; | ||
113 | |||
114 | #define r8a7790_register_audio_dmac(id) \ | ||
115 | platform_device_register_resndata( \ | ||
116 | &platform_bus, "sh-dma-engine", id, \ | ||
117 | &r8a7790_audio_dmac_resources[id * 3], 3, \ | ||
118 | &r8a7790_audio_dmac_platform_data, \ | ||
119 | sizeof(r8a7790_audio_dmac_platform_data)) | ||
120 | |||
33 | static const struct resource pfc_resources[] __initconst = { | 121 | static const struct resource pfc_resources[] __initconst = { |
34 | DEFINE_RES_MEM(0xe6060000, 0x250), | 122 | DEFINE_RES_MEM(0xe6060000, 0x250), |
35 | }; | 123 | }; |
@@ -101,6 +189,8 @@ void __init r8a7790_pinmux_init(void) | |||
101 | r8a7790_register_i2c(1); | 189 | r8a7790_register_i2c(1); |
102 | r8a7790_register_i2c(2); | 190 | r8a7790_register_i2c(2); |
103 | r8a7790_register_i2c(3); | 191 | r8a7790_register_i2c(3); |
192 | r8a7790_register_audio_dmac(0); | ||
193 | r8a7790_register_audio_dmac(1); | ||
104 | } | 194 | } |
105 | 195 | ||
106 | #define __R8A7790_SCIF(scif_type, _scscr, index, baseaddr, irq) \ | 196 | #define __R8A7790_SCIF(scif_type, _scscr, index, baseaddr, irq) \ |