2 * Samsung's S3C64XX generic DMA support using amba-pl08x driver.
4 * Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/kernel.h>
12 #include <linux/amba/bus.h>
13 #include <linux/amba/pl080.h>
14 #include <linux/amba/pl08x.h>
17 #include <mach/irqs.h>
22 static int pl08x_get_xfer_signal(const struct pl08x_channel_data
*cd
)
24 return cd
->min_signal
;
27 static void pl08x_put_xfer_signal(const struct pl08x_channel_data
*cd
, int ch
)
35 static struct pl08x_channel_data s3c64xx_dma0_info
[] = {
40 .periph_buses
= PL08X_AHB2
,
45 .periph_buses
= PL08X_AHB2
,
50 .periph_buses
= PL08X_AHB2
,
55 .periph_buses
= PL08X_AHB2
,
60 .periph_buses
= PL08X_AHB2
,
65 .periph_buses
= PL08X_AHB2
,
70 .periph_buses
= PL08X_AHB2
,
75 .periph_buses
= PL08X_AHB2
,
80 .periph_buses
= PL08X_AHB2
,
85 .periph_buses
= PL08X_AHB2
,
90 .periph_buses
= PL08X_AHB2
,
95 .periph_buses
= PL08X_AHB2
,
100 .periph_buses
= PL08X_AHB2
,
105 .periph_buses
= PL08X_AHB2
,
110 .periph_buses
= PL08X_AHB2
,
115 .periph_buses
= PL08X_AHB2
,
119 struct pl08x_platform_data s3c64xx_dma0_plat_data
= {
123 (PL080_BSIZE_4
<< PL080_CONTROL_SB_SIZE_SHIFT
|
124 PL080_BSIZE_4
<< PL080_CONTROL_DB_SIZE_SHIFT
|
125 PL080_WIDTH_32BIT
<< PL080_CONTROL_SWIDTH_SHIFT
|
126 PL080_WIDTH_32BIT
<< PL080_CONTROL_DWIDTH_SHIFT
|
127 PL080_CONTROL_PROT_BUFF
| PL080_CONTROL_PROT_CACHE
|
128 PL080_CONTROL_PROT_SYS
),
130 .lli_buses
= PL08X_AHB1
,
131 .mem_buses
= PL08X_AHB1
,
132 .get_xfer_signal
= pl08x_get_xfer_signal
,
133 .put_xfer_signal
= pl08x_put_xfer_signal
,
134 .slave_channels
= s3c64xx_dma0_info
,
135 .num_slave_channels
= ARRAY_SIZE(s3c64xx_dma0_info
),
138 static AMBA_AHB_DEVICE(s3c64xx_dma0
, "dma-pl080s.0", 0,
139 0x75000000, {IRQ_DMA0
}, &s3c64xx_dma0_plat_data
);
145 static struct pl08x_channel_data s3c64xx_dma1_info
[] = {
150 .periph_buses
= PL08X_AHB2
,
155 .periph_buses
= PL08X_AHB2
,
160 .periph_buses
= PL08X_AHB2
,
165 .periph_buses
= PL08X_AHB2
,
170 .periph_buses
= PL08X_AHB2
,
175 .periph_buses
= PL08X_AHB2
,
177 .bus_id
= "ac97_out",
180 .periph_buses
= PL08X_AHB2
,
185 .periph_buses
= PL08X_AHB2
,
187 .bus_id
= "ac97_mic",
190 .periph_buses
= PL08X_AHB2
,
195 .periph_buses
= PL08X_AHB2
,
200 .periph_buses
= PL08X_AHB2
,
202 .bus_id
= "external",
205 .periph_buses
= PL08X_AHB2
,
209 struct pl08x_platform_data s3c64xx_dma1_plat_data
= {
213 (PL080_BSIZE_4
<< PL080_CONTROL_SB_SIZE_SHIFT
|
214 PL080_BSIZE_4
<< PL080_CONTROL_DB_SIZE_SHIFT
|
215 PL080_WIDTH_32BIT
<< PL080_CONTROL_SWIDTH_SHIFT
|
216 PL080_WIDTH_32BIT
<< PL080_CONTROL_DWIDTH_SHIFT
|
217 PL080_CONTROL_PROT_BUFF
| PL080_CONTROL_PROT_CACHE
|
218 PL080_CONTROL_PROT_SYS
),
220 .lli_buses
= PL08X_AHB1
,
221 .mem_buses
= PL08X_AHB1
,
222 .get_xfer_signal
= pl08x_get_xfer_signal
,
223 .put_xfer_signal
= pl08x_put_xfer_signal
,
224 .slave_channels
= s3c64xx_dma1_info
,
225 .num_slave_channels
= ARRAY_SIZE(s3c64xx_dma1_info
),
228 static AMBA_AHB_DEVICE(s3c64xx_dma1
, "dma-pl080s.1", 0,
229 0x75100000, {IRQ_DMA1
}, &s3c64xx_dma1_plat_data
);
231 static int __init
s3c64xx_pl080_init(void)
233 /* Set all DMA configuration to be DMA, not SDMA */
234 writel(0xffffff, S3C64XX_SDMA_SEL
);
236 if (of_have_populated_dt())
239 amba_device_register(&s3c64xx_dma0_device
, &iomem_resource
);
240 amba_device_register(&s3c64xx_dma1_device
, &iomem_resource
);
244 arch_initcall(s3c64xx_pl080_init
);