The it8152 driver does a few things differently from
everyone else. Make sure that these have no effect when
running on anything other than a pxa2xx.

Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
 arch/arm/mach-pxa/pci-it8152.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-pxa/pci-it8152.c b/arch/arm/mach-pxa/pci-it8152.c
index af99c990f0c1..fe8cf7d2234d 100644
--- a/arch/arm/mach-pxa/pci-it8152.c
+++ b/arch/arm/mach-pxa/pci-it8152.c
@@ -23,6 +23,7 @@
 #include <linux/irq.h>
 #include <linux/io.h>
 #include <linux/export.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach/pci.h>
 
@@ -274,10 +275,21 @@ static int it8152_pci_platform_notify_remove(struct 
device *dev)
 
 int dma_set_coherent_mask(struct device *dev, u64 mask)
 {
-       if (mask >= PHYS_OFFSET + SZ_64M - 1)
-               return 0;
+       /* We've always done it like this, but it looks wrong */
+       if (cpu_is_pxa2xx()) {
+               if (mask >= PHYS_OFFSET + SZ_64M - 1)
+                       return 0;
 
-       return -EIO;
+               return -EIO;
+       }
+
+       /* generic implementation from kernel/dma/mapping.c */
+       mask = (dma_addr_t)mask;
+       if (!dma_supported(dev, mask))
+               return -EIO;
+
+       dev->coherent_dma_mask = mask;
+       return 0;
 }
 
 int __init it8152_pci_setup(int nr, struct pci_sys_data *sys)
@@ -331,6 +343,10 @@ void pcibios_set_master(struct pci_dev *dev)
 {
        u8 lat;
 
+       /* running on something else */
+       if (!cpu_is_pxa2xx())
+               return;
+
        /* no need to update on-chip OHCI controller */
        if ((dev->vendor == PCI_VENDOR_ID_ITE) &&
            (dev->device == PCI_DEVICE_ID_ITE_8152) &&
-- 
2.20.0

Reply via email to