Some fixes and cleanup on imx-dma device registration
Subsystems (4)
v2 cover Some fixes and cleanup on imx-dma device registration
The patch set makes some small fixes on imx-dma device registration code, and then cleans up the code by breaking the concentrated imx-dma device registration into soc specific setup function. This is basically what gpio-mxc device registration is doing. In this way, we can avoid the churn of "#ifdef" and the cpu_is_mx checking on such a long list of soc family, which makes no sense, considering more soc supports need to be added and we need to support single image for multiple socs in the long run.
Changes since v1:
* Drop the patch #5 in v1 and add another one to pass firmware name as a string via platform data
* Rebase it on Sascha's tree
Shawn Guo (6):
ARM: mxc: imx-sdma device gets 16K iosize than 4K
ARM: mxc: sdma on imx25 is a V2 block
ARM: mxc: change imx-dma default to_version to 1
ARM: mxc: imx-dma on imx25 has no other TO version but TO1
ARM: mxc: clean up imx-dma device registration
dmaengine: imx-sdma: pass sdma firmware name via platform data
arch/arm/mach-imx/mm-imx21.c | 3 + arch/arm/mach-imx/mm-imx25.c | 25 +++ arch/arm/mach-imx/mm-imx27.c | 3 + arch/arm/mach-imx/mm-imx31.c | 27 +++ arch/arm/mach-imx/mm-imx35.c | 47 +++++ arch/arm/mach-mx5/mm.c | 44 +++++ arch/arm/plat-mxc/devices.c | 16 ++- arch/arm/plat-mxc/devices/platform-imx-dma.c | 232 ++--------------------- arch/arm/plat-mxc/include/mach/devices-common.h | 6 + arch/arm/plat-mxc/include/mach/sdma.h | 6 +- drivers/dma/imx-sdma.c | 6 +- 11 files changed, 188 insertions(+), 227 deletions(-)
PATCH v2 1/6 ARM: mxc: imx-sdma device gets 16K iosize than 4K
The sdma on all imx soc gets 16K IO space not 4K.
--- arch/arm/plat-mxc/devices/platform-imx-dma.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/plat-mxc/devices/platform-imx-dma.c +1 -1
@@ -62,7 +62,7 @@ static struct platform_device __init __maybe_unused *imx_add_imx_sdma(struct resource res[] = { { .start = data->iobase, - .end = data->iobase +SZ_4K -1 , + .end = data->iobase +SZ_16K -1 , .flags =IORESOURCE_MEM , }, { .start = data->irq,
Signature · 1 line
1.7.4.1
PATCH v2 2/6 ARM: mxc: sdma on imx25 is a V2 block
In reply to Shawn GuoThe sdma on soc imx25 is not a V1 but V2 block.
--- arch/arm/plat-mxc/devices/platform-imx-dma.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/plat-mxc/devices/platform-imx-dma.c +1 -1
@@ -33,7 +33,7 @@ struct imx_imx_sdma_data {#ifdef CONFIG_SOC_IMX25 struct imx_imx_sdma_data imx25_imx_sdma_data__initconst = -imx_imx_sdma_data_entry_single (MX25 ,1 ,"imx25" ,0 ); +imx_imx_sdma_data_entry_single (MX25 ,2 ,"imx25" ,0 );#endif /* ifdef CONFIG_SOC_IMX25 */ #ifdef CONFIG_SOC_IMX31
Signature · 1 line
1.7.4.1
PATCH v2 3/6 ARM: mxc: change imx-dma default to_version to 1
In reply to Shawn GuoThe value 0 is not a valid TO version number. With the current code, imx-sdma driver will try to load firmware sdma-imx25-to0.bin, which is obviously not a good name. Instead, sdma-imx25-to1.bin makes much more sense.
--- arch/arm/plat-mxc/devices/platform-imx-dma.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/plat-mxc/devices/platform-imx-dma.c +4 -4
@@ -33,22 +33,22 @@ struct imx_imx_sdma_data {#ifdef CONFIG_SOC_IMX25 struct imx_imx_sdma_data imx25_imx_sdma_data__initconst = -imx_imx_sdma_data_entry_single (MX25 ,2 ,"imx25" ,0 ); +imx_imx_sdma_data_entry_single (MX25 ,2 ,"imx25" ,1 );#endif /* ifdef CONFIG_SOC_IMX25 */ #ifdef CONFIG_SOC_IMX31 struct imx_imx_sdma_data imx31_imx_sdma_data__initdata = -imx_imx_sdma_data_entry_single (MX31 ,1 ,"imx31" ,0 ); +imx_imx_sdma_data_entry_single (MX31 ,1 ,"imx31" ,1 );#endif /* ifdef CONFIG_SOC_IMX31 */ #ifdef CONFIG_SOC_IMX35 struct imx_imx_sdma_data imx35_imx_sdma_data__initdata = -imx_imx_sdma_data_entry_single (MX35 ,2 ,"imx35" ,0 ); +imx_imx_sdma_data_entry_single (MX35 ,2 ,"imx35" ,1 );#endif /* ifdef CONFIG_SOC_IMX35 */ #ifdef CONFIG_SOC_IMX51 struct imx_imx_sdma_data imx51_imx_sdma_data__initconst = -imx_imx_sdma_data_entry_single (MX51 ,2 ,"imx51" ,0 ); +imx_imx_sdma_data_entry_single (MX51 ,2 ,"imx51" ,1 );#endif /* ifdef CONFIG_SOC_IMX51 */ #ifdef CONFIG_SOC_IMX53
Signature · 1 line
1.7.4.1
PATCH v2 4/6 ARM: mxc: imx-dma on imx25 has no other TO version but TO1
In reply to Shawn GuoThe imx25 sdma script only gets TO1 version, so there is no need to encode "to1" in the variable name.
--- arch/arm/plat-mxc/devices/platform-imx-dma.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/plat-mxc/devices/platform-imx-dma.c +2 -2
@@ -82,7 +82,7 @@ static struct platform_device __init __maybe_unused *imx_add_imx_dma(void) }#ifdef CONFIG_ARCH_MX25 -static struct sdma_script_start_addrs addr_imx25_to1 = { +static struct sdma_script_start_addrs addr_imx25 = { .ap_2_ap_addr =729 , .uart_2_mcu_addr =904 , .per_2_app_addr = 1255,
@@ -186,7 +186,7 @@ static int __init imxXX_add_imx_dma(void)#if defined(CONFIG_SOC_IMX25 )if (cpu_is_mx25 ()) { - imx25_imx_sdma_data.pdata.script_addrs = &addr_imx25_to1; + imx25_imx_sdma_data.pdata.script_addrs = &addr_imx25; ret =imx_add_imx_sdma (&imx25_imx_sdma_data); } else#endif
Signature · 1 line
1.7.4.1
PATCH v2 5/6 ARM: mxc: clean up imx-dma device registration
In reply to Shawn GuoThe patch follows the implementation of gpio-mxc device registration to break the concentrated imx-dma device registration into soc specific setup function. Then we can avoid the churn of "#ifdef" and the cpu_is_mx checking on such a long list, which makes no sense, considering more soc supports need to be added and we need to support single image for multiple socs in the long run.
--- arch/arm/mach-imx/mm-imx21.c | 3 + arch/arm/mach-imx/mm-imx25.c | 26 +++ arch/arm/mach-imx/mm-imx27.c | 3 + arch/arm/mach-imx/mm-imx31.c | 24 +++ arch/arm/mach-imx/mm-imx35.c | 44 +++++ arch/arm/mach-mx5/mm.c | 49 +++++ arch/arm/plat-mxc/devices.c | 16 ++- arch/arm/plat-mxc/devices/platform-imx-dma.c | 232 ++--------------------- arch/arm/plat-mxc/include/mach/devices-common.h | 6 + 9 files changed, 183 insertions(+), 220 deletions(-)
arch/arm/mach-imx/mm-imx21.c +3 -0
@@ -22,6 +22,7 @@#include <linux/init.h> #include <mach/hardware.h> #include <mach/common.h> +#include <mach/devices-common.h> #include <asm/pgtable.h> #include <asm/mach/map.h> #include <mach/irqs.h>
@@ -82,4 +83,6 @@ void __init imx21_soc_init(void)mxc_register_gpio (3 ,MX21_GPIO4_BASE_ADDR ,SZ_256 ,MX21_INT_GPIO ,0 );mxc_register_gpio (4 ,MX21_GPIO5_BASE_ADDR ,SZ_256 ,MX21_INT_GPIO ,0 );mxc_register_gpio (5 ,MX21_GPIO6_BASE_ADDR ,SZ_256 ,MX21_INT_GPIO ,0 ); + +imx_add_imx_dma (); }
arch/arm/mach-imx/mm-imx25.c +26 -0
@@ -24,6 +24,7 @@#include <asm/mach/map.h> #include <mach/common.h> +#include <mach/devices-common.h> #include <mach/hardware.h> #include <mach/mx25.h> #include <mach/iomux-v3.h>
@@ -61,10 +62,35 @@ void __init mx25_init_irq(void)mxc_init_irq (MX25_IO_ADDRESS (MX25_AVIC_BASE_ADDR )); } +static struct sdma_script_start_addrs imx25_sdma_script__initdata = { + .ap_2_ap_addr =729 , + .uart_2_mcu_addr =904 , + .per_2_app_addr =1255 , + .mcu_2_app_addr =834 , + .uartsh_2_mcu_addr =1120 , + .per_2_shp_addr =1329 , + .mcu_2_shp_addr =1048 , + .ata_2_mcu_addr =1560 , + .mcu_2_ata_addr =1479 , + .app_2_per_addr =1189 , + .app_2_mcu_addr =770 , + .shp_2_per_addr =1407 , + .shp_2_mcu_addr =979 , +}; + +static struct sdma_platform_data imx25_sdma_pdata__initdata = { + .sdma_version =2 , + .cpu_name ="imx25" , + .to_version =1 , + .script_addrs = &imx25_sdma_script, +}; +void __init imx25_soc_init (void ) {mxc_register_gpio (0 ,MX25_GPIO1_BASE_ADDR ,SZ_16K ,MX25_INT_GPIO1 ,0 );mxc_register_gpio (1 ,MX25_GPIO2_BASE_ADDR ,SZ_16K ,MX25_INT_GPIO2 ,0 );mxc_register_gpio (2 ,MX25_GPIO3_BASE_ADDR ,SZ_16K ,MX25_INT_GPIO3 ,0 );mxc_register_gpio (3 ,MX25_GPIO4_BASE_ADDR ,SZ_16K ,MX25_INT_GPIO4 ,0 ); + +imx_add_imx_sdma (MX25_SDMA_BASE_ADDR ,MX25_INT_SDMA , &imx25_sdma_pdata); }
arch/arm/mach-imx/mm-imx27.c +3 -0
@@ -22,6 +22,7 @@#include <linux/init.h> #include <mach/hardware.h> #include <mach/common.h> +#include <mach/devices-common.h> #include <asm/pgtable.h> #include <asm/mach/map.h> #include <mach/irqs.h>
@@ -82,4 +83,6 @@ void __init imx27_soc_init(void)mxc_register_gpio (3 ,MX27_GPIO4_BASE_ADDR ,SZ_256 ,MX27_INT_GPIO ,0 );mxc_register_gpio (4 ,MX27_GPIO5_BASE_ADDR ,SZ_256 ,MX27_INT_GPIO ,0 );mxc_register_gpio (5 ,MX27_GPIO6_BASE_ADDR ,SZ_256 ,MX27_INT_GPIO ,0 ); + +imx_add_imx_dma (); }
arch/arm/mach-imx/mm-imx31.c +24 -0
@@ -24,6 +24,7 @@#include <asm/mach/map.h> #include <mach/common.h> +#include <mach/devices-common.h> #include <mach/hardware.h> #include <mach/iomux-v3.h> #include <mach/irqs.h>
@@ -57,9 +58,32 @@ void __init mx31_init_irq(void)mxc_init_irq (MX31_IO_ADDRESS (MX31_AVIC_BASE_ADDR )); } +static struct sdma_script_start_addrs imx31_to1_sdma_script__initdata = { + .per_2_per_addr =1677 , +}; + +static struct sdma_script_start_addrs imx31_to2_sdma_script__initdata = { + .ap_2_ap_addr =423 , + .ap_2_bp_addr =829 , + .bp_2_ap_addr =1029 , +}; + +static struct sdma_platform_data imx31_sdma_pdata__initdata = { + .sdma_version =1 , + .cpu_name ="imx31" , + .script_addrs = &imx31_to2_sdma_script, +}; +void __init imx31_soc_init (void ) { +int to_version =mx31_revision () >>4 ; +mxc_register_gpio (0 ,MX31_GPIO1_BASE_ADDR ,SZ_16K ,MX31_INT_GPIO1 ,0 );mxc_register_gpio (1 ,MX31_GPIO2_BASE_ADDR ,SZ_16K ,MX31_INT_GPIO2 ,0 );mxc_register_gpio (2 ,MX31_GPIO3_BASE_ADDR ,SZ_16K ,MX31_INT_GPIO3 ,0 ); + + imx31_sdma_pdata.to_version = to_version; +if (to_version ==1 ) + imx31_sdma_pdata.script_addrs = &imx31_to1_sdma_script; +imx_add_imx_sdma (MX31_SDMA_BASE_ADDR ,MX31_INT_SDMA , &imx31_sdma_pdata); }
arch/arm/mach-imx/mm-imx35.c +44 -0
59 lines not on this page · raw message
arch/arm/mach-mx5/mm.c +49 -0
71 lines not on this page · raw message
arch/arm/plat-mxc/devices.c +15 -1
@@ -95,8 +95,22 @@ struct device mxc_aips_bus = { .parent = &platform_bus, }; +struct device mxc_ahb_bus = { + .init_name ="mxc_ahb" , + .parent = &platform_bus, +}; +static int __init mxc_device_init (void ) { -return device_register (&mxc_aips_bus); +int ret; + + ret =device_register (&mxc_aips_bus); +if (IS_ERR_VALUE (ret)) + goto done; + + ret =device_register (&mxc_ahb_bus); + +done: +return ret; }core_initcall (mxc_device_init);
arch/arm/plat-mxc/devices/platform-imx-dma.c +13 -219
248 lines not on this page · raw message
arch/arm/plat-mxc/include/mach/devices-common.h +6 -0
@@ -9,8 +9,10 @@#include <linux/kernel.h> #include <linux/platform_device.h> #include <linux/init.h> +#include <mach/sdma.h> extern struct device mxc_aips_bus; +extern struct device mxc_ahb_bus; struct platform_device *imx_add_platform_device_dmamask( const char *name, int id,
@@ -293,3 +295,7 @@ struct imx_spi_imx_data {struct platform_device *__init imx_add_spi_imx (const struct imx_spi_imx_data *data,const struct spi_imx_master *pdata); + +struct platform_device *imx_add_imx_dma (void ); +struct platform_device *imx_add_imx_sdma ( +resource_size_t iobase,int irq,struct sdma_platform_data *pdata);
Signature · 1 line
1.7.4.1
PATCH v2 6/6 dmaengine: imx-sdma: pass sdma firmware name via platform data
In reply to Shawn GuoIt is not good to have cpu_name and to_version encoded into sdma firmware name as variables. For example, there are three TOs of imx51 soc, the sdma script never changes since TO1, which means all three TOs of imx51 uses TO1 version of sdma script. But we have to prepare three identical firmwares, sdma-imx51-to1.bin sdma-imx51-to2.bin and sdma-imx51-to3.bin, to have the kernel capable of running on all three TOs.
The patch removes cpu_name and to_version from sdma platform data, and instead uses fw_name to pass the firmware name, so that we can pass the TO version where it's relevant and skip it where only one firmware exists.
--- arch/arm/mach-imx/mm-imx25.c | 3 +-- arch/arm/mach-imx/mm-imx31.c | 9 ++++++--- arch/arm/mach-imx/mm-imx35.c | 9 ++++++--- arch/arm/mach-mx5/mm.c | 9 ++------- arch/arm/plat-mxc/include/mach/sdma.h | 6 ++---- drivers/dma/imx-sdma.c | 6 +++--- 6 files changed, 20 insertions(+), 22 deletions(-)
arch/arm/mach-imx/mm-imx25.c +1 -2
@@ -80,8 +80,7 @@ static struct sdma_script_start_addrs imx25_sdma_script __initdata = {static struct sdma_platform_data imx25_sdma_pdata__initdata = { .sdma_version =2 , - .cpu_name ="imx25" , - .to_version =1 , + .fw_name ="sdma-imx25.bin" , .script_addrs = &imx25_sdma_script, };
arch/arm/mach-imx/mm-imx31.c +6 -3
@@ -70,7 +70,7 @@ static struct sdma_script_start_addrs imx31_to2_sdma_script __initdata = {static struct sdma_platform_data imx31_sdma_pdata__initdata = { .sdma_version =1 , - .cpu_name ="imx31" , + .fw_name ="sdma-imx31-to2.bin" , .script_addrs = &imx31_to2_sdma_script, };
@@ -82,8 +82,11 @@ void __init imx31_soc_init(void)mxc_register_gpio (1 ,MX31_GPIO2_BASE_ADDR ,SZ_16K ,MX31_INT_GPIO2 ,0 );mxc_register_gpio (2 ,MX31_GPIO3_BASE_ADDR ,SZ_16K ,MX31_INT_GPIO3 ,0 ); - imx31_sdma_pdata.to_version = to_version; -if (to_version ==1 ) +if (to_version ==1 ) { +strncpy (imx31_sdma_pdata.fw_name,"sdma-imx31-to1.bin" , +strlen (imx31_sdma_pdata.fw_name)); imx31_sdma_pdata.script_addrs = &imx31_to1_sdma_script; + } +imx_add_imx_sdma (MX31_SDMA_BASE_ADDR ,MX31_INT_SDMA , &imx31_sdma_pdata); }
arch/arm/mach-imx/mm-imx35.c +6 -3
@@ -87,7 +87,7 @@ static struct sdma_script_start_addrs imx35_to2_sdma_script __initdata = {static struct sdma_platform_data imx35_sdma_pdata__initdata = { .sdma_version =2 , - .cpu_name ="imx35" , + .fw_name ="sdma-imx35-to2.bin" , .script_addrs = &imx35_to2_sdma_script, };
@@ -99,8 +99,11 @@ void __init imx35_soc_init(void)mxc_register_gpio (1 ,MX35_GPIO2_BASE_ADDR ,SZ_16K ,MX35_INT_GPIO2 ,0 );mxc_register_gpio (2 ,MX35_GPIO3_BASE_ADDR ,SZ_16K ,MX35_INT_GPIO3 ,0 ); - imx35_sdma_pdata.to_version = to_version; -if (to_version ==1 ) +if (to_version ==1 ) { +strncpy (imx35_sdma_pdata.fw_name,"sdma-imx35-to1.bin" , +strlen (imx35_sdma_pdata.fw_name)); imx35_sdma_pdata.script_addrs = &imx35_to1_sdma_script; + } +imx_add_imx_sdma (MX35_SDMA_BASE_ADDR ,MX35_INT_SDMA , &imx35_sdma_pdata); }
arch/arm/mach-mx5/mm.c +2 -7
@@ -116,8 +116,7 @@ static struct sdma_script_start_addrs imx51_sdma_script __initdata = {static struct sdma_platform_data imx51_sdma_pdata__initdata = { .sdma_version =2 , - .cpu_name ="imx51" , - .to_version =1 , + .fw_name ="sdma-imx51.bin" , .script_addrs = &imx51_sdma_script, };
@@ -137,21 +136,17 @@ static struct sdma_script_start_addrs imx53_sdma_script __initdata = {static struct sdma_platform_data imx53_sdma_pdata__initdata = { .sdma_version =2 , - .cpu_name ="imx53" , - .to_version =1 , + .fw_name ="sdma-imx53.bin" , .script_addrs = &imx53_sdma_script, };void __init imx51_soc_init (void ) { -int to_version =mx51_revision () >>4 ; -mxc_register_gpio (0 ,MX51_GPIO1_BASE_ADDR ,SZ_16K ,MX51_MXC_INT_GPIO1_LOW ,MX51_MXC_INT_GPIO1_HIGH );mxc_register_gpio (1 ,MX51_GPIO2_BASE_ADDR ,SZ_16K ,MX51_MXC_INT_GPIO2_LOW ,MX51_MXC_INT_GPIO2_HIGH );mxc_register_gpio (2 ,MX51_GPIO3_BASE_ADDR ,SZ_16K ,MX51_MXC_INT_GPIO3_LOW ,MX51_MXC_INT_GPIO3_HIGH );mxc_register_gpio (3 ,MX51_GPIO4_BASE_ADDR ,SZ_16K ,MX51_MXC_INT_GPIO4_LOW ,MX51_MXC_INT_GPIO4_HIGH ); - imx51_sdma_pdata.to_version = to_version;imx_add_imx_sdma (MX51_SDMA_BASE_ADDR ,MX51_INT_SDMA , &imx51_sdma_pdata); }
arch/arm/plat-mxc/include/mach/sdma.h +2 -4
@@ -49,14 +49,12 @@ struct sdma_script_start_addrs {* struct sdma_platform_data - platform specific data for SDMA engine * * @sdma_version The version of this SDMA engine -* @cpu_name used to generate the firmware name -* @to_version CPU Tape out version +* @fw_name The firmware name * @script_addrs SDMA scripts addresses in SDMA ROM */ struct sdma_platform_data {int sdma_version; -char *cpu_name; -int to_version; +char *fw_name;struct sdma_script_start_addrs *script_addrs; };
drivers/dma/imx-sdma.c +3 -3
@@ -1105,7 +1105,7 @@ static void sdma_add_scripts(struct sdma_engine *sdma, }static int __init sdma_get_firmware (struct sdma_engine *sdma, -const char *cpu_name,int to_version) +const char *fw_name) {const struct firmware *fw;char *fwname;
@@ -1114,7 +1114,7 @@ static int __init sdma_get_firmware(struct sdma_engine *sdma,const struct sdma_script_start_addrs *addr;unsigned short *ram_code; - fwname =kasprintf (GFP_KERNEL ,"sdma-%s-to%d.bin" , cpu_name, to_version); + fwname =kasprintf (GFP_KERNEL ,"%s" , fw_name);if (!fwname)return -ENOMEM ;
@@ -1317,7 +1317,7 @@ static int __init sdma_probe(struct platform_device *pdev)if (pdata->script_addrs)sdma_add_scripts (sdma, pdata->script_addrs); -sdma_get_firmware (sdma, pdata->cpu_name, pdata->to_version); +sdma_get_firmware (sdma, pdata->fw_name); sdma->dma_device.dev = &pdev->dev;
Signature · 1 line
1.7.4.1
Sascha Hauer
maintainerPATCH v2 6/6 dmaengine: imx-sdma: pass sdma firmware name via platform data
Vinod,
Can I have your ack for this? It depends on the other patches in this series and should go via the i.MX tree rather than the DMA tree.
Sascha
Quoted 187 lines · Shawn Guo
It is not good to have
cpu_nameandto_versionencoded into sdma firmware name as variables. For example, there are three TOs of imx51 soc, the sdma script never changes since TO1, which means all three TOs of imx51 uses TO1 version of sdma script. But we have to prepare three identical firmwares, sdma-imx51-to1.bin sdma-imx51-to2.bin and sdma-imx51-to3.bin, to have the kernel capable of running on all three TOs.The patch removes
cpu_nameandto_versionfrom sdma platform data, and instead usesfw_nameto pass the firmware name, so that we can pass the TO version where it's relevant and skip it where only one firmware exists.Signed-off-by Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Vinod Koul <[email protected]>--- arch/arm/mach-imx/mm-imx25.c | 3 +-- arch/arm/mach-imx/mm-imx31.c | 9 ++++++--- arch/arm/mach-imx/mm-imx35.c | 9 ++++++--- arch/arm/mach-mx5/mm.c | 9 ++------- arch/arm/plat-mxc/include/mach/sdma.h | 6 ++---- drivers/dma/imx-sdma.c | 6 +++--- 6 files changed, 20 insertions(+), 22 deletions(-)arch/arm/mach-imx/mm-imx25.c +1
-2@@ -80,8 +80,7 @@ static struct sdma_script_start_addrs imx25_sdma_script __initdata = {static struct sdma_platform_data imx25_sdma_pdata__initdata = { .sdma_version =2 , - .cpu_name ="imx25" , - .to_version =1 , + .fw_name ="sdma-imx25.bin" , .script_addrs = &imx25_sdma_script, };arch/arm/mach-imx/mm-imx31.c +6
-3@@ -70,7 +70,7 @@ static struct sdma_script_start_addrs imx31_to2_sdma_script __initdata = {static struct sdma_platform_data imx31_sdma_pdata__initdata = { .sdma_version =1 , - .cpu_name ="imx31" , + .fw_name ="sdma-imx31-to2.bin" , .script_addrs = &imx31_to2_sdma_script, };@@ -82,8 +82,11 @@ void __init imx31_soc_init(void)mxc_register_gpio (1 ,MX31_GPIO2_BASE_ADDR ,SZ_16K ,MX31_INT_GPIO2 ,0 );mxc_register_gpio (2 ,MX31_GPIO3_BASE_ADDR ,SZ_16K ,MX31_INT_GPIO3 ,0 ); - imx31_sdma_pdata.to_version = to_version; -if (to_version ==1 ) +if (to_version ==1 ) { +strncpy (imx31_sdma_pdata.fw_name,"sdma-imx31-to1.bin" , +strlen (imx31_sdma_pdata.fw_name)); imx31_sdma_pdata.script_addrs = &imx31_to1_sdma_script; + } +imx_add_imx_sdma (MX31_SDMA_BASE_ADDR ,MX31_INT_SDMA , &imx31_sdma_pdata); }arch/arm/mach-imx/mm-imx35.c +6
-3@@ -87,7 +87,7 @@ static struct sdma_script_start_addrs imx35_to2_sdma_script __initdata = {static struct sdma_platform_data imx35_sdma_pdata__initdata = { .sdma_version =2 , - .cpu_name ="imx35" , + .fw_name ="sdma-imx35-to2.bin" , .script_addrs = &imx35_to2_sdma_script, };@@ -99,8 +99,11 @@ void __init imx35_soc_init(void)mxc_register_gpio (1 ,MX35_GPIO2_BASE_ADDR ,SZ_16K ,MX35_INT_GPIO2 ,0 );mxc_register_gpio (2 ,MX35_GPIO3_BASE_ADDR ,SZ_16K ,MX35_INT_GPIO3 ,0 ); - imx35_sdma_pdata.to_version = to_version; -if (to_version ==1 ) +if (to_version ==1 ) { +strncpy (imx35_sdma_pdata.fw_name,"sdma-imx35-to1.bin" , +strlen (imx35_sdma_pdata.fw_name)); imx35_sdma_pdata.script_addrs = &imx35_to1_sdma_script; + } +imx_add_imx_sdma (MX35_SDMA_BASE_ADDR ,MX35_INT_SDMA , &imx35_sdma_pdata); }arch/arm/mach-mx5/mm.c +2
-7@@ -116,8 +116,7 @@ static struct sdma_script_start_addrs imx51_sdma_script __initdata = {static struct sdma_platform_data imx51_sdma_pdata__initdata = { .sdma_version =2 , - .cpu_name ="imx51" , - .to_version =1 , + .fw_name ="sdma-imx51.bin" , .script_addrs = &imx51_sdma_script, };@@ -137,21 +136,17 @@ static struct sdma_script_start_addrs imx53_sdma_script __initdata = {static struct sdma_platform_data imx53_sdma_pdata__initdata = { .sdma_version =2 , - .cpu_name ="imx53" , - .to_version =1 , + .fw_name ="sdma-imx53.bin" , .script_addrs = &imx53_sdma_script, };void __init imx51_soc_init (void ) { -int to_version =mx51_revision () >>4 ; -mxc_register_gpio (0 ,MX51_GPIO1_BASE_ADDR ,SZ_16K ,MX51_MXC_INT_GPIO1_LOW ,MX51_MXC_INT_GPIO1_HIGH );mxc_register_gpio (1 ,MX51_GPIO2_BASE_ADDR ,SZ_16K ,MX51_MXC_INT_GPIO2_LOW ,MX51_MXC_INT_GPIO2_HIGH );mxc_register_gpio (2 ,MX51_GPIO3_BASE_ADDR ,SZ_16K ,MX51_MXC_INT_GPIO3_LOW ,MX51_MXC_INT_GPIO3_HIGH );mxc_register_gpio (3 ,MX51_GPIO4_BASE_ADDR ,SZ_16K ,MX51_MXC_INT_GPIO4_LOW ,MX51_MXC_INT_GPIO4_HIGH ); - imx51_sdma_pdata.to_version = to_version;imx_add_imx_sdma (MX51_SDMA_BASE_ADDR ,MX51_INT_SDMA , &imx51_sdma_pdata); }arch/arm/plat-mxc/include/mach/sdma.h +2
-4@@ -49,14 +49,12 @@ struct sdma_script_start_addrs {* struct sdma_platform_data - platform specific data for SDMA engine * * @sdma_version The version of this SDMA engine -* @cpu_name used to generate the firmware name -* @to_version CPU Tape out version +* @fw_name The firmware name * @script_addrs SDMA scripts addresses in SDMA ROM */ struct sdma_platform_data {int sdma_version; -char *cpu_name; -int to_version; +char *fw_name;struct sdma_script_start_addrs *script_addrs; };drivers/dma/imx-sdma.c +3
-3@@ -1105,7 +1105,7 @@ static void sdma_add_scripts(struct sdma_engine *sdma, }static int __init sdma_get_firmware (struct sdma_engine *sdma, -const char *cpu_name,int to_version) +const char *fw_name) {const struct firmware *fw;char *fwname;@@ -1114,7 +1114,7 @@ static int __init sdma_get_firmware(struct sdma_engine *sdma,const struct sdma_script_start_addrs *addr;unsigned short *ram_code; - fwname =kasprintf (GFP_KERNEL ,"sdma-%s-to%d.bin" , cpu_name, to_version); + fwname =kasprintf (GFP_KERNEL ,"%s" , fw_name);if (!fwname)return -ENOMEM ;@@ -1317,7 +1317,7 @@ static int __init sdma_probe(struct platform_device *pdev)if (pdata->script_addrs)sdma_add_scripts (sdma, pdata->script_addrs); -sdma_get_firmware (sdma, pdata->cpu_name, pdata->to_version); +sdma_get_firmware (sdma, pdata->fw_name); sdma->dma_device.dev = &pdev->dev;Signature · 1 line
1.7.4.1
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 |
PATCH v2 6/6 dmaengine: imx-sdma: pass sdma firmware name via platform data
In reply to Shawn GuoQuoted 8 lines · Shawn Guo
It is not good to have
cpu_nameandto_versionencoded into sdma firmware name as variables. For example, there are three TOs of imx51 soc, the sdma script never changes since TO1, which means all three TOs of imx51 uses TO1 version of sdma script. But we have to prepare three identical firmwares, sdma-imx51-to1.bin sdma-imx51-to2.bin and sdma-imx51-to3.bin, to have the kernel capable of running on all three TOs.
Quoted 8 lines
The patch removes
cpu_nameandto_versionfrom sdma platform data, and instead usesfw_nameto pass the firmware name, so that we can pass the TO version where it's relevant and skip it where only one firmware exists.Signed-off-by Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Vinod Koul <[email protected]>
Quoted 166 lines
--- arch/arm/mach-imx/mm-imx25.c | 3 +-- arch/arm/mach-imx/mm-imx31.c | 9 ++++++--- arch/arm/mach-imx/mm-imx35.c | 9 ++++++--- arch/arm/mach-mx5/mm.c | 9 ++------- arch/arm/plat-mxc/include/mach/sdma.h | 6 ++---- drivers/dma/imx-sdma.c | 6 +++--- 6 files changed, 20 insertions(+), 22 deletions(-)arch/arm/mach-imx/mm-imx25.c +1
-2@@ -80,8 +80,7 @@ static struct sdma_script_start_addrs imx25_sdma_script __initdata = {static struct sdma_platform_data imx25_sdma_pdata__initdata = { .sdma_version =2 , - .cpu_name ="imx25" , - .to_version =1 , + .fw_name ="sdma-imx25.bin" , .script_addrs = &imx25_sdma_script, };arch/arm/mach-imx/mm-imx31.c +6
-3@@ -70,7 +70,7 @@ static struct sdma_script_start_addrs imx31_to2_sdma_script __initdata = {static struct sdma_platform_data imx31_sdma_pdata__initdata = { .sdma_version =1 , - .cpu_name ="imx31" , + .fw_name ="sdma-imx31-to2.bin" , .script_addrs = &imx31_to2_sdma_script, };@@ -82,8 +82,11 @@ void __init imx31_soc_init(void)mxc_register_gpio (1 ,MX31_GPIO2_BASE_ADDR ,SZ_16K ,MX31_INT_GPIO2 ,0 );mxc_register_gpio (2 ,MX31_GPIO3_BASE_ADDR ,SZ_16K ,MX31_INT_GPIO3 ,0 ); - imx31_sdma_pdata.to_version = to_version; -if (to_version ==1 ) +if (to_version ==1 ) { +strncpy (imx31_sdma_pdata.fw_name,"sdma-imx31-to1.bin" , +strlen (imx31_sdma_pdata.fw_name)); imx31_sdma_pdata.script_addrs = &imx31_to1_sdma_script; + } +imx_add_imx_sdma (MX31_SDMA_BASE_ADDR ,MX31_INT_SDMA , &imx31_sdma_pdata); }arch/arm/mach-imx/mm-imx35.c +6
-3@@ -87,7 +87,7 @@ static struct sdma_script_start_addrs imx35_to2_sdma_script __initdata = {static struct sdma_platform_data imx35_sdma_pdata__initdata = { .sdma_version =2 , - .cpu_name ="imx35" , + .fw_name ="sdma-imx35-to2.bin" , .script_addrs = &imx35_to2_sdma_script, };@@ -99,8 +99,11 @@ void __init imx35_soc_init(void)mxc_register_gpio (1 ,MX35_GPIO2_BASE_ADDR ,SZ_16K ,MX35_INT_GPIO2 ,0 );mxc_register_gpio (2 ,MX35_GPIO3_BASE_ADDR ,SZ_16K ,MX35_INT_GPIO3 ,0 ); - imx35_sdma_pdata.to_version = to_version; -if (to_version ==1 ) +if (to_version ==1 ) { +strncpy (imx35_sdma_pdata.fw_name,"sdma-imx35-to1.bin" , +strlen (imx35_sdma_pdata.fw_name)); imx35_sdma_pdata.script_addrs = &imx35_to1_sdma_script; + } +imx_add_imx_sdma (MX35_SDMA_BASE_ADDR ,MX35_INT_SDMA , &imx35_sdma_pdata); }arch/arm/mach-mx5/mm.c +2
-7@@ -116,8 +116,7 @@ static struct sdma_script_start_addrs imx51_sdma_script __initdata = {static struct sdma_platform_data imx51_sdma_pdata__initdata = { .sdma_version =2 , - .cpu_name ="imx51" , - .to_version =1 , + .fw_name ="sdma-imx51.bin" , .script_addrs = &imx51_sdma_script, };@@ -137,21 +136,17 @@ static struct sdma_script_start_addrs imx53_sdma_script __initdata = {static struct sdma_platform_data imx53_sdma_pdata__initdata = { .sdma_version =2 , - .cpu_name ="imx53" , - .to_version =1 , + .fw_name ="sdma-imx53.bin" , .script_addrs = &imx53_sdma_script, };void __init imx51_soc_init (void ) { -int to_version =mx51_revision () >>4 ; -mxc_register_gpio (0 ,MX51_GPIO1_BASE_ADDR ,SZ_16K ,MX51_MXC_INT_GPIO1_LOW ,MX51_MXC_INT_GPIO1_HIGH );mxc_register_gpio (1 ,MX51_GPIO2_BASE_ADDR ,SZ_16K ,MX51_MXC_INT_GPIO2_LOW ,MX51_MXC_INT_GPIO2_HIGH );mxc_register_gpio (2 ,MX51_GPIO3_BASE_ADDR ,SZ_16K ,MX51_MXC_INT_GPIO3_LOW ,MX51_MXC_INT_GPIO3_HIGH );mxc_register_gpio (3 ,MX51_GPIO4_BASE_ADDR ,SZ_16K ,MX51_MXC_INT_GPIO4_LOW ,MX51_MXC_INT_GPIO4_HIGH ); - imx51_sdma_pdata.to_version = to_version;imx_add_imx_sdma (MX51_SDMA_BASE_ADDR ,MX51_INT_SDMA , &imx51_sdma_pdata); }arch/arm/plat-mxc/include/mach/sdma.h +2
-4@@ -49,14 +49,12 @@ struct sdma_script_start_addrs {* struct sdma_platform_data - platform specific data for SDMA engine * * @sdma_version The version of this SDMA engine -* @cpu_name used to generate the firmware name -* @to_version CPU Tape out version +* @fw_name The firmware name * @script_addrs SDMA scripts addresses in SDMA ROM */ struct sdma_platform_data {int sdma_version; -char *cpu_name; -int to_version; +char *fw_name;struct sdma_script_start_addrs *script_addrs; };drivers/dma/imx-sdma.c +3
-3@@ -1105,7 +1105,7 @@ static void sdma_add_scripts(struct sdma_engine *sdma, }static int __init sdma_get_firmware (struct sdma_engine *sdma, -const char *cpu_name,int to_version) +const char *fw_name) {const struct firmware *fw;char *fwname;@@ -1114,7 +1114,7 @@ static int __init sdma_get_firmware(struct sdma_engine *sdma,const struct sdma_script_start_addrs *addr;unsigned short *ram_code; - fwname =kasprintf (GFP_KERNEL ,"sdma-%s-to%d.bin" , cpu_name, to_version); + fwname =kasprintf (GFP_KERNEL ,"%s" , fw_name);if (!fwname)return -ENOMEM ;@@ -1317,7 +1317,7 @@ static int __init sdma_probe(struct platform_device *pdev)if (pdata->script_addrs)sdma_add_scripts (sdma, pdata->script_addrs); -sdma_get_firmware (sdma, pdata->cpu_name, pdata->to_version); +sdma_get_firmware (sdma, pdata->fw_name); sdma->dma_device.dev = &pdev->dev;
v2 cover Some fixes and cleanup on imx-dma device registration
In reply to Shawn GuoQuoted 14 lines · Shawn Guo
The patch set makes some small fixes on imx-dma device registration code, and then cleans up the code by breaking the concentrated imx-dma device registration into soc specific setup function. This is basically what gpio-mxc device registration is doing. In this way, we can avoid the churn of "#ifdef" and the
cpu_is_mxchecking on such a long list of soc family, which makes no sense, considering more soc supports need to be added and we need to support single image for multiple socs in the long run.Changes since v1:
* Drop the patch #5 in v1 and add another one to pass firmware name as a string via platform data
* Rebase it on Sascha's tree
Quoted 7 lines
Shawn Guo (6):
ARM: mxc: imx-sdma device gets 16K iosize than 4K
ARM: mxc: sdma on imx25 is a V2 block
ARM: mxc: change imx-dma defaultto_versionto 1
ARM: mxc: imx-dma on imx25 has no other TO version but TO1
ARM: mxc: clean up imx-dma device registration
dmaengine: imx-sdma: pass sdma firmware name via platform data
Applied to -next.
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 |