dmaengine: jz4780: Fall back on smaller transfer sizes where necessary
authorAlex Smith <alex.smith@imgtec.com>
Fri, 24 Jul 2015 16:24:21 +0000 (17:24 +0100)
committerVinod Koul <vinod.koul@intel.com>
Tue, 18 Aug 2015 16:58:49 +0000 (22:28 +0530)
commitdc578f314e2471ca93a4c1f80988ecc781836f72
tree0862d31388141b3f6228685e1c5cdaeb3a5880d7
parent46fa516869f4b57f9eb63db02c76642abfb9f682
dmaengine: jz4780: Fall back on smaller transfer sizes where necessary

For some reason the controller does not support 8 byte transfers (but
does support all other powers of 2 up to 128). In this case fall back
to 4 bytes. In addition, fall back to 128 bytes when any larger power
of 2 would be possible within the alignment constraints, as this is
the maximum supported.

It makes no sense to outright reject 8 or >128 bytes just because the
alignment constraints make those the maximum possible size given the
parameters for the transaction. For instance, this can result in a DMA
from/to an 8 byte aligned address failing.

It is perfectly safe to fall back to smaller transfer sizes, the only
consequence is reduced transfer efficiency, which is far better than
not allowing the transfer at all.

Signed-off-by: Alex Smith <alex.smith@imgtec.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Cc: dmaengine@vger.kernel.org
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/dma-jz4780.c