diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2013-08-02 10:50:40 -0400 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2013-10-07 20:44:42 -0400 |
commit | 9f754b4a68e53c71f55aaa9564579ae617a2ff11 (patch) | |
tree | acb99605a34b84cbe14254e25da95aec43da55d5 | |
parent | 243b6db0588b1425cb020e764475e8e1c4eb40d9 (diff) |
ARM: shmobile: r8a73a4: add a DMAC platform device and clock for it
Add a DMAC platform device and clock definitions for it on r8a73a4.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r-- | arch/arm/mach-shmobile/clock-r8a73a4.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/r8a73a4.h | 9 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/setup-r8a73a4.c | 91 |
3 files changed, 103 insertions, 1 deletions
diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c index 8ea5ef6c79cc..357b9bca7940 100644 --- a/arch/arm/mach-shmobile/clock-r8a73a4.c +++ b/arch/arm/mach-shmobile/clock-r8a73a4.c | |||
@@ -504,7 +504,7 @@ static struct clk div6_clks[DIV6_NR] = { | |||
504 | 504 | ||
505 | /* MSTP */ | 505 | /* MSTP */ |
506 | enum { | 506 | enum { |
507 | MSTP217, MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, | 507 | MSTP218, MSTP217, MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, |
508 | MSTP329, MSTP323, MSTP318, MSTP317, MSTP316, | 508 | MSTP329, MSTP323, MSTP318, MSTP317, MSTP316, |
509 | MSTP315, MSTP314, MSTP313, MSTP312, MSTP305, MSTP300, | 509 | MSTP315, MSTP314, MSTP313, MSTP312, MSTP305, MSTP300, |
510 | MSTP411, MSTP410, MSTP409, | 510 | MSTP411, MSTP410, MSTP409, |
@@ -519,6 +519,7 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
519 | [MSTP207] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 7, 0), /* SCIFB1 */ | 519 | [MSTP207] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 7, 0), /* SCIFB1 */ |
520 | [MSTP216] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 16, 0), /* SCIFB2 */ | 520 | [MSTP216] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 16, 0), /* SCIFB2 */ |
521 | [MSTP217] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 17, 0), /* SCIFB3 */ | 521 | [MSTP217] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 17, 0), /* SCIFB3 */ |
522 | [MSTP218] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC */ | ||
522 | [MSTP300] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 0, 0), /* IIC2 */ | 523 | [MSTP300] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 0, 0), /* IIC2 */ |
523 | [MSTP305] = SH_CLK_MSTP32(&div6_clks[DIV6_MMC1],SMSTPCR3, 5, 0), /* MMCIF1 */ | 524 | [MSTP305] = SH_CLK_MSTP32(&div6_clks[DIV6_MMC1],SMSTPCR3, 5, 0), /* MMCIF1 */ |
524 | [MSTP312] = SH_CLK_MSTP32(&div6_clks[DIV6_SDHI2],SMSTPCR3, 12, 0), /* SDHI2 */ | 525 | [MSTP312] = SH_CLK_MSTP32(&div6_clks[DIV6_SDHI2],SMSTPCR3, 12, 0), /* SDHI2 */ |
@@ -578,6 +579,7 @@ static struct clk_lookup lookups[] = { | |||
578 | CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]), | 579 | CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]), |
579 | CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]), | 580 | CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]), |
580 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP217]), | 581 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP217]), |
582 | CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), | ||
581 | CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), | 583 | CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), |
582 | CLKDEV_DEV_ID("e6520000.i2c", &mstp_clks[MSTP300]), | 584 | CLKDEV_DEV_ID("e6520000.i2c", &mstp_clks[MSTP300]), |
583 | CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]), | 585 | CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]), |
diff --git a/arch/arm/mach-shmobile/include/mach/r8a73a4.h b/arch/arm/mach-shmobile/include/mach/r8a73a4.h index 5214338a6a47..ce8bdd1d8a8a 100644 --- a/arch/arm/mach-shmobile/include/mach/r8a73a4.h +++ b/arch/arm/mach-shmobile/include/mach/r8a73a4.h | |||
@@ -1,6 +1,15 @@ | |||
1 | #ifndef __ASM_R8A73A4_H__ | 1 | #ifndef __ASM_R8A73A4_H__ |
2 | #define __ASM_R8A73A4_H__ | 2 | #define __ASM_R8A73A4_H__ |
3 | 3 | ||
4 | /* DMA slave IDs */ | ||
5 | enum { | ||
6 | SHDMA_SLAVE_INVALID, | ||
7 | SHDMA_SLAVE_MMCIF0_TX, | ||
8 | SHDMA_SLAVE_MMCIF0_RX, | ||
9 | SHDMA_SLAVE_MMCIF1_TX, | ||
10 | SHDMA_SLAVE_MMCIF1_RX, | ||
11 | }; | ||
12 | |||
4 | void r8a73a4_add_standard_devices(void); | 13 | void r8a73a4_add_standard_devices(void); |
5 | void r8a73a4_add_dt_devices(void); | 14 | void r8a73a4_add_dt_devices(void); |
6 | void r8a73a4_clock_init(void); | 15 | void r8a73a4_clock_init(void); |
diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c index 53a896275cae..b0f2749071be 100644 --- a/arch/arm/mach-shmobile/setup-r8a73a4.c +++ b/arch/arm/mach-shmobile/setup-r8a73a4.c | |||
@@ -22,8 +22,10 @@ | |||
22 | #include <linux/of_platform.h> | 22 | #include <linux/of_platform.h> |
23 | #include <linux/platform_data/irq-renesas-irqc.h> | 23 | #include <linux/platform_data/irq-renesas-irqc.h> |
24 | #include <linux/serial_sci.h> | 24 | #include <linux/serial_sci.h> |
25 | #include <linux/sh_dma.h> | ||
25 | #include <linux/sh_timer.h> | 26 | #include <linux/sh_timer.h> |
26 | #include <mach/common.h> | 27 | #include <mach/common.h> |
28 | #include <mach/dma-register.h> | ||
27 | #include <mach/irqs.h> | 29 | #include <mach/irqs.h> |
28 | #include <mach/r8a73a4.h> | 30 | #include <mach/r8a73a4.h> |
29 | #include <asm/mach/arch.h> | 31 | #include <asm/mach/arch.h> |
@@ -199,12 +201,101 @@ void __init r8a73a4_add_dt_devices(void) | |||
199 | r8a7790_register_cmt(10); | 201 | r8a7790_register_cmt(10); |
200 | } | 202 | } |
201 | 203 | ||
204 | /* DMA */ | ||
205 | static const struct sh_dmae_slave_config dma_slaves[] = { | ||
206 | { | ||
207 | .slave_id = SHDMA_SLAVE_MMCIF0_TX, | ||
208 | .addr = 0xee200034, | ||
209 | .chcr = CHCR_TX(XMIT_SZ_32BIT), | ||
210 | .mid_rid = 0xd1, | ||
211 | }, { | ||
212 | .slave_id = SHDMA_SLAVE_MMCIF0_RX, | ||
213 | .addr = 0xee200034, | ||
214 | .chcr = CHCR_RX(XMIT_SZ_32BIT), | ||
215 | .mid_rid = 0xd2, | ||
216 | }, { | ||
217 | .slave_id = SHDMA_SLAVE_MMCIF1_TX, | ||
218 | .addr = 0xee220034, | ||
219 | .chcr = CHCR_TX(XMIT_SZ_32BIT), | ||
220 | .mid_rid = 0xe1, | ||
221 | }, { | ||
222 | .slave_id = SHDMA_SLAVE_MMCIF1_RX, | ||
223 | .addr = 0xee220034, | ||
224 | .chcr = CHCR_RX(XMIT_SZ_32BIT), | ||
225 | .mid_rid = 0xe2, | ||
226 | }, | ||
227 | }; | ||
228 | |||
229 | #define DMAE_CHANNEL(a, b) \ | ||
230 | { \ | ||
231 | .offset = (a) - 0x20, \ | ||
232 | .dmars = (a) - 0x20 + 0x40, \ | ||
233 | .chclr_bit = (b), \ | ||
234 | .chclr_offset = 0x80 - 0x20, \ | ||
235 | } | ||
236 | |||
237 | static const struct sh_dmae_channel dma_channels[] = { | ||
238 | DMAE_CHANNEL(0x8000, 0), | ||
239 | DMAE_CHANNEL(0x8080, 1), | ||
240 | DMAE_CHANNEL(0x8100, 2), | ||
241 | DMAE_CHANNEL(0x8180, 3), | ||
242 | DMAE_CHANNEL(0x8200, 4), | ||
243 | DMAE_CHANNEL(0x8280, 5), | ||
244 | DMAE_CHANNEL(0x8300, 6), | ||
245 | DMAE_CHANNEL(0x8380, 7), | ||
246 | DMAE_CHANNEL(0x8400, 8), | ||
247 | DMAE_CHANNEL(0x8480, 9), | ||
248 | DMAE_CHANNEL(0x8500, 10), | ||
249 | DMAE_CHANNEL(0x8580, 11), | ||
250 | DMAE_CHANNEL(0x8600, 12), | ||
251 | DMAE_CHANNEL(0x8680, 13), | ||
252 | DMAE_CHANNEL(0x8700, 14), | ||
253 | DMAE_CHANNEL(0x8780, 15), | ||
254 | DMAE_CHANNEL(0x8800, 16), | ||
255 | DMAE_CHANNEL(0x8880, 17), | ||
256 | DMAE_CHANNEL(0x8900, 18), | ||
257 | DMAE_CHANNEL(0x8980, 19), | ||
258 | }; | ||
259 | |||
260 | static const struct sh_dmae_pdata dma_pdata = { | ||
261 | .slave = dma_slaves, | ||
262 | .slave_num = ARRAY_SIZE(dma_slaves), | ||
263 | .channel = dma_channels, | ||
264 | .channel_num = ARRAY_SIZE(dma_channels), | ||
265 | .ts_low_shift = TS_LOW_SHIFT, | ||
266 | .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT, | ||
267 | .ts_high_shift = TS_HI_SHIFT, | ||
268 | .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT, | ||
269 | .ts_shift = dma_ts_shift, | ||
270 | .ts_shift_num = ARRAY_SIZE(dma_ts_shift), | ||
271 | .dmaor_init = DMAOR_DME, | ||
272 | .chclr_present = 1, | ||
273 | .chclr_bitwise = 1, | ||
274 | }; | ||
275 | |||
276 | static struct resource dma_resources[] = { | ||
277 | DEFINE_RES_MEM(0xe6700020, 0x89e0), | ||
278 | DEFINE_RES_IRQ_NAMED(gic_spi(220), "error_irq"), | ||
279 | { | ||
280 | /* IRQ for channels 0-19 */ | ||
281 | .start = gic_spi(200), | ||
282 | .end = gic_spi(219), | ||
283 | .flags = IORESOURCE_IRQ, | ||
284 | }, | ||
285 | }; | ||
286 | |||
287 | #define r8a73a4_register_dmac() \ | ||
288 | platform_device_register_resndata(&platform_bus, "sh-dma-engine", 0, \ | ||
289 | dma_resources, ARRAY_SIZE(dma_resources), \ | ||
290 | &dma_pdata, sizeof(dma_pdata)) | ||
291 | |||
202 | void __init r8a73a4_add_standard_devices(void) | 292 | void __init r8a73a4_add_standard_devices(void) |
203 | { | 293 | { |
204 | r8a73a4_add_dt_devices(); | 294 | r8a73a4_add_dt_devices(); |
205 | r8a73a4_register_irqc(0); | 295 | r8a73a4_register_irqc(0); |
206 | r8a73a4_register_irqc(1); | 296 | r8a73a4_register_irqc(1); |
207 | r8a73a4_register_thermal(); | 297 | r8a73a4_register_thermal(); |
298 | r8a73a4_register_dmac(); | ||
208 | } | 299 | } |
209 | 300 | ||
210 | void __init r8a73a4_init_early(void) | 301 | void __init r8a73a4_init_early(void) |