sh: Allow use of GENERIC_IOMAP
authorDavid McKay <david.mckay@st.com>
Mon, 24 Aug 2009 07:10:40 +0000 (16:10 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 24 Aug 2009 07:10:40 +0000 (16:10 +0900)
The synopsys PCI cell used in the later STMicro chips requires code to
be run in order to do IO cycles, rather than just memory mapping the IO
space. Rather than extending the existing SH infrastructure to allow
this, use the GENERIC_IOMAP implmentation to save re-inventing the
wheel.

This set of changes allows the SH to be built with GENERIC_IOMAP
enabled, it just ifdef's out the functions provided by the GENERIC_IOMAP
implementation, and provides a few required missing functions.

Signed-off-by: David McKay <david.mckay@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/drivers/pci/pci.c
arch/sh/include/asm/io.h
arch/sh/kernel/io.c

index 9a1c423..c481df6 100644 (file)
@@ -295,6 +295,8 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
                               vma->vm_page_prot);
 }
 
+#ifndef CONFIG_GENERIC_IOMAP
+
 static void __iomem *ioport_map_pci(struct pci_dev *dev,
                                    unsigned long port, unsigned int nr)
 {
@@ -346,6 +348,8 @@ void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
 }
 EXPORT_SYMBOL(pci_iounmap);
 
+#endif /* CONFIG_GENERIC_IOMAP */
+
 #ifdef CONFIG_HOTPLUG
 EXPORT_SYMBOL(pcibios_resource_to_bus);
 EXPORT_SYMBOL(pcibios_bus_to_resource);
index 2534814..aeecf43 100644 (file)
@@ -146,6 +146,7 @@ __BUILD_MEMORY_STRING(q, u64)
 #define readl_relaxed(a)       readl(a)
 #define readq_relaxed(a)       readq(a)
 
+#ifndef CONFIG_GENERIC_IOMAP
 /* Simple MMIO */
 #define ioread8(a)             __raw_readb(a)
 #define ioread16(a)            __raw_readw(a)
@@ -166,6 +167,15 @@ __BUILD_MEMORY_STRING(q, u64)
 #define iowrite8_rep(a, s, c)  __raw_writesb((a), (s), (c))
 #define iowrite16_rep(a, s, c) __raw_writesw((a), (s), (c))
 #define iowrite32_rep(a, s, c) __raw_writesl((a), (s), (c))
+#endif
+
+#define mmio_insb(p,d,c)       __raw_readsb(p,d,c)
+#define mmio_insw(p,d,c)       __raw_readsw(p,d,c)
+#define mmio_insl(p,d,c)       __raw_readsl(p,d,c)
+
+#define mmio_outsb(p,s,c)      __raw_writesb(p,s,c)
+#define mmio_outsw(p,s,c)      __raw_writesw(p,s,c)
+#define mmio_outsl(p,s,c)      __raw_writesl(p,s,c)
 
 /* synco on SH-4A, otherwise a nop */
 #define mmiowb()               wmb()
index 4f85fff..d0ca968 100644 (file)
@@ -62,6 +62,8 @@ void memset_io(volatile void __iomem *dst, int c, unsigned long count)
 }
 EXPORT_SYMBOL(memset_io);
 
+#ifndef CONFIG_GENERIC_IOMAP
+
 void __iomem *ioport_map(unsigned long port, unsigned int nr)
 {
        void __iomem *ret;
@@ -79,3 +81,5 @@ void ioport_unmap(void __iomem *addr)
        sh_mv.mv_ioport_unmap(addr);
 }
 EXPORT_SYMBOL(ioport_unmap);
+
+#endif /* CONFIG_GENERIC_IOMAP */