diff options
author | Phil Edworthy <phil.edworthy@renesas.com> | 2015-10-23 14:36:44 +0100 |
---|---|---|
committer | Marek Vasut <marek.vasut+renesas@gmail.com> | 2018-06-09 15:40:50 +0200 |
commit | 763ad2e6618806d25956a699b11424cfb9147ed1 (patch) | |
tree | 787afca620f20509c15d371c986c75f8de0c76c8 | |
parent | 0799596643a21a8c62eed5f8d7a9f23dda75f963 (diff) | |
download | linux-2.6-rcar/pci-gen3/next.tar.gz |
[RFC] PCI: rcar: Add bus notifier so we can limit the DMA rangercar/pci-gen3/next
The PCIe DMA controller on RCar Gen2 and earlier is on 32bit bus,
so limit the DMA range to 32bit.
Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Phil Edworthy <phil.edworthy@renesas.com>
Cc: Simon Horman <horms+renesas@verge.net.au>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-renesas-soc@vger.kernel.org
To: linux-pci@vger.kernel.org
---
NOTE: I'm aware of https://patchwork.kernel.org/patch/9495895/ , but the
discussion seems to have gone way off, so I'm sending this as a
RFC. Any feedback on how to do this limiting properly would be nice.
-rw-r--r-- | drivers/pci/host/pcie-rcar.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index 08393acf4eeee4..3e3cca461b241f 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c @@ -1340,3 +1340,31 @@ static struct platform_driver rcar_pcie_driver = { .probe = rcar_pcie_probe, }; builtin_platform_driver(rcar_pcie_driver); + +static int rcar_pcie_pci_notifier(struct notifier_block *nb, + unsigned long action, void *data) +{ + struct device *dev = data; + + switch (action) { + case BUS_NOTIFY_BOUND_DRIVER: + /* Force the DMA mask to lower 32-bits */ + dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); + break; + default: + return NOTIFY_DONE; + } + + return NOTIFY_OK; +} + +static struct notifier_block device_nb = { + .notifier_call = rcar_pcie_pci_notifier, +}; + +static int __init register_rcar_pcie_pci_notifier(void) +{ + return bus_register_notifier(&pci_bus_type, &device_nb); +} + +arch_initcall(register_rcar_pcie_pci_notifier); |