mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-18 06:15:12 +00:00
dmaengine: omap-dma: cleanup errata 3.3 handling
Provide a function to read the CSAC/CDAC register, working around the OMAP 3.2/3.3 erratum (which requires two reads of the register if the first returned zero. Acked-by: Tony Lindgren <tony@atomide.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
parent
c5ed98b6ae
commit
b07fd625ac
@ -451,28 +451,39 @@ static size_t omap_dma_desc_size_pos(struct omap_desc *d, dma_addr_t addr)
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* OMAP 3.2/3.3 erratum: sometimes 0 is returned if CSAC/CDAC is
|
||||||
|
* read before the DMA controller finished disabling the channel.
|
||||||
|
*/
|
||||||
|
static uint32_t omap_dma_chan_read_3_3(struct omap_chan *c, unsigned reg)
|
||||||
|
{
|
||||||
|
struct omap_dmadev *od = to_omap_dma_dev(c->vc.chan.device);
|
||||||
|
uint32_t val;
|
||||||
|
|
||||||
|
val = omap_dma_chan_read(c, reg);
|
||||||
|
if (val == 0 && od->plat->errata & DMA_ERRATA_3_3)
|
||||||
|
val = omap_dma_chan_read(c, reg);
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
static dma_addr_t omap_dma_get_src_pos(struct omap_chan *c)
|
static dma_addr_t omap_dma_get_src_pos(struct omap_chan *c)
|
||||||
{
|
{
|
||||||
struct omap_dmadev *od = to_omap_dma_dev(c->vc.chan.device);
|
struct omap_dmadev *od = to_omap_dma_dev(c->vc.chan.device);
|
||||||
dma_addr_t addr;
|
dma_addr_t addr, cdac;
|
||||||
|
|
||||||
if (__dma_omap15xx(od->plat->dma_attr))
|
if (__dma_omap15xx(od->plat->dma_attr)) {
|
||||||
addr = omap_dma_chan_read(c, CPC);
|
addr = omap_dma_chan_read(c, CPC);
|
||||||
else
|
} else {
|
||||||
addr = omap_dma_chan_read(c, CSAC);
|
addr = omap_dma_chan_read_3_3(c, CSAC);
|
||||||
|
cdac = omap_dma_chan_read_3_3(c, CDAC);
|
||||||
|
|
||||||
if (od->plat->errata & DMA_ERRATA_3_3 && addr == 0)
|
|
||||||
addr = omap_dma_chan_read(c, CSAC);
|
|
||||||
|
|
||||||
if (!__dma_omap15xx(od->plat->dma_attr)) {
|
|
||||||
/*
|
/*
|
||||||
* CDAC == 0 indicates that the DMA transfer on the channel has
|
* CDAC == 0 indicates that the DMA transfer on the channel has
|
||||||
* not been started (no data has been transferred so far).
|
* not been started (no data has been transferred so far).
|
||||||
* Return the programmed source start address in this case.
|
* Return the programmed source start address in this case.
|
||||||
*/
|
*/
|
||||||
if (omap_dma_chan_read(c, CDAC))
|
if (cdac == 0)
|
||||||
addr = omap_dma_chan_read(c, CSAC);
|
|
||||||
else
|
|
||||||
addr = omap_dma_chan_read(c, CSSA);
|
addr = omap_dma_chan_read(c, CSSA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,21 +498,16 @@ static dma_addr_t omap_dma_get_dst_pos(struct omap_chan *c)
|
|||||||
struct omap_dmadev *od = to_omap_dma_dev(c->vc.chan.device);
|
struct omap_dmadev *od = to_omap_dma_dev(c->vc.chan.device);
|
||||||
dma_addr_t addr;
|
dma_addr_t addr;
|
||||||
|
|
||||||
if (__dma_omap15xx(od->plat->dma_attr))
|
if (__dma_omap15xx(od->plat->dma_attr)) {
|
||||||
addr = omap_dma_chan_read(c, CPC);
|
addr = omap_dma_chan_read(c, CPC);
|
||||||
else
|
} else {
|
||||||
addr = omap_dma_chan_read(c, CDAC);
|
addr = omap_dma_chan_read_3_3(c, CDAC);
|
||||||
|
|
||||||
/*
|
|
||||||
* omap 3.2/3.3 erratum: sometimes 0 is returned if CSAC/CDAC is
|
|
||||||
* read before the DMA controller finished disabling the channel.
|
|
||||||
*/
|
|
||||||
if (!__dma_omap15xx(od->plat->dma_attr) && addr == 0) {
|
|
||||||
addr = omap_dma_chan_read(c, CDAC);
|
|
||||||
/*
|
/*
|
||||||
* CDAC == 0 indicates that the DMA transfer on the channel has
|
* CDAC == 0 indicates that the DMA transfer on the channel
|
||||||
* not been started (no data has been transferred so far).
|
* has not been started (no data has been transferred so
|
||||||
* Return the programmed destination start address in this case.
|
* far). Return the programmed destination start address in
|
||||||
|
* this case.
|
||||||
*/
|
*/
|
||||||
if (addr == 0)
|
if (addr == 0)
|
||||||
addr = omap_dma_chan_read(c, CDSA);
|
addr = omap_dma_chan_read(c, CDSA);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user