]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - arch/arm/mach-ixp4xx/common.c
Merge tag 'cleanup-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[linux.git] / arch / arm / mach-ixp4xx / common.c
index dc5d7a0e5d9c6a31d6e250d7b5625b4fd346b66a..fc4b7b24265e91d5c3007cc5d2ffe42229b85427 100644 (file)
@@ -29,8 +29,8 @@
 #include <linux/export.h>
 #include <linux/gpio.h>
 #include <linux/cpu.h>
+#include <linux/pci.h>
 #include <linux/sched_clock.h>
-
 #include <mach/udc.h>
 #include <mach/hardware.h>
 #include <mach/io.h>
@@ -39,7 +39,6 @@
 #include <asm/page.h>
 #include <asm/irq.h>
 #include <asm/system_misc.h>
-
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
@@ -322,7 +321,7 @@ static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id)
 
 static struct irqaction ixp4xx_timer_irq = {
        .name           = "timer1",
-       .flags          = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
+       .flags          = IRQF_TIMER | IRQF_IRQPOLL,
        .handler        = ixp4xx_timer_interrupt,
        .dev_id         = &clockevent_ixp4xx,
 };
@@ -588,6 +587,54 @@ void ixp4xx_restart(enum reboot_mode mode, const char *cmd)
        }
 }
 
+#ifdef CONFIG_PCI
+static int ixp4xx_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size)
+{
+       return (dma_addr + size) > SZ_64M;
+}
+
+static int ixp4xx_platform_notify_remove(struct device *dev)
+{
+       if (dev_is_pci(dev))
+               dmabounce_unregister_dev(dev);
+
+       return 0;
+}
+#endif
+
+/*
+ * Setup DMA mask to 64MB on PCI devices and 4 GB on all other things.
+ */
+static int ixp4xx_platform_notify(struct device *dev)
+{
+       dev->dma_mask = &dev->coherent_dma_mask;
+
+#ifdef CONFIG_PCI
+       if (dev_is_pci(dev)) {
+               dev->coherent_dma_mask = DMA_BIT_MASK(28); /* 64 MB */
+               dmabounce_register_dev(dev, 2048, 4096, ixp4xx_needs_bounce);
+               return 0;
+       }
+#endif
+
+       dev->coherent_dma_mask = DMA_BIT_MASK(32);
+       return 0;
+}
+
+int dma_set_coherent_mask(struct device *dev, u64 mask)
+{
+       if (dev_is_pci(dev))
+               mask &= DMA_BIT_MASK(28); /* 64 MB */
+
+       if ((mask & DMA_BIT_MASK(28)) == DMA_BIT_MASK(28)) {
+               dev->coherent_dma_mask = mask;
+               return 0;
+       }
+
+       return -EIO;            /* device wanted sub-64MB mask */
+}
+EXPORT_SYMBOL(dma_set_coherent_mask);
+
 #ifdef CONFIG_IXP4XX_INDIRECT_PCI
 /*
  * In the case of using indirect PCI, we simply return the actual PCI
@@ -610,12 +657,16 @@ static void ixp4xx_iounmap(void __iomem *addr)
        if (!is_pci_memory((__force u32)addr))
                __iounmap(addr);
 }
+#endif
 
 void __init ixp4xx_init_early(void)
 {
+       platform_notify = ixp4xx_platform_notify;
+#ifdef CONFIG_PCI
+       platform_notify_remove = ixp4xx_platform_notify_remove;
+#endif
+#ifdef CONFIG_IXP4XX_INDIRECT_PCI
        arch_ioremap_caller = ixp4xx_ioremap_caller;
        arch_iounmap = ixp4xx_iounmap;
-}
-#else
-void __init ixp4xx_init_early(void) {}
 #endif
+}