bcma: use of_dma_configure() to set initial dma mask
authorArnd Bergmann <arnd@arndb.de>
Thu, 17 Mar 2016 09:39:17 +0000 (10:39 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 9 Sep 2016 09:00:37 +0000 (12:00 +0300)
While fixing another bug, I noticed that bcma manually sets up
a dma_mask pointer for its child devices. We have a generic
helper for that now, which should be able to cope better with
any variations that might be needed to deal with cache coherency,
unusual DMA address offsets, iommus, or limited DMA masks, none
of which are currently handled here.

This changes the core to use the of_dma_configure(), like
we do for platform devices that are probed directly from
DT.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/bcma/main.c

index 1f635471f318cb9d9395e26466ea9abebf6ddb7f..2c1798e38abd166bb62596e81c9921a13c452d94 100644 (file)
@@ -209,6 +209,8 @@ static void bcma_of_fill_device(struct platform_device *parent,
                core->dev.of_node = node;
 
        core->irq = bcma_of_get_irq(parent, core, 0);
+
+       of_dma_configure(&core->dev, node);
 }
 
 unsigned int bcma_core_irq(struct bcma_device *core, int num)
@@ -248,12 +250,12 @@ void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
                core->irq = bus->host_pci->irq;
                break;
        case BCMA_HOSTTYPE_SOC:
-               core->dev.dma_mask = &core->dev.coherent_dma_mask;
-               if (bus->host_pdev) {
+               if (IS_ENABLED(CONFIG_OF) && bus->host_pdev) {
                        core->dma_dev = &bus->host_pdev->dev;
                        core->dev.parent = &bus->host_pdev->dev;
                        bcma_of_fill_device(bus->host_pdev, core);
                } else {
+                       core->dev.dma_mask = &core->dev.coherent_dma_mask;
                        core->dma_dev = &core->dev;
                }
                break;