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>
18 #include <mach/irqs.h>
23 static int pl08x_get_xfer_signal(const struct pl08x_channel_data
*cd
)
25 return cd
->min_signal
;
28 static void pl08x_put_xfer_signal(const struct pl08x_channel_data
*cd
, int ch
)
36 static struct pl08x_channel_data s3c64xx_dma0_info
[] = {
41 .periph_buses
= PL08X_AHB2
,
46 .periph_buses
= PL08X_AHB2
,
51 .periph_buses
= PL08X_AHB2
,
56 .periph_buses
= PL08X_AHB2
,
61 .periph_buses
= PL08X_AHB2
,
66 .periph_buses
= PL08X_AHB2
,
71 .periph_buses
= PL08X_AHB2
,
76 .periph_buses
= PL08X_AHB2
,
81 .periph_buses
= PL08X_AHB2
,
86 .periph_buses
= PL08X_AHB2
,
91 .periph_buses
= PL08X_AHB2
,
96 .periph_buses
= PL08X_AHB2
,
101 .periph_buses
= PL08X_AHB2
,
106 .periph_buses
= PL08X_AHB2
,
111 .periph_buses
= PL08X_AHB2
,
116 .periph_buses
= PL08X_AHB2
,
120 struct pl08x_platform_data s3c64xx_dma0_plat_data
= {
124 (PL080_BSIZE_4
<< PL080_CONTROL_SB_SIZE_SHIFT
|
125 PL080_BSIZE_4
<< PL080_CONTROL_DB_SIZE_SHIFT
|
126 PL080_WIDTH_32BIT
<< PL080_CONTROL_SWIDTH_SHIFT
|
127 PL080_WIDTH_32BIT
<< PL080_CONTROL_DWIDTH_SHIFT
|
128 PL080_CONTROL_PROT_BUFF
| PL080_CONTROL_PROT_CACHE
|
129 PL080_CONTROL_PROT_SYS
),
131 .lli_buses
= PL08X_AHB1
,
132 .mem_buses
= PL08X_AHB1
,
133 .get_xfer_signal
= pl08x_get_xfer_signal
,
134 .put_xfer_signal
= pl08x_put_xfer_signal
,
135 .slave_channels
= s3c64xx_dma0_info
,
136 .num_slave_channels
= ARRAY_SIZE(s3c64xx_dma0_info
),
139 static AMBA_AHB_DEVICE(s3c64xx_dma0
, "dma-pl080s.0", 0,
140 0x75000000, {IRQ_DMA0
}, &s3c64xx_dma0_plat_data
);
146 static struct pl08x_channel_data s3c64xx_dma1_info
[] = {
151 .periph_buses
= PL08X_AHB2
,
156 .periph_buses
= PL08X_AHB2
,
161 .periph_buses
= PL08X_AHB2
,
166 .periph_buses
= PL08X_AHB2
,
171 .periph_buses
= PL08X_AHB2
,
176 .periph_buses
= PL08X_AHB2
,
178 .bus_id
= "ac97_out",
181 .periph_buses
= PL08X_AHB2
,
186 .periph_buses
= PL08X_AHB2
,
188 .bus_id
= "ac97_mic",
191 .periph_buses
= PL08X_AHB2
,
196 .periph_buses
= PL08X_AHB2
,
201 .periph_buses
= PL08X_AHB2
,
203 .bus_id
= "external",
206 .periph_buses
= PL08X_AHB2
,
210 struct pl08x_platform_data s3c64xx_dma1_plat_data
= {
214 (PL080_BSIZE_4
<< PL080_CONTROL_SB_SIZE_SHIFT
|
215 PL080_BSIZE_4
<< PL080_CONTROL_DB_SIZE_SHIFT
|
216 PL080_WIDTH_32BIT
<< PL080_CONTROL_SWIDTH_SHIFT
|
217 PL080_WIDTH_32BIT
<< PL080_CONTROL_DWIDTH_SHIFT
|
218 PL080_CONTROL_PROT_BUFF
| PL080_CONTROL_PROT_CACHE
|
219 PL080_CONTROL_PROT_SYS
),
221 .lli_buses
= PL08X_AHB1
,
222 .mem_buses
= PL08X_AHB1
,
223 .get_xfer_signal
= pl08x_get_xfer_signal
,
224 .put_xfer_signal
= pl08x_put_xfer_signal
,
225 .slave_channels
= s3c64xx_dma1_info
,
226 .num_slave_channels
= ARRAY_SIZE(s3c64xx_dma1_info
),
229 static AMBA_AHB_DEVICE(s3c64xx_dma1
, "dma-pl080s.1", 0,
230 0x75100000, {IRQ_DMA1
}, &s3c64xx_dma1_plat_data
);
232 static int __init
s3c64xx_pl080_init(void)
234 if (!soc_is_s3c64xx())
237 /* Set all DMA configuration to be DMA, not SDMA */
238 writel(0xffffff, S3C64XX_SDMA_SEL
);
240 if (of_have_populated_dt())
243 amba_device_register(&s3c64xx_dma0_device
, &iomem_resource
);
244 amba_device_register(&s3c64xx_dma1_device
, &iomem_resource
);
248 arch_initcall(s3c64xx_pl080_init
);