]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mtd: nand: pxa3xx: Allow devices with no dma resources
authorEzequiel Garcia <ezequiel.garcia@free-electrons.com>
Mon, 12 Aug 2013 17:14:58 +0000 (14:14 -0300)
committerBrian Norris <computersforpeace@gmail.com>
Mon, 12 Aug 2013 22:13:44 +0000 (15:13 -0700)
When use_dma=0 there's no point in requesting resources for dma,
since they won't be used anyway. Therefore we remove that requirement,
therefore allowing devices without dma to pass the driver probe.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/nand/pxa3xx_nand.c

index c98182c0415fe3a8e207eb37dfc4c37d97e0ded7..dd03dfdfb0d65e0ded1b0a124221663b586482b5 100644 (file)
@@ -1141,30 +1141,35 @@ static int alloc_nand_resource(struct platform_device *pdev)
        if (ret < 0)
                return ret;
 
-       /*
-        * This is a dirty hack to make this driver work from devicetree
-        * bindings. It can be removed once we have a prober DMA controller
-        * framework for DT.
-        */
-       if (pdev->dev.of_node && of_machine_is_compatible("marvell,pxa3xx")) {
-               info->drcmr_dat = 97;
-               info->drcmr_cmd = 99;
-       } else {
-               r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
-               if (r == NULL) {
-                       dev_err(&pdev->dev, "no resource defined for data DMA\n");
-                       ret = -ENXIO;
-                       goto fail_disable_clk;
-               }
-               info->drcmr_dat = r->start;
-
-               r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
-               if (r == NULL) {
-                       dev_err(&pdev->dev, "no resource defined for command DMA\n");
-                       ret = -ENXIO;
-                       goto fail_disable_clk;
+       if (use_dma) {
+               /*
+                * This is a dirty hack to make this driver work from
+                * devicetree bindings. It can be removed once we have
+                * a prober DMA controller framework for DT.
+                */
+               if (pdev->dev.of_node &&
+                   of_machine_is_compatible("marvell,pxa3xx")) {
+                       info->drcmr_dat = 97;
+                       info->drcmr_cmd = 99;
+               } else {
+                       r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+                       if (r == NULL) {
+                               dev_err(&pdev->dev,
+                                       "no resource defined for data DMA\n");
+                               ret = -ENXIO;
+                               goto fail_disable_clk;
+                       }
+                       info->drcmr_dat = r->start;
+
+                       r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
+                       if (r == NULL) {
+                               dev_err(&pdev->dev,
+                                       "no resource defined for cmd DMA\n");
+                               ret = -ENXIO;
+                               goto fail_disable_clk;
+                       }
+                       info->drcmr_cmd = r->start;
                }
-               info->drcmr_cmd = r->start;
        }
 
        irq = platform_get_irq(pdev, 0);