diff options
author | Jay Monkman <jay.monkman@freescale.com> | 2013-06-14 11:47:50 -0500 |
---|---|---|
committer | Jay Monkman <jay.monkman@freescale.com> | 2013-06-14 11:47:50 -0500 |
commit | f4857b5482c67dcc9757d50cf57cb32728af788b (patch) | |
tree | 9b2d7c7c382ee1cdc3160d662a94b7b3deaa67f7 /arch | |
parent | df551ae02c600f8bc9244441700f7da7ac62ac88 (diff) |
ENGR00267024 mx6q: Stop DMA memory fragmentation
Applied patch from customer to prevent DMA memory
fragmentation. Customer reported system crashes due to running out of
DMA-able memory while playing videos. Reported in CT42391649.
Signed-off-by: Jay Monkman <jay.monkman@freescale.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-mx6/board-mx6q_sabrelite.c | 30 | ||||
-rw-r--r-- | arch/arm/mach-mx6/board-mx6q_sabresd.c | 28 |
2 files changed, 56 insertions, 2 deletions
diff --git a/arch/arm/mach-mx6/board-mx6q_sabrelite.c b/arch/arm/mach-mx6/board-mx6q_sabrelite.c index e1075fec4b68..92c51198c890 100644 --- a/arch/arm/mach-mx6/board-mx6q_sabrelite.c +++ b/arch/arm/mach-mx6/board-mx6q_sabrelite.c @@ -919,6 +919,16 @@ static struct fsl_mxc_capture_platform_data capture_data[] = { }; +struct imx_vout_mem { + resource_size_t res_mbase; + resource_size_t res_msize; +}; + +static struct imx_vout_mem vout_mem __initdata = { + .res_msize = SZ_128M, +}; + + static void sabrelite_suspend_enter(void) { /* suspend preparation */ @@ -1156,6 +1166,7 @@ static void __init mx6_sabrelite_board_init(void) struct clk *clko2; struct clk *new_parent; int rate; + struct platform_device *voutdev; mxc_iomux_v3_setup_multiple_pads(mx6q_sabrelite_pads, ARRAY_SIZE(mx6q_sabrelite_pads)); @@ -1184,7 +1195,17 @@ static void __init mx6_sabrelite_board_init(void) imx6q_add_vdoa(); imx6q_add_lcdif(&lcdif_data); imx6q_add_ldb(&ldb_data); - imx6q_add_v4l2_output(0); + voutdev = imx6q_add_v4l2_output(0); + if (vout_mem.res_msize && voutdev) { + dma_declare_coherent_memory(&voutdev->dev, + vout_mem.res_mbase, + vout_mem.res_mbase, + vout_mem.res_msize, + (DMA_MEMORY_MAP | + DMA_MEMORY_EXCLUSIVE)); + } + + imx6q_add_v4l2_capture(0, &capture_data[0]); imx6q_add_v4l2_capture(1, &capture_data[1]); imx6q_add_mipi_csi2(&mipi_csi2_pdata); @@ -1314,6 +1335,13 @@ static void __init mx6q_sabrelite_reserve(void) imx6q_gpu_pdata.reserved_mem_base = phys; } #endif + if (vout_mem.res_msize) { + phys = memblock_alloc_base(vout_mem.res_msize, + SZ_4K, SZ_1G); + memblock_remove(phys, vout_mem.res_msize); + vout_mem.res_mbase = phys; + } + } /* diff --git a/arch/arm/mach-mx6/board-mx6q_sabresd.c b/arch/arm/mach-mx6/board-mx6q_sabresd.c index 227008796bd8..3f90df0281d9 100644 --- a/arch/arm/mach-mx6/board-mx6q_sabresd.c +++ b/arch/arm/mach-mx6/board-mx6q_sabresd.c @@ -1425,6 +1425,15 @@ static struct fsl_mxc_capture_platform_data capture_data[] = { }; +struct imx_vout_mem { + resource_size_t res_mbase; + resource_size_t res_msize; +}; + +static struct imx_vout_mem vout_mem __initdata = { + .res_msize = SZ_128M, +}; + static void sabresd_suspend_enter(void) { /* suspend preparation */ @@ -1704,6 +1713,7 @@ static void __init mx6_sabresd_board_init(void) struct clk *clko, *clko2; struct clk *new_parent; int rate; + struct platform_device *voutdev; if (cpu_is_mx6q()) mxc_iomux_v3_setup_multiple_pads(mx6q_sabresd_pads, @@ -1752,7 +1762,16 @@ static void __init mx6_sabresd_board_init(void) imx6q_add_mipi_dsi(&mipi_dsi_pdata); imx6q_add_lcdif(&lcdif_data); imx6q_add_ldb(&ldb_data); - imx6q_add_v4l2_output(0); + voutdev = imx6q_add_v4l2_output(0); + if (vout_mem.res_msize && voutdev) { + dma_declare_coherent_memory(&voutdev->dev, + vout_mem.res_mbase, + vout_mem.res_mbase, + vout_mem.res_msize, + (DMA_MEMORY_MAP | + DMA_MEMORY_EXCLUSIVE)); + } + imx6q_add_v4l2_capture(0, &capture_data[0]); imx6q_add_v4l2_capture(1, &capture_data[1]); imx6q_add_mipi_csi2(&mipi_csi2_pdata); @@ -1979,6 +1998,13 @@ static void __init mx6q_sabresd_reserve(void) imx6q_gpu_pdata.reserved_mem_base = phys; } #endif + + if (vout_mem.res_msize) { + phys = memblock_alloc_base(vout_mem.res_msize, + SZ_4K, SZ_1G); + memblock_remove(phys, vout_mem.res_msize); + vout_mem.res_mbase = phys; + } } /* |