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

EDMA renames: edma_start(), edma_stop()

These functions now only accept channels, since reload slots can
never be independently active.  Change parameter to unsinged, to
allow a minor code shrink.  Remove pointless foof in edma_stop():
the channel's parameter RAM slot must be reinitialized, so there
is no reason to modify it unless chaining is being misused; and
just updating the link register can't protect aginst chain bugs.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent 62ef2b07
...@@ -612,7 +612,7 @@ arch_initcall(davinci_dma_init); ...@@ -612,7 +612,7 @@ arch_initcall(davinci_dma_init);
* be used only for software triggering or event chaining, channels not * be used only for software triggering or event chaining, channels not
* mapped to hardware events (or mapped to unused events) are preferable. * mapped to hardware events (or mapped to unused events) are preferable.
* *
* DMA transfers start from a channel using davinci_start_dma(), or by * DMA transfers start from a channel using edma_start(), or by
* chaining. When the transfer described in that channel's parameter RAM * chaining. When the transfer described in that channel's parameter RAM
* slot completes, that slot's data may be reloaded through a link. * slot completes, that slot's data may be reloaded through a link.
* *
...@@ -650,7 +650,7 @@ int edma_alloc_channel(int channel, ...@@ -650,7 +650,7 @@ int edma_alloc_channel(int channel,
edma_or_array2(EDMA_DRAE, 0, channel >> 5, 1 << (channel & 0x1f)); edma_or_array2(EDMA_DRAE, 0, channel >> 5, 1 << (channel & 0x1f));
/* ensure no events are pending */ /* ensure no events are pending */
davinci_stop_dma(channel); edma_stop(channel);
memcpy_toio(edmacc_regs_base + PARM_OFFSET(channel), memcpy_toio(edmacc_regs_base + PARM_OFFSET(channel),
&dummy_paramset, PARM_SIZE); &dummy_paramset, PARM_SIZE);
...@@ -673,7 +673,7 @@ EXPORT_SYMBOL(edma_alloc_channel); ...@@ -673,7 +673,7 @@ EXPORT_SYMBOL(edma_alloc_channel);
* *
* Callers are responsible for ensuring the channel is inactive, and * Callers are responsible for ensuring the channel is inactive, and
* will not be reactivated by linking, chaining, or software calls to * will not be reactivated by linking, chaining, or software calls to
* davinci_start_dma(). * edma_start().
*/ */
void edma_free_channel(unsigned channel) void edma_free_channel(unsigned channel)
{ {
...@@ -1011,8 +1011,8 @@ void davinci_resume_dma(int lch) ...@@ -1011,8 +1011,8 @@ void davinci_resume_dma(int lch)
EXPORT_SYMBOL(davinci_resume_dma); EXPORT_SYMBOL(davinci_resume_dma);
/** /**
* davinci_start_dma - start dma on a channel * edma_start - start dma on a channel
* @lch: logical channel being activated * @channel: channel being activated
* *
* Channels with event associations will be triggered by their hardware * Channels with event associations will be triggered by their hardware
* events, and channels without such associations will be triggered by * events, and channels without such associations will be triggered by
...@@ -1021,20 +1021,18 @@ EXPORT_SYMBOL(davinci_resume_dma); ...@@ -1021,20 +1021,18 @@ EXPORT_SYMBOL(davinci_resume_dma);
* *
* Returns zero on success, else negative errno. * Returns zero on success, else negative errno.
*/ */
int davinci_start_dma(int lch) int edma_start(unsigned channel)
{ {
int ret_val = 0; if (channel < DAVINCI_EDMA_NUM_DMACH) {
int j = channel >> 5;
if ((lch >= 0) && (lch < DAVINCI_EDMA_NUM_DMACH)) { unsigned int mask = (1 << (channel & 0x1f));
int j = lch >> 5;
unsigned int mask = (1 << (lch & 0x1f));
/* EDMA channels without event association */ /* EDMA channels without event association */
if (test_bit(lch, edma_noevent)) { if (test_bit(channel, edma_noevent)) {
dev_dbg(&edma_dev.dev, "ESR%d %08x\n", j, dev_dbg(&edma_dev.dev, "ESR%d %08x\n", j,
edma_shadow0_read_array(SH_ESR, j)); edma_shadow0_read_array(SH_ESR, j));
edma_shadow0_write_array(SH_ESR, j, mask); edma_shadow0_write_array(SH_ESR, j, mask);
return ret_val; return 0;
} }
/* EDMA channel with event association */ /* EDMA channel with event association */
...@@ -1047,30 +1045,27 @@ int davinci_start_dma(int lch) ...@@ -1047,30 +1045,27 @@ int davinci_start_dma(int lch)
edma_shadow0_write_array(SH_EESR, j, mask); edma_shadow0_write_array(SH_EESR, j, mask);
dev_dbg(&edma_dev.dev, "EER%d %08x\n", j, dev_dbg(&edma_dev.dev, "EER%d %08x\n", j,
edma_shadow0_read_array(SH_EER, j)); edma_shadow0_read_array(SH_EER, j));
} else { return 0;
ret_val = -EINVAL;
} }
return ret_val;
return -EINVAL;
} }
EXPORT_SYMBOL(davinci_start_dma); EXPORT_SYMBOL(edma_start);
/** /**
* davinci_stop_dma - stops dma on the channel passed * edma_stop - stops dma on the channel passed
* @lch: logical channel being deactivated * @channel: channel being deactivated
* *
* When @lch is a channel, any active transfer is paused and * When @lch is a channel, any active transfer is paused and
* all pending hardware events are cleared. The current transfer * all pending hardware events are cleared. The current transfer
* may not be resumed, and the channel's Parameter RAM should be * may not be resumed, and the channel's Parameter RAM should be
* reinitialized before being reused. * reinitialized before being reused.
*/ */
void davinci_stop_dma(int lch) void edma_stop(unsigned channel)
{ {
if (lch < 0 || lch >= DAVINCI_EDMA_NUM_PARAMENTRY) if (channel < DAVINCI_EDMA_NUM_DMACH) {
return; int j = channel >> 5;
unsigned int mask = (1 << (channel & 0x1f));
if (lch < DAVINCI_EDMA_NUM_DMACH) {
int j = lch >> 5;
unsigned int mask = (1 << (lch & 0x1f));
edma_shadow0_write_array(SH_EECR, j, mask); edma_shadow0_write_array(SH_EECR, j, mask);
edma_shadow0_write_array(SH_ECR, j, mask); edma_shadow0_write_array(SH_ECR, j, mask);
...@@ -1079,19 +1074,13 @@ void davinci_stop_dma(int lch) ...@@ -1079,19 +1074,13 @@ void davinci_stop_dma(int lch)
dev_dbg(&edma_dev.dev, "EER%d %08x\n", j, dev_dbg(&edma_dev.dev, "EER%d %08x\n", j,
edma_shadow0_read_array(SH_EER, j)); edma_shadow0_read_array(SH_EER, j));
/*
* if the requested channel is one of the event channels /* REVISIT: consider guarding against inappropriate event
* then just set the link field of the corresponding * chaining by overwriting with dummy_paramset.
* param entry to 0xffff
*/
/* don't clear link until audio driver fixed
* edma_parm_or(PARM_LINK_BCNTRLD, lch, 0xffff);
*/ */
} else {
edma_parm_or(PARM_LINK_BCNTRLD, lch, 0xffff);
} }
} }
EXPORT_SYMBOL(davinci_stop_dma); EXPORT_SYMBOL(edma_stop);
/****************************************************************************** /******************************************************************************
* *
......
...@@ -210,8 +210,8 @@ void edma_unlink(unsigned from); ...@@ -210,8 +210,8 @@ void edma_unlink(unsigned from);
void edma_write_slot(unsigned slot, const struct edmacc_param *params); void edma_write_slot(unsigned slot, const struct edmacc_param *params);
void edma_read_slot(unsigned slot, struct edmacc_param *params); void edma_read_slot(unsigned slot, struct edmacc_param *params);
int davinci_start_dma(int lch); int edma_start(unsigned channel);
void davinci_stop_dma(int lch); void edma_stop(unsigned channel);
void davinci_dma_getposition(int lch, dma_addr_t *src, dma_addr_t *dst); void davinci_dma_getposition(int lch, dma_addr_t *src, dma_addr_t *dst);
void davinci_clean_channel(int lch); void davinci_clean_channel(int lch);
......
...@@ -417,7 +417,7 @@ static void davinci_abort_dma(struct mmc_davinci_host *host) ...@@ -417,7 +417,7 @@ static void davinci_abort_dma(struct mmc_davinci_host *host)
else else
sync_dev = host->txdma; sync_dev = host->txdma;
davinci_stop_dma(sync_dev); edma_stop(sync_dev);
davinci_clean_channel(sync_dev); davinci_clean_channel(sync_dev);
} }
...@@ -532,7 +532,7 @@ static int mmc_davinci_send_dma_request(struct mmc_davinci_host *host, ...@@ -532,7 +532,7 @@ static int mmc_davinci_send_dma_request(struct mmc_davinci_host *host,
regs.ccnt = count >> ((rw_threshold == 32) ? 5 : 4); regs.ccnt = count >> ((rw_threshold == 32) ? 5 : 4);
edma_write_slot(lch, &regs); edma_write_slot(lch, &regs);
davinci_start_dma(lch); edma_start(lch);
return 0; return 0;
} }
......
...@@ -184,12 +184,12 @@ static int davinci_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -184,12 +184,12 @@ static int davinci_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
davinci_start_dma(prtd->master_lch); edma_start(prtd->master_lch);
break; break;
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
davinci_stop_dma(prtd->master_lch); edma_stop(prtd->master_lch);
break; break;
default: default:
ret = -EINVAL; ret = -EINVAL;
......
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