diff options
author | Magnus Damm <magnus.damm@gmail.com> | 2008-02-19 07:35:31 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-04-16 03:00:14 -0400 |
commit | 8ce0143b11cdc519b8e1fd94a262b654ef0bc3ab (patch) | |
tree | 912403b5b8b853ca1479e95590ac2fd057de0030 /arch/sh/include/asm/pci.h | |
parent | ef339f241b08a16af58897e6288ba200e0c7a8c7 (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.h | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h index ccf5c5ff62ff..bb2c2fcddc9e 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[]; | |||
38 | #define PCIBIOS_MIN_IO __PCI_CHAN(bus)->io_resource->start | 38 | #define PCIBIOS_MIN_IO __PCI_CHAN(bus)->io_resource->start |
39 | #define PCIBIOS_MIN_MEM __PCI_CHAN(bus)->mem_resource->start | 39 | #define PCIBIOS_MIN_MEM __PCI_CHAN(bus)->mem_resource->start |
40 | 40 | ||
41 | /* | ||
42 | * I/O routine helpers | ||
43 | */ | ||
44 | #if defined(CONFIG_CPU_SUBTYPE_SH7780) || defined(CONFIG_CPU_SUBTYPE_SH7785) | ||
45 | #define PCI_IO_AREA 0xFE400000 | ||
46 | #define PCI_IO_SIZE 0x00400000 | ||
47 | #elif defined(CONFIG_CPU_SH5) | ||
48 | extern unsigned long PCI_IO_AREA; | ||
49 | #define PCI_IO_SIZE 0x00010000 | ||
50 | #else | ||
51 | #define PCI_IO_AREA 0xFE240000 | ||
52 | #define PCI_IO_SIZE 0x00040000 | ||
53 | #endif | ||
54 | |||
55 | #define PCI_MEM_SIZE 0x01000000 | ||
56 | |||
57 | #define SH4_PCIIOBR_MASK 0xFFFC0000 | ||
58 | #define pci_ioaddr(addr) (PCI_IO_AREA + (addr & ~SH4_PCIIOBR_MASK)) | ||
59 | |||
60 | #if defined(CONFIG_PCI) | ||
61 | #define is_pci_ioaddr(port) \ | ||
62 | (((port) >= PCIBIOS_MIN_IO) && \ | ||
63 | ((port) < (PCIBIOS_MIN_IO + PCI_IO_SIZE))) | ||
64 | #else | ||
65 | #define is_pci_ioaddr(port) (0) | ||
66 | #endif | ||
67 | |||
68 | struct pci_dev; | 41 | struct pci_dev; |
69 | 42 | ||
70 | extern void pcibios_set_master(struct pci_dev *dev); | 43 | 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) | |||
137 | } | 110 | } |
138 | return 0; | 111 | return 0; |
139 | } | 112 | } |
113 | |||
114 | static inline void __iomem *__get_pci_io_base(unsigned long port, | ||
115 | unsigned long size) | ||
116 | { | ||
117 | struct pci_channel *p; | ||
118 | struct resource *res; | ||
119 | |||
120 | for (p = board_pci_channels; p->init; p++) { | ||
121 | res = p->io_resource; | ||
122 | if (p->enabled && (port >= res->start) && | ||
123 | (port + size) <= (res->end + 1)) | ||
124 | return (void __iomem *)(p->io_base + port); | ||
125 | } | ||
126 | return NULL; | ||
127 | } | ||
140 | #else | 128 | #else |
141 | static inline int __is_pci_memory(unsigned long phys_addr, unsigned long size) | 129 | static inline int __is_pci_memory(unsigned long phys_addr, unsigned long size) |
142 | { | 130 | { |
143 | return 0; | 131 | return 0; |
144 | } | 132 | } |
133 | static inline void __iomem *__get_pci_io_base(unsigned long port, | ||
134 | unsigned long size) | ||
135 | { | ||
136 | return NULL; | ||
137 | } | ||
145 | #endif | 138 | #endif |
146 | 139 | ||
147 | /* Board-specific fixup routines. */ | 140 | /* Board-specific fixup routines. */ |