From eae74028df1e62ae84e341d6cfc3c149f590a4d6 Mon Sep 17 00:00:00 2001 From: Fancy Fang Date: Thu, 2 Mar 2017 21:07:22 +0800 Subject: [PATCH] MLK-14314-10 dma: pxp-v3: refine m4 init in probe() Extract the m4 related initialization code from pxp_probe() to make the probing function more clear. Signed-off-by: Fancy Fang (cherry picked from commit f1bd8146332f880b75f08eab64505070069018fb) --- drivers/dma/pxp/pxp_dma_v3.c | 47 ++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/drivers/dma/pxp/pxp_dma_v3.c b/drivers/dma/pxp/pxp_dma_v3.c index e7a88f2990e5..373b308a1b1d 100644 --- a/drivers/dma/pxp/pxp_dma_v3.c +++ b/drivers/dma/pxp/pxp_dma_v3.c @@ -5196,6 +5196,31 @@ static int pxp_init_interrupt(struct platform_device *pdev) return 0; } +#ifdef CONFIG_MXC_FPGA_M4_TEST +static void pxp_config_m4(struct platform_device *pdev) +{ + fpga_tcml_base = ioremap(FPGA_TCML_ADDR, SZ_32K); + if (fpga_tcml_base == NULL) { + dev_err(&pdev->dev, + "get fpga_tcml_base error.\n"); + goto exit; + } + pinctrl_base = ioremap(PINCTRL, SZ_4K); + if (pinctrl_base == NULL) { + dev_err(&pdev->dev, + "get fpga_tcml_base error.\n"); + goto exit; + } + + __raw_writel(0xC0000000, pinctrl_base + 0x08); + __raw_writel(0x3, pinctrl_base + PIN_DOUT); + int i; + for (i = 0; i < 1024 * 32 / 4; i++) { + *(((unsigned int *)(fpga_tcml_base)) + i) = cm4_image[i]; + } +} +#endif + static int pxp_probe(struct platform_device *pdev) { const struct of_device_id *of_id = @@ -5288,31 +5313,11 @@ static int pxp_probe(struct platform_device *pdev) } #ifdef CONFIG_MXC_FPGA_M4_TEST - fpga_tcml_base = ioremap(FPGA_TCML_ADDR, SZ_32K); - if (fpga_tcml_base == NULL) { - dev_err(&pdev->dev, - "get fpga_tcml_base error.\n"); - goto exit; - } - pinctrl_base = ioremap(PINCTRL, SZ_4K); - if (pinctrl_base == NULL) { - dev_err(&pdev->dev, - "get fpga_tcml_base error.\n"); - goto exit; - } - - __raw_writel(0xC0000000, pinctrl_base + 0x08); - __raw_writel(0x3, pinctrl_base + PIN_DOUT); - int i; - for (i = 0; i < 1024 * 32 / 4; i++) { - *(((unsigned int *)(fpga_tcml_base)) + i) = cm4_image[i]; - } + pxp_config_m4(pdev); #endif register_pxp_device(); pm_runtime_enable(pxp->dev); - - exit: if (err) dev_err(&pdev->dev, "Exiting (unsuccessfully) pxp_probe()\n"); -- 2.17.1