Skip to content

Commit 829f9fe

Browse files
pm215Kevin Hilman
authored andcommitted
ARM: PCI: versatile: Fix PCI I/O
The versatile PCI controller code was confused between the PCI I/O window (at 0x43000000) and the first PCI memory window (at 0x44000000). Pass the correct base address to pci_remap_io() so that PCI I/O accesses work. Since the first PCI memory window isn't used at all (it's an odd size), rename the associated variables and labels so that it's clear that it isn't related to the I/O window. This has been tested and confirmed to fix PCI I/O accesses both on physical PB926+PCI backplane hardware and on QEMU. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Cc: stable@vger.kernel.org Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Kevin Hilman <khilman@linaro.org>
1 parent f9b71fe commit 829f9fe

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

‎arch/arm/mach-versatile/include/mach/platform.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,14 @@
231231
/* PCI space */
232232
#define VERSATILE_PCI_BASE 0x41000000 /* PCI Interface */
233233
#define VERSATILE_PCI_CFG_BASE 0x42000000
234+
#define VERSATILE_PCI_IO_BASE 0x43000000
234235
#define VERSATILE_PCI_MEM_BASE0 0x44000000
235236
#define VERSATILE_PCI_MEM_BASE1 0x50000000
236237
#define VERSATILE_PCI_MEM_BASE2 0x60000000
237238
/* Sizes of above maps */
238239
#define VERSATILE_PCI_BASE_SIZE 0x01000000
239240
#define VERSATILE_PCI_CFG_BASE_SIZE 0x02000000
241+
#define VERSATILE_PCI_IO_BASE_SIZE 0x01000000
240242
#define VERSATILE_PCI_MEM_BASE0_SIZE 0x0c000000 /* 32Mb */
241243
#define VERSATILE_PCI_MEM_BASE1_SIZE 0x10000000 /* 256Mb */
242244
#define VERSATILE_PCI_MEM_BASE2_SIZE 0x10000000 /* 256Mb */

‎arch/arm/mach-versatile/pci.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ static struct pci_ops pci_versatile_ops = {
170170
.write = versatile_write_config,
171171
};
172172

173-
static struct resource io_mem = {
174-
.name = "PCI I/O space",
173+
static struct resource unused_mem = {
174+
.name = "PCI unused",
175175
.start = VERSATILE_PCI_MEM_BASE0,
176176
.end = VERSATILE_PCI_MEM_BASE0+VERSATILE_PCI_MEM_BASE0_SIZE-1,
177177
.flags = IORESOURCE_MEM,
@@ -195,17 +195,17 @@ static int __init pci_versatile_setup_resources(struct pci_sys_data *sys)
195195
{
196196
int ret = 0;
197197

198-
ret = request_resource(&iomem_resource, &io_mem);
198+
ret = request_resource(&iomem_resource, &unused_mem);
199199
if (ret) {
200-
printk(KERN_ERR "PCI: unable to allocate I/O "
200+
printk(KERN_ERR "PCI: unable to allocate unused "
201201
"memory region (%d)\n", ret);
202202
goto out;
203203
}
204204
ret = request_resource(&iomem_resource, &non_mem);
205205
if (ret) {
206206
printk(KERN_ERR "PCI: unable to allocate non-prefetchable "
207207
"memory region (%d)\n", ret);
208-
goto release_io_mem;
208+
goto release_unused_mem;
209209
}
210210
ret = request_resource(&iomem_resource, &pre_mem);
211211
if (ret) {
@@ -225,8 +225,8 @@ static int __init pci_versatile_setup_resources(struct pci_sys_data *sys)
225225

226226
release_non_mem:
227227
release_resource(&non_mem);
228-
release_io_mem:
229-
release_resource(&io_mem);
228+
release_unused_mem:
229+
release_resource(&unused_mem);
230230
out:
231231
return ret;
232232
}
@@ -246,7 +246,7 @@ int __init pci_versatile_setup(int nr, struct pci_sys_data *sys)
246246
goto out;
247247
}
248248

249-
ret = pci_ioremap_io(0, VERSATILE_PCI_MEM_BASE0);
249+
ret = pci_ioremap_io(0, VERSATILE_PCI_IO_BASE);
250250
if (ret)
251251
goto out;
252252

0 commit comments

Comments
 (0)