aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-04-20 05:42:00 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-04-20 05:42:00 -0400
commit09cfeb133e3cac39b8b9a2cb1d8ab4f77e396248 (patch)
treee74554cadc6e60ebe1243e1297d90fd4ac4c2a2b
parente79066a659b893debe19010179d3f3f015d76d1c (diff)
sh: pci: Track io and mem_offset per-channel.
This implements a per-hose offset for I/O and mem resources. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/drivers/pci/pci-new.c18
-rw-r--r--arch/sh/drivers/pci/pci-sh7780.c2
-rw-r--r--arch/sh/include/asm/pci.h3
3 files changed, 14 insertions, 9 deletions
diff --git a/arch/sh/drivers/pci/pci-new.c b/arch/sh/drivers/pci/pci-new.c
index 78b7292c6aa8..e8ac8daafc33 100644
--- a/arch/sh/drivers/pci/pci-new.c
+++ b/arch/sh/drivers/pci/pci-new.c
@@ -105,7 +105,7 @@ static void pcibios_fixup_device_resources(struct pci_dev *dev,
105 struct pci_bus *bus) 105 struct pci_bus *bus)
106{ 106{
107 /* Update device resources. */ 107 /* Update device resources. */
108 struct pci_channel *chan = bus->sysdata; 108 struct pci_channel *hose = bus->sysdata;
109 unsigned long offset = 0; 109 unsigned long offset = 0;
110 int i; 110 int i;
111 111
@@ -115,9 +115,9 @@ static void pcibios_fixup_device_resources(struct pci_dev *dev,
115 if (dev->resource[i].flags & IORESOURCE_PCI_FIXED) 115 if (dev->resource[i].flags & IORESOURCE_PCI_FIXED)
116 continue; 116 continue;
117 if (dev->resource[i].flags & IORESOURCE_IO) 117 if (dev->resource[i].flags & IORESOURCE_IO)
118 offset = chan->io_base; 118 offset = hose->io_offset;
119 else if (dev->resource[i].flags & IORESOURCE_MEM) 119 else if (dev->resource[i].flags & IORESOURCE_MEM)
120 offset = 0; 120 offset = hose->mem_offset;
121 121
122 dev->resource[i].start += offset; 122 dev->resource[i].start += offset;
123 dev->resource[i].end += offset; 123 dev->resource[i].end += offset;
@@ -150,13 +150,13 @@ void __devinit __weak pcibios_fixup_bus(struct pci_bus *bus)
150void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 150void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
151 struct resource *res) 151 struct resource *res)
152{ 152{
153 struct pci_channel *chan = dev->sysdata; 153 struct pci_channel *hose = dev->sysdata;
154 unsigned long offset = 0; 154 unsigned long offset = 0;
155 155
156 if (res->flags & IORESOURCE_IO) 156 if (res->flags & IORESOURCE_IO)
157 offset = chan->io_base; 157 offset = hose->io_offset;
158 else if (res->flags & IORESOURCE_MEM) 158 else if (res->flags & IORESOURCE_MEM)
159 offset = 0; 159 offset = hose->mem_offset;
160 160
161 region->start = res->start - offset; 161 region->start = res->start - offset;
162 region->end = res->end - offset; 162 region->end = res->end - offset;
@@ -166,13 +166,13 @@ void __devinit
166pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, 166pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
167 struct pci_bus_region *region) 167 struct pci_bus_region *region)
168{ 168{
169 struct pci_channel *chan = dev->sysdata; 169 struct pci_channel *hose = dev->sysdata;
170 unsigned long offset = 0; 170 unsigned long offset = 0;
171 171
172 if (res->flags & IORESOURCE_IO) 172 if (res->flags & IORESOURCE_IO)
173 offset = chan->io_base; 173 offset = hose->io_offset;
174 else if (res->flags & IORESOURCE_MEM) 174 else if (res->flags & IORESOURCE_MEM)
175 offset = 0; 175 offset = hose->mem_offset;
176 176
177 res->start = region->start + offset; 177 res->start = region->start + offset;
178 res->end = region->end + offset; 178 res->end = region->end + offset;
diff --git a/arch/sh/drivers/pci/pci-sh7780.c b/arch/sh/drivers/pci/pci-sh7780.c
index 4dd6e3b94a67..57a3b870a276 100644
--- a/arch/sh/drivers/pci/pci-sh7780.c
+++ b/arch/sh/drivers/pci/pci-sh7780.c
@@ -34,7 +34,9 @@ static struct resource sh7785_mem_resource = {
34static struct pci_channel sh7780_pci_controller = { 34static struct pci_channel sh7780_pci_controller = {
35 .pci_ops = &sh4_pci_ops, 35 .pci_ops = &sh4_pci_ops,
36 .mem_resource = &sh7785_mem_resource, 36 .mem_resource = &sh7785_mem_resource,
37 .mem_offset = 0x00000000,
37 .io_resource = &sh7785_io_resource, 38 .io_resource = &sh7785_io_resource,
39 .io_offset = 0x00000000,
38}; 40};
39 41
40static struct sh4_pci_address_map sh7780_pci_map = { 42static struct sh4_pci_address_map sh7780_pci_map = {
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index e057ebdb4618..0be20521a1fe 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -25,6 +25,9 @@ struct pci_channel {
25 struct resource *io_resource; 25 struct resource *io_resource;
26 struct resource *mem_resource; 26 struct resource *mem_resource;
27 27
28 unsigned long io_offset;
29 unsigned long mem_offset;
30
28 int first_devfn; 31 int first_devfn;
29 int last_devfn; 32 int last_devfn;
30 int enabled; 33 int enabled;