Commit dd844fb8 authored by Kieran Bingham's avatar Kieran Bingham Committed by Mauro Carvalho Chehab

media: platform: fcp: Set appropriate DMA parameters

Enabling CONFIG_DMA_API_DEBUG=y and CONFIG_DMA_API_DEBUG_SG=y will
enable extra validation on DMA operations ensuring that the size
restraints are met.

When using the FCP in conjunction with the VSP1/DU, and display frames,
the size of the DMA operations is larger than the default maximum
segment size reported by the DMA core (64K). With the DMA debug enabled,
this produces a warning such as the following:

"DMA-API: rcar-fcp fea27000.fcp: mapping sg segment longer than device
claims to support [len=3145728] [max=65536]"

We have no specific limitation on the segment size which isn't already
handled by the VSP1/DU which actually handles the DMA allcoations and
buffer management, so define a maximum segment size of up to 4GB (a 32
bit mask).
Reported-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Fixes: 7b49235e ("[media] v4l: Add Renesas R-Car FCP driver")
Signed-off-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent dba36134
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
*/ */
#include <linux/device.h> #include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
struct rcar_fcp_device { struct rcar_fcp_device {
struct list_head list; struct list_head list;
struct device *dev; struct device *dev;
struct device_dma_parameters dma_parms;
}; };
static LIST_HEAD(fcp_devices); static LIST_HEAD(fcp_devices);
...@@ -136,6 +138,9 @@ static int rcar_fcp_probe(struct platform_device *pdev) ...@@ -136,6 +138,9 @@ static int rcar_fcp_probe(struct platform_device *pdev)
fcp->dev = &pdev->dev; fcp->dev = &pdev->dev;
fcp->dev->dma_parms = &fcp->dma_parms;
dma_set_max_seg_size(fcp->dev, DMA_BIT_MASK(32));
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
mutex_lock(&fcp_lock); mutex_lock(&fcp_lock);
......
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