Commit ae0502f8 authored by David Brownell's avatar David Brownell Committed by Kevin Hilman

edma: move setup to dm<soc>.c

Move EDMA platform device creation into SoC-specific init code,
and provide it with platform_data to parameterize some of the
key differences.

Handle some key dm646x differences.  Ones that can change the
behavior including supporting all the DMA slots (512 vs just 128)
and a different set of no-events channels.

This doesn't yet ioremap(), or support using more than the first
two TCs on platforms like dm646x or dm365.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent e0db1357
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include <mach/dm355.h> #include <mach/dm355.h>
#include <mach/clock.h> #include <mach/clock.h>
#include <mach/cpu.h>
#include <mach/edma.h>
#include <mach/psc.h> #include <mach/psc.h>
#include <mach/mux.h> #include <mach/mux.h>
#include <mach/irqs.h> #include <mach/irqs.h>
...@@ -463,8 +465,75 @@ EVT_CFG(DM355, EVT9_ASP1_RX, 1, 1, 0, false) ...@@ -463,8 +465,75 @@ EVT_CFG(DM355, EVT9_ASP1_RX, 1, 1, 0, false)
EVT_CFG(DM355, EVT26_MMC0_RX, 2, 1, 0, false) EVT_CFG(DM355, EVT26_MMC0_RX, 2, 1, 0, false)
}; };
/*----------------------------------------------------------------------*/
static const s8 dma_chan_dm355_no_event[] = {
12, 13, 24, 56, 57,
58, 59, 60, 61, 62,
63,
-1
};
static struct edma_soc_info dm355_edma_info = {
.n_channel = 64,
.n_region = 4,
.n_slot = 128,
.n_tc = 2,
.noevent = dma_chan_dm355_no_event,
};
static struct resource edma_resources[] = {
{
.start = 0x01c00000,
.end = 0x01c00000 + SZ_64K - 1,
.flags = IORESOURCE_MEM,
},
{
.name = "edma_tc0",
.start = 0x01c10000,
.end = 0x01c10000 + SZ_1K - 1,
.flags = IORESOURCE_MEM,
},
{
.name = "edma_tc1",
.start = 0x01c10400,
.end = 0x01c10400 + SZ_1K - 1,
.flags = IORESOURCE_MEM,
},
{
.start = IRQ_CCINT0,
.flags = IORESOURCE_IRQ,
},
{
.start = IRQ_CCERRINT,
.flags = IORESOURCE_IRQ,
},
/* not using (or muxing) TC*_ERR */
};
static struct platform_device dm355_edma_device = {
.name = "edma",
.id = -1,
.dev.platform_data = &dm355_edma_info,
.num_resources = ARRAY_SIZE(edma_resources),
.resource = edma_resources,
};
/*----------------------------------------------------------------------*/
void __init dm355_init(void) void __init dm355_init(void)
{ {
davinci_clk_init(dm355_clks); davinci_clk_init(dm355_clks);
davinci_mux_register(dm355_pins, ARRAY_SIZE(dm355_pins));; davinci_mux_register(dm355_pins, ARRAY_SIZE(dm355_pins));;
} }
static int __init dm355_init_devices(void)
{
if (!cpu_is_davinci_dm355())
return 0;
davinci_cfg_reg(DM355_INT_EDMA_CC);
platform_device_register(&dm355_edma_device);
return 0;
}
postcore_initcall(dm355_init_devices);
...@@ -11,9 +11,13 @@ ...@@ -11,9 +11,13 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/platform_device.h>
#include <mach/dm644x.h> #include <mach/dm644x.h>
#include <mach/clock.h> #include <mach/clock.h>
#include <mach/cpu.h>
#include <mach/edma.h>
#include <mach/irqs.h>
#include <mach/psc.h> #include <mach/psc.h>
#include <mach/mux.h> #include <mach/mux.h>
...@@ -358,8 +362,76 @@ MUX_CFG(DM644X, LFLDEN, 0, 25, 1, 1, false) ...@@ -358,8 +362,76 @@ MUX_CFG(DM644X, LFLDEN, 0, 25, 1, 1, false)
}; };
/*----------------------------------------------------------------------*/
static const s8 dma_chan_dm644x_no_event[] = {
0, 1, 12, 13, 14,
15, 25, 30, 31, 45,
46, 47, 55, 56, 57,
58, 59, 60, 61, 62,
63,
-1
};
static struct edma_soc_info dm644x_edma_info = {
.n_channel = 64,
.n_region = 4,
.n_slot = 128,
.n_tc = 2,
.noevent = dma_chan_dm644x_no_event,
};
static struct resource edma_resources[] = {
{
.start = 0x01c00000,
.end = 0x01c00000 + SZ_64K - 1,
.flags = IORESOURCE_MEM,
},
{
.name = "edma_tc0",
.start = 0x01c10000,
.end = 0x01c10000 + SZ_1K - 1,
.flags = IORESOURCE_MEM,
},
{
.name = "edma_tc1",
.start = 0x01c10400,
.end = 0x01c10400 + SZ_1K - 1,
.flags = IORESOURCE_MEM,
},
{
.start = IRQ_CCINT0,
.flags = IORESOURCE_IRQ,
},
{
.start = IRQ_CCERRINT,
.flags = IORESOURCE_IRQ,
},
/* not using TC*_ERR */
};
static struct platform_device dm644x_edma_device = {
.name = "edma",
.id = -1,
.dev.platform_data = &dm644x_edma_info,
.num_resources = ARRAY_SIZE(edma_resources),
.resource = edma_resources,
};
/*----------------------------------------------------------------------*/
void __init dm644x_init(void) void __init dm644x_init(void)
{ {
davinci_clk_init(dm644x_clks); davinci_clk_init(dm644x_clks);
davinci_mux_register(dm644x_pins, ARRAY_SIZE(dm644x_pins)); davinci_mux_register(dm644x_pins, ARRAY_SIZE(dm644x_pins));
} }
static int __init dm644x_init_devices(void)
{
if (!cpu_is_davinci_dm644x())
return 0;
platform_device_register(&dm644x_edma_device);
return 0;
}
postcore_initcall(dm644x_init_devices);
...@@ -11,9 +11,13 @@ ...@@ -11,9 +11,13 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/platform_device.h>
#include <mach/dm646x.h> #include <mach/dm646x.h>
#include <mach/clock.h> #include <mach/clock.h>
#include <mach/cpu.h>
#include <mach/edma.h>
#include <mach/irqs.h>
#include <mach/psc.h> #include <mach/psc.h>
#include <mach/mux.h> #include <mach/mux.h>
...@@ -273,8 +277,88 @@ MUX_CFG(DM646X, AUDCK1, 0, 29, 1, 0, false) ...@@ -273,8 +277,88 @@ MUX_CFG(DM646X, AUDCK1, 0, 29, 1, 0, false)
MUX_CFG(DM646X, AUDCK0, 0, 28, 1, 0, false) MUX_CFG(DM646X, AUDCK0, 0, 28, 1, 0, false)
}; };
/*----------------------------------------------------------------------*/
static const s8 dma_chan_dm646x_no_event[] = {
0, 1, 2, 3, 13,
14, 15, 24, 25, 26,
27, 30, 31, 54, 55,
56,
-1
};
static struct edma_soc_info dm646x_edma_info = {
.n_channel = 64,
.n_region = 6, /* 0-1, 4-7 */
.n_slot = 512,
.n_tc = 4,
.noevent = dma_chan_dm646x_no_event,
};
static struct resource edma_resources[] = {
{
.start = 0x01c00000,
.end = 0x01c00000 + SZ_64K - 1,
.flags = IORESOURCE_MEM,
},
{
.name = "edma_tc0",
.start = 0x01c10000,
.end = 0x01c10000 + SZ_1K - 1,
.flags = IORESOURCE_MEM,
},
{
.name = "edma_tc1",
.start = 0x01c10400,
.end = 0x01c10400 + SZ_1K - 1,
.flags = IORESOURCE_MEM,
},
{
.name = "edma_tc2",
.start = 0x01c10800,
.end = 0x01c10800 + SZ_1K - 1,
.flags = IORESOURCE_MEM,
},
{
.name = "edma_tc3",
.start = 0x01c10c00,
.end = 0x01c10c00 + SZ_1K - 1,
.flags = IORESOURCE_MEM,
},
{
.start = IRQ_CCINT0,
.flags = IORESOURCE_IRQ,
},
{
.start = IRQ_CCERRINT,
.flags = IORESOURCE_IRQ,
},
/* not using TC*_ERR */
};
static struct platform_device dm646x_edma_device = {
.name = "edma",
.id = -1,
.dev.platform_data = &dm646x_edma_info,
.num_resources = ARRAY_SIZE(edma_resources),
.resource = edma_resources,
};
/*----------------------------------------------------------------------*/
void __init dm646x_init(void) void __init dm646x_init(void)
{ {
davinci_clk_init(dm646x_clks); davinci_clk_init(dm646x_clks);
davinci_mux_register(dm646x_pins, ARRAY_SIZE(dm646x_pins)); davinci_mux_register(dm646x_pins, ARRAY_SIZE(dm646x_pins));
} }
static int __init dm646x_init_devices(void)
{
if (!cpu_is_davinci_dm646x())
return 0;
platform_device_register(&dm646x_edma_device);
return 0;
}
postcore_initcall(dm646x_init_devices);
This diff is collapsed.
...@@ -91,16 +91,6 @@ struct edmacc_param { ...@@ -91,16 +91,6 @@ struct edmacc_param {
#define TRWORD (0x7<<2) #define TRWORD (0x7<<2)
#define PAENTRY (0x1ff<<5) #define PAENTRY (0x1ff<<5)
#define DAVINCI_EDMA_NUM_DMACH 64
#define DAVINCI_EDMA_NUM_PARAMENTRY 128
#define DAVINCI_EDMA_NUM_EVQUE 2
#define DAVINCI_EDMA_CHMAPEXIST 0
#define DAVINCI_EDMA_NUM_REGIONS 4
#define DAVINCI_EDMA_MEMPROTECT 0
/* Drivers should avoid using these symbolic names for dm644x /* Drivers should avoid using these symbolic names for dm644x
* channels, and use platform_device IORESOURCE_DMA resources * channels, and use platform_device IORESOURCE_DMA resources
* instead. (Other DaVinci chips have different peripherals * instead. (Other DaVinci chips have different peripherals
...@@ -221,4 +211,18 @@ void edma_resume(unsigned channel); ...@@ -221,4 +211,18 @@ void edma_resume(unsigned channel);
/* UNRELATED TO DMA */ /* UNRELATED TO DMA */
int davinci_alloc_iram(unsigned size); int davinci_alloc_iram(unsigned size);
void davinci_free_iram(unsigned addr, unsigned size); void davinci_free_iram(unsigned addr, unsigned size);
/* platform_data for EDMA driver */
struct edma_soc_info {
/* how many dma resources of each type */
unsigned n_channel;
unsigned n_region;
unsigned n_slot;
unsigned n_tc;
/* list of channels with no even trigger; terminated by "-1" */
const s8 *noevent;
};
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment