ARM: mx27_3ds: Reserve memory for camera usage
Subsystems (3)
Fabio Estevam
reviewerPATCH 1/2 ARM: mx27_3ds: Reserve memory for camera usage
From: Fabio Estevam <[email protected]>
Reserve dedicated memory block for camera usage.
--- arch/arm/mach-imx/mach-mx27_3ds.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
arch/arm/mach-imx/mach-mx27_3ds.c +31 -1
@@ -30,6 +30,7 @@#include <linux/spi/spi.h> #include <linux/regulator/machine.h> #include <linux/spi/l4f00242t03.h> +#include <asm/memblock.h> #include <media/soc_camera.h>
@@ -165,6 +166,9 @@ static const int mx27pdk_pins[] __initconst = { PC19_PF_SSI4_CLK, }; +static phys_addr_t mx2_camera_base__initdata ; +#define MX27PDK_CAM_BUF_SIZE SZ_8M +static struct gpio mx27_3ds_camera_gpios[] = { {CSI_PWRDWN ,GPIOF_OUT_INIT_HIGH ,"camera-power" }, {CSI_RESET ,GPIOF_OUT_INIT_HIGH ,"camera-reset" },
@@ -478,6 +482,24 @@ static const struct mx2_camera_platform_data mx27_3ds_cam_pdata __initconst = { .clk = 26000000, }; +static void __init mx27pdk_init_camera (void ) +{ +struct platform_device *pdev; +int dma; + + pdev =imx27_add_mx2_camera (&mx27_3ds_cam_pdata); + +if (IS_ERR (pdev)) +return ; + + dma =dma_declare_coherent_memory (&pdev->dev, + mx2_camera_base, mx2_camera_base, +MX27PDK_CAM_BUF_SIZE , +DMA_MEMORY_MAP |DMA_MEMORY_EXCLUSIVE ); +if (!(dma &DMA_MEMORY_MAP )) +return ; +} +static const struct imxi2c_platform_data mx27_3ds_i2c0_data__initconst = { .bitrate =100000 , };
@@ -527,7 +549,7 @@ static void __init mx27pdk_init(void) iclink_ov2640.power =NULL ; } -imx27_add_mx2_camera (&mx27_3ds_cam_pdata); +mx27pdk_init_camera ();imx27_add_imx_ssi (0 , &mx27_3ds_ssi_pdata);imx_add_platform_device ("imx_mc13783" ,0 ,NULL ,0 ,NULL ,0 );
@@ -542,6 +564,13 @@ static struct sys_timer mx27pdk_timer = { .init = mx27pdk_timer_init, }; +static void __init mx27pdk_reserve (void ) +{ +/* reserve MX27_3DS_CAMERA_BUF_SIZE bytes for mx2-camera */ + mx2_camera_base =arm_memblock_steal (MX27PDK_CAM_BUF_SIZE , +MX27PDK_CAM_BUF_SIZE ); +} +MACHINE_START (MX27_3DS ,"Freescale MX27PDK" )/* maintainer: Freescale Semiconductor, Inc. */ .atag_offset = 0x100,
@@ -551,5 +580,6 @@ MACHINE_START(MX27_3DS, "Freescale MX27PDK") .handle_irq = imx27_handle_irq, .timer = &mx27pdk_timer, .init_machine = mx27pdk_init, + .reserve = mx27pdk_reserve, .restart = mxc_restart,MACHINE_END
Signature · 1 line
1.7.9.5
Fabio Estevam
reviewerPATCH 2/2 ARM: mx27_3ds: Add VPU support
From: Fabio Estevam <[email protected]>
mx27 has a VPU (Video Processing Unit) block that allows doing H264/MPEG4 decoding and encoding in hardware.
Add support for it.
--- arch/arm/mach-imx/mach-mx27_3ds.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
arch/arm/mach-imx/mach-mx27_3ds.c +17 -1
@@ -500,6 +500,21 @@ static void __init mx27pdk_init_camera(void)return ; } +static void __init mx27pdk_init_vpu (void ) +{ +struct platform_device *pdev; +int dma; + + pdev =imx27_add_coda (); + dma =dma_declare_coherent_memory (&pdev->dev, + mx2_camera_base +MX27PDK_CAM_BUF_SIZE , + mx2_camera_base +MX27PDK_CAM_BUF_SIZE , +MX27PDK_CAM_BUF_SIZE , +DMA_MEMORY_MAP |DMA_MEMORY_EXCLUSIVE ); +if (!(dma &DMA_MEMORY_MAP )) +return ; +} +static const struct imxi2c_platform_data mx27_3ds_i2c0_data__initconst = { .bitrate =100000 , };
@@ -553,6 +568,7 @@ static void __init mx27pdk_init(void)imx27_add_imx_ssi (0 , &mx27_3ds_ssi_pdata);imx_add_platform_device ("imx_mc13783" ,0 ,NULL ,0 ,NULL ,0 ); +mx27pdk_init_vpu (); }static void __init mx27pdk_timer_init (void )
@@ -567,7 +583,7 @@ static struct sys_timer mx27pdk_timer = {static void __init mx27pdk_reserve (void ) {/* reserve MX27_3DS_CAMERA_BUF_SIZE bytes for mx2-camera */ - mx2_camera_base =arm_memblock_steal (MX27PDK_CAM_BUF_SIZE , + mx2_camera_base =arm_memblock_steal (3 *MX27PDK_CAM_BUF_SIZE ,MX27PDK_CAM_BUF_SIZE ); }
Signature · 1 line
1.7.9.5
PATCH 1/2 ARM: mx27_3ds: Reserve memory for camera usage
In reply to Fabio EstevamHi Fabio,
Quoted 3 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Reserve dedicated memory block for camera usage.
Why camera need to have a dedicated memory block reserved in the platform file ?
Quoted 78 lines
Signed-off-by Fabio Estevam <[email protected]>--- arch/arm/mach-imx/mach-mx27_3ds.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)arch/arm/mach-imx/mach-mx27_3ds.c +30
-1@@ -30,6 +30,7 @@#include <linux/spi/spi.h> #include <linux/regulator/machine.h> #include <linux/spi/l4f00242t03.h> +#include <asm/memblock.h> #include <media/soc_camera.h> @@ -165,6 +166,9 @@ static const int mx27pdk_pins[] __initconst = { PC19_PF_SSI4_CLK, }; +static phys_addr_t mx2_camera_base__initdata ; +#define MX27PDK_CAM_BUF_SIZE SZ_8M +static struct gpio mx27_3ds_camera_gpios[] = { {CSI_PWRDWN ,GPIOF_OUT_INIT_HIGH ,"camera-power" }, {CSI_RESET ,GPIOF_OUT_INIT_HIGH ,"camera-reset" },@@ -478,6 +482,24 @@ static const struct mx2_camera_platform_data mx27_3ds_cam_pdata __initconst = { .clk = 26000000, }; +static void __init mx27pdk_init_camera (void ) +{ +struct platform_device *pdev; +int dma; + + pdev =imx27_add_mx2_camera (&mx27_3ds_cam_pdata); + +if (IS_ERR (pdev)) +return ; + + dma =dma_declare_coherent_memory (&pdev->dev, + mx2_camera_base, mx2_camera_base, +MX27PDK_CAM_BUF_SIZE , +DMA_MEMORY_MAP |DMA_MEMORY_EXCLUSIVE ); +if (!(dma &DMA_MEMORY_MAP )) +return ; +} +static const struct imxi2c_platform_data mx27_3ds_i2c0_data__initconst = { .bitrate =100000 , };@@ -527,7 +549,7 @@ static void __init mx27pdk_init(void) iclink_ov2640.power =NULL ; } -imx27_add_mx2_camera (&mx27_3ds_cam_pdata); +mx27pdk_init_camera ();imx27_add_imx_ssi (0 , &mx27_3ds_ssi_pdata);imx_add_platform_device ("imx_mc13783" ,0 ,NULL ,0 ,NULL ,0 );@@ -542,6 +564,13 @@ static struct sys_timer mx27pdk_timer = { .init = mx27pdk_timer_init, }; +static void __init mx27pdk_reserve (void ) +{ +/* reserve MX27_3DS_CAMERA_BUF_SIZE bytes for mx2-camera */ + mx2_camera_base =arm_memblock_steal (MX27PDK_CAM_BUF_SIZE , +MX27PDK_CAM_BUF_SIZE ); +} +MACHINE_START (MX27_3DS ,"Freescale MX27PDK" )/* maintainer: Freescale Semiconductor, Inc. */ .atag_offset = 0x100,
arch/arm/mach-imx/mach-mx27_3ds.c MACHINE_START(MX27_3DS, "Freescale MX27PDK") · line 585
Quoted 6 lines
arch/arm/mach-imx/mach-mx27_3ds.c +1
-0@@ -551,5 +580,6 @@ MACHINE_START(MX27_3DS, "Freescale MX27PDK") .handle_irq = imx27_handle_irq, .timer = &mx27pdk_timer, .init_machine = mx27pdk_init, + .reserve = mx27pdk_reserve, .restart = mxc_restart,MACHINE_END
Thank you.
Best regards,
Ga?tan Carlier.
Sascha Hauer
maintainerPATCH 1/2 ARM: mx27_3ds: Reserve memory for camera usage
In reply to Fabio EstevamQuoted 3 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Reserve dedicated memory block for camera usage.
Why not use CMA?
Sascha
Quoted 87 lines
Signed-off-by Fabio Estevam <[email protected]>--- arch/arm/mach-imx/mach-mx27_3ds.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)arch/arm/mach-imx/mach-mx27_3ds.c +31
-1@@ -30,6 +30,7 @@#include <linux/spi/spi.h> #include <linux/regulator/machine.h> #include <linux/spi/l4f00242t03.h> +#include <asm/memblock.h> #include <media/soc_camera.h> @@ -165,6 +166,9 @@ static const int mx27pdk_pins[] __initconst = { PC19_PF_SSI4_CLK, }; +static phys_addr_t mx2_camera_base__initdata ; +#define MX27PDK_CAM_BUF_SIZE SZ_8M +static struct gpio mx27_3ds_camera_gpios[] = { {CSI_PWRDWN ,GPIOF_OUT_INIT_HIGH ,"camera-power" }, {CSI_RESET ,GPIOF_OUT_INIT_HIGH ,"camera-reset" },@@ -478,6 +482,24 @@ static const struct mx2_camera_platform_data mx27_3ds_cam_pdata __initconst = { .clk = 26000000, }; +static void __init mx27pdk_init_camera (void ) +{ +struct platform_device *pdev; +int dma; + + pdev =imx27_add_mx2_camera (&mx27_3ds_cam_pdata); + +if (IS_ERR (pdev)) +return ; + + dma =dma_declare_coherent_memory (&pdev->dev, + mx2_camera_base, mx2_camera_base, +MX27PDK_CAM_BUF_SIZE , +DMA_MEMORY_MAP |DMA_MEMORY_EXCLUSIVE ); +if (!(dma &DMA_MEMORY_MAP )) +return ; +} +static const struct imxi2c_platform_data mx27_3ds_i2c0_data__initconst = { .bitrate =100000 , };@@ -527,7 +549,7 @@ static void __init mx27pdk_init(void) iclink_ov2640.power =NULL ; } -imx27_add_mx2_camera (&mx27_3ds_cam_pdata); +mx27pdk_init_camera ();imx27_add_imx_ssi (0 , &mx27_3ds_ssi_pdata);imx_add_platform_device ("imx_mc13783" ,0 ,NULL ,0 ,NULL ,0 );@@ -542,6 +564,13 @@ static struct sys_timer mx27pdk_timer = { .init = mx27pdk_timer_init, }; +static void __init mx27pdk_reserve (void ) +{ +/* reserve MX27_3DS_CAMERA_BUF_SIZE bytes for mx2-camera */ + mx2_camera_base =arm_memblock_steal (MX27PDK_CAM_BUF_SIZE , +MX27PDK_CAM_BUF_SIZE ); +} +MACHINE_START (MX27_3DS ,"Freescale MX27PDK" )/* maintainer: Freescale Semiconductor, Inc. */ .atag_offset = 0x100,@@ -551,5 +580,6 @@ MACHINE_START(MX27_3DS, "Freescale MX27PDK") .handle_irq = imx27_handle_irq, .timer = &mx27pdk_timer, .init_machine = mx27pdk_init, + .reserve = mx27pdk_reserve, .restart = mxc_restart,MACHINE_END Signature · 1 line
1.7.9.5
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Fabio Estevam
reviewerPATCH 1/2 ARM: mx27_3ds: Reserve memory for camera usage
Quoted 6 lines · Sascha Hauer
Quoted 3 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Reserve dedicated memory block for camera usage.
Why not use CMA?
Sorry, not familiar with CMA. Could you please point to some board file/driver that makes use of it?
Regards,
Fabio Estevam
Sascha Hauer
maintainerPATCH 1/2 ARM: mx27_3ds: Reserve memory for camera usage
Quoted 10 lines · Fabio Estevam
Quoted 6 lines · Sascha Hauer
Quoted 3 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Reserve dedicated memory block for camera usage.
Why not use CMA?
Sorry, not familiar with CMA. Could you please point to some board file/driver that makes use of it?
You just have to enable it. The driver then can use dma_alloc_* as it used to.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |