Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: iop3xx: use fixed PCI i/o mapping

Move iop33x and iop32x PCI to fixed i/o mapping and remove io.h. This
changes the PCI bus addresses from the cpu address to 0 based. It appears
that there is translation h/w for this, but its untested.

Not sure what to do with io_offset. I think it should always be 0.
AFAICT, PCI setup is skipped if the ATU is already setup.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>

+10 -72
-2
arch/arm/Kconfig
··· 495 495 bool "IOP32x-based" 496 496 depends on MMU 497 497 select CPU_XSCALE 498 - select NEED_MACH_IO_H 499 498 select NEED_RET_TO_USER 500 499 select PLAT_IOP 501 500 select PCI ··· 507 508 bool "IOP33x-based" 508 509 depends on MMU 509 510 select CPU_XSCALE 510 - select NEED_MACH_IO_H 511 511 select NEED_RET_TO_USER 512 512 select PLAT_IOP 513 513 select PCI
+1 -11
arch/arm/include/asm/hardware/iop3xx.h
··· 217 217 #define IOP3XX_PCI_LOWER_MEM_PA 0x80000000 218 218 #define IOP3XX_PCI_MEM_WINDOW_SIZE 0x08000000 219 219 220 - #define IOP3XX_PCI_IO_WINDOW_SIZE 0x00010000 221 220 #define IOP3XX_PCI_LOWER_IO_PA 0x90000000 222 - #define IOP3XX_PCI_LOWER_IO_VA 0xfe000000 223 - #define IOP3XX_PCI_LOWER_IO_BA 0x90000000 224 - #define IOP3XX_PCI_UPPER_IO_PA (IOP3XX_PCI_LOWER_IO_PA +\ 225 - IOP3XX_PCI_IO_WINDOW_SIZE - 1) 226 - #define IOP3XX_PCI_UPPER_IO_VA (IOP3XX_PCI_LOWER_IO_VA +\ 227 - IOP3XX_PCI_IO_WINDOW_SIZE - 1) 228 - #define IOP3XX_PCI_IO_PHYS_TO_VIRT(addr) (((u32) (addr) -\ 229 - IOP3XX_PCI_LOWER_IO_PA) +\ 230 - IOP3XX_PCI_LOWER_IO_VA) 231 - 221 + #define IOP3XX_PCI_LOWER_IO_BA 0x00000000 232 222 233 223 #ifndef __ASSEMBLY__ 234 224
-19
arch/arm/mach-iop32x/include/mach/io.h
··· 1 - /* 2 - * arch/arm/mach-iop32x/include/mach/io.h 3 - * 4 - * Copyright (C) 2001 MontaVista Software, Inc. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 - */ 10 - 11 - #ifndef __IO_H 12 - #define __IO_H 13 - 14 - #include <asm/hardware/iop3xx.h> 15 - 16 - #define IO_SPACE_LIMIT 0xffffffff 17 - #define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p)) 18 - 19 - #endif
-19
arch/arm/mach-iop33x/include/mach/io.h
··· 1 - /* 2 - * arch/arm/mach-iop33x/include/mach/io.h 3 - * 4 - * Copyright (C) 2001 MontaVista Software, Inc. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 - */ 10 - 11 - #ifndef __IO_H 12 - #define __IO_H 13 - 14 - #include <asm/hardware/iop3xx.h> 15 - 16 - #define IO_SPACE_LIMIT 0xffffffff 17 - #define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p)) 18 - 19 - #endif
+9 -16
arch/arm/plat-iop/pci.c
··· 192 192 if (nr != 0) 193 193 return 0; 194 194 195 - res = kzalloc(2 * sizeof(struct resource), GFP_KERNEL); 195 + res = kzalloc(sizeof(struct resource), GFP_KERNEL); 196 196 if (!res) 197 197 panic("PCI: unable to alloc resources"); 198 198 199 - res[0].start = IOP3XX_PCI_LOWER_IO_PA; 200 - res[0].end = IOP3XX_PCI_LOWER_IO_PA + IOP3XX_PCI_IO_WINDOW_SIZE - 1; 201 - res[0].name = "IOP3XX PCI I/O Space"; 202 - res[0].flags = IORESOURCE_IO; 203 - request_resource(&ioport_resource, &res[0]); 204 - 205 - res[1].start = IOP3XX_PCI_LOWER_MEM_PA; 206 - res[1].end = IOP3XX_PCI_LOWER_MEM_PA + IOP3XX_PCI_MEM_WINDOW_SIZE - 1; 207 - res[1].name = "IOP3XX PCI Memory Space"; 208 - res[1].flags = IORESOURCE_MEM; 209 - request_resource(&iomem_resource, &res[1]); 199 + res->start = IOP3XX_PCI_LOWER_MEM_PA; 200 + res->end = IOP3XX_PCI_LOWER_MEM_PA + IOP3XX_PCI_MEM_WINDOW_SIZE - 1; 201 + res->name = "IOP3XX PCI Memory Space"; 202 + res->flags = IORESOURCE_MEM; 203 + request_resource(&iomem_resource, res); 210 204 211 205 /* 212 206 * Use whatever translation is already setup. 213 207 */ 214 208 sys->mem_offset = IOP3XX_PCI_LOWER_MEM_PA - *IOP3XX_OMWTVR0; 215 - sys->io_offset = IOP3XX_PCI_LOWER_IO_PA - *IOP3XX_OIOWTVR; 216 209 217 - pci_add_resource_offset(&sys->resources, &res[0], sys->io_offset); 218 - pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset); 210 + pci_add_resource_offset(&sys->resources, res, sys->mem_offset); 211 + 212 + pci_ioremap_io(0, IOP3XX_PCI_LOWER_IO_PA); 219 213 220 214 return 1; 221 215 } ··· 361 367 362 368 void __init iop3xx_pci_preinit(void) 363 369 { 364 - pcibios_min_io = 0; 365 370 pcibios_min_mem = 0; 366 371 367 372 iop3xx_atu_disable();
-5
arch/arm/plat-iop/setup.c
··· 25 25 .pfn = __phys_to_pfn(IOP3XX_PERIPHERAL_PHYS_BASE), 26 26 .length = IOP3XX_PERIPHERAL_SIZE, 27 27 .type = MT_UNCACHED, 28 - }, { /* PCI IO space */ 29 - .virtual = IOP3XX_PCI_LOWER_IO_VA, 30 - .pfn = __phys_to_pfn(IOP3XX_PCI_LOWER_IO_PA), 31 - .length = IOP3XX_PCI_IO_WINDOW_SIZE, 32 - .type = MT_DEVICE, 33 28 }, 34 29 }; 35 30