Commit Graph

9 Commits

Author SHA1 Message Date
Eric Long 32fa20139e dmaengine: sprd: Optimize the sprd_dma_prep_dma_memcpy()
This is one preparation patch, we can use default DMA configuration to
implement the device_prep_dma_memcpy() interface instead of issuing
sprd_dma_config().

We will implement one new sprd_dma_config() function with introducing
device_prep_slave_sg() interface in following patch. So we can remove
the obsolete sprd_dma_config() firstly.

Signed-off-by: Eric Long <eric.long@spreadtrum.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-05-29 10:15:33 +05:30
Dan Carpenter fd8d26adc9 dmaengine: sprd: fix an NULL vs IS_ERR() bug
We recently cleaned this code up but we need to update the error
handling as well.  The devm_ioremap_resource() returns error pointers on
error, never NULL.

Fixes: e7f063ae1a ("dmaengine: sprd: Use devm_ioremap_resource() to map memory")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-05-17 09:57:34 +05:30
Baolin Wang e7f063ae1a dmaengine: sprd: Use devm_ioremap_resource() to map memory
Instead of checking the return value of platform_get_resource(), we can
use devm_ioremap_resource() which has the NULL pointer check and the
memory region requesting.

Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-05-09 11:43:17 +05:30
Wei Yongjun e891e41ee3 dmaengine: sprd: Fix potential NULL dereference in sprd_dma_probe()
platform_get_resource() may fail and return NULL, so we should
better check it's return value to avoid a NULL pointer dereference
a bit later in the code.

This is detected by Coccinelle semantic patch.

@@
expression pdev, res, n, t, e, e1, e2;
@@

res = platform_get_resource(pdev, t, n);
+ if (!res)
+   return -EINVAL;
... when != res == NULL
e = devm_ioremap_nocache(e1, res->start, e2);

Fixes: 9b3b8171f7 ("dmaengine: sprd: Add Spreadtrum DMA driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-05-07 13:31:32 +05:30
Eric Long ab42ddb9eb dmaengine: sprd: Move DMA request mode and interrupt type into head file
This patch will move the Spreadtrum DMA request mode and interrupt type
into one head file for user to configure.

Signed-off-by: Eric Long <eric.long@spreadtrum.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-04-27 11:54:55 +05:30
Baolin Wang d7c33cf8ff dmaengine: sprd: Define the DMA data width type
Define the DMA data width type to make code more readable.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-04-27 11:54:55 +05:30
Eric Long 6b1d255ecd dmaengine: sprd: Define the DMA transfer step type
Define the DMA transfer step type to make code more readable.

Signed-off-by: Eric Long <eric.long@spreadtrum.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-04-27 11:54:55 +05:30
Vinod Koul 1ab8da1182 dmaengine: sprd: statify 'sprd_dma_prep_dma_memcpy'
Sparse warns that 'sprd_dma_prep_dma_memcpy' should be static so make it
static.

drivers/dma/sprd-dma.c:713:32: warning:
symbol'sprd_dma_prep_dma_memcpy' was not declared. Should it be static?

Reviewed-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2018-01-15 11:33:11 +05:30
Baolin Wang 9b3b8171f7 dmaengine: sprd: Add Spreadtrum DMA driver
This patch adds the DMA controller driver for Spreadtrum SC9860 platform.

Signed-off-by: Baolin Wang <baolin.wang@spreadtrum.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2017-10-24 20:07:55 +05:30