mtd: nand: pxa3xx: Allow devices with no dma resources

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>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
Ezequiel Garcia 2013-08-12 14:14:58 -03:00 committed by David Woodhouse
parent 57ff88f0f9
commit 6b45c1eef6

View file

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