PCI io.h clean-up
Subsystems (8)
v2 cover PCI io.h clean-up
From: Rob Herring <[email protected]>
This is the 2nd part of mach/io.h removals. This series removes io.h on platforms with PCI by creating a fixed virtual I/O mapping and a common __io() macro.
This version has changed a bit to accommodate Tegra converting its PCIe host to a platform driver. Now the virtual space is only reserved during early boot before .map_io() is called. The mapping is not created until calling pci_ioremap_io which can be done at any point after vmalloc is initialized.
I've gone back to fixed 64K windows for each PCI bus. This allows removing all the i/o resource setup from the individually platforms and placing it within the common ARM PCI code.
I've only tested versatilepb under qemu (with the model hacked up to actually enable i/o space), so any testing is appreciated. iop3xx and mv78xx0 have some risk of breaking as the PCI bus addresses are moved to 0 from matching the cpu host bus addesss.
This is available from my git tree:
git://sources.calxeda.com/kernel/linux.git io-cleanup-pci
Rob
Arnd Bergmann (1):
iop13xx: use more regular PCI I/O space handling
Rob Herring (14):
ARM: Add fixed PCI i/o mapping
ARM: move PCI i/o resource setup into common code
ARM: versatile: use fixed PCI i/o mapping
ARM: tegra: use fixed PCI i/o mapping
ARM: integrator: use fixed PCI i/o mapping
ARM: integrator: remove trailing whitespace on pci_v3.c
ARM: shark: use fixed PCI i/o mapping
ARM: footbridge: use fixed PCI i/o mapping
ARM: dove: use fixed PCI i/o mapping
ARM: kirkwood: use fixed PCI i/o mapping
ARM: orion5x: use fixed PCI i/o mapping
ARM: iop13xx: use fixed PCI i/o mapping
ARM: mv78xx0: use fixed pci i/o mapping
ARM: iop3xx: use fixed PCI i/o mapping
Documentation/arm/memory.txt | 3 + arch/arm/Kconfig | 13 +-- arch/arm/include/asm/hardware/iop3xx.h | 12 +-- arch/arm/include/asm/io.h | 8 ++ arch/arm/include/asm/mach/map.h | 7 ++ arch/arm/include/asm/mach/pci.h | 18 ++++ arch/arm/kernel/bios32.c | 42 +++++++- arch/arm/mach-dove/common.c | 10 -- arch/arm/mach-dove/include/mach/dove.h | 8 +- arch/arm/mach-dove/include/mach/io.h | 19 ---- arch/arm/mach-dove/pcie.c | 23 +--- arch/arm/mach-footbridge/common.c | 8 +- arch/arm/mach-footbridge/dc21285.c | 16 +-- .../arm/mach-footbridge/include/mach/debug-macro.S | 3 +- arch/arm/mach-footbridge/include/mach/io.h | 12 +-- arch/arm/mach-integrator/include/mach/io.h | 33 ------ arch/arm/mach-integrator/include/mach/platform.h | 4 + arch/arm/mach-integrator/integrator_ap.c | 7 +- arch/arm/mach-integrator/pci_v3.c | 49 ++++----- arch/arm/mach-iop13xx/include/mach/io.h | 28 ----- arch/arm/mach-iop13xx/include/mach/iop13xx.h | 27 +---- arch/arm/mach-iop13xx/io.c | 27 ----- arch/arm/mach-iop13xx/pci.c | 37 +++---- arch/arm/mach-iop13xx/setup.c | 10 -- arch/arm/mach-iop32x/include/mach/io.h | 19 ---- arch/arm/mach-iop33x/include/mach/io.h | 19 ---- arch/arm/mach-kirkwood/common.c | 10 -- arch/arm/mach-kirkwood/include/mach/io.h | 24 ----- arch/arm/mach-kirkwood/include/mach/kirkwood.h | 8 +- arch/arm/mach-kirkwood/pcie.c | 22 +--- arch/arm/mach-mv78xx0/addr-map.c | 3 +- arch/arm/mach-mv78xx0/common.c | 5 - arch/arm/mach-mv78xx0/include/mach/io.h | 24 ----- arch/arm/mach-mv78xx0/include/mach/mv78xx0.h | 21 ++-- arch/arm/mach-mv78xx0/pcie.c | 110 ++++++-------------- arch/arm/mach-orion5x/common.c | 10 -- arch/arm/mach-orion5x/include/mach/io.h | 22 ---- arch/arm/mach-orion5x/include/mach/orion5x.h | 20 ++-- arch/arm/mach-orion5x/pci.c | 56 ++++------ arch/arm/mach-shark/core.c | 18 ---- arch/arm/mach-shark/include/mach/debug-macro.S | 7 +- arch/arm/mach-shark/include/mach/entry-macro.S | 3 +- arch/arm/mach-shark/include/mach/io.h | 18 ---- arch/arm/mach-shark/pci.c | 5 + arch/arm/mach-tegra/include/mach/io.h | 46 -------- arch/arm/mach-tegra/include/mach/iomap.h | 3 + arch/arm/mach-tegra/pcie.c | 95 ++++------------- arch/arm/mach-versatile/core.c | 5 - arch/arm/mach-versatile/include/mach/hardware.h | 1 - arch/arm/mach-versatile/include/mach/io.h | 27 ----- arch/arm/mach-versatile/pci.c | 22 +--- arch/arm/mm/ioremap.c | 14 +++ arch/arm/mm/mmu.c | 25 +++-- arch/arm/plat-iop/pci.c | 25 ++--- arch/arm/plat-iop/setup.c | 5 - 55 files changed, 293 insertions(+), 823 deletions(-) delete mode 100644 arch/arm/mach-dove/include/mach/io.h delete mode 100644 arch/arm/mach-integrator/include/mach/io.h delete mode 100644 arch/arm/mach-iop13xx/include/mach/io.h delete mode 100644 arch/arm/mach-iop32x/include/mach/io.h delete mode 100644 arch/arm/mach-iop33x/include/mach/io.h delete mode 100644 arch/arm/mach-kirkwood/include/mach/io.h delete mode 100644 arch/arm/mach-mv78xx0/include/mach/io.h delete mode 100644 arch/arm/mach-orion5x/include/mach/io.h delete mode 100644 arch/arm/mach-shark/include/mach/io.h delete mode 100644 arch/arm/mach-tegra/include/mach/io.h delete mode 100644 arch/arm/mach-versatile/include/mach/io.h
Signature · 1 line
1.7.9.5
PATCH v2 1/15 ARM: Add fixed PCI i/o mapping
From: Rob Herring <[email protected]>
This adds a fixed virtual mapping for PCI i/o addresses. The mapping is located at the last 2MB of vmalloc region (0xfee00000-0xff000000). 2MB is used to align with PMD size, but IO_SPACE_LIMIT is 1MB. The space is reserved just before .map_io and can be mapped at any time later with pci_ioremap_io.
This has changed completely from the 1st implementation which only supported creating the static mapping at .map_io.
--- Documentation/arm/memory.txt | 3 +++ arch/arm/include/asm/io.h | 8 ++++++++ arch/arm/include/asm/mach/map.h | 7 +++++++ arch/arm/include/asm/mach/pci.h | 15 +++++++++++++++ arch/arm/kernel/bios32.c | 1 + arch/arm/mm/ioremap.c | 14 ++++++++++++++ arch/arm/mm/mmu.c | 25 +++++++++++++++++-------- 7 files changed, 65 insertions(+), 8 deletions(-)
Documentation/arm/memory.txt +3 -0
@@ -51,6 +51,9 @@ ffc00000 ffefffff DMA memory mapping region. Memory returned ff000000 ffbfffff Reserved for future expansion of DMA mapping region. +fef00000 feffffff Mapping of PCI I/O space. This is a static + mapping within the vmalloc space. + VMALLOC_START VMALLOC_END-1 vmalloc() / ioremap() space. Memory returned by vmalloc/ioremap will be dynamically placed in this region.
arch/arm/include/asm/io.h +8 -0
@@ -113,11 +113,19 @@ static inline void __iomem *__typesafe_io(unsigned long addr)#define __iowmb () do { } while (0)#endif +/* PCI fixed i/o mapping */ +#define PCI_IO_VIRT_BASE 0xfee00000 + +extern int pci_ioremap_io (unsigned int offset,phys_addr_t phys_addr); +/* * Now, pick up the machine-defined IO definitions */ #ifdef CONFIG_NEED_MACH_IO_H #include <mach/io.h> +#elif defined(CONFIG_PCI ) +#define IO_SPACE_LIMIT ((resource_size_t)0xfffff) +#define __io (a) __typesafe_io(PCI_IO_VIRT_BASE + ((a) & IO_SPACE_LIMIT))#else #define __io (a) __typesafe_io((a) & IO_SPACE_LIMIT)#endif
arch/arm/include/asm/mach/map.h +7 -0
@@ -9,6 +9,9 @@* * Page table mapping constructs and function prototypes */ +#ifndef __ASM_MACH_MAP_H +#define __ASM_MACH_MAP_H +#include <asm/io.h> struct map_desc {
@@ -34,6 +37,7 @@ struct map_desc {#ifdef CONFIG_MMU extern void iotable_init (struct map_desc *,int ); +extern void vm_reserve_area_early (unsigned long addr,unsigned long size);struct mem_type ;extern const struct mem_type *get_mem_type (unsigned int type);
@@ -44,4 +48,7 @@ extern int ioremap_page(unsigned long virt, unsigned long phys, const struct mem_type *mtype);#else #define iotable_init (map,num) do { } while (0) +#define vm_reserve_area_early (a,s) do { } while (0) +#endif +#endif
arch/arm/include/asm/mach/pci.h +15 -0
@@ -11,6 +11,8 @@#ifndef __ASM_MACH_PCI_H#define __ASM_MACH_PCI_H +#include <asm/mach/map.h> +struct pci_sys_data ;struct pci_ops ;struct pci_bus ;
@@ -55,6 +57,19 @@ struct pci_sys_data {void pci_common_init (struct hw_pci *);/* +* Setup fixed I/O mapping. +*/ +#if defined(CONFIG_PCI ) && !defined(CONFIG_NEED_MACH_IO_H ) +/* Called from devicemaps_init before .map_io */ +static inline void pci_reserve_io (void ) +{ +vm_reserve_area_early (PCI_IO_VIRT_BASE ,SZ_2M ); +} +#else +static inline void pci_reserve_io (void ) {} +#endif + +/* * PCI controllers */ extern struct pci_ops iop3xx_ops;
arch/arm/kernel/bios32.c +1 -0
@@ -13,6 +13,7 @@#include <linux/io.h> #include <asm/mach-types.h> +#include <asm/mach/map.h> #include <asm/mach/pci.h> static int debug_pci;
arch/arm/mm/ioremap.c +14 -0
@@ -36,6 +36,7 @@#include <asm/system_info.h> #include <asm/mach/map.h> +#include <asm/mach/pci.h> #include "mm.h" int ioremap_page(unsigned long virt, unsigned long phys,
@@ -383,3 +384,16 @@ void __arm_iounmap(volatile void __iomem *io_addr)arch_iounmap (io_addr); }EXPORT_SYMBOL (__arm_iounmap); + +#ifdef CONFIG_PCI +int pci_ioremap_io (unsigned int offset,phys_addr_t phys_addr) +{ +BUG_ON (offset +SZ_64K >IO_SPACE_LIMIT ); + +return ioremap_page_range (PCI_IO_VIRT_BASE + offset, +PCI_IO_VIRT_BASE + offset +SZ_64K , + phys_addr, +__pgprot (get_mem_type (MT_DEVICE )->prot_pte)); +} +EXPORT_SYMBOL_GPL (pci_ioremap_io); +#endif
arch/arm/mm/mmu.c +17 -8
@@ -31,6 +31,7 @@#include <asm/mach/arch.h> #include <asm/mach/map.h> +#include <asm/mach/pci.h> #include "mm.h"
@@ -791,6 +792,18 @@ void __init iotable_init(struct map_desc *io_desc, int nr) } } +void __init vm_reserve_area_early (unsigned long addr,unsigned long size) +{ +struct vm_struct *vm; + + vm = early_alloc_aligned(sizeof(*vm), __alignof__(*vm)); + vm->addr = (void *)addr; + vm->size = size; + vm->flags =VM_IOREMAP |VM_ARM_STATIC_MAPPING ; + vm->caller = vm_reserve_area_early; +vm_area_add_early (vm++); +} +#ifndef CONFIG_ARM_LPAE /*
@@ -808,14 +821,7 @@ void __init iotable_init(struct map_desc *io_desc, int nr)static void __init pmd_empty_section_gap (unsigned long addr) { -struct vm_struct *vm; - - vm = early_alloc_aligned(sizeof(*vm), __alignof__(*vm)); - vm->addr = (void *)addr; - vm->size =SECTION_SIZE ; - vm->flags =VM_IOREMAP |VM_ARM_STATIC_MAPPING ; - vm->caller = pmd_empty_section_gap; -vm_area_add_early (vm); +vm_reserve_area_early (addr,SECTION_SIZE ); }static void __init fill_pmd_gaps (void )
@@ -1140,6 +1146,9 @@ static void __init devicemaps_init(struct machine_desc *mdesc)create_mapping (&map); } +/* Reserve fixed i/o space in VMALLOC region */ +pci_reserve_io (); +/* * Ask the machine support to map in the statically mapped devices. */
Signature · 1 line
1.7.9.5
PATCH v2 1/15 ARM: Add fixed PCI i/o mapping
Quoted 8 lines · Rob Herring
From: Rob Herring <[email protected]>
This adds a fixed virtual mapping for PCI i/o addresses. The mapping is located at the last 2MB of vmalloc region (0xfee00000-0xff000000). 2MB is used to align with PMD size, but
IO_SPACE_LIMITis 1MB. The space is reserved just before .map_io and can be mapped at any time later withpci_ioremap_io.
Quoted 6 lines
This has changed completely from the 1st implementation which only supported creating the static mapping at .map_io.
Signed-off-by Rob Herring <[email protected]>Cc Russell King <[email protected]>Cc Nicolas Pitre <[email protected]>
A few comments below:
Quoted 15 lines
arch/arm/mm/mmu.c +1
-0@@ -31,6 +31,7 @@#include <asm/mach/arch.h> #include <asm/mach/map.h> +#include <asm/mach/pci.h> #include "mm.h" @@ -791,6 +792,18 @@ void __init iotable_init(struct map_desc *io_desc, int nr) } }
arch/arm/mm/mmu.c void __init iotable_init(struct map_desc *io_desc, int nr) · line 803
Quoted 10 lines
arch/arm/mm/mmu.c +9
-0+void __init vm_reserve_area_early (unsigned long addr,unsigned long size) +{ +struct vm_struct *vm; + + vm = early_alloc_aligned(sizeof(*vm), __alignof__(*vm)); + vm->addr = (void *)addr; + vm->size = size; + vm->flags =VM_IOREMAP |VM_ARM_STATIC_MAPPING ; + vm->caller = vm_reserve_area_early;
This is not providing much useful information when looking at /proc/vmallocinfo anymore. What about adding a void *caller argument to this function and initializing vm->caller with it to identify the true origin of the region?
arch/arm/mm/mmu.c void __init iotable_init(struct map_desc *io_desc, int nr) · line 804
Quoted 1 line
arch/arm/mm/mmu.c +1
-0+vm_area_add_early (vm++);
Why ++ ?
Other than that...
Nicolas
PATCH v2 1/15 ARM: Add fixed PCI i/o mapping
Quoted 10 lines · Nicolas Pitre
arch/arm/mm/mmu.c void __init iotable_init(struct map_desc *io_desc, int nr) · line 803
Quoted 3 lines · Rob Herring
arch/arm/mm/mmu.c +3
-0+ vm->size = size; + vm->flags =VM_IOREMAP |VM_ARM_STATIC_MAPPING ; + vm->caller = vm_reserve_area_early;This is not providing much useful information when looking at
/proc/vmallocinfoanymore. What about adding a void *caller argument to this function and initializingvm->callerwith it to identify the true origin of the region?
What about just using __builtin_return_address(0)? Since pci_reserve_io and devicemaps_init get inlined, ultimately it shows paging_init doing that.
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +1
-0+ vm_area_add_early(vm
Rob++);
Quoted 2 lines
Why ++ ?
Just a cut and paste left over.
Quoted 5 lines
Other than that...
Acked-by Nicolas Pitre <[email protected]>
Thanks!
Rob
PATCH v2 1/15 ARM: Add fixed PCI i/o mapping
Quoted 12 lines · Rob Herring
Quoted 10 lines · Nicolas Pitre
arch/arm/mm/mmu.c void __init iotable_init(struct map_desc *io_desc, int nr) · line 803
Quoted 3 lines · Rob Herring
arch/arm/mm/mmu.c +3
-0+ vm->size = size; + vm->flags =VM_IOREMAP |VM_ARM_STATIC_MAPPING ; + vm->caller = vm_reserve_area_early;This is not providing much useful information when looking at
/proc/vmallocinfoanymore. What about adding a void *caller argument to this function and initializingvm->callerwith it to identify the true origin of the region?
Quoted 2 lines
What about just using
__builtin_return_address(0)? Sincepci_reserve_ioanddevicemaps_initget inlined, ultimately it showspaging_initdoing that.
Using __builtin_return_address(0) doesn't prevent gcc from inlining the callers in their own callers and then the provided information isn't as useful. They won't get inlined if you pass the address of the caller. Furthermore __builtin_return_address(0) provides the call site address and not the caller's start address which isn't as pretty.
Nicolas
PATCH v2 2/15 ARM: move PCI i/o resource setup into common code
In reply to Rob HerringFrom: Rob Herring <[email protected]>
With consolidation of the PCI i/o mappings, the i/o space is being set to start at a PCI bus addr of 0x0 and fixed to 64K per bus. In this case the core ARM PCI setup code can setup the i/o resource.
Currently, the resource is only setup if the platform did not setup an i/o resource.
--- arch/arm/include/asm/mach/pci.h | 3 +++ arch/arm/kernel/bios32.c | 41 ++++++++++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 5 deletions(-)
arch/arm/include/asm/mach/pci.h +3 -0
@@ -11,6 +11,7 @@#ifndef __ASM_MACH_PCI_H#define __ASM_MACH_PCI_H +#include <linux/ioport.h> #include <asm/mach/map.h> struct pci_sys_data ;
@@ -44,6 +45,8 @@ struct pci_sys_data {unsigned long io_offset;/* bus->cpu IO mapping offset */ struct pci_bus *bus;/* PCI bus */ struct list_head resources;/* root bus resources (apertures) */ +struct resource io_res; +char io_res_name[12 ];/* Bridge swizzling */ u8 (*swizzle)(struct pci_dev *,u8 *);/* IRQ mapping */
arch/arm/kernel/bios32.c +36 -5
53 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 3/15 ARM: versatile: use fixed PCI i/o mapping
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Move versatile PCI to fixed i/o mapping and remove io.h.
--- arch/arm/Kconfig | 1 - arch/arm/mach-versatile/core.c | 5 ----- arch/arm/mach-versatile/include/mach/hardware.h | 1 - arch/arm/mach-versatile/include/mach/io.h | 27 ----------------------- arch/arm/mach-versatile/pci.c | 22 ++++-------------- 5 files changed, 4 insertions(+), 52 deletions(-) delete mode 100644 arch/arm/mach-versatile/include/mach/io.h
arch/arm/Kconfig +0 -1
@@ -293,7 +293,6 @@ config ARCH_VERSATILE select ICST select GENERIC_CLOCKEVENTS select ARCH_WANT_OPTIONAL_GPIOLIB - select NEED_MACH_IO_H if PCI select PLAT_VERSATILE select PLAT_VERSATILE_CLCD select PLAT_VERSATILE_FPGA_IRQ
arch/arm/mach-versatile/core.c +0 -5
@@ -169,11 +169,6 @@ static struct map_desc versatile_io_desc[] __initdata = { .pfn = __phys_to_pfn(VERSATILE_PCI_CFG_BASE), .length = VERSATILE_PCI_CFG_BASE_SIZE, .type = MT_DEVICE - }, { - .virtual = (unsigned long)VERSATILE_PCI_VIRT_MEM_BASE0, - .pfn = __phys_to_pfn(VERSATILE_PCI_MEM_BASE0), - .length = IO_SPACE_LIMIT, - .type = MT_DEVICE },#endif };
arch/arm/mach-versatile/include/mach/hardware.h +0 -1
@@ -29,7 +29,6 @@*/ #define VERSATILE_PCI_VIRT_BASE (void __iomem *)0xe8000000ul#define VERSATILE_PCI_CFG_VIRT_BASE (void __iomem *)0xe9000000ul -#define VERSATILE_PCI_VIRT_MEM_BASE0 (void __iomem *)PCIO_BASE/* macro to get at MMIO space when running virtually */ #define IO_ADDRESS (x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000)
arch/arm/mach-versatile/include/mach/io.h deleted +0 -27
@@ -1,27 +0,0 @@ -/* -* arch/arm/mach-versatile/include/mach/io.h -* -* Copyright (C) 2003 ARM Limited -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef __ASM_ARM_ARCH_IO_H -#define __ASM_ARM_ARCH_IO_H - -#define PCIO_BASE 0xeb000000ul - -#define __io (a) ((a) + PCIO_BASE) - -#endif
arch/arm/mach-versatile/pci.c +4 -18
@@ -169,13 +169,6 @@ static struct pci_ops pci_versatile_ops = { .write = versatile_write_config, }; -static struct resource io_port = { - .name ="PCI" , - .start =0 , - .end =IO_SPACE_LIMIT , - .flags =IORESOURCE_IO , -}; -static struct resource io_mem = { .name ="PCI I/O space" , .start =VERSATILE_PCI_MEM_BASE0 ,
@@ -207,12 +200,6 @@ static int __init pci_versatile_setup_resources(struct pci_sys_data *sys) "memory region (%d)\n", ret); goto out; } - ret =request_resource (&ioport_resource, &io_port); -if (ret) { -printk (KERN_ERR "PCI: unable to allocate I/O " -"port region (%d)\n" , ret); - goto out; - } ret =request_resource (&iomem_resource, &non_mem);if (ret) { printk(KERN_ERR "PCI: unable to allocate non-prefetchable "
@@ -227,11 +214,9 @@ static int __init pci_versatile_setup_resources(struct pci_sys_data *sys) }/* -* the IO resource for this bus * the mem resource for this bus * the prefetch mem resource for this bus */ -pci_add_resource_offset (&sys->resources, &io_port, sys->io_offset);pci_add_resource_offset (&sys->resources, &non_mem, sys->mem_offset);pci_add_resource_offset (&sys->resources, &pre_mem, sys->mem_offset);
@@ -260,9 +245,11 @@ int __init pci_versatile_setup(int nr, struct pci_sys_data *sys) goto out; } + ret =pci_ioremap_io (0 ,VERSATILE_PCI_MEM_BASE0 ); +if (ret) + goto out; +if (nr ==0 ) { - sys->mem_offset =0 ; - sys->io_offset =0 ; ret =pci_versatile_setup_resources (sys);if (ret <0 ) {printk ("pci_versatile_setup: resources... oops?\n" );
@@ -319,7 +306,6 @@ int __init pci_versatile_setup(int nr, struct pci_sys_data *sys)void __init pci_versatile_preinit (void ) { - pcibios_min_io =0x44000000 ; pcibios_min_mem =0x50000000 ;__raw_writel (VERSATILE_PCI_MEM_BASE0 >>28 ,PCI_IMAP0 );
Signature · 1 line
1.7.9.5
PATCH v2 4/15 ARM: tegra: use fixed PCI i/o mapping
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Move tegra PCI to fixed i/o mapping and remove io.h.
--- arch/arm/Kconfig | 1 - arch/arm/mach-tegra/include/mach/io.h | 46 --------------- arch/arm/mach-tegra/include/mach/iomap.h | 3 + arch/arm/mach-tegra/pcie.c | 95 +++++++----------------------- 4 files changed, 25 insertions(+), 120 deletions(-) delete mode 100644 arch/arm/mach-tegra/include/mach/io.h
arch/arm/Kconfig +0 -1
@@ -644,7 +644,6 @@ config ARCH_TEGRA select HAVE_CLK select HAVE_SMP select MIGHT_HAVE_CACHE_L2X0 - select NEED_MACH_IO_H if PCI select ARCH_HAS_CPUFREQ help This enables support for NVIDIA Tegra based systems (Tegra APX,
arch/arm/mach-tegra/include/mach/io.h deleted +0 -46
46 lines not on this page · raw message
arch/arm/mach-tegra/include/mach/iomap.h +3 -0
@@ -303,6 +303,9 @@#define IO_APB_VIRT IOMEM(0xFE300000)#define IO_APB_SIZE SZ_1M +#define TEGRA_PCIE_BASE 0x80000000 +#define TEGRA_PCIE_IO_BASE (TEGRA_PCIE_BASE + SZ_4M) +#define IO_TO_VIRT_BETWEEN (p, st, sz) ((p) >= (st) && (p) < ((st) + (sz)))#define IO_TO_VIRT_XLATE (p, pst, vst) (((p) - (pst) + (vst)))
arch/arm/mach-tegra/pcie.c +22 -73
174 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 5/15 ARM: integrator: use fixed PCI i/o mapping
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Move integrator PCI to fixed i/o mapping and remove io.h.
--- arch/arm/Kconfig | 1 - arch/arm/mach-integrator/include/mach/io.h | 33 ---------------------- arch/arm/mach-integrator/include/mach/platform.h | 4 +++ arch/arm/mach-integrator/integrator_ap.c | 7 +---- arch/arm/mach-integrator/pci_v3.c | 3 -- 5 files changed, 5 insertions(+), 43 deletions(-) delete mode 100644 arch/arm/mach-integrator/include/mach/io.h
arch/arm/Kconfig +0 -1
@@ -261,7 +261,6 @@ config ARCH_INTEGRATOR select GENERIC_CLOCKEVENTS select PLAT_VERSATILE select PLAT_VERSATILE_FPGA_IRQ - select NEED_MACH_IO_H select NEED_MACH_MEMORY_H select SPARSE_IRQ select MULTI_IRQ_HANDLER
arch/arm/mach-integrator/include/mach/io.h deleted +0 -33
@@ -1,33 +0,0 @@ -/* -* arch/arm/mach-integrator/include/mach/io.h -* -* Copyright (C) 1999 ARM Limited -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef __ASM_ARM_ARCH_IO_H -#define __ASM_ARM_ARCH_IO_H - -/* -* WARNING: this has to mirror definitions in platform.h -*/ -#define PCI_MEMORY_VADDR 0xe8000000 -#define PCI_CONFIG_VADDR 0xec000000 -#define PCI_V3_VADDR 0xed000000 -#define PCI_IO_VADDR 0xee000000 - -#define __io (a) ((void __iomem *)(PCI_IO_VADDR + (a))) - -#endif
arch/arm/mach-integrator/include/mach/platform.h +4 -0
@@ -324,6 +324,10 @@*/ #define PHYS_PCI_V3_BASE 0x62000000 +#define PCI_MEMORY_VADDR 0xe8000000 +#define PCI_CONFIG_VADDR 0xec000000 +#define PCI_V3_VADDR 0xed000000 +/* ------------------------------------------------------------------------ * Integrator Interrupt Controllers * ------------------------------------------------------------------------
arch/arm/mach-integrator/integrator_ap.c +1 -6
@@ -72,7 +72,7 @@* e8000000 40000000 PCI memory PHYS_PCI_MEM_BASE (max 512M) * ec000000 61000000 PCI config space PHYS_PCI_CONFIG_BASE (max 16M) * ed000000 62000000 PCI V3 regs PHYS_PCI_V3_BASE (max 64k) -* ee000000 60000000 PCI IO PHYS_PCI_IO_BASE (max 16M) +* fee00000 60000000 PCI IO PHYS_PCI_IO_BASE (max 16M) * ef000000 Cache flush * f1000000 10000000 Core module registers * f1100000 11000000 System controller registers
@@ -146,11 +146,6 @@ static struct map_desc ap_io_desc[] __initdata = { .pfn = __phys_to_pfn(PHYS_PCI_V3_BASE), .length = SZ_64K, .type = MT_DEVICE - }, { - .virtual = PCI_IO_VADDR, - .pfn = __phys_to_pfn(PHYS_PCI_IO_BASE), - .length = SZ_64K, - .type = MT_DEVICE } };
arch/arm/mach-integrator/pci_v3.c +0 -3
@@ -374,12 +374,9 @@ static int __init pci_v3_setup_resources(struct pci_sys_data *sys) }/* -* the IO resource for this bus * the mem resource for this bus * the prefetch mem resource for this bus */ -pci_add_resource_offset (&sys->resources, - &ioport_resource, sys->io_offset);pci_add_resource_offset (&sys->resources, &non_mem, sys->mem_offset);pci_add_resource_offset (&sys->resources, &pre_mem, sys->mem_offset);
Signature · 1 line
1.7.9.5
PATCH v2 5/15 ARM: integrator: use fixed PCI i/o mapping
Quoted 7 lines · Rob Herring
From: Rob Herring <[email protected]>
Move integrator PCI to fixed i/o mapping and remove
io.h.Signed-off-by Rob Herring <[email protected]>Cc Russell King <[email protected]>Cc Linus Walleij <[email protected]>
I think the PCI bus on my Integrator/AP is tilted and not suitable for tests. But IIRC Will Deacon actually has one of these machines and managed to get ethernet going on it. Maybe he can even test this patch?
Yours,
Linus Walleij
PATCH v2 5/15 ARM: integrator: use fixed PCI i/o mapping
Quoted 6 lines · Linus Walleij
Quoted 4 lines · Rob Herring
From: Rob Herring <[email protected]>
Move integrator PCI to fixed i/o mapping and remove
io.h.
Quoted 8 lines
Quoted 3 lines
Signed-off-by Rob Herring <[email protected]>Cc Russell King <[email protected]>Cc Linus Walleij <[email protected]>I think the PCI bus on my Integrator/AP is tilted and not suitable for tests. But IIRC Will Deacon actually has one of these machines and managed to get ethernet going on it. Maybe he can even test this patch?
I can try digging out my integrator at the weekend if you like. Are these patches sitting in a branch anywhere that I can grab?
Will
PATCH v2 5/15 ARM: integrator: use fixed PCI i/o mapping
Quoted 11 lines · Will Deacon
Quoted 10 lines · Linus Walleij
Quoted 7 lines · Rob Herring
From: Rob Herring <[email protected]>
Move integrator PCI to fixed i/o mapping and remove
io.h.Signed-off-by Rob Herring <[email protected]>Cc Russell King <[email protected]>Cc Linus Walleij <[email protected]>
Quoted 8 lines
Quoted 4 lines
I think the PCI bus on my Integrator/AP is tilted and not suitable for tests. But IIRC Will Deacon actually has one of these machines and managed to get ethernet going on it. Maybe he can even test this patch?
I can try digging out my integrator at the weekend if you like. Are these patches sitting in a branch anywhere that I can grab?
git://sources.calxeda.com/kernel/linux.git io-cleanup-pci
Rob
PATCH v2 5/15 ARM: integrator: use fixed PCI i/o mapping
Hi Rob,
Quoted 7 lines · Rob Herring
Quoted 6 lines · Will Deacon
Quoted 4 lines · Linus Walleij
I think the PCI bus on my Integrator/AP is tilted and not suitable for tests. But IIRC Will Deacon actually has one of these machines and managed to get ethernet going on it. Maybe he can even test this patch?
Quoted 5 lines
Quoted 3 lines
I can try digging out my integrator at the weekend if you like. Are these patches sitting in a branch anywhere that I can grab?
git://sources.calxeda.com/kernel/linux.gitio-cleanup-pci
I dusted off the integrator, but I'm failing to boot at all if I build from that branch:
Uncompressing Linux... done, booting the kernel. <silence>
Using the same .config, I can boot v3.5-rc7 just fine (I even rebased your branch onto that in case something had been fixed in mainline, but it made no difference).
Will
PATCH v2 5/15 ARM: integrator: use fixed PCI i/o mapping
Quoted 19 lines · Will Deacon
Hi Rob,
Quoted 7 lines · Rob Herring
Quoted 6 lines · Will Deacon
Quoted 4 lines · Linus Walleij
I think the PCI bus on my Integrator/AP is tilted and not suitable for tests. But IIRC Will Deacon actually has one of these machines and managed to get ethernet going on it. Maybe he can even test this patch?
Quoted 5 lines
Quoted 3 lines
I can try digging out my integrator at the weekend if you like. Are these patches sitting in a branch anywhere that I can grab?
git://sources.calxeda.com/kernel/linux.gitio-cleanup-pciI dusted off the integrator, but I'm failing to boot at all if I build from that branch:
Quoted 6 lines
Uncompressing Linux... done, booting the kernel. <silence>
Using the same .config, I can boot v3.5-rc7 just fine (I even rebased your branch onto that in case something had been fixed in mainline, but it made no difference).
I've looked at integrator_defconfig, and could not find any code that actually uses the PIO accessors. Is your configuration different to that? Do you actually have PCI enabled and present on the machine? Do things change if you turn PCI off?
Arnd
PATCH v2 5/15 ARM: integrator: use fixed PCI i/o mapping
Quoted 5 lines · Arnd Bergmann
Quoted 3 lines · Will Deacon
Hi Rob,
On Tue, Jul 17, 2012 at 07:02:12PM +0100, Rob Herring wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Will Deacon
Quoted 7 lines · Linus Walleij
Quoted 4 lines
I think the PCI bus on my Integrator/AP is tilted and not suitable for tests. But IIRC Will Deacon actually has one of these machines and managed to get ethernet going on it. Maybe he can even test this patch?
I can try digging out my integrator at the weekend if you like. Are
these
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
patches sitting in a branch anywhere that I can grab?
git://sources.calxeda.com/kernel/linux.gitio-cleanup-pciI dusted off the integrator, but I'm failing to boot at all if I build
from
Quoted 6 lines
Quoted 6 lines
that branch:
Uncompressing Linux... done, booting the kernel. <silence>
Using the same .config, I can boot v3.5-rc7 just fine (I even rebased
your
Quoted 1 line
Quoted 1 line
branch onto that in case something had been fixed in mainline, but it
made
Quoted 7 lines
Quoted 1 line
no difference).
I've looked at
integrator_defconfig, and could not find any code that actually uses the PIO accessors. Is your configuration different to that? Do you actually have PCI enabled and present on the machine? Do things change if you turn PCI off?
Could be overlapping static mappings. I manually checked that, but may have missed something.
Can you turn on earlyprintk?
Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120722/d40637a6/attachment-0001.html>
PATCH v2 5/15 ARM: integrator: use fixed PCI i/o mapping
Quoted 8 lines · Rob Herring
Quoted 7 lines · On Jul 21, 2012 5:56 PM, "Arnd Bergmann" <arnd at…
Quoted 6 lines · Will Deacon
I dusted off the integrator, but I'm failing to boot at all if I build from that branch:
Uncompressing Linux... done, booting the kernel. <silence>
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Using the same .config, I can boot v3.5-rc7 just fine (I even rebased your branch onto that in case something had been fixed in mainline, but it made no difference).
I've looked at
integrator_defconfig, and could not find any code that actually uses the PIO accessors. Is your configuration different to that? Do you actually have PCI enabled and present on the machine? Do things change if you turn PCI off?
I have PCI up and running, yes, but all I use it for is an Intel e100 ethernet card which isn't required for booting. Disabling PCI makes no difference, but see below.
Quoted 3 lines
Could be overlapping static mappings. I manually checked that, but may have missed something.
Can you turn on earlyprintk?
I had that turned on already... after banging my head against a wall, I realised that increasing the baudrate in u-boot (I have to use ymodem to transfer the kernel image...) kills the serial console completely when booting Linux if I forget to change it back.
With that observation, I see booting get stuck:
Uncompressing Linux... done, booting the kernel.
[ 0.000000] Booting Linux on physical CPU 0 [ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Linux version 3.5.0-rc6-00017-g52f1412 (will at tiny-lites) (gcc version 4.5.3 (Gent2 [ 0.000000] CPU: ARM926EJ-S [41069263] revision 3 (ARMv5TEJ), cr=00053177 [ 0.000000] CPU: VIVT data cache, VIVT instruction cache [ 0.000000] Machine: ARM-Integrator [ 0.000000] bootconsole [earlycon0] enabled [ 0.000000] Memory policy: ECC disabled, Data cache writeback [ 0.000000] On node 0 totalpages: 32768 [ 0.000000] free_area_init_node: node 0, pgdat c04ad1f0, node_mem_map c04c9000 [ 0.000000] Normal zone: 256 pages used for memmap [ 0.000000] Normal zone: 0 pages reserved [ 0.000000] Normal zone: 32512 pages, LIFO batch:7 [ 0.000000] CPU: found DTCM0 32k @ 00000000, not enabled [ 0.000000] CPU: moved DTCM0 32k to fffe8000, enabled [ 0.000000] CPU: found ITCM0 32k @ 00000000, not enabled [ 0.000000] CPU: moved ITCM0 32k to fffe0000, enabled [ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768 [ 0.000000] pcpu-alloc: [0] 0 [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512 [ 0.000000] Kernel command line: console=ttyAM0 mem=128M earlyprintk debug user_debug=31 logl9 [ 0.000000] PID hash table entries: 512 (order: -1, 2048 bytes) [ 0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) [ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) [ 0.000000] Memory: 128MB = 128MB total [ 0.000000] Memory: 124968k/124968k available, 6104k reserved, 0K highmem [ 0.000000] Virtual kernel memory layout: [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB) [ 0.000000] DTCM : 0xfffe8000 - 0xffff0000 ( 32 kB) [ 0.000000] ITCM : 0xfffe0000 - 0xfffe8000 ( 32 kB) [ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) [ 0.000000] vmalloc : 0xc8800000 - 0xff000000 ( 872 MB) [ 0.000000] lowmem : 0xc0000000 - 0xc8000000 ( 128 MB) [ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB) [ 0.000000] .text : 0xc0008000 - 0xc036e9b0 (3483 kB) [ 0.000000] .init : 0xc036f000 - 0xc048e7a4 (1150 kB) [ 0.000000] .data : 0xc0490000 - 0xc04ad920 ( 119 kB) [ 0.000000] .bss : 0xc04ae024 - 0xc04c86b4 ( 106 kB) [ 0.000000] SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 [ 0.000000] NR_IRQS:16 nr_irqs:34 34 [ 0.000000] FPGA IRQ chip 0 "SC" @ f1400000, 22 irqs [ 0.000000] sched_clock: 16 bits at 1500kHz, resolution 666ns, wraps every 43ms
Now, the next line is usually when the VGA text console is poked. Sure enough, disabling that (CONFIG_VGA_CONSOLE) is enough to boot with your patches and PCI appears to work correctly (I can do basic networking).
I guess there's some mapping race with the VGA code since vga_base = PCI_MEMORY_VADDR, but you left the static mapping alone for that region, so I'm not sure. Any ideas?
Will
PATCH v2 5/15 ARM: integrator: use fixed PCI i/o mapping
Quoted 3 lines · Will Deacon
Quoted 1 line · Rob Herring
On Jul 21, 2012 5:56 PM, "Arnd Bergmann" <arnd at arndb.de<mailto:
Quoted 2 lines · [email protected]>> wrote:
Quoted 2 lines
Quoted 2 lines · Will Deacon
Quoted 1 line
I dusted off the integrator, but I'm failing to boot at all if I
build from
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
that branch:
Uncompressing Linux... done, booting the kernel. <silence>
Using the same .config, I can boot v3.5-rc7 just fine (I even
rebased your
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
branch onto that in case something had been fixed in mainline, but
it made
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
no difference).
I've looked at
integrator_defconfig, and could not find any code that actually uses the PIO accessors. Is your configuration different to
that?
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Do you actually have PCI enabled and present on the machine? Do things change if you turn PCI off?
I have PCI up and running, yes, but all I use it for is an Intel e100 ethernet card which isn't required for booting. Disabling PCI makes no difference, but see below.
Quoted 1 line
Could be overlapping static mappings. I manually checked that, but may
have missed something.
Quoted 8 lines
Quoted 2 lines
Can you turn on earlyprintk?
I had that turned on already... after banging my head against a wall, I realised that increasing the baudrate in u-boot (I have to use ymodem to transfer the kernel image...) kills the serial console completely when booting Linux if I forget to change it back.
Quoted 7 lines
With that observation, I see booting get stuck:
Uncompressing Linux... done, booting the kernel.
[ 0.000000] Booting Linux on physical CPU 0 [ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Linux version 3.5.0-rc6-00017-g52f1412 (will at tiny-lites)
(gcc version 4.5.3 (Gent2
Quoted 1 line
[ 0.000000] CPU: ARM926EJ-S [41069263] revision 3 (ARMv5TEJ),
cr=00053177
Quoted 6 lines
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache [ 0.000000] Machine: ARM-Integrator [ 0.000000] bootconsole [earlycon0] enabled [ 0.000000] Memory policy: ECC disabled, Data cache writeback [ 0.000000] On node 0 totalpages: 32768 [ 0.000000] free_area_init_node: node 0, pgdat c04ad1f0, node_mem_map
c04c9000
Quoted 10 lines
[ 0.000000] Normal zone: 256 pages used for memmap [ 0.000000] Normal zone: 0 pages reserved [ 0.000000] Normal zone: 32512 pages, LIFO batch:7 [ 0.000000] CPU: found DTCM0 32k @ 00000000, not enabled [ 0.000000] CPU: moved DTCM0 32k to fffe8000, enabled [ 0.000000] CPU: found ITCM0 32k @ 00000000, not enabled [ 0.000000] CPU: moved ITCM0 32k to fffe0000, enabled [ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768 [ 0.000000] pcpu-alloc: [0] 0 [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on.
Total pages: 32512
Quoted 1 line
[ 0.000000] Kernel command line: console=ttyAM0 mem=128M earlyprintk
debug user_debug=31 logl9
Quoted 2 lines
[ 0.000000] PID hash table entries: 512 (order: -1, 2048 bytes) [ 0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536
bytes)
Quoted 1 line
[ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768
bytes)
Quoted 2 lines
[ 0.000000] Memory: 128MB = 128MB total [ 0.000000] Memory: 124968k/124968k available, 6104k reserved, 0K
highmem
Quoted 5 lines
[ 0.000000] Virtual kernel memory layout: [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB) [ 0.000000] DTCM : 0xfffe8000 - 0xffff0000 ( 32 kB) [ 0.000000] ITCM : 0xfffe0000 - 0xfffe8000 ( 32 kB) [ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
Quoted 8 lines
[ 0.000000] vmalloc : 0xc8800000 - 0xff000000 ( 872 MB) [ 0.000000] lowmem : 0xc0000000 - 0xc8000000 ( 128 MB) [ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB) [ 0.000000] .text : 0xc0008000 - 0xc036e9b0 (3483 kB) [ 0.000000] .init : 0xc036f000 - 0xc048e7a4 (1150 kB) [ 0.000000] .data : 0xc0490000 - 0xc04ad920 ( 119 kB) [ 0.000000] .bss : 0xc04ae024 - 0xc04c86b4 ( 106 kB) [ 0.000000] SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0,
CPUs=1, Nodes=1
Quoted 3 lines
[ 0.000000] NR_IRQS:16 nr_irqs:34 34 [ 0.000000] FPGA IRQ chip 0 "SC" @ f1400000, 22 irqs [ 0.000000] sched_clock: 16 bits at 1500kHz, resolution 666ns, wraps
every 43ms
Quoted 9 lines
Now, the next line is usually when the VGA text console is poked. Sure enough, disabling that (
CONFIG_VGA_CONSOLE) is enough to boot with your patches and PCI appears to work correctly (I can do basic networking).I guess there's some mapping race with the VGA code since
vga_base=PCI_MEMORY_VADDR, but you left the static mapping alone for that region, so I'm not sure. Any ideas?
Perhaps pcibios_min_io changing from 6000 to default of 1000 causes probing for vga?
Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120722/eb26f978/attachment-0001.html>
PATCH v2 5/15 ARM: integrator: use fixed PCI i/o mapping
Quoted 10 lines · Rob Herring
Quoted 7 lines · On Jul 22, 2012 11:08 AM, "Will Deacon" <will.deacon at…
Now, the next line is usually when the VGA text console is poked. Sure enough, disabling that (
CONFIG_VGA_CONSOLE) is enough to boot with your patches and PCI appears to work correctly (I can do basic networking).I guess there's some mapping race with the VGA code since
vga_base=PCI_MEMORY_VADDR, but you left the static mapping alone for that region, so I'm not sure. Any ideas?Perhaps
pcibios_min_iochanging from 6000 to default of 1000 causes probing for vga?
I can try changing it back and see it makes a difference sometime this week. It certainly smells like some probing is going on before the PCI stuff is up and running and I suspect that the static mapping just leads to a hang rather than an abort.
Will
PATCH v2 5/15 ARM: integrator: use fixed PCI i/o mapping
Quoted 10 lines · Will Deacon
Quoted 9 lines · Rob Herring
Quoted 7 lines · On Jul 22, 2012 11:08 AM, "Will Deacon" <will.deacon at…
Now, the next line is usually when the VGA text console is poked. Sure enough, disabling that (
CONFIG_VGA_CONSOLE) is enough to boot with your patches and PCI appears to work correctly (I can do basic networking).I guess there's some mapping race with the VGA code since
vga_base=PCI_MEMORY_VADDR, but you left the static mapping alone for that region, so I'm not sure. Any ideas?
Quoted 6 lines
Quoted 1 line
Perhaps
pcibios_min_iochanging from 6000 to default of 1000 causes probing for vga?I can try changing it back and see it makes a difference sometime this week. It certainly smells like some probing is going on before the PCI stuff is up and running and I suspect that the static mapping just leads to a hang rather than an abort.
Now that I have looked at the code. I think it is simply vgacon is postcore_init and pci setup of the i/o mapping is in subsys_init. It curious that you don't get an abort and backtrace though.
vgacon is only enabled for footbridge and integrator. I guess the only way this worked before is if the bootloader has already setup the bus. So I can add back an early mapping function that these 2 platforms can call from .map_io. Something like this:
static inline void __init pci_map_io_early(unsigned long pfn)
{
struct map_desc pci_io_desc = {
.virtual = PCI_IO_VIRT_BASE,
.type = MT_DEVICE,
.length = SZ_64K,
};
pci_io_desc.pfn = pfn;
create_mapping(&pci_io_desc);
}Rob
PATCH v2 5/15 ARM: integrator: use fixed PCI i/o mapping
Quoted 2 lines · Rob Herring
Now that I have looked at the code. I think it is simply vgacon is
postcore_initand pci setup of the i/o mapping is insubsys_init.
Makes perfect sense.
Quoted 1 line
It curious that you don't get an abort and backtrace though.
I never get that either, it just locks up. Probably some other oddity in these old boards.
Quoted 2 lines
vgacon is only enabled for footbridge and integrator. I guess the only way this worked before is if the bootloader has already setup the bus.
Yes that is the case with most of the "V3 PCI" code, without some bootloader or "BIOS" (boot monitor) poking, nothing works. Some of the V3 registers are only just poked once, from the boot monitor or boot loader.
Quoted 4 lines
So I can add back an early mapping function that these 2 platforms can call from .map_io. Something like this:
static inline void
__initpci_map_io_early(unsigned long pfn)
Quoted 10 lines
{
struct map_desc pci_io_desc = {
.virtual = PCI_IO_VIRT_BASE,
.type = MT_DEVICE,
.length = SZ_64K,
};
pci_io_desc.pfn = pfn;
create_mapping(&pci_io_desc);
}Wouldn't the same kind of thing be necessary for all x86 systems, and for any other ARM system that wants to use a VGA console? How do these system handle it?
BTW: in the integrator_defconfig the VGA console is disabled, for the very reason that it tends to lock things up if ther is no graphics card in the machine.
Yours,
Linus Walleij
PATCH v2 6/15 ARM: integrator: remove trailing whitespace on pci_v3.c
In reply to Rob HerringFrom: Rob Herring <[email protected]>
No functional changes.
--- arch/arm/mach-integrator/pci_v3.c | 46 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-)
arch/arm/mach-integrator/pci_v3.c +23 -23
@@ -41,61 +41,61 @@/* * The V3 PCI interface chip in Integrator provides several windows from * local bus memory into the PCI memory areas. Unfortunately, there -* are not really enough windows for our usage, therefore we reuse +* are not really enough windows for our usage, therefore we reuse * one of the windows for access to PCI configuration space. The * memory map is as follows: -* +* * Local Bus Memory Usage -* +* * 40000000 - 4FFFFFFF PCI memory. 256M non-prefetchable * 50000000 - 5FFFFFFF PCI memory. 256M prefetchable * 60000000 - 60FFFFFF PCI IO. 16M * 61000000 - 61FFFFFF PCI Configuration. 16M -* +* * There are three V3 windows, each described by a pair of V3 registers. * These are LB_BASE0/LB_MAP0, LB_BASE1/LB_MAP1 and LB_BASE2/LB_MAP2. * Base0 and Base1 can be used for any type of PCI memory access. Base2 * can be used either for PCI I/O or for I20 accesses. By default, uHAL * uses this only for PCI IO space. -* +* * Normally these spaces are mapped using the following base registers: -* +* * Usage Local Bus Memory Base/Map registers used -* +* * Mem 40000000 - 4FFFFFFF LB_BASE0/LB_MAP0 * Mem 50000000 - 5FFFFFFF LB_BASE1/LB_MAP1 * IO 60000000 - 60FFFFFF LB_BASE2/LB_MAP2 * Cfg 61000000 - 61FFFFFF -* +* * This means that I20 and PCI configuration space accesses will fail. -* When PCI configuration accesses are needed (via the uHAL PCI +* When PCI configuration accesses are needed (via the uHAL PCI * configuration space primitives) we must remap the spaces as follows: -* +* * Usage Local Bus Memory Base/Map registers used -* +* * Mem 40000000 - 4FFFFFFF LB_BASE0/LB_MAP0 * Mem 50000000 - 5FFFFFFF LB_BASE0/LB_MAP0 * IO 60000000 - 60FFFFFF LB_BASE2/LB_MAP2 * Cfg 61000000 - 61FFFFFF LB_BASE1/LB_MAP1 -* +* * To make this work, the code depends on overlapping windows working. -* The V3 chip translates an address by checking its range within +* The V3 chip translates an address by checking its range within * each of the BASE/MAP pairs in turn (in ascending register number * order). It will use the first matching pair. So, for example, * if the same address is mapped by both LB_BASE0/LB_MAP0 and -* LB_BASE1/LB_MAP1, the V3 will use the translation from +* LB_BASE1/LB_MAP1, the V3 will use the translation from * LB_BASE0/LB_MAP0. -* +* * To allow PCI Configuration space access, the code enlarges the * window mapped by LB_BASE0/LB_MAP0 from 256M to 512M. This occludes * the windows currently mapped by LB_BASE1/LB_MAP1 so that it can * be remapped for use by configuration cycles. -* -* At the end of the PCI Configuration space accesses, +* +* At the end of the PCI Configuration space accesses, * LB_BASE1/LB_MAP1 is reset to map PCI Memory. Finally the window * mapped by LB_BASE0/LB_MAP0 is reduced in size from 512M to 256M to * reveal the now restored LB_BASE1/LB_MAP1 window. -* +* * NOTE: We do not set up I2O mapping. I suspect that this is only * for an intelligent (target) device. Using I2O disables most of * the mappings into PCI memory.
@@ -127,8 +127,8 @@* * returns: configuration address to play on the PCI bus * -* To generate the appropriate PCI configuration cycles in the PCI -* configuration address space, you present the V3 with the following pattern +* To generate the appropriate PCI configuration cycles in the PCI +* configuration address space, you present the V3 with the following pattern * (which is very nearly a type 1 (except that the lower two bits are 00 and * not 01). In order for this mapping to work you need to set up one of * the local to PCI aperatures to 16Mbytes in length translating to
@@ -138,7 +138,7 @@* * Type 0: * -* 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1 +* 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1 * 3 2|1 0 9 8|7 6 5 4|3 2 1 0|9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | | |D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|F|F|F|R|R|R|R|R|R|0|0|
@@ -150,7 +150,7 @@* * Type 1: * -* 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1 +* 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1 * 3 2|1 0 9 8|7 6 5 4|3 2 1 0|9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | | | | | | | | | | |B|B|B|B|B|B|B|B|D|D|D|D|D|F|F|F|R|R|R|R|R|R|0|1|
@@ -161,7 +161,7 @@* 15:11 Device number (5 bits) * 10:8 function number * 7:2 register number -* +* */ static DEFINE_RAW_SPINLOCK (v3_lock);
Signature · 1 line
1.7.9.5
PATCH v2 7/15 ARM: shark: use fixed PCI i/o mapping
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Convert shark to use the fixed i/o mapping and remove io.h.
This shrinks the mapping from 256MB to 64KB, but nothing is using that much space AFAICT.
--- arch/arm/Kconfig | 1 - arch/arm/mach-shark/core.c | 18 ------------------ arch/arm/mach-shark/include/mach/debug-macro.S | 7 ++++--- arch/arm/mach-shark/include/mach/entry-macro.S | 3 ++- arch/arm/mach-shark/include/mach/io.h | 18 ------------------ arch/arm/mach-shark/pci.c | 5 +++++ 6 files changed, 11 insertions(+), 41 deletions(-) delete mode 100644 arch/arm/mach-shark/include/mach/io.h
arch/arm/Kconfig +0 -1
@@ -869,7 +869,6 @@ config ARCH_SHARK select PCI select ARCH_USES_GETTIMEOFFSET select NEED_MACH_MEMORY_H - select NEED_MACH_IO_H help Support for the StrongARM based Digital DNARD machine, also known as "Shark" (<http://www.shark-linux.de/shark.html>).
arch/arm/mach-shark/core.c +0 -18
@@ -21,9 +21,6 @@#include <asm/mach/arch.h> #include <asm/mach/time.h> -#define IO_BASE 0xe0000000 -#define IO_SIZE 0x08000000 -#define IO_START 0x40000000#define ROMCARD_SIZE 0x08000000#define ROMCARD_START 0x10000000
@@ -104,20 +101,6 @@ arch_initcall(shark_init);extern void shark_init_irq (void ); -static struct map_desc shark_io_desc[]__initdata = { - { - .virtual =IO_BASE , - .pfn =__phys_to_pfn (IO_START ), - .length =IO_SIZE , - .type =MT_DEVICE - } -}; - -static void __init shark_map_io (void ) -{ -iotable_init (shark_io_desc,ARRAY_SIZE (shark_io_desc)); -} -#define IRQ_TIMER 0#define HZ_TIME ((1193180 + HZ/2) / HZ)
@@ -158,7 +141,6 @@ static void shark_init_early(void)MACHINE_START (SHARK ,"Shark" )/* Maintainer: Alexander Schulz */ .atag_offset = 0x3000, - .map_io = shark_map_io, .init_early = shark_init_early, .init_irq = shark_init_irq, .timer = &shark_timer,
arch/arm/mach-shark/include/mach/debug-macro.S +4 -3
@@ -12,9 +12,10 @@ */ .macro addruart, rp, rv, tmp - mov \rp, #0xe0000000 - orr \rp, \rp, #0x000003f8 - mov \rv, \rp + mov \rp, #0x3f8 + orr \rv, \rp, #0xfe000000 + orr \rv, \rv, #0x00e00000 + orr \rp, \rp, #0x40000000 .endm .macro senduart,rd,rx
arch/arm/mach-shark/include/mach/entry-macro.S +2 -1
@@ -8,7 +8,8 @@ * warranty of any kind, whether express or implied. */ .macro get_irqnr_preamble, base, tmp - mov \base, #0xe0000000 + mov \base, #0xfe000000 + orr \base, \base, #0x00e00000 .endm .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
arch/arm/mach-shark/include/mach/io.h deleted +0 -18
@@ -1,18 +0,0 @@ -/* -* arch/arm/mach-shark/include/mach/io.h -* -* by Alexander Schulz -* -* derived from: -* arch/arm/mach-ebsa110/include/mach/io.h -* Copyright (C) 1997,1998 Russell King -*/ - -#ifndef __ASM_ARM_ARCH_IO_H -#define __ASM_ARM_ARCH_IO_H - -#define IO_SPACE_LIMIT 0xffffffff - -#define __io (a) ((void __iomem *)(0xe0000000 + (a))) - -#endif
arch/arm/mach-shark/pci.c +5 -0
@@ -8,12 +8,15 @@#include <linux/kernel.h> #include <linux/pci.h> #include <linux/init.h> +#include <linux/io.h> #include <video/vga.h> #include <asm/irq.h> #include <asm/mach/pci.h> #include <asm/mach-types.h> +#define IO_START 0x40000000 +static int __init shark_map_irq (const struct pci_dev *dev,u8 slot,u8 pin) {if (dev->bus->number ==0 )
@@ -44,6 +47,8 @@ static int __init shark_pci_init(void) pcibios_min_mem =0x50000000 ; vga_base =0xe8000000 ; +pci_ioremap_io (0 ,IO_START ); +pci_common_init (&shark_pci);return 0 ;
Signature · 1 line
1.7.9.5
PATCH v2 8/15 ARM: footbridge: use fixed PCI i/o mapping
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Move footbridge PCI to fixed i/o mapping. io.h is still needed for the !MMU case.
--- arch/arm/Kconfig | 2 +- arch/arm/mach-footbridge/common.c | 8 ++------ arch/arm/mach-footbridge/dc21285.c | 16 ++++------------ .../arm/mach-footbridge/include/mach/debug-macro.S | 3 ++- arch/arm/mach-footbridge/include/mach/io.h | 12 ++---------- 5 files changed, 11 insertions(+), 30 deletions(-)
arch/arm/Kconfig +1 -1
@@ -431,7 +431,7 @@ config ARCH_FOOTBRIDGE select FOOTBRIDGE select GENERIC_CLOCKEVENTS select HAVE_IDE - select NEED_MACH_IO_H + select NEED_MACH_IO_H if !MMU select NEED_MACH_MEMORY_H help Support for systems based on the DC21285 companion chip
arch/arm/mach-footbridge/common.c +2 -6
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/io.h> #include <linux/spinlock.h> - +#include <asm/pgtable.h> #include <asm/page.h> #include <asm/irq.h>
@@ -26,6 +26,7 @@#include <asm/mach/irq.h> #include <asm/mach/map.h> +#include <asm/mach/pci.h> #include "common.h"
@@ -175,11 +176,6 @@ static struct map_desc ebsa285_host_io_desc[] __initdata = { .pfn = __phys_to_pfn(DC21285_PCI_IACK), .length = PCIIACK_SIZE, .type = MT_DEVICE, - }, { - .virtual = PCIO_BASE, - .pfn = __phys_to_pfn(DC21285_PCI_IO), - .length = PCIO_SIZE, - .type = MT_DEVICE, },#endif };
arch/arm/mach-footbridge/dc21285.c +4 -12
@@ -276,8 +276,8 @@ int __init dc21285_setup(int nr, struct pci_sys_data *sys) sys->mem_offset =DC21285_PCI_MEM ; -pci_add_resource_offset (&sys->resources, - &ioport_resource, sys->io_offset); +pci_ioremap_io (0 ,DC21285_PCI_IO ); +pci_add_resource_offset (&sys->resources, &res[0 ], sys->mem_offset);pci_add_resource_offset (&sys->resources, &res[1 ], sys->mem_offset);
@@ -298,7 +298,7 @@ void __init dc21285_preinit(void) mem_size = (unsigned int )high_memory -PAGE_OFFSET ;for (mem_mask =0x00100000 ; mem_mask <0x10000000 ; mem_mask <<=1 )if (mem_mask >= mem_size) -break ; +break ;/* * These registers need to be set up whether we're the
@@ -350,14 +350,6 @@ void __init dc21285_preinit(void) "PCI data parity", NULL);if (cfn_mode) { -static struct resource csrio; - - csrio.flags =IORESOURCE_IO ; - csrio.name ="Footbridge" ; - -allocate_resource (&ioport_resource, &csrio,128 , -0xff00 ,0xffff ,128 ,NULL ,NULL ); -/* * Map our SDRAM at a known address in PCI space, just in case * the firmware had other ideas. Using a nonzero base is
@@ -365,7 +357,7 @@ void __init dc21285_preinit(void)* in the range 0x000a0000 to 0x000c0000. (eg, S3 cards). */ *CSR_PCICSRBASE =0xf4000000 ; - *CSR_PCICSRIOBASE = csrio.start; + *CSR_PCICSRIOBASE =0 ; *CSR_PCISDRAMBASE =__virt_to_bus (PAGE_OFFSET ); *CSR_PCIROMBASE =0 ; *CSR_PCICMD = PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
arch/arm/mach-footbridge/include/mach/debug-macro.S +2 -1
@@ -17,7 +17,8 @@ /* For NetWinder debugging */ .macro addruart, rp, rv, tmp mov \rp, #0x000003f8 - orr \rv, \rp, #0xff000000 @ virtual + orr \rv, \rp, #0xfe000000 @ virtual + orr \rv, \rv, #0x00e00000 @ virtual orr \rp, \rp, #0x7c000000 @ physical .endm
arch/arm/mach-footbridge/include/mach/io.h +2 -10
@@ -14,18 +14,10 @@#ifndef __ASM_ARM_ARCH_IO_H#define __ASM_ARM_ARCH_IO_H -#ifdef CONFIG_MMU -#define MMU_IO (a, b) (a) -#else -#define MMU_IO (a, b) (b) -#endif - -#define PCIO_SIZE 0x00100000 -#define PCIO_BASE MMU_IO(0xff000000, 0x7c000000) -/* -* Translation of various region addresses to virtual addresses +* Translation of various i/o addresses to host addresses for !CONFIG_MMU */ +#define PCIO_BASE 0x7c000000#define __io (a) ((void __iomem *)(PCIO_BASE + (a)))#endif
Signature · 1 line
1.7.9.5
PATCH v2 9/15 ARM: dove: use fixed PCI i/o mapping
In reply to Rob HerringFrom: Rob Herring <[email protected]>
The i/o regions are changed from 1MB to 64KB. It's likely that the 2nd bus is not setup correctly.
--- arch/arm/Kconfig | 1 - arch/arm/mach-dove/common.c | 10 ---------- arch/arm/mach-dove/include/mach/dove.h | 8 +++----- arch/arm/mach-dove/include/mach/io.h | 19 ------------------- arch/arm/mach-dove/pcie.c | 23 ++++------------------- 5 files changed, 7 insertions(+), 54 deletions(-) delete mode 100644 arch/arm/mach-dove/include/mach/io.h
arch/arm/Kconfig +0 -1
@@ -537,7 +537,6 @@ config ARCH_DOVE select PCI select ARCH_REQUIRE_GPIOLIB select GENERIC_CLOCKEVENTS - select NEED_MACH_IO_H select PLAT_ORION help Support for the Marvell Dove SoC 88AP510
arch/arm/mach-dove/common.c +0 -10
@@ -49,16 +49,6 @@ static struct map_desc dove_io_desc[] __initdata = { .pfn = __phys_to_pfn(DOVE_NB_REGS_PHYS_BASE), .length = DOVE_NB_REGS_SIZE, .type = MT_DEVICE, - }, { - .virtual = DOVE_PCIE0_IO_VIRT_BASE, - .pfn = __phys_to_pfn(DOVE_PCIE0_IO_PHYS_BASE), - .length = DOVE_PCIE0_IO_SIZE, - .type = MT_DEVICE, - }, { - .virtual = DOVE_PCIE1_IO_VIRT_BASE, - .pfn = __phys_to_pfn(DOVE_PCIE1_IO_PHYS_BASE), - .length = DOVE_PCIE1_IO_SIZE, - .type = MT_DEVICE, }, };
arch/arm/mach-dove/include/mach/dove.h +3 -5
@@ -50,14 +50,12 @@#define DOVE_NB_REGS_SIZE SZ_8M#define DOVE_PCIE0_IO_PHYS_BASE 0xf2000000 -#define DOVE_PCIE0_IO_VIRT_BASE 0xfee00000#define DOVE_PCIE0_IO_BUS_BASE 0x00000000 -#define DOVE_PCIE0_IO_SIZE SZ_1M +#define DOVE_PCIE0_IO_SIZE SZ_64K#define DOVE_PCIE1_IO_PHYS_BASE 0xf2100000 -#define DOVE_PCIE1_IO_VIRT_BASE 0xfef00000 -#define DOVE_PCIE1_IO_BUS_BASE 0x00100000 -#define DOVE_PCIE1_IO_SIZE SZ_1M +#define DOVE_PCIE1_IO_BUS_BASE 0x00010000 +#define DOVE_PCIE1_IO_SIZE SZ_64K/* * Dove Core Registers Map
arch/arm/mach-dove/include/mach/io.h deleted +0 -19
@@ -1,19 +0,0 @@ -/* -* arch/arm/mach-dove/include/mach/io.h -* -* This file is licensed under the terms of the GNU General Public -* License version 2. This program is licensed "as is" without any -* warranty of any kind, whether express or implied. -*/ - -#ifndef __ASM_ARCH_IO_H -#define __ASM_ARCH_IO_H - -#include "dove.h" - -#define IO_SPACE_LIMIT 0xffffffff - -#define __io (a) ((void __iomem *)(((a) - DOVE_PCIE0_IO_BUS_BASE) + \ - DOVE_PCIE0_IO_VIRT_BASE)) - -#endif
arch/arm/mach-dove/pcie.c +4 -19
@@ -26,7 +26,6 @@ struct pcie_port {u8 root_bus_nr;void __iomem *base;spinlock_t conf_lock; -char io_space_name[16 ];char mem_space_name[16 ];struct resource res[2 ]; };
@@ -53,24 +52,10 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys)orion_pcie_setup (pp->base); -/* -* IORESOURCE_IO -*/ -snprintf (pp->io_space_name,sizeof (pp->io_space_name), -"PCIe %d I/O" , pp->index); - pp->io_space_name[sizeof (pp->io_space_name) -1 ] =0 ; - pp->res[0 ].name = pp->io_space_name; -if (pp->index ==0 ) { - pp->res[0 ].start =DOVE_PCIE0_IO_PHYS_BASE ; - pp->res[0 ].end = pp->res[0 ].start +DOVE_PCIE0_IO_SIZE -1 ; - }else { - pp->res[0 ].start =DOVE_PCIE1_IO_PHYS_BASE ; - pp->res[0 ].end = pp->res[0 ].start +DOVE_PCIE1_IO_SIZE -1 ; - } - pp->res[0 ].flags =IORESOURCE_IO ; -if (request_resource (&ioport_resource, &pp->res[0 ])) -panic ("Request PCIe IO resource failed\n" ); -pci_add_resource_offset (&sys->resources, &pp->res[0 ], sys->io_offset); +if (pp->index ==0 ) +pci_ioremap_io (sys->busnr *SZ_64K ,DOVE_PCIE0_IO_PHYS_BASE ); +else +pci_ioremap_io (sys->busnr *SZ_64K ,DOVE_PCIE1_IO_PHYS_BASE );/* * IORESOURCE_MEM
Signature · 1 line
1.7.9.5
PATCH v2 10/15 ARM: kirkwood: use fixed PCI i/o mapping
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Move kirkwood PCI to fixed i/o mapping and remove io.h.
--- arch/arm/Kconfig | 1 - arch/arm/mach-kirkwood/common.c | 10 ---------- arch/arm/mach-kirkwood/include/mach/io.h | 24 ------------------------ arch/arm/mach-kirkwood/include/mach/kirkwood.h | 8 +++----- arch/arm/mach-kirkwood/pcie.c | 22 ++-------------------- 5 files changed, 5 insertions(+), 60 deletions(-) delete mode 100644 arch/arm/mach-kirkwood/include/mach/io.h
arch/arm/Kconfig +0 -1
@@ -547,7 +547,6 @@ config ARCH_KIRKWOOD select PCI select ARCH_REQUIRE_GPIOLIB select GENERIC_CLOCKEVENTS - select NEED_MACH_IO_H select PLAT_ORION help Support for the following Marvell Kirkwood series SoCs:
arch/arm/mach-kirkwood/common.c +0 -10
@@ -41,16 +41,6 @@****************************************************************************/ static struct map_desc kirkwood_io_desc[]__initdata = { { - .virtual =KIRKWOOD_PCIE_IO_VIRT_BASE , - .pfn =__phys_to_pfn (KIRKWOOD_PCIE_IO_PHYS_BASE ), - .length =KIRKWOOD_PCIE_IO_SIZE , - .type =MT_DEVICE , - }, { - .virtual =KIRKWOOD_PCIE1_IO_VIRT_BASE , - .pfn =__phys_to_pfn (KIRKWOOD_PCIE1_IO_PHYS_BASE ), - .length =KIRKWOOD_PCIE1_IO_SIZE , - .type =MT_DEVICE , - }, { .virtual =KIRKWOOD_REGS_VIRT_BASE , .pfn =__phys_to_pfn (KIRKWOOD_REGS_PHYS_BASE ), .length =KIRKWOOD_REGS_SIZE ,
arch/arm/mach-kirkwood/include/mach/io.h deleted +0 -24
@@ -1,24 +0,0 @@ -/* -* arch/arm/mach-kirkwood/include/mach/io.h -* -* This file is licensed under the terms of the GNU General Public -* License version 2. This program is licensed "as is" without any -* warranty of any kind, whether express or implied. -*/ - -#ifndef __ASM_ARCH_IO_H -#define __ASM_ARCH_IO_H - -#include "kirkwood.h" - -#define IO_SPACE_LIMIT 0xffffffff - -static inline void __iomem *__io (unsigned long addr) -{ -return (void __iomem *)((addr -KIRKWOOD_PCIE_IO_BUS_BASE ) - +KIRKWOOD_PCIE_IO_VIRT_BASE ); -} - -#define __io (a) __io(a) - -#endif
arch/arm/mach-kirkwood/include/mach/kirkwood.h +3 -5
@@ -37,14 +37,12 @@#define KIRKWOOD_NAND_MEM_SIZE SZ_1K#define KIRKWOOD_PCIE1_IO_PHYS_BASE 0xf3000000 -#define KIRKWOOD_PCIE1_IO_VIRT_BASE 0xfef00000 -#define KIRKWOOD_PCIE1_IO_BUS_BASE 0x00100000 -#define KIRKWOOD_PCIE1_IO_SIZE SZ_1M +#define KIRKWOOD_PCIE1_IO_BUS_BASE 0x00010000 +#define KIRKWOOD_PCIE1_IO_SIZE SZ_64K#define KIRKWOOD_PCIE_IO_PHYS_BASE 0xf2000000 -#define KIRKWOOD_PCIE_IO_VIRT_BASE 0xfee00000#define KIRKWOOD_PCIE_IO_BUS_BASE 0x00000000 -#define KIRKWOOD_PCIE_IO_SIZE SZ_1M +#define KIRKWOOD_PCIE_IO_SIZE SZ_64K#define KIRKWOOD_REGS_PHYS_BASE 0xf1000000#define KIRKWOOD_REGS_VIRT_BASE 0xfed00000
arch/arm/mach-kirkwood/pcie.c +2 -20
@@ -137,14 +137,6 @@ static void __init pcie0_ioresources_init(struct pcie_port *pp) pp->irq =IRQ_KIRKWOOD_PCIE ;/* -* IORESOURCE_IO -*/ - pp->res[0 ].name ="PCIe 0 I/O Space" ; - pp->res[0 ].start =KIRKWOOD_PCIE_IO_BUS_BASE ; - pp->res[0 ].end = pp->res[0 ].start +KIRKWOOD_PCIE_IO_SIZE -1 ; - pp->res[0 ].flags =IORESOURCE_IO ; - -/* * IORESOURCE_MEM */ pp->res[1 ].name ="PCIe 0 MEM" ;
@@ -159,14 +151,6 @@ static void __init pcie1_ioresources_init(struct pcie_port *pp) pp->irq =IRQ_KIRKWOOD_PCIE1 ;/* -* IORESOURCE_IO -*/ - pp->res[0 ].name ="PCIe 1 I/O Space" ; - pp->res[0 ].start =KIRKWOOD_PCIE1_IO_BUS_BASE ; - pp->res[0 ].end = pp->res[0 ].start +KIRKWOOD_PCIE1_IO_SIZE -1 ; - pp->res[0 ].flags =IORESOURCE_IO ; - -/* * IORESOURCE_MEM */ pp->res[1 ].name ="PCIe 1 MEM" ;
@@ -197,22 +181,20 @@ static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys)case 0 :kirkwood_enable_pcie_clk ("0" );pcie0_ioresources_init (pp); +pci_ioremap_io (SZ_64K * sys->busnr,KIRKWOOD_PCIE_IO_PHYS_BASE );break ;case 1 :kirkwood_enable_pcie_clk ("1" );pcie1_ioresources_init (pp); +pci_ioremap_io (SZ_64K * sys->busnr,KIRKWOOD_PCIE1_IO_PHYS_BASE );break ;default :panic ("PCIe setup: invalid controller %d" , index); } -if (request_resource (&ioport_resource, &pp->res[0 ])) -panic ("Request PCIe%d IO resource failed\n" , index);if (request_resource (&iomem_resource, &pp->res[1 ]))panic ("Request PCIe%d Memory resource failed\n" , index); - sys->io_offset =0 ; -pci_add_resource_offset (&sys->resources, &pp->res[0 ], sys->io_offset);pci_add_resource_offset (&sys->resources, &pp->res[1 ], sys->mem_offset);/*
Signature · 1 line
1.7.9.5
Andrew Lunn
maintainerPATCH v2 10/15 ARM: kirkwood: use fixed PCI i/o mapping
Quoted 9 lines · Rob Herring
From: Rob Herring <[email protected]>
Move kirkwood PCI to fixed i/o mapping and remove
io.h.Signed-off-by Rob Herring <[email protected]>Cc Lennert Buytenhek <[email protected]>Acked-by Nicolas Pitre <[email protected]>Cc Jason Cooper <[email protected]>Cc Andrew Lunn <[email protected]>
Hi Rob
I boot tested this, on a board without any PCI devices. At least the PCI controllers were found O.K.
So although its not worth much:
I have one question, see below.
Quoted 113 lines
--- arch/arm/Kconfig | 1 - arch/arm/mach-kirkwood/common.c | 10 ---------- arch/arm/mach-kirkwood/include/mach/io.h | 24 ------------------------ arch/arm/mach-kirkwood/include/mach/kirkwood.h | 8 +++----- arch/arm/mach-kirkwood/pcie.c | 22 ++-------------------- 5 files changed, 5 insertions(+), 60 deletions(-) delete mode 100644 arch/arm/mach-kirkwood/include/mach/io.harch/arm/Kconfig +0
-1@@ -547,7 +547,6 @@ config ARCH_KIRKWOOD select PCI select ARCH_REQUIRE_GPIOLIB select GENERIC_CLOCKEVENTS - select NEED_MACH_IO_H select PLAT_ORION help Support for the following Marvell Kirkwood series SoCs:arch/arm/mach-kirkwood/common.c +0
-10@@ -41,16 +41,6 @@****************************************************************************/ static struct map_desc kirkwood_io_desc[]__initdata = { { - .virtual =KIRKWOOD_PCIE_IO_VIRT_BASE , - .pfn =__phys_to_pfn (KIRKWOOD_PCIE_IO_PHYS_BASE ), - .length =KIRKWOOD_PCIE_IO_SIZE , - .type =MT_DEVICE , - }, { - .virtual =KIRKWOOD_PCIE1_IO_VIRT_BASE , - .pfn =__phys_to_pfn (KIRKWOOD_PCIE1_IO_PHYS_BASE ), - .length =KIRKWOOD_PCIE1_IO_SIZE , - .type =MT_DEVICE , - }, { .virtual =KIRKWOOD_REGS_VIRT_BASE , .pfn =__phys_to_pfn (KIRKWOOD_REGS_PHYS_BASE ), .length =KIRKWOOD_REGS_SIZE ,arch/arm/mach-kirkwood/include/mach/io.h deleted +0
-24@@ -1,24 +0,0 @@ -/* -* arch/arm/mach-kirkwood/include/mach/io.h -* -* This file is licensed under the terms of the GNU General Public -* License version 2. This program is licensed "as is" without any -* warranty of any kind, whether express or implied. -*/ - -#ifndef __ASM_ARCH_IO_H -#define __ASM_ARCH_IO_H - -#include "kirkwood.h" - -#define IO_SPACE_LIMIT 0xffffffff - -static inline void __iomem *__io (unsigned long addr) -{ -return (void __iomem *)((addr -KIRKWOOD_PCIE_IO_BUS_BASE ) - +KIRKWOOD_PCIE_IO_VIRT_BASE ); -} - -#define __io (a) __io(a) - -#endif arch/arm/mach-kirkwood/include/mach/kirkwood.h +3
-5@@ -37,14 +37,12 @@#define KIRKWOOD_NAND_MEM_SIZE SZ_1K#define KIRKWOOD_PCIE1_IO_PHYS_BASE 0xf3000000 -#define KIRKWOOD_PCIE1_IO_VIRT_BASE 0xfef00000 -#define KIRKWOOD_PCIE1_IO_BUS_BASE 0x00100000 -#define KIRKWOOD_PCIE1_IO_SIZE SZ_1M +#define KIRKWOOD_PCIE1_IO_BUS_BASE 0x00010000 +#define KIRKWOOD_PCIE1_IO_SIZE SZ_64K#define KIRKWOOD_PCIE_IO_PHYS_BASE 0xf2000000 -#define KIRKWOOD_PCIE_IO_VIRT_BASE 0xfee00000#define KIRKWOOD_PCIE_IO_BUS_BASE 0x00000000 -#define KIRKWOOD_PCIE_IO_SIZE SZ_1M +#define KIRKWOOD_PCIE_IO_SIZE SZ_64K#define KIRKWOOD_REGS_PHYS_BASE 0xf1000000#define KIRKWOOD_REGS_VIRT_BASE 0xfed00000arch/arm/mach-kirkwood/pcie.c +0
-8@@ -137,14 +137,6 @@ static void __init pcie0_ioresources_init(struct pcie_port *pp) pp->irq =IRQ_KIRKWOOD_PCIE ;/* -* IORESOURCE_IO -*/ - pp->res[0 ].name ="PCIe 0 I/O Space" ; - pp->res[0 ].start =KIRKWOOD_PCIE_IO_BUS_BASE ; - pp->res[0 ].end = pp->res[0 ].start +KIRKWOOD_PCIE_IO_SIZE -1 ; - pp->res[0 ].flags =IORESOURCE_IO ; - -/* * IORESOURCE_MEM */ pp->res[1 ].name ="PCIe 0 MEM" ;
...
arch/arm/mach-kirkwood/pcie.c static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys) · line 198
Quoted 6 lines
arch/arm/mach-kirkwood/pcie.c +0
-2if (request_resource (&iomem_resource, &pp->res[1 ]))panic ("Request PCIe%d Memory resource failed\n" , index); - sys->io_offset =0 ; -pci_add_resource_offset (&sys->resources, &pp->res[0 ], sys->io_offset);pci_add_resource_offset (&sys->resources, &pp->res[1 ], sys->mem_offset);
pp->res[0] is now unused. Do you plan to also clean up the PCI MEM space at some point? And then at the same time remove the rest of this code?
Thanks
Andrew
PATCH v2 10/15 ARM: kirkwood: use fixed PCI i/o mapping
Quoted 2 lines · Andrew Lunn
Quoted 1 line · Rob Herring
From: Rob Herring <[email protected]>
...
Quoted 7 lines
Quoted 1 line
pp->res[1].name = "PCIe 0 MEM";
...
Quoted 3 lines
arch/arm/mach-kirkwood/pcie.c +0
-0if (request_resource (&iomem_resource, &pp->res[1 ]))panic ("Request PCIe%d Memory resource failed\n" , index);
Quoted 7 lines
arch/arm/mach-kirkwood/pcie.c static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys) · line 198
Quoted 3 lines
arch/arm/mach-kirkwood/pcie.c +0
-2- sys->io_offset =0 ; -pci_add_resource_offset (&sys->resources, &pp->res[0 ], sys->io_offset);pci_add_resource_offset (&sys->resources, &pp->res[1 ], sys->mem_offset);pp->res[0] is now unused. Do you plan to also clean up the PCI MEM space at some point? And then at the same time remove the rest of this code?
I think we should follow what Tegra is doing and convert PCI hosts to platform drivers (see DT support for Tegra PCI). Then this resource would be one of the device resources. A simpler change would be moving this resource into pci_sys_data struct. I may do the latter, but don't plan to do the former.
I should go back and change this to a single resource though.
Rob
Quoted 4 lines
Thanks
Andrew
PATCH v2 10/15 ARM: kirkwood: use fixed PCI i/o mapping
In reply to Andrew LunnQuoted 10 lines · Andrew Lunn
arch/arm/mach-kirkwood/pcie.c static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys) · line 198
Quoted 6 lines
if (request_resource(&iomem_resource, &pp->res[1])) panic("Request PCIe%d Memory resource failed\n", index);arch/arm/mach-kirkwood/pcie.c +0
-2- sys->io_offset =0 ; -pci_add_resource_offset (&sys->resources, &pp->res[0 ], sys->io_offset);pci_add_resource_offset (&sys->resources, &pp->res[1 ], sys->mem_offset);pp->res[0] is now unused. Do you plan to also clean up the PCI MEM space at some point? And then at the same time remove the rest of this code?
I think we still want the pci host drivers to register the resources for the memory space. One thing is that they are not ioremapped at init time, and also they typically have a nonzero offset.
Arnd
PATCH v2 11/15 ARM: orion5x: use fixed PCI i/o mapping
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Move orion5x PCI to fixed i/o mapping and remove io.h.
--- arch/arm/Kconfig | 1 - arch/arm/mach-orion5x/common.c | 10 ----- arch/arm/mach-orion5x/include/mach/io.h | 22 ---------- arch/arm/mach-orion5x/include/mach/orion5x.h | 20 +++++---- arch/arm/mach-orion5x/pci.c | 56 +++++++++----------------- 5 files changed, 27 insertions(+), 82 deletions(-) delete mode 100644 arch/arm/mach-orion5x/include/mach/io.h
arch/arm/Kconfig +0 -1
@@ -585,7 +585,6 @@ config ARCH_ORION5X select PCI select ARCH_REQUIRE_GPIOLIB select GENERIC_CLOCKEVENTS - select NEED_MACH_IO_H select PLAT_ORION help Support for the following Marvell Orion 5x series SoCs:
arch/arm/mach-orion5x/common.c +0 -10
@@ -47,16 +47,6 @@ static struct map_desc orion5x_io_desc[] __initdata = { .length = ORION5X_REGS_SIZE, .type = MT_DEVICE, }, { - .virtual = ORION5X_PCIE_IO_VIRT_BASE, - .pfn = __phys_to_pfn(ORION5X_PCIE_IO_PHYS_BASE), - .length = ORION5X_PCIE_IO_SIZE, - .type = MT_DEVICE, - }, { - .virtual = ORION5X_PCI_IO_VIRT_BASE, - .pfn = __phys_to_pfn(ORION5X_PCI_IO_PHYS_BASE), - .length = ORION5X_PCI_IO_SIZE, - .type = MT_DEVICE, - }, { .virtual = ORION5X_PCIE_WA_VIRT_BASE, .pfn = __phys_to_pfn(ORION5X_PCIE_WA_PHYS_BASE), .length = ORION5X_PCIE_WA_SIZE,
arch/arm/mach-orion5x/include/mach/io.h deleted +0 -22
@@ -1,22 +0,0 @@ -/* -* arch/arm/mach-orion5x/include/mach/io.h -* -* This file is licensed under the terms of the GNU General Public -* License version 2. This program is licensed "as is" without any -* warranty of any kind, whether express or implied. -*/ - -#ifndef __ASM_ARCH_IO_H -#define __ASM_ARCH_IO_H - -#include <mach/orion5x.h> -#include <asm/sizes.h> - -#define IO_SPACE_LIMIT SZ_2M -static inline void __iomem *__io (unsigned long addr) -{ -return (void __iomem *)(addr +ORION5X_PCIE_IO_VIRT_BASE ); -} - -#define __io (a) __io(a) -#endif
arch/arm/mach-orion5x/include/mach/orion5x.h +9 -11
@@ -31,31 +31,29 @@* fc000000 device bus mappings (cs0/cs1) * * virt phys size -* fdd00000 f1000000 1M on-chip peripheral registers -* fde00000 f2000000 1M PCIe I/O space -* fdf00000 f2100000 1M PCI I/O space -* fe000000 f0000000 16M PCIe WA space (Orion-1/Orion-NAS only) +* fe000000 f1000000 1M on-chip peripheral registers +* fee00000 f2000000 64K PCIe I/O space +* fee10000 f2100000 64K PCI I/O space +* fd000000 f0000000 16M PCIe WA space (Orion-1/Orion-NAS only) ****************************************************************************/ #define ORION5X_REGS_PHYS_BASE 0xf1000000 -#define ORION5X_REGS_VIRT_BASE 0xfdd00000 +#define ORION5X_REGS_VIRT_BASE 0xfe000000#define ORION5X_REGS_SIZE SZ_1M#define ORION5X_PCIE_IO_PHYS_BASE 0xf2000000 -#define ORION5X_PCIE_IO_VIRT_BASE 0xfde00000#define ORION5X_PCIE_IO_BUS_BASE 0x00000000 -#define ORION5X_PCIE_IO_SIZE SZ_1M +#define ORION5X_PCIE_IO_SIZE SZ_64K#define ORION5X_PCI_IO_PHYS_BASE 0xf2100000 -#define ORION5X_PCI_IO_VIRT_BASE 0xfdf00000 -#define ORION5X_PCI_IO_BUS_BASE 0x00100000 -#define ORION5X_PCI_IO_SIZE SZ_1M +#define ORION5X_PCI_IO_BUS_BASE 0x00010000 +#define ORION5X_PCI_IO_SIZE SZ_64K#define ORION5X_SRAM_PHYS_BASE (0xf2200000)#define ORION5X_SRAM_SIZE SZ_8K/* Relevant only for Orion-1/Orion-NAS */ #define ORION5X_PCIE_WA_PHYS_BASE 0xf0000000 -#define ORION5X_PCIE_WA_VIRT_BASE 0xfe000000 +#define ORION5X_PCIE_WA_VIRT_BASE 0xfd000000#define ORION5X_PCIE_WA_SIZE SZ_16M#define ORION5X_PCIE_MEM_PHYS_BASE 0xe0000000
arch/arm/mach-orion5x/pci.c +18 -38
88 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 12/15 iop13xx: use more regular PCI I/O space handling
In reply to Rob HerringFrom: Arnd Bergmann <[email protected]>
iop13xx confuses I/O port numbers with physical addresses, which breaks legacy ISA I/O access behind PCI bridges and makes it unnecessarily hard to unify the inb/outb accessors with other platforms. This removes the special-casing and just puts all I/O ports into a single 128KB virtually mapped I/O port range starting at port zero.
--- arch/arm/mach-iop13xx/include/mach/io.h | 6 +++--- arch/arm/mach-iop13xx/include/mach/iop13xx.h | 12 +++--------- arch/arm/mach-iop13xx/io.c | 27 -------------------------- arch/arm/mach-iop13xx/pci.c | 12 ++++++------ 4 files changed, 12 insertions(+), 45 deletions(-)
arch/arm/mach-iop13xx/include/mach/io.h +3 -3
@@ -19,10 +19,10 @@#ifndef __ASM_ARM_ARCH_IO_H#define __ASM_ARM_ARCH_IO_H -#define IO_SPACE_LIMIT 0xffffffff +#include <mach/iop13xx.h> -#define __io (a) __iop13xx_io(a) +#define IO_SPACE_LIMIT (IOP13XX_PCIE_IO_WINDOW_SIZE + IOP13XX_PCIX_IO_WINDOW_SIZE - 1) -extern void __iomem *__iop13xx_io (unsigned long io_addr); +#define __io (a) (IOP13XX_PCIX_LOWER_IO_VA + ((a) & IO_SPACE_LIMIT))#endif
arch/arm/mach-iop13xx/include/mach/iop13xx.h +3 -9
@@ -69,17 +69,15 @@ extern unsigned long get_iop_tick_rate(void);* 0x8000.0000 + 928M 0x2.8000.0000 (ioremap) PCIE outbound memory window * * IO MAP -* 0x1000 + 64K 0x0.fffb.1000 0xfec6.1000 PCIX outbound i/o window +* 0x1000 + 64K 0x0.fffb.1000 0xfed6.1000 PCIX outbound i/o window * 0x1000 + 64K 0x0.fffd.1000 0xfed7.1000 PCIE outbound i/o window */ #define IOP13XX_PCIX_IO_WINDOW_SIZE 0x10000UL#define IOP13XX_PCIX_LOWER_IO_PA 0xfffb0000UL -#define IOP13XX_PCIX_LOWER_IO_VA 0xfec60000UL +#define IOP13XX_PCIX_LOWER_IO_VA 0xfed60000UL#define IOP13XX_PCIX_LOWER_IO_BA 0x0UL/* OIOTVR */ #define IOP13XX_PCIX_IO_BUS_OFFSET 0x1000UL -#define IOP13XX_PCIX_UPPER_IO_PA (IOP13XX_PCIX_LOWER_IO_PA +\ - IOP13XX_PCIX_IO_WINDOW_SIZE - 1) -#define IOP13XX_PCIX_UPPER_IO_VA (IOP13XX_PCIX_LOWER_IO_VA +\ +#define IOP13XX_PCIX_UPPER_IO_BA (IOP13XX_PCIX_LOWER_IO_BA +\ IOP13XX_PCIX_IO_WINDOW_SIZE - 1)#define IOP13XX_PCIX_IO_PHYS_TO_VIRT (addr) (u32) ((u32) addr -\ (IOP13XX_PCIX_LOWER_IO_PA\
@@ -108,10 +106,6 @@ extern unsigned long get_iop_tick_rate(void);#define IOP13XX_PCIE_LOWER_IO_VA 0xfed70000UL#define IOP13XX_PCIE_LOWER_IO_BA 0x0UL/* OIOTVR */ #define IOP13XX_PCIE_IO_BUS_OFFSET 0x1000UL -#define IOP13XX_PCIE_UPPER_IO_PA (IOP13XX_PCIE_LOWER_IO_PA +\ - IOP13XX_PCIE_IO_WINDOW_SIZE - 1) -#define IOP13XX_PCIE_UPPER_IO_VA (IOP13XX_PCIE_LOWER_IO_VA +\ - IOP13XX_PCIE_IO_WINDOW_SIZE - 1)#define IOP13XX_PCIE_UPPER_IO_BA (IOP13XX_PCIE_LOWER_IO_BA +\ IOP13XX_PCIE_IO_WINDOW_SIZE - 1)#define IOP13XX_PCIE_IO_PHYS_TO_VIRT (addr) (u32) ((u32) addr -\
arch/arm/mach-iop13xx/io.c +0 -27
@@ -23,25 +23,6 @@#include "pci.h" -void *__iomem __iop13xx_io (unsigned long io_addr) -{ -void __iomem * io_virt; - -switch (io_addr) { - case IOP13XX_PCIE_LOWER_IO_PA ... IOP13XX_PCIE_UPPER_IO_PA: - io_virt = (void *)IOP13XX_PCIE_IO_PHYS_TO_VIRT (io_addr); -break ; - case IOP13XX_PCIX_LOWER_IO_PA ... IOP13XX_PCIX_UPPER_IO_PA: - io_virt = (void *)IOP13XX_PCIX_IO_PHYS_TO_VIRT (io_addr); -break ; -default : -BUG (); - } - -return io_virt; -} -EXPORT_SYMBOL (__iop13xx_io); -static void __iomem *__iop13xx_ioremap_caller (unsigned long cookie,size_t size,unsigned int mtype,void *caller) {
@@ -67,12 +48,6 @@ static void __iomem *__iop13xx_ioremap_caller(unsigned long cookie, (cookie -IOP13XX_PBI_LOWER_MEM_RA ), size, mtype, __builtin_return_address(0));break ; - case IOP13XX_PCIE_LOWER_IO_PA ... IOP13XX_PCIE_UPPER_IO_PA: - retval = (void *)IOP13XX_PCIE_IO_PHYS_TO_VIRT (cookie); -break ; - case IOP13XX_PCIX_LOWER_IO_PA ... IOP13XX_PCIX_UPPER_IO_PA: - retval = (void *)IOP13XX_PCIX_IO_PHYS_TO_VIRT (cookie); -break ; case IOP13XX_PMMR_PHYS_MEM_BASE ... IOP13XX_PMMR_UPPER_MEM_PA: retval = (void *)IOP13XX_PMMR_PHYS_TO_VIRT (cookie);break ;
@@ -99,8 +74,6 @@ static void __iop13xx_iounmap(volatile void __iomem *addr) goto skip;switch ((u32 ) addr) { - case IOP13XX_PCIE_LOWER_IO_VA ... IOP13XX_PCIE_UPPER_IO_VA: - case IOP13XX_PCIX_LOWER_IO_VA ... IOP13XX_PCIX_UPPER_IO_VA: case IOP13XX_PMMR_VIRT_MEM_BASE ... IOP13XX_PMMR_UPPER_MEM_VA: goto skip; }
arch/arm/mach-iop13xx/pci.c +6 -6
@@ -1042,8 +1042,8 @@ int iop13xx_pci_setup(int nr, struct pci_sys_data *sys) << IOP13XX_ATUX_PCIXSR_FUNC_NUM;__raw_writel (pcixsr,IOP13XX_ATUX_PCIXSR ); - res[0 ].start =IOP13XX_PCIX_LOWER_IO_PA +IOP13XX_PCIX_IO_BUS_OFFSET ; - res[0 ].end =IOP13XX_PCIX_UPPER_IO_PA ; + res[0 ].start =IOP13XX_PCIX_LOWER_IO_BA +IOP13XX_PCIX_IO_BUS_OFFSET ; + res[0 ].end =IOP13XX_PCIX_UPPER_IO_BA ; res[0 ].name ="IQ81340 ATUX PCI I/O Space" ; res[0 ].flags =IORESOURCE_IO ;
@@ -1052,7 +1052,7 @@ int iop13xx_pci_setup(int nr, struct pci_sys_data *sys) res[1 ].name ="IQ81340 ATUX PCI Memory Space" ; res[1 ].flags =IORESOURCE_MEM ; sys->mem_offset =IOP13XX_PCIX_MEM_OFFSET ; - sys->io_offset =IOP13XX_PCIX_LOWER_IO_PA ; + sys->io_offset =IOP13XX_PCIX_LOWER_IO_BA ;break ;case IOP13XX_INIT_ATU_ATUE :/* Note: the function number field in the PCSR is ro */
@@ -1063,8 +1063,8 @@ int iop13xx_pci_setup(int nr, struct pci_sys_data *sys)__raw_writel (pcsr,IOP13XX_ATUE_PCSR ); - res[0 ].start =IOP13XX_PCIE_LOWER_IO_PA +IOP13XX_PCIE_IO_BUS_OFFSET ; - res[0 ].end =IOP13XX_PCIE_UPPER_IO_PA ; + res[0 ].start =IOP13XX_PCIE_LOWER_IO_BA +IOP13XX_PCIE_IO_BUS_OFFSET ; + res[0 ].end =IOP13XX_PCIE_UPPER_IO_BA ; res[0 ].name ="IQ81340 ATUE PCI I/O Space" ; res[0 ].flags =IORESOURCE_IO ;
@@ -1073,7 +1073,7 @@ int iop13xx_pci_setup(int nr, struct pci_sys_data *sys) res[1 ].name ="IQ81340 ATUE PCI Memory Space" ; res[1 ].flags =IORESOURCE_MEM ; sys->mem_offset =IOP13XX_PCIE_MEM_OFFSET ; - sys->io_offset =IOP13XX_PCIE_LOWER_IO_PA ; + sys->io_offset =IOP13XX_PCIE_LOWER_IO_BA ; sys->map_irq = iop13xx_pcie_map_irq;break ;default :
Signature · 1 line
1.7.9.5
PATCH v2 13/15 ARM: iop13xx: use fixed PCI i/o mapping
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Move iop13xx PCI to fixed i/o mapping and remove io.h.
--- arch/arm/Kconfig | 1 - arch/arm/mach-iop13xx/include/mach/io.h | 28 ------------------- arch/arm/mach-iop13xx/include/mach/iop13xx.h | 21 +++------------ arch/arm/mach-iop13xx/pci.c | 37 +++++++++----------------- arch/arm/mach-iop13xx/setup.c | 10 ------- 5 files changed, 16 insertions(+), 81 deletions(-) delete mode 100644 arch/arm/mach-iop13xx/include/mach/io.h
arch/arm/Kconfig +0 -1
@@ -486,7 +486,6 @@ config ARCH_IOP13XX select PCI select ARCH_SUPPORTS_MSI select VMSPLIT_1G - select NEED_MACH_IO_H select NEED_MACH_MEMORY_H select NEED_RET_TO_USER help
arch/arm/mach-iop13xx/include/mach/io.h deleted +0 -28
@@ -1,28 +0,0 @@ -/* -* iop13xx custom ioremap implementation -* Copyright (c) 2005-2006, Intel Corporation. -* -* This program is free software; you can redistribute it and/or modify it -* under the terms and conditions of the GNU General Public License, -* version 2, as published by the Free Software Foundation. -* -* This program is distributed in the hope it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., 59 Temple -* Place - Suite 330, Boston, MA 02111-1307 USA. -* -*/ -#ifndef __ASM_ARM_ARCH_IO_H -#define __ASM_ARM_ARCH_IO_H - -#include <mach/iop13xx.h> - -#define IO_SPACE_LIMIT (IOP13XX_PCIE_IO_WINDOW_SIZE + IOP13XX_PCIX_IO_WINDOW_SIZE - 1) - -#define __io (a) (IOP13XX_PCIX_LOWER_IO_VA + ((a) & IO_SPACE_LIMIT)) - -#endif
arch/arm/mach-iop13xx/include/mach/iop13xx.h +3 -18
@@ -69,19 +69,11 @@ extern unsigned long get_iop_tick_rate(void);* 0x8000.0000 + 928M 0x2.8000.0000 (ioremap) PCIE outbound memory window * * IO MAP -* 0x1000 + 64K 0x0.fffb.1000 0xfed6.1000 PCIX outbound i/o window -* 0x1000 + 64K 0x0.fffd.1000 0xfed7.1000 PCIE outbound i/o window +* 0x00000 + 64K 0x0.fffb.0000 0xfee0.0000 PCIX outbound i/o window +* 0x10000 + 64K 0x0.fffd.0000 0xfee1.0000 PCIE outbound i/o window */ -#define IOP13XX_PCIX_IO_WINDOW_SIZE 0x10000UL#define IOP13XX_PCIX_LOWER_IO_PA 0xfffb0000UL -#define IOP13XX_PCIX_LOWER_IO_VA 0xfed60000UL#define IOP13XX_PCIX_LOWER_IO_BA 0x0UL/* OIOTVR */ -#define IOP13XX_PCIX_IO_BUS_OFFSET 0x1000UL -#define IOP13XX_PCIX_UPPER_IO_BA (IOP13XX_PCIX_LOWER_IO_BA +\ - IOP13XX_PCIX_IO_WINDOW_SIZE - 1) -#define IOP13XX_PCIX_IO_PHYS_TO_VIRT (addr) (u32) ((u32) addr -\ - (IOP13XX_PCIX_LOWER_IO_PA\ - - IOP13XX_PCIX_LOWER_IO_VA))#define IOP13XX_PCIX_MEM_PHYS_OFFSET 0x100000000ULL#define IOP13XX_PCIX_MEM_WINDOW_SIZE 0x3a000000UL
@@ -101,16 +93,9 @@ extern unsigned long get_iop_tick_rate(void); IOP13XX_PCIX_LOWER_MEM_BA)/* PCI-E ranges */ -#define IOP13XX_PCIE_IO_WINDOW_SIZE 0x10000UL#define IOP13XX_PCIE_LOWER_IO_PA 0xfffd0000UL -#define IOP13XX_PCIE_LOWER_IO_VA 0xfed70000UL#define IOP13XX_PCIE_LOWER_IO_BA 0x0UL/* OIOTVR */ -#define IOP13XX_PCIE_IO_BUS_OFFSET 0x1000UL -#define IOP13XX_PCIE_UPPER_IO_BA (IOP13XX_PCIE_LOWER_IO_BA +\ - IOP13XX_PCIE_IO_WINDOW_SIZE - 1) -#define IOP13XX_PCIE_IO_PHYS_TO_VIRT (addr) (u32) ((u32) addr -\ - (IOP13XX_PCIE_LOWER_IO_PA\ - - IOP13XX_PCIE_LOWER_IO_VA)) +#define IOP13XX_PCIE_LOWER_IO_BA 0x10000UL#define IOP13XX_PCIE_MEM_PHYS_OFFSET 0x200000000ULL#define IOP13XX_PCIE_MEM_WINDOW_SIZE 0x3a000000UL
arch/arm/mach-iop13xx/pci.c +13 -24
@@ -970,7 +970,6 @@ void __init iop13xx_pci_init(void)__raw_writel (__raw_readl (IOP13XX_XBG_BECSR ) &3 ,IOP13XX_XBG_BECSR );/* Setup the Min Address for PCI memory... */ - pcibios_min_io =0 ; pcibios_min_mem =IOP13XX_PCIX_LOWER_MEM_BA ;/* if Linux is given control of an ATU
@@ -1003,7 +1002,7 @@ int iop13xx_pci_setup(int nr, struct pci_sys_data *sys)if (nr >1 )return 0 ; - res =kcalloc (2 ,sizeof (struct resource ),GFP_KERNEL ); + res =kzalloc (sizeof (struct resource ),GFP_KERNEL );if (!res)panic ("PCI: unable to alloc resources" );
@@ -1042,17 +1041,13 @@ int iop13xx_pci_setup(int nr, struct pci_sys_data *sys) << IOP13XX_ATUX_PCIXSR_FUNC_NUM;__raw_writel (pcixsr,IOP13XX_ATUX_PCIXSR ); - res[0 ].start =IOP13XX_PCIX_LOWER_IO_BA +IOP13XX_PCIX_IO_BUS_OFFSET ; - res[0 ].end =IOP13XX_PCIX_UPPER_IO_BA ; - res[0 ].name ="IQ81340 ATUX PCI I/O Space" ; - res[0 ].flags =IORESOURCE_IO ; +pci_ioremap_io (0 ,IOP13XX_PCIX_LOWER_IO_PA ); - res[1 ].start =IOP13XX_PCIX_LOWER_MEM_RA ; - res[1 ].end =IOP13XX_PCIX_UPPER_MEM_RA ; - res[1 ].name ="IQ81340 ATUX PCI Memory Space" ; - res[1 ].flags =IORESOURCE_MEM ; + res->start =IOP13XX_PCIX_LOWER_MEM_RA ; + res->end =IOP13XX_PCIX_UPPER_MEM_RA ; + res->name ="IQ81340 ATUX PCI Memory Space" ; + res->flags =IORESOURCE_MEM ; sys->mem_offset =IOP13XX_PCIX_MEM_OFFSET ; - sys->io_offset =IOP13XX_PCIX_LOWER_IO_BA ;break ;case IOP13XX_INIT_ATU_ATUE :/* Note: the function number field in the PCSR is ro */
@@ -1063,17 +1058,13 @@ int iop13xx_pci_setup(int nr, struct pci_sys_data *sys)__raw_writel (pcsr,IOP13XX_ATUE_PCSR ); - res[0 ].start =IOP13XX_PCIE_LOWER_IO_BA +IOP13XX_PCIE_IO_BUS_OFFSET ; - res[0 ].end =IOP13XX_PCIE_UPPER_IO_BA ; - res[0 ].name ="IQ81340 ATUE PCI I/O Space" ; - res[0 ].flags =IORESOURCE_IO ; +pci_ioremap_io (IOP13XX_PCIE_LOWER_IO_BA ,IOP13XX_PCIE_LOWER_IO_PA ); - res[1 ].start =IOP13XX_PCIE_LOWER_MEM_RA ; - res[1 ].end =IOP13XX_PCIE_UPPER_MEM_RA ; - res[1 ].name ="IQ81340 ATUE PCI Memory Space" ; - res[1 ].flags =IORESOURCE_MEM ; + res->start =IOP13XX_PCIE_LOWER_MEM_RA ; + res->end =IOP13XX_PCIE_UPPER_MEM_RA ; + res->name ="IQ81340 ATUE PCI Memory Space" ; + res->flags =IORESOURCE_MEM ; sys->mem_offset =IOP13XX_PCIE_MEM_OFFSET ; - sys->io_offset =IOP13XX_PCIE_LOWER_IO_BA ; sys->map_irq = iop13xx_pcie_map_irq;break ;default :
@@ -1081,11 +1072,9 @@ int iop13xx_pci_setup(int nr, struct pci_sys_data *sys)return 0 ; } -request_resource (&ioport_resource, &res[0 ]); -request_resource (&iomem_resource, &res[1 ]); +request_resource (&iomem_resource, res); -pci_add_resource_offset (&sys->resources, &res[0 ], sys->io_offset); -pci_add_resource_offset (&sys->resources, &res[1 ], sys->mem_offset); +pci_add_resource_offset (&sys->resources, res, sys->mem_offset);return 1 ; }
arch/arm/mach-iop13xx/setup.c +0 -10
@@ -40,16 +40,6 @@ static struct map_desc iop13xx_std_desc[] __initdata = { .pfn = __phys_to_pfn(IOP13XX_PMMR_PHYS_MEM_BASE), .length = IOP13XX_PMMR_SIZE, .type = MT_DEVICE, - }, { /* PCIE IO space */ - .virtual = IOP13XX_PCIE_LOWER_IO_VA, - .pfn = __phys_to_pfn(IOP13XX_PCIE_LOWER_IO_PA), - .length = IOP13XX_PCIX_IO_WINDOW_SIZE, - .type = MT_DEVICE, - }, { /* PCIX IO space */ - .virtual = IOP13XX_PCIX_LOWER_IO_VA, - .pfn = __phys_to_pfn(IOP13XX_PCIX_LOWER_IO_PA), - .length = IOP13XX_PCIX_IO_WINDOW_SIZE, - .type = MT_DEVICE, }, };
Signature · 1 line
1.7.9.5
PATCH v2 14/15 ARM: mv78xx0: use fixed pci i/o mapping
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Move mv78xx0 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.
--- arch/arm/Kconfig | 1 - arch/arm/mach-mv78xx0/addr-map.c | 3 +- arch/arm/mach-mv78xx0/common.c | 5 -- arch/arm/mach-mv78xx0/include/mach/io.h | 24 ------ arch/arm/mach-mv78xx0/include/mach/mv78xx0.h | 21 +++-- arch/arm/mach-mv78xx0/pcie.c | 110 ++++++++------------------ 6 files changed, 45 insertions(+), 119 deletions(-) delete mode 100644 arch/arm/mach-mv78xx0/include/mach/io.h
arch/arm/Kconfig +0 -1
@@ -571,7 +571,6 @@ config ARCH_MV78XX0 select PCI select ARCH_REQUIRE_GPIOLIB select GENERIC_CLOCKEVENTS - select NEED_MACH_IO_H select PLAT_ORION help Support for the following Marvell MV78xx0 series SoCs:
arch/arm/mach-mv78xx0/addr-map.c +2 -1
@@ -13,6 +13,7 @@#include <linux/mbus.h> #include <linux/io.h> #include <plat/addr-map.h> +#include <mach/mv78xx0.h> #include "common.h" /*
@@ -81,7 +82,7 @@ void __init mv78xx0_setup_pcie_io_win(int window, u32 base, u32 size, int maj, int min) {orion_setup_cpu_win (&addr_map_cfg, window, base, size, -TARGET_PCIE (maj),ATTR_PCIE_IO (min),-1 ); +TARGET_PCIE (maj),ATTR_PCIE_IO (min),0 ); } void __init mv78xx0_setup_pcie_mem_win(int window, u32 base, u32 size,
arch/arm/mach-mv78xx0/common.c +0 -5
@@ -135,11 +135,6 @@ static struct map_desc mv78xx0_io_desc[] __initdata = { .length = MV78XX0_CORE_REGS_SIZE, .type = MT_DEVICE, }, { - .virtual = MV78XX0_PCIE_IO_VIRT_BASE(0), - .pfn = __phys_to_pfn(MV78XX0_PCIE_IO_PHYS_BASE(0)), - .length = MV78XX0_PCIE_IO_SIZE * 8, - .type = MT_DEVICE, - }, { .virtual = MV78XX0_REGS_VIRT_BASE, .pfn = __phys_to_pfn(MV78XX0_REGS_PHYS_BASE), .length = MV78XX0_REGS_SIZE,
arch/arm/mach-mv78xx0/include/mach/io.h deleted +0 -24
@@ -1,24 +0,0 @@ -/* -* arch/arm/mach-mv78xx0/include/mach/io.h -* -* This file is licensed under the terms of the GNU General Public -* License version 2. This program is licensed "as is" without any -* warranty of any kind, whether express or implied. -*/ - -#ifndef __ASM_ARCH_IO_H -#define __ASM_ARCH_IO_H - -#include "mv78xx0.h" - -#define IO_SPACE_LIMIT 0xffffffff - -static inline void __iomem *__io (unsigned long addr) -{ -return (void __iomem *)((addr -MV78XX0_PCIE_IO_PHYS_BASE (0 )) - +MV78XX0_PCIE_IO_VIRT_BASE (0 )); -} - -#define __io (a) __io(a) - -#endif
arch/arm/mach-mv78xx0/include/mach/mv78xx0.h +10 -11
@@ -29,15 +29,15 @@* * virt phys size * fe400000 f102x000 16K core-specific peripheral registers -* fe700000 f0800000 1M PCIe #0 I/O space -* fe800000 f0900000 1M PCIe #1 I/O space -* fe900000 f0a00000 1M PCIe #2 I/O space -* fea00000 f0b00000 1M PCIe #3 I/O space -* feb00000 f0c00000 1M PCIe #4 I/O space -* fec00000 f0d00000 1M PCIe #5 I/O space -* fed00000 f0e00000 1M PCIe #6 I/O space -* fee00000 f0f00000 1M PCIe #7 I/O space -* fef00000 f1000000 1M on-chip peripheral registers +* fee00000 f0800000 64K PCIe #0 I/O space +* fee10000 f0900000 64K PCIe #1 I/O space +* fee20000 f0a00000 64K PCIe #2 I/O space +* fee30000 f0b00000 64K PCIe #3 I/O space +* fee40000 f0c00000 64K PCIe #4 I/O space +* fee50000 f0d00000 64K PCIe #5 I/O space +* fee60000 f0e00000 64K PCIe #6 I/O space +* fee70000 f0f00000 64K PCIe #7 I/O space +* fd000000 f1000000 1M on-chip peripheral registers */ #define MV78XX0_CORE0_REGS_PHYS_BASE 0xf1020000#define MV78XX0_CORE1_REGS_PHYS_BASE 0xf1024000
@@ -46,11 +46,10 @@#define MV78XX0_CORE_REGS_SIZE SZ_16K#define MV78XX0_PCIE_IO_PHYS_BASE (i) (0xf0800000 + ((i) << 20)) -#define MV78XX0_PCIE_IO_VIRT_BASE (i) (0xfe700000 + ((i) << 20))#define MV78XX0_PCIE_IO_SIZE SZ_1M#define MV78XX0_REGS_PHYS_BASE 0xf1000000 -#define MV78XX0_REGS_VIRT_BASE 0xfef00000 +#define MV78XX0_REGS_VIRT_BASE 0xfd000000#define MV78XX0_REGS_SIZE SZ_1M#define MV78XX0_PCIE_MEM_PHYS_BASE 0xc0000000
arch/arm/mach-mv78xx0/pcie.c +33 -77
172 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 15/15 ARM: iop3xx: use fixed PCI i/o mapping
In reply to Rob HerringFrom: Rob Herring <[email protected]>
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.
--- arch/arm/Kconfig | 2 -- arch/arm/include/asm/hardware/iop3xx.h | 12 +----------- arch/arm/mach-iop32x/include/mach/io.h | 19 ------------------- arch/arm/mach-iop33x/include/mach/io.h | 19 ------------------- arch/arm/plat-iop/pci.c | 25 +++++++++---------------- arch/arm/plat-iop/setup.c | 5 ----- 6 files changed, 10 insertions(+), 72 deletions(-) delete mode 100644 arch/arm/mach-iop32x/include/mach/io.h delete mode 100644 arch/arm/mach-iop33x/include/mach/io.h
arch/arm/Kconfig +0 -2
@@ -495,7 +495,6 @@ config ARCH_IOP32X bool "IOP32x-based" depends on MMU select CPU_XSCALE - select NEED_MACH_IO_H select NEED_RET_TO_USER select PLAT_IOP select PCI
@@ -508,7 +507,6 @@ config ARCH_IOP33X bool "IOP33x-based" depends on MMU select CPU_XSCALE - select NEED_MACH_IO_H select NEED_RET_TO_USER select PLAT_IOP select PCI
arch/arm/include/asm/hardware/iop3xx.h +1 -11
@@ -217,18 +217,8 @@ extern int iop3xx_get_init_atu(void);#define IOP3XX_PCI_LOWER_MEM_PA 0x80000000#define IOP3XX_PCI_MEM_WINDOW_SIZE 0x08000000 -#define IOP3XX_PCI_IO_WINDOW_SIZE 0x00010000#define IOP3XX_PCI_LOWER_IO_PA 0x90000000 -#define IOP3XX_PCI_LOWER_IO_VA 0xfe000000 -#define IOP3XX_PCI_LOWER_IO_BA 0x90000000 -#define IOP3XX_PCI_UPPER_IO_PA (IOP3XX_PCI_LOWER_IO_PA +\ - IOP3XX_PCI_IO_WINDOW_SIZE - 1) -#define IOP3XX_PCI_UPPER_IO_VA (IOP3XX_PCI_LOWER_IO_VA +\ - IOP3XX_PCI_IO_WINDOW_SIZE - 1) -#define IOP3XX_PCI_IO_PHYS_TO_VIRT (addr) (((u32) (addr) -\ - IOP3XX_PCI_LOWER_IO_PA) +\ - IOP3XX_PCI_LOWER_IO_VA) - +#define IOP3XX_PCI_LOWER_IO_BA 0x00000000#ifndef __ASSEMBLY__
arch/arm/mach-iop32x/include/mach/io.h deleted +0 -19
@@ -1,19 +0,0 @@ -/* -* arch/arm/mach-iop32x/include/mach/io.h -* -* Copyright (C) 2001 MontaVista Software, Inc. -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -*/ - -#ifndef __IO_H -#define __IO_H - -#include <asm/hardware/iop3xx.h> - -#define IO_SPACE_LIMIT 0xffffffff -#define __io (p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p)) - -#endif
arch/arm/mach-iop33x/include/mach/io.h deleted +0 -19
@@ -1,19 +0,0 @@ -/* -* arch/arm/mach-iop33x/include/mach/io.h -* -* Copyright (C) 2001 MontaVista Software, Inc. -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -*/ - -#ifndef __IO_H -#define __IO_H - -#include <asm/hardware/iop3xx.h> - -#define IO_SPACE_LIMIT 0xffffffff -#define __io (p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p)) - -#endif
arch/arm/plat-iop/pci.c +9 -16
@@ -192,30 +192,24 @@ int iop3xx_pci_setup(int nr, struct pci_sys_data *sys)if (nr !=0 )return 0 ; - res =kzalloc (2 *sizeof (struct resource ),GFP_KERNEL ); + res =kzalloc (sizeof (struct resource ),GFP_KERNEL );if (!res)panic ("PCI: unable to alloc resources" ); - res[0 ].start =IOP3XX_PCI_LOWER_IO_PA ; - res[0 ].end =IOP3XX_PCI_LOWER_IO_PA +IOP3XX_PCI_IO_WINDOW_SIZE -1 ; - res[0 ].name ="IOP3XX PCI I/O Space" ; - res[0 ].flags =IORESOURCE_IO ; -request_resource (&ioport_resource, &res[0 ]); - - res[1 ].start =IOP3XX_PCI_LOWER_MEM_PA ; - res[1 ].end =IOP3XX_PCI_LOWER_MEM_PA +IOP3XX_PCI_MEM_WINDOW_SIZE -1 ; - res[1 ].name ="IOP3XX PCI Memory Space" ; - res[1 ].flags =IORESOURCE_MEM ; -request_resource (&iomem_resource, &res[1 ]); + res->start =IOP3XX_PCI_LOWER_MEM_PA ; + res->end =IOP3XX_PCI_LOWER_MEM_PA +IOP3XX_PCI_MEM_WINDOW_SIZE -1 ; + res->name ="IOP3XX PCI Memory Space" ; + res->flags =IORESOURCE_MEM ; +request_resource (&iomem_resource, res);/* * Use whatever translation is already setup. */ sys->mem_offset =IOP3XX_PCI_LOWER_MEM_PA - *IOP3XX_OMWTVR0 ; - sys->io_offset =IOP3XX_PCI_LOWER_IO_PA - *IOP3XX_OIOWTVR ; -pci_add_resource_offset (&sys->resources, &res[0 ], sys->io_offset); -pci_add_resource_offset (&sys->resources, &res[1 ], sys->mem_offset); +pci_add_resource_offset (&sys->resources, res, sys->mem_offset); + +pci_ioremap_io (0 ,IOP3XX_PCI_LOWER_IO_PA );return 1 ; }
@@ -367,7 +361,6 @@ void __init iop3xx_pci_preinit_cond(void)void __init iop3xx_pci_preinit (void ) { - pcibios_min_io =0 ; pcibios_min_mem =0 ;iop3xx_atu_disable ();
arch/arm/plat-iop/setup.c +0 -5
@@ -25,11 +25,6 @@ static struct map_desc iop3xx_std_desc[] __initdata = { .pfn = __phys_to_pfn(IOP3XX_PERIPHERAL_PHYS_BASE), .length = IOP3XX_PERIPHERAL_SIZE, .type = MT_UNCACHED, - }, { /* PCI IO space */ - .virtual = IOP3XX_PCI_LOWER_IO_VA, - .pfn = __phys_to_pfn(IOP3XX_PCI_LOWER_IO_PA), - .length = IOP3XX_PCI_IO_WINDOW_SIZE, - .type = MT_DEVICE, }, };
Signature · 1 line
1.7.9.5
v2 cover PCI io.h clean-up
In reply to Rob HerringQuoted 16 lines · Rob Herring
From: Rob Herring <[email protected]>
This is the 2nd part of
mach/io.hremovals. This series removesio.hon platforms with PCI by creating a fixed virtual I/O mapping and a common__io()macro.This version has changed a bit to accommodate Tegra converting its PCIe host to a platform driver. Now the virtual space is only reserved during early boot before .map_io() is called. The mapping is not created until calling
pci_ioremap_iowhich can be done at any point after vmalloc is initialized.I've gone back to fixed 64K windows for each PCI bus. This allows removing all the i/o resource setup from the individually platforms and placing it within the common ARM PCI code.
Quoted 8 lines
I've only tested versatilepb under qemu (with the model hacked up to actually enable i/o space), so any testing is appreciated. iop3xx and mv78xx0 have some risk of breaking as the PCI bus addresses are moved to 0 from matching the cpu host bus addesss.
This is available from my git tree:
git://sources.calxeda.com/kernel/linux.gitio-cleanup-pci
I would propose sticking it in the arm-soc tree as a staging branch for now to get some more testing on this. We can then decide in the merge window if we consider it good enough or whether we want to delay it to 3.7.
Any objections?
Arnd
v2 cover PCI io.h clean-up
Quoted 24 lines · Arnd Bergmann
Quoted 23 lines · Rob Herring
From: Rob Herring <[email protected]>
This is the 2nd part of
mach/io.hremovals. This series removesio.hon platforms with PCI by creating a fixed virtual I/O mapping and a common__io()macro.This version has changed a bit to accommodate Tegra converting its PCIe host to a platform driver. Now the virtual space is only reserved during early boot before .map_io() is called. The mapping is not created until calling
pci_ioremap_iowhich can be done at any point after vmalloc is initialized.I've gone back to fixed 64K windows for each PCI bus. This allows removing all the i/o resource setup from the individually platforms and placing it within the common ARM PCI code.
I've only tested versatilepb under qemu (with the model hacked up to actually enable i/o space), so any testing is appreciated. iop3xx and mv78xx0 have some risk of breaking as the PCI bus addresses are moved to 0 from matching the cpu host bus addesss.
This is available from my git tree:
Quoted 8 lines
Quoted 1 line
git://sources.calxeda.com/kernel/linux.gitio-cleanup-pciI would propose sticking it in the arm-soc tree as a staging branch for now to get some more testing on this. We can then decide in the merge window if we consider it good enough or whether we want to delay it to 3.7.
Any objections?
I suggested a cosmetic fix I'd like to see before this goes into mainline, but no objections otherwise.
Nicolas
v2 cover PCI io.h clean-up
In reply to Arnd BergmannQuoted 24 lines · Arnd Bergmann
Quoted 23 lines · Rob Herring
From: Rob Herring <[email protected]>
This is the 2nd part of
mach/io.hremovals. This series removesio.hon platforms with PCI by creating a fixed virtual I/O mapping and a common__io()macro.This version has changed a bit to accommodate Tegra converting its PCIe host to a platform driver. Now the virtual space is only reserved during early boot before .map_io() is called. The mapping is not created until calling
pci_ioremap_iowhich can be done at any point after vmalloc is initialized.I've gone back to fixed 64K windows for each PCI bus. This allows removing all the i/o resource setup from the individually platforms and placing it within the common ARM PCI code.
I've only tested versatilepb under qemu (with the model hacked up to actually enable i/o space), so any testing is appreciated. iop3xx and mv78xx0 have some risk of breaking as the PCI bus addresses are moved to 0 from matching the cpu host bus addesss.
This is available from my git tree:
Quoted 8 lines
Quoted 1 line
git://sources.calxeda.com/kernel/linux.gitio-cleanup-pciI would propose sticking it in the arm-soc tree as a staging branch for now to get some more testing on this. We can then decide in the merge window if we consider it good enough or whether we want to delay it to 3.7.
Any objections?
No. BTW, it is all opt in and any platform broken can be simply be reverted I think. I did tell previously tell Wolfram that he could take the iop3xx i2c fixes, but they aren't in next yet. So Wolfram, please don't pick up those 2 commits for i2c-iop3xx.
It changed a bit so I didn't add your reviewed-by. Okay to do so now? I'll rebase and send you a pull request.
Rob
Quoted 3 lines
Arnd
Andrew Lunn
maintainerv2 cover PCI io.h clean-up
In reply to Rob HerringQuoted 5 lines · Rob Herring
From: Rob Herring <[email protected]>
This is the 2nd part of
mach/io.hremovals. This series removesio.hon platforms with PCI by creating a fixed virtual I/O mapping and a common__io()macro.
Hi Rob
Time to show my ignorance of PCI again.
root at orion5x:~# cat /proc/ioports
00001000-0000ffff : PCI0 I/O
00010000-0001ffff : PCI1 I/O
The changes you made for Orion decreased the window to 64K. However, i see here that PCI0 only gets 60K, where as PCI1 gets the full 64K.
Is this asymmetry correct?
I see this for both orion5x and kirkwood.
Thanks
Andrew
v2 cover PCI io.h clean-up
Quoted 6 lines · Andrew Lunn
The changes you made for Orion decreased the window to 64K. However, i see here that PCI0 only gets 60K, where as PCI1 gets the full 64K.
Is this asymmetry correct?
I see this for both orion5x and kirkwood.
The range from 0x0-0xfff is used for ISA-style devices, including those behind a PCI bridge or emulating one like a VGA text console or an IDE controller. We set PCIBIOS_MIN_IO to 0x1000 to avoid conflicts between those and dynamically probed PCI devices that we might otherwise put in the same range.
Arnd
v2 cover PCI io.h clean-up
In reply to Andrew LunnQuoted 11 lines · Andrew Lunn
Quoted 5 lines · Rob Herring
From: Rob Herring <[email protected]>
This is the 2nd part of
mach/io.hremovals. This series removesio.hon platforms with PCI by creating a fixed virtual I/O mapping and a common__io()macro.Hi Rob
Time to show my ignorance of PCI again.
Quoted 8 lines
root at orion5x:~# cat
/proc/ioports
00001000-0000ffff : PCI0 I/O
00010000-0001ffff : PCI1 I/OThe changes you made for Orion decreased the window to 64K. However, i see here that PCI0 only gets 60K, where as PCI1 gets the full 64K.
Is this asymmetry correct?
First, thanks for testing.
PC's only have 64K, so that should be enough for any platform. 0-0x1000 is reserved for legacy ISA range. Even if we set the start to 0, pcibios_min_io would still limit it to above 0x1000.
Also, based on the address translation masking on these platforms, I believe it should be okay to start the PCI bus address on a 64K boundary.
Rob
Quoted 6 lines
I see this for both orion5x and kirkwood.
Thanks
Andrew