aboutsummaryrefslogtreecommitdiff
path: root/arch/sh/include/asm/pci.h
diff options
context:
space:
mode:
authorMagnus Damm <magnus.damm@gmail.com>2008-02-19 21:35:31 +0900
committerPaul Mundt <lethal@linux-sh.org>2009-04-16 16:00:14 +0900
commit8ce0143b11cdc519b8e1fd94a262b654ef0bc3ab (patch)
tree912403b5b8b853ca1479e95590ac2fd057de0030 /arch/sh/include/asm/pci.h
parentef339f241b08a16af58897e6288ba200e0c7a8c7 (diff)
sh: pci io port base address code
Adds a __get_pci_io_base() function which is used to match a port range against struct pci_channel. This allows us to detect if a port range is assigned to pci or happens to be legacy port io. While at it, remove unused cpu-specific cruft. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/include/asm/pci.h')
-rw-r--r--arch/sh/include/asm/pci.h47
1 files changed, 20 insertions, 27 deletions
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index ccf5c5ff62f..bb2c2fcddc9 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -38,33 +38,6 @@ extern struct pci_channel board_pci_channels[];
#define PCIBIOS_MIN_IO __PCI_CHAN(bus)->io_resource->start
#define PCIBIOS_MIN_MEM __PCI_CHAN(bus)->mem_resource->start
-/*
- * I/O routine helpers
- */
-#if defined(CONFIG_CPU_SUBTYPE_SH7780) || defined(CONFIG_CPU_SUBTYPE_SH7785)
-#define PCI_IO_AREA 0xFE400000
-#define PCI_IO_SIZE 0x00400000
-#elif defined(CONFIG_CPU_SH5)
-extern unsigned long PCI_IO_AREA;
-#define PCI_IO_SIZE 0x00010000
-#else
-#define PCI_IO_AREA 0xFE240000
-#define PCI_IO_SIZE 0x00040000
-#endif
-
-#define PCI_MEM_SIZE 0x01000000
-
-#define SH4_PCIIOBR_MASK 0xFFFC0000
-#define pci_ioaddr(addr) (PCI_IO_AREA + (addr & ~SH4_PCIIOBR_MASK))
-
-#if defined(CONFIG_PCI)
-#define is_pci_ioaddr(port) \
- (((port) >= PCIBIOS_MIN_IO) && \
- ((port) < (PCIBIOS_MIN_IO + PCI_IO_SIZE)))
-#else
-#define is_pci_ioaddr(port) (0)
-#endif
-
struct pci_dev;
extern void pcibios_set_master(struct pci_dev *dev);
@@ -137,11 +110,31 @@ static inline int __is_pci_memory(unsigned long phys_addr, unsigned long size)
}
return 0;
}
+
+static inline void __iomem *__get_pci_io_base(unsigned long port,
+ unsigned long size)
+{
+ struct pci_channel *p;
+ struct resource *res;
+
+ for (p = board_pci_channels; p->init; p++) {
+ res = p->io_resource;
+ if (p->enabled && (port >= res->start) &&
+ (port + size) <= (res->end + 1))
+ return (void __iomem *)(p->io_base + port);
+ }
+ return NULL;
+}
#else
static inline int __is_pci_memory(unsigned long phys_addr, unsigned long size)
{
return 0;
}
+static inline void __iomem *__get_pci_io_base(unsigned long port,
+ unsigned long size)
+{
+ return NULL;
+}
#endif
/* Board-specific fixup routines. */