3c57e8749276f98b11b641cf867c88361d756123
[openwrt/openwrt.git] / target / linux / mvebu / patches-3.10 / 0125-mtd-nand-pxa3xx-Allow-devices-with-no-dma-resources.patch
1 From c26369f5b9929e1187ccf716d6d1678196ec0b4f Mon Sep 17 00:00:00 2001
2 From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
3 Date: Mon, 12 Aug 2013 14:14:58 -0300
4 Subject: [PATCH 125/203] mtd: nand: pxa3xx: Allow devices with no dma
5 resources
6
7 When use_dma=0 there's no point in requesting resources for dma,
8 since they won't be used anyway. Therefore we remove that requirement,
9 therefore allowing devices without dma to pass the driver probe.
10
11 Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
12 Tested-by: Daniel Mack <zonque@gmail.com>
13 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
14 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 ---
16 drivers/mtd/nand/pxa3xx_nand.c | 51 +++++++++++++++++++++++-------------------
17 1 file changed, 28 insertions(+), 23 deletions(-)
18
19 --- a/drivers/mtd/nand/pxa3xx_nand.c
20 +++ b/drivers/mtd/nand/pxa3xx_nand.c
21 @@ -1141,30 +1141,35 @@ static int alloc_nand_resource(struct pl
22 if (ret < 0)
23 return ret;
24
25 - /*
26 - * This is a dirty hack to make this driver work from devicetree
27 - * bindings. It can be removed once we have a prober DMA controller
28 - * framework for DT.
29 - */
30 - if (pdev->dev.of_node && of_machine_is_compatible("marvell,pxa3xx")) {
31 - info->drcmr_dat = 97;
32 - info->drcmr_cmd = 99;
33 - } else {
34 - r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
35 - if (r == NULL) {
36 - dev_err(&pdev->dev, "no resource defined for data DMA\n");
37 - ret = -ENXIO;
38 - goto fail_disable_clk;
39 - }
40 - info->drcmr_dat = r->start;
41 + if (use_dma) {
42 + /*
43 + * This is a dirty hack to make this driver work from
44 + * devicetree bindings. It can be removed once we have
45 + * a prober DMA controller framework for DT.
46 + */
47 + if (pdev->dev.of_node &&
48 + of_machine_is_compatible("marvell,pxa3xx")) {
49 + info->drcmr_dat = 97;
50 + info->drcmr_cmd = 99;
51 + } else {
52 + r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
53 + if (r == NULL) {
54 + dev_err(&pdev->dev,
55 + "no resource defined for data DMA\n");
56 + ret = -ENXIO;
57 + goto fail_disable_clk;
58 + }
59 + info->drcmr_dat = r->start;
60
61 - r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
62 - if (r == NULL) {
63 - dev_err(&pdev->dev, "no resource defined for command DMA\n");
64 - ret = -ENXIO;
65 - goto fail_disable_clk;
66 + r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
67 + if (r == NULL) {
68 + dev_err(&pdev->dev,
69 + "no resource defined for cmd DMA\n");
70 + ret = -ENXIO;
71 + goto fail_disable_clk;
72 + }
73 + info->drcmr_cmd = r->start;
74 }
75 - info->drcmr_cmd = r->start;
76 }
77
78 irq = platform_get_irq(pdev, 0);