aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid McKay <david.mckay@st.com>2009-08-24 03:10:40 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-08-24 03:10:40 -0400
commit15444a8973dcfbd286b3e638cbadac2446a9271a (patch)
treedacfad06a662291e28eb9cb6d49e37d86e33c4ca
parent2fc742f8d64c68b4a175a1dcb28351b112d63315 (diff)
sh: Allow use of GENERIC_IOMAP
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>
-rw-r--r--arch/sh/drivers/pci/pci.c4
-rw-r--r--arch/sh/include/asm/io.h10
-rw-r--r--arch/sh/kernel/io.c4
3 files changed, 18 insertions, 0 deletions
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 9a1c423ad167..c481df639022 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -295,6 +295,8 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
295 vma->vm_page_prot); 295 vma->vm_page_prot);
296} 296}
297 297
298#ifndef CONFIG_GENERIC_IOMAP
299
298static void __iomem *ioport_map_pci(struct pci_dev *dev, 300static void __iomem *ioport_map_pci(struct pci_dev *dev,
299 unsigned long port, unsigned int nr) 301 unsigned long port, unsigned int nr)
300{ 302{
@@ -346,6 +348,8 @@ void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
346} 348}
347EXPORT_SYMBOL(pci_iounmap); 349EXPORT_SYMBOL(pci_iounmap);
348 350
351#endif /* CONFIG_GENERIC_IOMAP */
352
349#ifdef CONFIG_HOTPLUG 353#ifdef CONFIG_HOTPLUG
350EXPORT_SYMBOL(pcibios_resource_to_bus); 354EXPORT_SYMBOL(pcibios_resource_to_bus);
351EXPORT_SYMBOL(pcibios_bus_to_resource); 355EXPORT_SYMBOL(pcibios_bus_to_resource);
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 25348141674b..aeecf432d48c 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -146,6 +146,7 @@ __BUILD_MEMORY_STRING(q, u64)
146#define readl_relaxed(a) readl(a) 146#define readl_relaxed(a) readl(a)
147#define readq_relaxed(a) readq(a) 147#define readq_relaxed(a) readq(a)
148 148
149#ifndef CONFIG_GENERIC_IOMAP
149/* Simple MMIO */ 150/* Simple MMIO */
150#define ioread8(a) __raw_readb(a) 151#define ioread8(a) __raw_readb(a)
151#define ioread16(a) __raw_readw(a) 152#define ioread16(a) __raw_readw(a)
@@ -166,6 +167,15 @@ __BUILD_MEMORY_STRING(q, u64)
166#define iowrite8_rep(a, s, c) __raw_writesb((a), (s), (c)) 167#define iowrite8_rep(a, s, c) __raw_writesb((a), (s), (c))
167#define iowrite16_rep(a, s, c) __raw_writesw((a), (s), (c)) 168#define iowrite16_rep(a, s, c) __raw_writesw((a), (s), (c))
168#define iowrite32_rep(a, s, c) __raw_writesl((a), (s), (c)) 169#define iowrite32_rep(a, s, c) __raw_writesl((a), (s), (c))
170#endif
171
172#define mmio_insb(p,d,c) __raw_readsb(p,d,c)
173#define mmio_insw(p,d,c) __raw_readsw(p,d,c)
174#define mmio_insl(p,d,c) __raw_readsl(p,d,c)
175
176#define mmio_outsb(p,s,c) __raw_writesb(p,s,c)
177#define mmio_outsw(p,s,c) __raw_writesw(p,s,c)
178#define mmio_outsl(p,s,c) __raw_writesl(p,s,c)
169 179
170/* synco on SH-4A, otherwise a nop */ 180/* synco on SH-4A, otherwise a nop */
171#define mmiowb() wmb() 181#define mmiowb() wmb()
diff --git a/arch/sh/kernel/io.c b/arch/sh/kernel/io.c
index 4f85fffaa557..d0ca9684b781 100644
--- a/arch/sh/kernel/io.c
+++ b/arch/sh/kernel/io.c
@@ -62,6 +62,8 @@ void memset_io(volatile void __iomem *dst, int c, unsigned long count)
62} 62}
63EXPORT_SYMBOL(memset_io); 63EXPORT_SYMBOL(memset_io);
64 64
65#ifndef CONFIG_GENERIC_IOMAP
66
65void __iomem *ioport_map(unsigned long port, unsigned int nr) 67void __iomem *ioport_map(unsigned long port, unsigned int nr)
66{ 68{
67 void __iomem *ret; 69 void __iomem *ret;
@@ -79,3 +81,5 @@ void ioport_unmap(void __iomem *addr)
79 sh_mv.mv_ioport_unmap(addr); 81 sh_mv.mv_ioport_unmap(addr);
80} 82}
81EXPORT_SYMBOL(ioport_unmap); 83EXPORT_SYMBOL(ioport_unmap);
84
85#endif /* CONFIG_GENERIC_IOMAP */