Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 7BBC2E006AE; Tue, 29 Mar 2016 12:29:54 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,HTML_MESSAGE, MISSING_MID,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-HAM-Report: * -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no * trust * [46.19.21.50 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.0 HTML_MESSAGE BODY: HTML included in message * 0.5 MISSING_MID Missing Message-Id: header X-Greylist: delayed 64 seconds by postgrey-1.32 at yocto-www; Tue, 29 Mar 2016 12:29:51 PDT Received: from nep.datarespons.com (nep.datarespons.com [46.19.21.50]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 5B425E0048B for ; Tue, 29 Mar 2016 12:29:51 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.24,412,1454976000"; d="scan'208,217";a="1349806" From: =?iso-8859-1?Q?Hans_Christian_L=F8nstad?= To: "meta-freescale@yoctoproject.org" Thread-Topic: [PATCH] spi-imx -> make DMA optional through DT Thread-Index: AQHRifEz+XqTfI+1QkKt8zraU5qMdA== Date: Tue, 29 Mar 2016 19:28:42 +0000 Accept-Language: nb-NO, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.3124) x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [80.213.240.115] MIME-Version: 1.0 Message-Id: <20160329192954.7BBC2E006AE@yocto-www.yoctoproject.org> Subject: [PATCH] spi-imx -> make DMA optional through DT X-BeenThere: meta-freescale@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Usage and development list for the meta-fsl-* layers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Mar 2016 19:29:54 -0000 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_01065D4B0DE9419C94079A15DA6CBB67dataresponsno_" --_000_01065D4B0DE9419C94079A15DA6CBB67dataresponsno_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 =3D of_property_read_bool(np, "nodma"); master =3D 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 *pde= v) * Only validated on i.mx6 now, can remove the constrain if validate= d on * other chips. */ + if (nodma) + dev_info(&pdev->dev, "DMA disabled by DT\n"); + if ((spi_imx->devtype_data =3D=3D &imx51_ecspi_devtype_data || spi_imx->devtype_data =3D=3D &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 --_000_01065D4B0DE9419C94079A15DA6CBB67dataresponsno_ Content-Type: text/html; charset="iso-8859-1" Content-ID: <476A0CE2B5672B4C80A1E3CC35AA7224@datarespons.com> Content-Transfer-Encoding: quoted-printable
This patch applies t= o kernel 4.1.15_ga and fixes a regression for UBIFS on SPI NOR introduced b= y 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) {
            &nb= sp;  dev_err(&pdev->dev, "can't get the platform data= \n");
@@ -1177,6 +1178,7 @@ static int spi_imx_probe(struct platform_device *= pdev)
            &nb= sp;          return ret; =
       }
 
+       nodma =3D of_property_read_bool(n= p, "nodma");
       master =3D spi_alloc_master(&= pdev->dev,
            &nb= sp;          sizeof(struc= t 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 n= ow, can remove the constrain if validated on
        * other chips.
        */
+       if (nodma)
+            &nb= sp;  dev_info(&pdev->dev, "DMA disabled by DT\n"= );
+
       if ((spi_imx->devtype_data =3D= =3D &imx51_ecspi_devtype_data
           || spi_im= x->devtype_data =3D=3D &imx6ul_ecspi_devtype_data)
-           && sp= i_imx_sdma_init(&pdev->dev, spi_imx, master, res))
+           &&= ; !nodma && spi_imx_sdma_init(&pdev->dev, spi_imx, master, r= es))
            &nb= sp;  dev_err(&pdev->dev, "dma setup error,use pio ins= tead\n");
 
       spi_imx->devtype_data->rese= t(spi_imx);
--  
2.5.5



--_000_01065D4B0DE9419C94079A15DA6CBB67dataresponsno_--