[meta-freescale] [PATCH] spi-imx -> make DMA optional through DT

Hans Christian Lønstad hcl at datarespons.no
Tue Mar 29 12:28:42 PDT 2016


This patch applies to kernel 4.1.15_ga and fixes a regression for UBIFS on SPI NOR introduced by assigning DMA channels in DT

When UBIFS uses SPI NOR devices, the IO buffer allocation using vmalloc
creates problems when the SPI controller is DMA based (as it is for some
ARM SoC's).
Introduce a "nodma" boolean DT attribute as a fix for imx SoC.
---
drivers/spi/spi-imx.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 8c0e0cc..d0df195 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -1163,6 +1163,7 @@ static int spi_imx_probe(struct platform_device *pdev)
       struct spi_imx_data *spi_imx;
       struct resource *res;
       int i, ret, num_cs, irq;
+       bool nodma;

       if (!np && !mxc_platform_info) {
               dev_err(&pdev->dev, "can't get the platform data\n");
@@ -1177,6 +1178,7 @@ static int spi_imx_probe(struct platform_device *pdev)
                       return ret;
       }

+       nodma = of_property_read_bool(np, "nodma");
       master = spi_alloc_master(&pdev->dev,
                       sizeof(struct spi_imx_data) + sizeof(int) * num_cs);
       if (!master)
@@ -1267,9 +1269,12 @@ static int spi_imx_probe(struct platform_device *pdev)
        * Only validated on i.mx6 now, can remove the constrain if validated on
        * other chips.
        */
+       if (nodma)
+               dev_info(&pdev->dev, "DMA disabled by DT\n");
+
       if ((spi_imx->devtype_data == &imx51_ecspi_devtype_data
           || spi_imx->devtype_data == &imx6ul_ecspi_devtype_data)
-           && spi_imx_sdma_init(&pdev->dev, spi_imx, master, res))
+           && !nodma && spi_imx_sdma_init(&pdev->dev, spi_imx, master, res))
               dev_err(&pdev->dev, "dma setup error,use pio instead\n");

       spi_imx->devtype_data->reset(spi_imx);
--
2.5.5



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/meta-freescale/attachments/20160329/c49b87be/attachment.html>


More information about the meta-freescale mailing list