davinci: EDMA: multiple CCs, channel mapping and API changes
- restructure to support multiple channel controllers by using additional struct resources for each CC - interface changes visible to EDMA clients Introduce macros to build IDs from controller and channel number, and to extract them. Modify the edma_alloc_slot function to take an extra argument for the controller. Also update ASoC drivers to use API. ASoC changes Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> - Move queue related mappings to dm<soc>.c EDMA in DM355 and DM644x has two transfer controllers while DM646x has four transfer controllers. Moving the queue to tc mapping and queue priority mapping to dm<soc>.c will be helpful to probe these mappings from platform device so that the machine_is_* testing will be avoided. - add channel mapping logic Channel mapping logic is introduced in dm646x EDMA. This implies that there is no fixed association for a channel number to a parameter entry number. In other words, using the DMA channel mapping registers (DCHMAPn), a PaRAM entry can be mapped to any channel. While in the case of dm644x and dm355 there is a fixed mapping between the EDMA channel and Param entry number. Signed-off-by: Naresh Medisetty <naresh@ti.com> Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com> Reviewed-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
This commit is contained in:
parent
4c5adde794
commit
60902a2cb1
|
@ -82,10 +82,10 @@ static struct resource mmcsd0_resources[] = {
|
||||||
},
|
},
|
||||||
/* DMA channels: RX, then TX */
|
/* DMA channels: RX, then TX */
|
||||||
{
|
{
|
||||||
.start = DAVINCI_DMA_MMCRXEVT,
|
.start = EDMA_CTLR_CHAN(0, DAVINCI_DMA_MMCRXEVT),
|
||||||
.flags = IORESOURCE_DMA,
|
.flags = IORESOURCE_DMA,
|
||||||
}, {
|
}, {
|
||||||
.start = DAVINCI_DMA_MMCTXEVT,
|
.start = EDMA_CTLR_CHAN(0, DAVINCI_DMA_MMCTXEVT),
|
||||||
.flags = IORESOURCE_DMA,
|
.flags = IORESOURCE_DMA,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -119,10 +119,10 @@ static struct resource mmcsd1_resources[] = {
|
||||||
},
|
},
|
||||||
/* DMA channels: RX, then TX */
|
/* DMA channels: RX, then TX */
|
||||||
{
|
{
|
||||||
.start = 30, /* rx */
|
.start = EDMA_CTLR_CHAN(0, 30), /* rx */
|
||||||
.flags = IORESOURCE_DMA,
|
.flags = IORESOURCE_DMA,
|
||||||
}, {
|
}, {
|
||||||
.start = 31, /* tx */
|
.start = EDMA_CTLR_CHAN(0, 31), /* tx */
|
||||||
.flags = IORESOURCE_DMA,
|
.flags = IORESOURCE_DMA,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -558,17 +558,38 @@ static const s8 dma_chan_dm355_no_event[] = {
|
||||||
-1
|
-1
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct edma_soc_info dm355_edma_info = {
|
static const s8
|
||||||
.n_channel = 64,
|
queue_tc_mapping[][2] = {
|
||||||
.n_region = 4,
|
/* {event queue no, TC no} */
|
||||||
.n_slot = 128,
|
{0, 0},
|
||||||
.n_tc = 2,
|
{1, 1},
|
||||||
.noevent = dma_chan_dm355_no_event,
|
{-1, -1},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const s8
|
||||||
|
queue_priority_mapping[][2] = {
|
||||||
|
/* {event queue no, Priority} */
|
||||||
|
{0, 3},
|
||||||
|
{1, 7},
|
||||||
|
{-1, -1},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct edma_soc_info dm355_edma_info[] = {
|
||||||
|
{
|
||||||
|
.n_channel = 64,
|
||||||
|
.n_region = 4,
|
||||||
|
.n_slot = 128,
|
||||||
|
.n_tc = 2,
|
||||||
|
.n_cc = 1,
|
||||||
|
.noevent = dma_chan_dm355_no_event,
|
||||||
|
.queue_tc_mapping = queue_tc_mapping,
|
||||||
|
.queue_priority_mapping = queue_priority_mapping,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct resource edma_resources[] = {
|
static struct resource edma_resources[] = {
|
||||||
{
|
{
|
||||||
.name = "edma_cc",
|
.name = "edma_cc0",
|
||||||
.start = 0x01c00000,
|
.start = 0x01c00000,
|
||||||
.end = 0x01c00000 + SZ_64K - 1,
|
.end = 0x01c00000 + SZ_64K - 1,
|
||||||
.flags = IORESOURCE_MEM,
|
.flags = IORESOURCE_MEM,
|
||||||
|
@ -586,10 +607,12 @@ static struct resource edma_resources[] = {
|
||||||
.flags = IORESOURCE_MEM,
|
.flags = IORESOURCE_MEM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
.name = "edma0",
|
||||||
.start = IRQ_CCINT0,
|
.start = IRQ_CCINT0,
|
||||||
.flags = IORESOURCE_IRQ,
|
.flags = IORESOURCE_IRQ,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
.name = "edma0_err",
|
||||||
.start = IRQ_CCERRINT,
|
.start = IRQ_CCERRINT,
|
||||||
.flags = IORESOURCE_IRQ,
|
.flags = IORESOURCE_IRQ,
|
||||||
},
|
},
|
||||||
|
@ -598,8 +621,8 @@ static struct resource edma_resources[] = {
|
||||||
|
|
||||||
static struct platform_device dm355_edma_device = {
|
static struct platform_device dm355_edma_device = {
|
||||||
.name = "edma",
|
.name = "edma",
|
||||||
.id = -1,
|
.id = 0,
|
||||||
.dev.platform_data = &dm355_edma_info,
|
.dev.platform_data = dm355_edma_info,
|
||||||
.num_resources = ARRAY_SIZE(edma_resources),
|
.num_resources = ARRAY_SIZE(edma_resources),
|
||||||
.resource = edma_resources,
|
.resource = edma_resources,
|
||||||
};
|
};
|
||||||
|
|
|
@ -484,17 +484,38 @@ static const s8 dma_chan_dm644x_no_event[] = {
|
||||||
-1
|
-1
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct edma_soc_info dm644x_edma_info = {
|
static const s8
|
||||||
.n_channel = 64,
|
queue_tc_mapping[][2] = {
|
||||||
.n_region = 4,
|
/* {event queue no, TC no} */
|
||||||
.n_slot = 128,
|
{0, 0},
|
||||||
.n_tc = 2,
|
{1, 1},
|
||||||
.noevent = dma_chan_dm644x_no_event,
|
{-1, -1},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const s8
|
||||||
|
queue_priority_mapping[][2] = {
|
||||||
|
/* {event queue no, Priority} */
|
||||||
|
{0, 3},
|
||||||
|
{1, 7},
|
||||||
|
{-1, -1},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct edma_soc_info dm644x_edma_info[] = {
|
||||||
|
{
|
||||||
|
.n_channel = 64,
|
||||||
|
.n_region = 4,
|
||||||
|
.n_slot = 128,
|
||||||
|
.n_tc = 2,
|
||||||
|
.n_cc = 1,
|
||||||
|
.noevent = dma_chan_dm644x_no_event,
|
||||||
|
.queue_tc_mapping = queue_tc_mapping,
|
||||||
|
.queue_priority_mapping = queue_priority_mapping,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct resource edma_resources[] = {
|
static struct resource edma_resources[] = {
|
||||||
{
|
{
|
||||||
.name = "edma_cc",
|
.name = "edma_cc0",
|
||||||
.start = 0x01c00000,
|
.start = 0x01c00000,
|
||||||
.end = 0x01c00000 + SZ_64K - 1,
|
.end = 0x01c00000 + SZ_64K - 1,
|
||||||
.flags = IORESOURCE_MEM,
|
.flags = IORESOURCE_MEM,
|
||||||
|
@ -512,10 +533,12 @@ static struct resource edma_resources[] = {
|
||||||
.flags = IORESOURCE_MEM,
|
.flags = IORESOURCE_MEM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
.name = "edma0",
|
||||||
.start = IRQ_CCINT0,
|
.start = IRQ_CCINT0,
|
||||||
.flags = IORESOURCE_IRQ,
|
.flags = IORESOURCE_IRQ,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
.name = "edma0_err",
|
||||||
.start = IRQ_CCERRINT,
|
.start = IRQ_CCERRINT,
|
||||||
.flags = IORESOURCE_IRQ,
|
.flags = IORESOURCE_IRQ,
|
||||||
},
|
},
|
||||||
|
@ -524,8 +547,8 @@ static struct resource edma_resources[] = {
|
||||||
|
|
||||||
static struct platform_device dm644x_edma_device = {
|
static struct platform_device dm644x_edma_device = {
|
||||||
.name = "edma",
|
.name = "edma",
|
||||||
.id = -1,
|
.id = 0,
|
||||||
.dev.platform_data = &dm644x_edma_info,
|
.dev.platform_data = dm644x_edma_info,
|
||||||
.num_resources = ARRAY_SIZE(edma_resources),
|
.num_resources = ARRAY_SIZE(edma_resources),
|
||||||
.resource = edma_resources,
|
.resource = edma_resources,
|
||||||
};
|
};
|
||||||
|
|
|
@ -451,17 +451,43 @@ static const s8 dma_chan_dm646x_no_event[] = {
|
||||||
-1
|
-1
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct edma_soc_info dm646x_edma_info = {
|
/* Four Transfer Controllers on DM646x */
|
||||||
.n_channel = 64,
|
static const s8
|
||||||
.n_region = 6, /* 0-1, 4-7 */
|
dm646x_queue_tc_mapping[][2] = {
|
||||||
.n_slot = 512,
|
/* {event queue no, TC no} */
|
||||||
.n_tc = 4,
|
{0, 0},
|
||||||
.noevent = dma_chan_dm646x_no_event,
|
{1, 1},
|
||||||
|
{2, 2},
|
||||||
|
{3, 3},
|
||||||
|
{-1, -1},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const s8
|
||||||
|
dm646x_queue_priority_mapping[][2] = {
|
||||||
|
/* {event queue no, Priority} */
|
||||||
|
{0, 4},
|
||||||
|
{1, 0},
|
||||||
|
{2, 5},
|
||||||
|
{3, 1},
|
||||||
|
{-1, -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,
|
||||||
|
.n_cc = 1,
|
||||||
|
.noevent = dma_chan_dm646x_no_event,
|
||||||
|
.queue_tc_mapping = dm646x_queue_tc_mapping,
|
||||||
|
.queue_priority_mapping = dm646x_queue_priority_mapping,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct resource edma_resources[] = {
|
static struct resource edma_resources[] = {
|
||||||
{
|
{
|
||||||
.name = "edma_cc",
|
.name = "edma_cc0",
|
||||||
.start = 0x01c00000,
|
.start = 0x01c00000,
|
||||||
.end = 0x01c00000 + SZ_64K - 1,
|
.end = 0x01c00000 + SZ_64K - 1,
|
||||||
.flags = IORESOURCE_MEM,
|
.flags = IORESOURCE_MEM,
|
||||||
|
@ -491,10 +517,12 @@ static struct resource edma_resources[] = {
|
||||||
.flags = IORESOURCE_MEM,
|
.flags = IORESOURCE_MEM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
.name = "edma0",
|
||||||
.start = IRQ_CCINT0,
|
.start = IRQ_CCINT0,
|
||||||
.flags = IORESOURCE_IRQ,
|
.flags = IORESOURCE_IRQ,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
.name = "edma0_err",
|
||||||
.start = IRQ_CCERRINT,
|
.start = IRQ_CCERRINT,
|
||||||
.flags = IORESOURCE_IRQ,
|
.flags = IORESOURCE_IRQ,
|
||||||
},
|
},
|
||||||
|
@ -503,8 +531,8 @@ static struct resource edma_resources[] = {
|
||||||
|
|
||||||
static struct platform_device dm646x_edma_device = {
|
static struct platform_device dm646x_edma_device = {
|
||||||
.name = "edma",
|
.name = "edma",
|
||||||
.id = -1,
|
.id = 0,
|
||||||
.dev.platform_data = &dm646x_edma_info,
|
.dev.platform_data = dm646x_edma_info,
|
||||||
.num_resources = ARRAY_SIZE(edma_resources),
|
.num_resources = ARRAY_SIZE(edma_resources),
|
||||||
.resource = edma_resources,
|
.resource = edma_resources,
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -170,6 +170,10 @@ enum sync_dimension {
|
||||||
ABSYNC = 1
|
ABSYNC = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define EDMA_CTLR_CHAN(ctlr, chan) (((ctlr) << 16) | (chan))
|
||||||
|
#define EDMA_CTLR(i) ((i) >> 16)
|
||||||
|
#define EDMA_CHAN_SLOT(i) ((i) & 0xffff)
|
||||||
|
|
||||||
#define EDMA_CHANNEL_ANY -1 /* for edma_alloc_channel() */
|
#define EDMA_CHANNEL_ANY -1 /* for edma_alloc_channel() */
|
||||||
#define EDMA_SLOT_ANY -1 /* for edma_alloc_slot() */
|
#define EDMA_SLOT_ANY -1 /* for edma_alloc_slot() */
|
||||||
|
|
||||||
|
@ -180,7 +184,7 @@ int edma_alloc_channel(int channel,
|
||||||
void edma_free_channel(unsigned channel);
|
void edma_free_channel(unsigned channel);
|
||||||
|
|
||||||
/* alloc/free parameter RAM slots */
|
/* alloc/free parameter RAM slots */
|
||||||
int edma_alloc_slot(int slot);
|
int edma_alloc_slot(unsigned ctlr, int slot);
|
||||||
void edma_free_slot(unsigned slot);
|
void edma_free_slot(unsigned slot);
|
||||||
|
|
||||||
/* calls that operate on part of a parameter RAM slot */
|
/* calls that operate on part of a parameter RAM slot */
|
||||||
|
@ -216,9 +220,12 @@ struct edma_soc_info {
|
||||||
unsigned n_region;
|
unsigned n_region;
|
||||||
unsigned n_slot;
|
unsigned n_slot;
|
||||||
unsigned n_tc;
|
unsigned n_tc;
|
||||||
|
unsigned n_cc;
|
||||||
|
|
||||||
/* list of channels with no even trigger; terminated by "-1" */
|
/* list of channels with no even trigger; terminated by "-1" */
|
||||||
const s8 *noevent;
|
const s8 *noevent;
|
||||||
|
const s8 (*queue_tc_mapping)[2];
|
||||||
|
const s8 (*queue_priority_mapping)[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -143,7 +143,7 @@ static int davinci_pcm_dma_request(struct snd_pcm_substream *substream)
|
||||||
prtd->master_lch = ret;
|
prtd->master_lch = ret;
|
||||||
|
|
||||||
/* Request parameter RAM reload slot */
|
/* Request parameter RAM reload slot */
|
||||||
ret = edma_alloc_slot(EDMA_SLOT_ANY);
|
ret = edma_alloc_slot(EDMA_CTLR(prtd->master_lch), EDMA_SLOT_ANY);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
edma_free_channel(prtd->master_lch);
|
edma_free_channel(prtd->master_lch);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -160,8 +160,8 @@ static int davinci_pcm_dma_request(struct snd_pcm_substream *substream)
|
||||||
* so davinci_pcm_enqueue_dma() takes less time in IRQ.
|
* so davinci_pcm_enqueue_dma() takes less time in IRQ.
|
||||||
*/
|
*/
|
||||||
edma_read_slot(prtd->slave_lch, &p_ram);
|
edma_read_slot(prtd->slave_lch, &p_ram);
|
||||||
p_ram.opt |= TCINTEN | EDMA_TCC(prtd->master_lch);
|
p_ram.opt |= TCINTEN | EDMA_TCC(EDMA_CHAN_SLOT(prtd->master_lch));
|
||||||
p_ram.link_bcntrld = prtd->slave_lch << 5;
|
p_ram.link_bcntrld = EDMA_CHAN_SLOT(prtd->slave_lch) << 5;
|
||||||
edma_write_slot(prtd->slave_lch, &p_ram);
|
edma_write_slot(prtd->slave_lch, &p_ram);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue