dmaengine: shdma: convert to platform device resources
The shdma dmaengine driver currently uses numerous macros to support various platforms, selected by ifdef's. Convert it to use platform device resources and lists of channel descriptors to specify register locations, interrupt numbers and other system-specific configuration variants. Unavoidably, we have to simultaneously convert all shdma users to provide those resources. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:

committed by
Paul Mundt

parent
47a4dc26ee
commit
027811b9b8
@@ -28,15 +28,157 @@
|
||||
#include <cpu/sh7724.h>
|
||||
|
||||
/* DMA */
|
||||
static struct sh_dmae_pdata dma_platform_data = {
|
||||
.mode = SHDMA_DMAOR1,
|
||||
static struct sh_dmae_channel sh7724_dmae0_channels[] = {
|
||||
{
|
||||
.offset = 0,
|
||||
.dmars = 0,
|
||||
.dmars_bit = 0,
|
||||
}, {
|
||||
.offset = 0x10,
|
||||
.dmars = 0,
|
||||
.dmars_bit = 8,
|
||||
}, {
|
||||
.offset = 0x20,
|
||||
.dmars = 4,
|
||||
.dmars_bit = 0,
|
||||
}, {
|
||||
.offset = 0x30,
|
||||
.dmars = 4,
|
||||
.dmars_bit = 8,
|
||||
}, {
|
||||
.offset = 0x50,
|
||||
.dmars = 8,
|
||||
.dmars_bit = 0,
|
||||
}, {
|
||||
.offset = 0x60,
|
||||
.dmars = 8,
|
||||
.dmars_bit = 8,
|
||||
}
|
||||
};
|
||||
|
||||
static struct platform_device dma_device = {
|
||||
.name = "sh-dma-engine",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &dma_platform_data,
|
||||
static struct sh_dmae_channel sh7724_dmae1_channels[] = {
|
||||
{
|
||||
.offset = 0,
|
||||
.dmars = 0,
|
||||
.dmars_bit = 0,
|
||||
}, {
|
||||
.offset = 0x10,
|
||||
.dmars = 0,
|
||||
.dmars_bit = 8,
|
||||
}, {
|
||||
.offset = 0x20,
|
||||
.dmars = 4,
|
||||
.dmars_bit = 0,
|
||||
}, {
|
||||
.offset = 0x30,
|
||||
.dmars = 4,
|
||||
.dmars_bit = 8,
|
||||
}, {
|
||||
.offset = 0x50,
|
||||
.dmars = 8,
|
||||
.dmars_bit = 0,
|
||||
}, {
|
||||
.offset = 0x60,
|
||||
.dmars = 8,
|
||||
.dmars_bit = 8,
|
||||
}
|
||||
};
|
||||
|
||||
static struct sh_dmae_pdata dma0_platform_data = {
|
||||
.channel = sh7724_dmae0_channels,
|
||||
.channel_num = ARRAY_SIZE(sh7724_dmae0_channels),
|
||||
};
|
||||
|
||||
static struct sh_dmae_pdata dma1_platform_data = {
|
||||
.channel = sh7724_dmae1_channels,
|
||||
.channel_num = ARRAY_SIZE(sh7724_dmae1_channels),
|
||||
};
|
||||
|
||||
/* Resource order important! */
|
||||
static struct resource sh7724_dmae0_resources[] = {
|
||||
{
|
||||
/* Channel registers and DMAOR */
|
||||
.start = 0xfe008020,
|
||||
.end = 0xfe00808f,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
||||
/* DMARSx */
|
||||
.start = 0xfe009000,
|
||||
.end = 0xfe00900b,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
||||
/* DMA error IRQ */
|
||||
.start = 78,
|
||||
.end = 78,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
{
|
||||
/* IRQ for channels 0-3 */
|
||||
.start = 48,
|
||||
.end = 51,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
{
|
||||
/* IRQ for channels 4-5 */
|
||||
.start = 76,
|
||||
.end = 77,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
/* Resource order important! */
|
||||
static struct resource sh7724_dmae1_resources[] = {
|
||||
{
|
||||
/* Channel registers and DMAOR */
|
||||
.start = 0xfdc08020,
|
||||
.end = 0xfdc0808f,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
||||
/* DMARSx */
|
||||
.start = 0xfdc09000,
|
||||
.end = 0xfdc0900b,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
||||
/* DMA error IRQ */
|
||||
.start = 74,
|
||||
.end = 74,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
{
|
||||
/* IRQ for channels 0-3 */
|
||||
.start = 40,
|
||||
.end = 43,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
{
|
||||
/* IRQ for channels 4-5 */
|
||||
.start = 72,
|
||||
.end = 73,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device dma0_device = {
|
||||
.name = "sh-dma-engine",
|
||||
.id = 0,
|
||||
.resource = sh7724_dmae0_resources,
|
||||
.num_resources = ARRAY_SIZE(sh7724_dmae0_resources),
|
||||
.dev = {
|
||||
.platform_data = &dma0_platform_data,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device dma1_device = {
|
||||
.name = "sh-dma-engine",
|
||||
.id = 1,
|
||||
.resource = sh7724_dmae1_resources,
|
||||
.num_resources = ARRAY_SIZE(sh7724_dmae1_resources),
|
||||
.dev = {
|
||||
.platform_data = &dma1_platform_data,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -663,7 +805,8 @@ static struct platform_device *sh7724_devices[] __initdata = {
|
||||
&tmu3_device,
|
||||
&tmu4_device,
|
||||
&tmu5_device,
|
||||
&dma_device,
|
||||
&dma0_device,
|
||||
&dma1_device,
|
||||
&rtc_device,
|
||||
&iic0_device,
|
||||
&iic1_device,
|
||||
|
Reference in New Issue
Block a user