PCI io.h cleanups
Subsystems (9)
cover PCI io.h cleanups
From: Rob Herring <[email protected]>
I've finally gotten back to this after several months. 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.
As several platforms have 2 1MB I/O windows, I've changed the fixed mapping to 2MB (vs. 1MB in the prior posting) and allow platforms to control the size. This also allows using a single 1MB section mapping rather than 4KB pages.
I've only tested versatilepb under qemu, 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.
Rob
Arnd Bergmann (1):
iop13xx: use more regular PCI I/O space handling
Rob Herring (14):
ARM: Add fixed PCI i/o mapping
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: 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
i2c: iop3xx: clean-up trailing whitespace
i2c: iop3xx: use standard gpiolib functions
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 | 5 + arch/arm/include/asm/mach/pci.h | 18 +++ arch/arm/kernel/bios32.c | 20 ++++ arch/arm/mach-dove/common.c | 15 +-- arch/arm/mach-dove/include/mach/dove.h | 2 - arch/arm/mach-dove/include/mach/io.h | 19 --- arch/arm/mach-dove/pcie.c | 9 +- arch/arm/mach-footbridge/common.c | 10 +- .../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 | 9 +- arch/arm/mach-iop13xx/include/mach/io.h | 28 ----- arch/arm/mach-iop13xx/include/mach/iop13xx.h | 14 +-- arch/arm/mach-iop13xx/io.c | 27 ----- arch/arm/mach-iop13xx/pci.c | 12 +- arch/arm/mach-iop13xx/setup.c | 17 ++- arch/arm/mach-iop32x/include/mach/io.h | 19 --- arch/arm/mach-iop33x/include/mach/io.h | 19 --- arch/arm/mach-kirkwood/common.c | 17 ++- arch/arm/mach-kirkwood/include/mach/io.h | 24 ---- arch/arm/mach-kirkwood/include/mach/kirkwood.h | 2 - arch/arm/mach-mv78xx0/addr-map.c | 1 + arch/arm/mach-mv78xx0/common.c | 18 ++- arch/arm/mach-mv78xx0/include/mach/io.h | 24 ---- arch/arm/mach-mv78xx0/include/mach/mv78xx0.h | 22 ++-- arch/arm/mach-mv78xx0/pcie.c | 28 +---- arch/arm/mach-orion5x/common.c | 16 +-- arch/arm/mach-orion5x/include/mach/io.h | 22 ---- arch/arm/mach-orion5x/include/mach/orion5x.h | 14 +-- arch/arm/mach-shark/core.c | 14 +-- 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-tegra/include/mach/io.h | 46 -------- arch/arm/mach-tegra/include/mach/iomap.h | 3 + arch/arm/mach-tegra/io.c | 2 + arch/arm/mach-tegra/pcie.c | 43 +------ arch/arm/mach-versatile/core.c | 7 +- arch/arm/mach-versatile/include/mach/hardware.h | 1 - arch/arm/mach-versatile/include/mach/io.h | 27 ----- arch/arm/mach-versatile/pci.c | 1 - arch/arm/plat-iop/pci.c | 4 +- arch/arm/plat-iop/setup.c | 7 +- drivers/i2c/busses/i2c-iop3xx.c | 121 ++++++++++---------- 49 files changed, 219 insertions(+), 596 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 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).
--- Documentation/arm/memory.txt | 3 +++ arch/arm/include/asm/io.h | 5 +++++ arch/arm/include/asm/mach/pci.h | 18 ++++++++++++++++++ arch/arm/kernel/bios32.c | 20 ++++++++++++++++++++ 4 files changed, 46 insertions(+)
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. +fee00000 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 +5 -0
@@ -113,11 +113,16 @@ static inline void __iomem *__typesafe_io(unsigned long addr)#define __iowmb () do { } while (0)#endif +#define PCI_IO_VIRT_BASE 0xfee00000 +/* * 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)0x1fffff) +#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/pci.h +18 -0
@@ -55,6 +55,24 @@ struct pci_sys_data {void pci_common_init (struct hw_pci *);/* +* Setup fixed I/O mapping. Must be called from .map_io function. +*/ +#ifdef CONFIG_PCI +extern void pci_map_io_pfn (unsigned long pfn[],int nr,int size); +#else +static inline void pci_map_io_pfn (unsigned long pfn[],int nr,int size) {} +#endif +static inline void __init pci_map_io_single_pfn (unsigned long pfn) +{ +pci_map_io_pfn (&pfn,1 ,SZ_1M ); +} + +static inline void __init pci_map_io_single (unsigned long paddr) +{ +pci_map_io_single_pfn (__phys_to_pfn (paddr)); +} + +/* * PCI controllers */ extern struct pci_ops iop3xx_ops;
arch/arm/kernel/bios32.c +20 -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;
@@ -627,3 +628,22 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,return 0 ; } + +static struct map_desc pci_io_desc__initdata = { + .virtual =PCI_IO_VIRT_BASE , + .type =MT_DEVICE , +}; + +void __init pci_map_io_pfn (unsigned long pfn[],int nr,int size) +{ +int i; + + pci_io_desc.length = size; + +for (i =0 ; i < nr; i++) { + pci_io_desc.pfn = pfn[i]; +iotable_init (&pci_io_desc,1 ); + + pci_io_desc.virtual += size; + } +}
Signature · 1 line
1.7.9.5
PATCH 1/15 ARM: Add fixed PCI i/o mapping
Quoted 7 lines · Rob Herring
/*
+ * Setup fixed I/O mapping. Must be called from .map_io function.
+ */arch/arm/include/asm/mach/pci.h +4
-0+#ifdef CONFIG_PCI +extern void pci_map_io_pfn (unsigned long pfn[],int nr,int size); +#else +static inline void pci_map_io_pfn (unsigned long pfn[],int nr,int size) {}
arch/arm/include/asm/mach/pci.h struct pci_sys_data { · line 73
Quoted 10 lines
arch/arm/include/asm/mach/pci.h +10
-0+#endif +static inline void __init pci_map_io_single_pfn (unsigned long pfn) +{ +pci_map_io_pfn (&pfn,1 ,SZ_1M ); +} + +static inline void __init pci_map_io_single (unsigned long paddr) +{ +pci_map_io_single_pfn (__phys_to_pfn (paddr)); +}
On powerpc, we have a special flag that gets used to register a "primary" I/O space, which is the one that holds the port numbers between 0 and 1024 because that is the only place that an ISA add-on card can be used in.
I wonder if we want to support that as well, or if we just assume that the first one to get registered is the primary bus.
Arnd
PATCH 2/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 | 7 ++---- arch/arm/mach-versatile/include/mach/hardware.h | 1 - arch/arm/mach-versatile/include/mach/io.h | 27 ----------------------- arch/arm/mach-versatile/pci.c | 1 - 5 files changed, 2 insertions(+), 35 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 +2 -5
@@ -47,6 +47,7 @@#include <asm/mach/irq.h> #include <asm/mach/time.h> #include <asm/mach/map.h> +#include <asm/mach/pci.h> #include <mach/hardware.h> #include <mach/platform.h> #include <asm/hardware/timer-sp.h>
@@ -169,17 +170,13 @@ 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 };void __init versatile_map_io (void ) { +pci_map_io_single (VERSATILE_PCI_MEM_BASE0 );iotable_init (versatile_io_desc,ARRAY_SIZE (versatile_io_desc)); }
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 +0 -1
@@ -319,7 +319,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 3/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/io.c | 2 ++ arch/arm/mach-tegra/pcie.c | 43 ++++------------------------ 5 files changed, 10 insertions(+), 85 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/io.c +2 -0
@@ -26,6 +26,7 @@#include <asm/page.h> #include <asm/mach/map.h> +#include <asm/mach/pci.h> #include <mach/iomap.h> #include "board.h"
@@ -59,5 +60,6 @@ static struct map_desc tegra_io_desc[] __initdata = {void __init tegra_map_common_io (void ) { +pci_map_io_single (TEGRA_PCIE_IO_BASE );iotable_init (tegra_io_desc,ARRAY_SIZE (tegra_io_desc)); }
arch/arm/mach-tegra/pcie.c +5 -38
94 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 3/15 ARM: tegra: use fixed PCI i/o mapping
Quoted 3 lines · Rob Herring
From: Rob Herring <[email protected]>
Move tegra PCI to fixed i/o mapping and remove
io.h.
Thierry, since you're the Tegra PCIe expert right now, could you please test and/or comment on this.
I did try testing this on next-20120705 on TrimSlice (i.e. the PCIe-based Ethernet controller), but found that PCIe has stopped working there due to "resource collisions". I know this used to work fairly recently, since I tested it when I added the PCIe initialization call to board-dt-tegra20.c. The PCIe messages are:
Quoted 37 lines
PCIE: port 1: link down, retrying
PCIE: port 1: link down, retrying
PCIE: port 1: link down, ignoring
PCI host bridge to bus 0000:00pci_bus0000:00: root bus resource [io 0x1000-0x8fff]pci_bus0000:00: root bus resource [mem 0x90000000-0x97ffffff]pci_bus0000:00: root bus resource [mem 0xa0000000-0xa7ffffff pref]pci_bus0000:00: No busn resource found for root bus, will use [bus 00-ff]pci_bus0000:00:busn_res: [bus 00-ff] is inserted under domain [bus 00-ff] pci 0000:00:00.0: [10de:0bf0] type 01 class0x060000
pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot D3cold
PCI: bus0: Fast back to back transfers disabledpci_bus0000:01:busn_res: [bus 01-ff] is inserted under [bus 00-ff] pci 0000:01:00.0: [10ec:8168] type 00 class0x020000
pci 0000:01:00.0: reg 10: [io 0x0000-0x00ff]
pci 0000:01:00.0: reg 18: [mem 0x00000000-0x00000fff 64bit pref] pci 0000:01:00.0: reg 20: [mem 0x00000000-0x00003fff 64bit pref] pci 0000:01:00.0: reg 30: [mem 0x00000000-0x0001ffff pref]
pci 0000:01:00.0: supports D1 D2
pci 0000:01:00.0: PME# supported from D0 D1 D2 D3hot D3cold
PCI: bus1: Fast back to back transfers disabledpci_bus0000:01:busn_res: [bus 01-ff] end is updated to 01pci_bus0000:00:busn_res: [bus 00-ff] end is updated to 01 r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
PCI: Device 0000:01:00.0 not available because of resource collisions r8169 0000:01:00.0: (unregisterednet_device): enable failure
r8169: probe of 0000:01:00.0 failed with error -22
pci 0000:00:00.0: BAR 9: assigned [mem 0xa0000000-0xa00fffff pref] pci 0000:00:00.0: BAR 7: assigned [io 0x1000-0x1fff]
pci 0000:01:00.0: BAR 6: assigned [mem 0xa0000000-0xa001ffff pref] pci 0000:01:00.0: BAR 4: assigned [mem 0xa0020000-0xa0023fff 64bit pref] pci 0000:01:00.0: BAR 2: assigned [mem 0xa0024000-0xa0024fff 64bit pref] pci 0000:01:00.0: BAR 0: assigned [io 0x1000-0x10ff]
pci 0000:00:00.0: PCI bridge to [bus 01]
pci 0000:00:00.0: bridge window [io 0x1000-0x1fff]
pci 0000:00:00.0: bridge window [mem 0xa0000000-0xa00fffff pref]
PCI: enabling device 0000:00:00.0 (0140 -> 0143)
PATCH 3/15 ARM: tegra: use fixed PCI i/o mapping
Quoted 5 lines · Stephen Warren
Quoted 3 lines · Rob Herring
From: Rob Herring <[email protected]>
Move tegra PCI to fixed i/o mapping and remove
io.h.
Quoted 8 lines
Thierry, since you're the Tegra PCIe expert right now, could you please test and/or comment on this.
I did try testing this on next-20120705 on TrimSlice (i.e. the PCIe-based Ethernet controller), but found that PCIe has stopped working there due to "resource collisions". I know this used to work fairly recently, since I tested it when I added the PCIe initialization call to
board-dt-tegra20.c. The PCIe messages are:
This is with my change and it works currently without?
The i/o mapping of the 2nd ctrlr looked a bit screwy to me. It's not clear to me how an i/o address of 0x11000+ gets steered to the 2nd controller.
Rob
Quoted 38 lines
Quoted 38 lines
PCIE: port 1: link down, retrying
PCIE: port 1: link down, retrying
PCIE: port 1: link down, ignoring
PCI host bridge to bus 0000:00pci_bus0000:00: root bus resource [io 0x1000-0x8fff]pci_bus0000:00: root bus resource [mem 0x90000000-0x97ffffff]pci_bus0000:00: root bus resource [mem 0xa0000000-0xa7ffffff pref]pci_bus0000:00: No busn resource found for root bus, will use [bus 00-ff]pci_bus0000:00:busn_res: [bus 00-ff] is inserted under domain [bus 00-ff] pci 0000:00:00.0: [10de:0bf0] type 01 class0x060000
pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot D3cold
PCI: bus0: Fast back to back transfers disabledpci_bus0000:01:busn_res: [bus 01-ff] is inserted under [bus 00-ff] pci 0000:01:00.0: [10ec:8168] type 00 class0x020000
pci 0000:01:00.0: reg 10: [io 0x0000-0x00ff]
pci 0000:01:00.0: reg 18: [mem 0x00000000-0x00000fff 64bit pref] pci 0000:01:00.0: reg 20: [mem 0x00000000-0x00003fff 64bit pref] pci 0000:01:00.0: reg 30: [mem 0x00000000-0x0001ffff pref]
pci 0000:01:00.0: supports D1 D2
pci 0000:01:00.0: PME# supported from D0 D1 D2 D3hot D3cold
PCI: bus1: Fast back to back transfers disabledpci_bus0000:01:busn_res: [bus 01-ff] end is updated to 01pci_bus0000:00:busn_res: [bus 00-ff] end is updated to 01 r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
PCI: Device 0000:01:00.0 not available because of resource collisions r8169 0000:01:00.0: (unregisterednet_device): enable failure
r8169: probe of 0000:01:00.0 failed with error -22
pci 0000:00:00.0: BAR 9: assigned [mem 0xa0000000-0xa00fffff pref] pci 0000:00:00.0: BAR 7: assigned [io 0x1000-0x1fff]
pci 0000:01:00.0: BAR 6: assigned [mem 0xa0000000-0xa001ffff pref] pci 0000:01:00.0: BAR 4: assigned [mem 0xa0020000-0xa0023fff 64bit pref] pci 0000:01:00.0: BAR 2: assigned [mem 0xa0024000-0xa0024fff 64bit pref] pci 0000:01:00.0: BAR 0: assigned [io 0x1000-0x10ff]
pci 0000:00:00.0: PCI bridge to [bus 01]
pci 0000:00:00.0: bridge window [io 0x1000-0x1fff]
pci 0000:00:00.0: bridge window [mem 0xa0000000-0xa00fffff pref]
PCI: enabling device 0000:00:00.0 (0140 -> 0143)
PATCH 3/15 ARM: tegra: use fixed PCI i/o mapping
Quoted 9 lines · Rob Herring
Quoted 8 lines · Stephen Warren
Quoted 3 lines · Rob Herring
From: Rob Herring <[email protected]>
Move tegra PCI to fixed i/o mapping and remove
io.h.Thierry, since you're the Tegra PCIe expert right now, could you please test and/or comment on this.
Quoted 7 lines
Quoted 5 lines
I did try testing this on next-20120705 on TrimSlice (i.e. the PCIe-based Ethernet controller), but found that PCIe has stopped working there due to "resource collisions". I know this used to work fairly recently, since I tested it when I added the PCIe initialization call to
board-dt-tegra20.c. The PCIe messages are:This is with my change and it works currently without?
Sorry, no, it's broken even without your change. Hence, I can't test the impact of your change. Well, I saw the same failure with your patches too, but that isn't really conclusive testing of your change:-)
PATCH 3/15 ARM: tegra: use fixed PCI i/o mapping
Quoted 16 lines · Stephen Warren
Quoted 15 lines · Rob Herring
Quoted 13 lines · Stephen Warren
Quoted 3 lines · Rob Herring
From: Rob Herring <[email protected]>
Move tegra PCI to fixed i/o mapping and remove
io.h.Thierry, since you're the Tegra PCIe expert right now, could you please test and/or comment on this.
I did try testing this on next-20120705 on TrimSlice (i.e. the PCIe-based Ethernet controller), but found that PCIe has stopped working there due to "resource collisions". I know this used to work fairly recently, since I tested it when I added the PCIe initialization call to
board-dt-tegra20.c. The PCIe messages are:
Quoted 5 lines
Quoted 1 line
This is with my change and it works currently without?
Sorry, no, it's broken even without your change. Hence, I can't test the impact of your change. Well, I saw the same failure with your patches too, but that isn't really conclusive testing of your change:-)
Aha. The PCIe problem only shows up when booting TrimSlice using DT (in next-20120705 or Tegra's for-next branch).
When booting using board files, PCIe works, both without and with your patch, on top of next-20120705.
So, your patches are tested on Tegra and still working.
PATCH 3/15 ARM: tegra: use fixed PCI i/o mapping
(cutting down CCs for Tegra-specific discussion)
Quoted 23 lines · Stephen Warren
Quoted 16 lines · Stephen Warren
Quoted 15 lines · Rob Herring
Quoted 13 lines · Stephen Warren
Quoted 3 lines · Rob Herring
From: Rob Herring <[email protected]>
Move tegra PCI to fixed i/o mapping and remove
io.h.Thierry, since you're the Tegra PCIe expert right now, could you please test and/or comment on this.
I did try testing this on next-20120705 on TrimSlice (i.e. the PCIe-based Ethernet controller), but found that PCIe has stopped working there due to "resource collisions". I know this used to work fairly recently, since I tested it when I added the PCIe initialization call to
board-dt-tegra20.c. The PCIe messages are:Quoted 5 lines
Quoted 1 line
This is with my change and it works currently without?
Sorry, no, it's broken even without your change. Hence, I can't test the impact of your change. Well, I saw the same failure with your patches too, but that isn't really conclusive testing of your change:-)
Quoted 7 lines
Aha. The PCIe problem only shows up when booting TrimSlice using DT (in next-20120705 or Tegra's for-next branch).
When booting using board files, PCIe works, both without and with your patch, on top of next-20120705.
So, your patches are tested on Tegra and still working.
I haven't root-caused it, but I have found what changed that triggered the problem:
When I first wrote the patch to board-dt-tegra20.c that brought DT booting up to feature parity with non-DT boot, IIRC, I wrote a late_initcall() to run whatever code I added. I'm sure I tested TrimSlice PCIe when booting using DT then, since that was the whole point of the patch.
Later, I revised the patch to sit on top of Shawn Guo's .init_late machine descriptor patch, and ran the code from there instead. However, this appears to have broken PCIe on Trimslice; I must have screwed up the testing of that change. I don't know why this causes a behavior difference though; perhaps some resource acquisition race condition.
But just reverting that change doesn't fix the problem; I need to switch to a *subsys*_initcall() instead (which is in fact what the Trimslice board file uses for PCIe init). In other words:
(quoted diff) +0 -0
b/arch/arm/mach-tegra/board-dt-tegra20.c
index 70a19a9..74aefaf 100644
arch/arm/mach-tegra/board-dt-tegra20.c +4 -3
@@ -145,19 +145,20 @@ static struct {#endif }; -static void __init tegra_dt_init_late (void ) +static int __init tegra_dt_init_late (void ) {int i; -tegra_init_late (); -for (i =0 ; i <ARRAY_SIZE (board_init_funcs); i++) {if (of_machine_is_compatible (board_init_funcs[i].machine)) { board_init_funcs[i].init ();break ; } } + +return 0 ; } +subsys_initcall (tegra_dt_init_late);static const char *tegra20_dt_board_compat[] = {"nvidia,tegra20" ,
@@ -171,7 +172,7 @@ DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20
(Flattened Device Tree)")
.handle_irq = gic_handle_irq,
.timer = &tegra_timer,
.init_machine = tegra_dt_init,
- .init_late = tegra_dt_init_late,
+ .init_late = tegra_init_late,
.restart = tegra_assert_system_reset,
.dt_compat = tegra20_dt_board_compat,
MACHINE_END
PATCH 3/15 ARM: tegra: use fixed PCI i/o mapping
In reply to Rob HerringQuoted 8 lines · Rob Herring
From: Rob Herring <[email protected]>
Move tegra PCI to fixed i/o mapping and remove
io.h.Signed-off-by Rob Herring <[email protected]>Cc Colin Cross <[email protected]>Cc Olof Johansson <[email protected]>Acked-by Stephen Warren <[email protected]>
Quoted 8 lines
--- 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/io.c | 2 ++ arch/arm/mach-tegra/pcie.c | 43 ++++------------------------ 5 files changed, 10 insertions(+), 85 deletions(-) delete mode 100644 arch/arm/mach-tegra/include/mach/io.h
Hi Rob,
generally this looks good. However I've been working on a rewrite of the Tegra PCIe support to make it work as a driver and add DT support. This entails that PCIe support isn't initialized until very late in the process because it makes use of deferred probe if some regulators aren't available. One problem caused by this is that it suddenly requires a lot of code marked as __init to be available after the init phase and I see that you've introduced pci_map_io_single_pfn() that is __init annotated, so it will cause problems when used with my patches.
I'm not very familiar with the inner workings of the iotable and the mappings initialized by it, but I wonder if this can be done dynamically at a later stage. The way this is currently done in this patch, the I/O region is statically mapped from a fixed offset within the PCIe address range. Part of the patches to add DT support is to allow this region to be defined by the DT, so that will obviously also create problems.
If both of those issues can be easily addressed, then this certainly looks very nice.
Thierry
Quoted 208 lines
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@@ -1,46 +0,0 @@ -/* -* arch/arm/mach-tegra/include/mach/io.h -* -* Copyright (C) 2010 Google, Inc. -* -* Author: -* Colin Cross <[email protected]> -* Erik Gilling <[email protected]> -* -* This software is licensed under the terms of the GNU General Public -* License version 2, as published by the Free Software Foundation, and -* may be copied, distributed, and modified under those terms. -* -* 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. -* -*/ - -#ifndef __MACH_TEGRA_IO_H -#define __MACH_TEGRA_IO_H - -#define IO_SPACE_LIMIT 0xffff - -#ifndef __ASSEMBLER__ - -#ifdef CONFIG_TEGRA_PCI -extern void __iomem *tegra_pcie_io_base; - -static inline void __iomem *__io (unsigned long addr) -{ -return tegra_pcie_io_base + (addr &IO_SPACE_LIMIT ); -} -#else -static inline void __iomem *__io (unsigned long addr) -{ -return (void __iomem *)addr; -} -#endif - -#define __io (a) __io(a) - -#endif - -#endif 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/io.c +2
-0@@ -26,6 +26,7 @@#include <asm/page.h> #include <asm/mach/map.h> +#include <asm/mach/pci.h> #include <mach/iomap.h> #include "board.h" @@ -59,5 +60,6 @@ static struct map_desc tegra_io_desc[] __initdata = {void __init tegra_map_common_io (void ) { +pci_map_io_single (TEGRA_PCIE_IO_BASE );iotable_init (tegra_io_desc,ARRAY_SIZE (tegra_io_desc)); }arch/arm/mach-tegra/pcie.c +5
-38@@ -171,8 +171,6 @@ static void __iomem *reg_pmc_base = IO_ADDRESS(TEGRA_PMC_BASE);* 0x90000000 - 0x9fffffff - non-prefetchable memory * 0xa0000000 - 0xbfffffff - prefetchable memory */ -#define TEGRA_PCIE_BASE 0x80000000 -#define PCIE_REGS_SZ SZ_16K#define PCIE_CFG_OFF PCIE_REGS_SZ#define PCIE_CFG_SZ SZ_1M@@ -180,8 +178,6 @@ static void __iomem *reg_pmc_base = IO_ADDRESS(TEGRA_PMC_BASE);#define PCIE_EXT_CFG_SZ SZ_1M#define PCIE_IOMAP_SZ (PCIE_REGS_SZ + PCIE_CFG_SZ + PCIE_EXT_CFG_SZ) -#define MMIO_BASE (TEGRA_PCIE_BASE + SZ_4M) -#define MMIO_SIZE SZ_64K#define MEM_BASE_0 (TEGRA_PCIE_BASE + SZ_256M)#define MEM_SIZE_0 SZ_128M#define MEM_BASE_1 (MEM_BASE_0 + MEM_SIZE_0)@@ -223,17 +219,7 @@ struct tegra_pcie_info {struct clk *pll_e; }; -static struct tegra_pcie_info tegra_pcie = { - .res_mmio = { - .name ="PCI IO" , - .start =MMIO_BASE , - .end =MMIO_BASE +MMIO_SIZE -1 , - .flags =IORESOURCE_MEM , - }, -}; - -void __iomem *tegra_pcie_io_base; -EXPORT_SYMBOL (tegra_pcie_io_base); +static struct tegra_pcie_info tegra_pcie;static inline void afi_writel (u32 value,unsigned long offset) {@@ -403,7 +389,7 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys) pp->res[0 ].end = pp->res[0 ].start +SZ_32K -1 ; }else { pp->res[0 ].start =PCIBIOS_MIN_IO +SZ_32K ; - pp->res[0 ].end =IO_SPACE_LIMIT ; + pp->res[0 ].end =SZ_64K -1 ; } pp->res[0 ].flags =IORESOURCE_IO ;if (request_resource (&ioport_resource, &pp->res[0 ]))@@ -541,8 +527,8 @@ static void tegra_pcie_setup_translations(void)/* Bar 2: downstream IO bar */ fpci_bar = ((__u32 )0xfdfc <<16 ); - size =MMIO_SIZE ; - axi_address =MMIO_BASE ; + size =SZ_64K ; + axi_address =TEGRA_PCIE_IO_BASE ;afi_writel (axi_address,AFI_AXI_BAR2_START );afi_writel (size >>12 ,AFI_AXI_BAR2_SZ );afi_writel (fpci_bar,AFI_FPCI_BAR2 );@@ -776,7 +762,6 @@ static void tegra_pcie_clocks_put(void)static int __init tegra_pcie_get_resources (void ) { -struct resource *res_mmio = &tegra_pcie.res_mmio;int err; err =tegra_pcie_clocks_get ();@@ -798,34 +783,16 @@ static int __init tegra_pcie_get_resources(void) goto err_map_reg; } - err =request_resource (&iomem_resource, res_mmio); -if (err) { -pr_err ("PCIE: Failed to request resources: %d\n" , err); - goto err_req_io; - } - - tegra_pcie_io_base =ioremap_nocache (res_mmio->start, -resource_size (res_mmio)); -if (tegra_pcie_io_base ==NULL ) { -pr_err ("PCIE: Failed to map IO\n" ); - err = -ENOMEM ; - goto err_map_io; - } - err =request_irq (INT_PCIE_INTR , tegra_pcie_isr,IRQF_SHARED ,"PCIE" , &tegra_pcie);if (err) {pr_err ("PCIE: Failed to register IRQ: %d\n" , err); - goto err_irq; + goto err_req_io; }set_irq_flags (INT_PCIE_INTR ,IRQF_VALID );return 0 ; -err_irq: -iounmap (tegra_pcie_io_base); -err_map_io: -release_resource (&tegra_pcie.res_mmio); err_req_io:iounmap (tegra_pcie.regs); err_map_reg:Signature · 1 line
1.7.9.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120708/c002e0c8/attachment-0001.sig>
PATCH 3/15 ARM: tegra: use fixed PCI i/o mapping
Quoted 20 lines · Thierry Reding
Quoted 8 lines · Rob Herring
From: Rob Herring <[email protected]>
Move tegra PCI to fixed i/o mapping and remove
io.h.Signed-off-by Rob Herring <[email protected]>Cc Colin Cross <[email protected]>Cc Olof Johansson <[email protected]>Acked-by Stephen Warren <[email protected]>Quoted 8 lines
--- 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/io.c | 2 ++ arch/arm/mach-tegra/pcie.c | 43 ++++------------------------ 5 files changed, 10 insertions(+), 85 deletions(-) delete mode 100644 arch/arm/mach-tegra/include/mach/io.hHi Rob,
Quoted 8 lines
generally this looks good. However I've been working on a rewrite of the Tegra PCIe support to make it work as a driver and add DT support. This entails that PCIe support isn't initialized until very late in the process because it makes use of deferred probe if some regulators aren't available. One problem caused by this is that it suddenly requires a lot of code marked as
__initto be available after the init phase and I see that you've introducedpci_map_io_single_pfn()that is__initannotated, so it will cause problems when used with my patches.
This function can only be called during .map_io anyway, so the __init is irrelevant.
Quoted 6 lines
I'm not very familiar with the inner workings of the iotable and the mappings initialized by it, but I wonder if this can be done dynamically at a later stage. The way this is currently done in this patch, the I/O region is statically mapped from a fixed offset within the PCIe address range. Part of the patches to add DT support is to allow this region to be defined by the DT, so that will obviously also create problems.
Is the i/o address something you could extract from DT earlier? This can be done separately if it doesn't require information from the driver.
I'm sure exactly how to do a fixed virtual mapping other than the io_table mappings. There was some discussion of use fixmap region previously, but doing so will be a bit more complex. I'll look into this some.
Rob
Quoted 213 lines
If both of those issues can be easily addressed, then this certainly looks very nice.
Thierry
Quoted 208 lines
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@@ -1,46 +0,0 @@ -/* -* arch/arm/mach-tegra/include/mach/io.h -* -* Copyright (C) 2010 Google, Inc. -* -* Author: -* Colin Cross <[email protected]> -* Erik Gilling <[email protected]> -* -* This software is licensed under the terms of the GNU General Public -* License version 2, as published by the Free Software Foundation, and -* may be copied, distributed, and modified under those terms. -* -* 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. -* -*/ - -#ifndef __MACH_TEGRA_IO_H -#define __MACH_TEGRA_IO_H - -#define IO_SPACE_LIMIT 0xffff - -#ifndef __ASSEMBLER__ - -#ifdef CONFIG_TEGRA_PCI -extern void __iomem *tegra_pcie_io_base; - -static inline void __iomem *__io (unsigned long addr) -{ -return tegra_pcie_io_base + (addr &IO_SPACE_LIMIT ); -} -#else -static inline void __iomem *__io (unsigned long addr) -{ -return (void __iomem *)addr; -} -#endif - -#define __io (a) __io(a) - -#endif - -#endif 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/io.c +2
-0@@ -26,6 +26,7 @@#include <asm/page.h> #include <asm/mach/map.h> +#include <asm/mach/pci.h> #include <mach/iomap.h> #include "board.h" @@ -59,5 +60,6 @@ static struct map_desc tegra_io_desc[] __initdata = {void __init tegra_map_common_io (void ) { +pci_map_io_single (TEGRA_PCIE_IO_BASE );iotable_init (tegra_io_desc,ARRAY_SIZE (tegra_io_desc)); }arch/arm/mach-tegra/pcie.c +5
-38@@ -171,8 +171,6 @@ static void __iomem *reg_pmc_base = IO_ADDRESS(TEGRA_PMC_BASE);* 0x90000000 - 0x9fffffff - non-prefetchable memory * 0xa0000000 - 0xbfffffff - prefetchable memory */ -#define TEGRA_PCIE_BASE 0x80000000 -#define PCIE_REGS_SZ SZ_16K#define PCIE_CFG_OFF PCIE_REGS_SZ#define PCIE_CFG_SZ SZ_1M@@ -180,8 +178,6 @@ static void __iomem *reg_pmc_base = IO_ADDRESS(TEGRA_PMC_BASE);#define PCIE_EXT_CFG_SZ SZ_1M#define PCIE_IOMAP_SZ (PCIE_REGS_SZ + PCIE_CFG_SZ + PCIE_EXT_CFG_SZ) -#define MMIO_BASE (TEGRA_PCIE_BASE + SZ_4M) -#define MMIO_SIZE SZ_64K#define MEM_BASE_0 (TEGRA_PCIE_BASE + SZ_256M)#define MEM_SIZE_0 SZ_128M#define MEM_BASE_1 (MEM_BASE_0 + MEM_SIZE_0)@@ -223,17 +219,7 @@ struct tegra_pcie_info {struct clk *pll_e; }; -static struct tegra_pcie_info tegra_pcie = { - .res_mmio = { - .name ="PCI IO" , - .start =MMIO_BASE , - .end =MMIO_BASE +MMIO_SIZE -1 , - .flags =IORESOURCE_MEM , - }, -}; - -void __iomem *tegra_pcie_io_base; -EXPORT_SYMBOL (tegra_pcie_io_base); +static struct tegra_pcie_info tegra_pcie;static inline void afi_writel (u32 value,unsigned long offset) {@@ -403,7 +389,7 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys) pp->res[0 ].end = pp->res[0 ].start +SZ_32K -1 ; }else { pp->res[0 ].start =PCIBIOS_MIN_IO +SZ_32K ; - pp->res[0 ].end =IO_SPACE_LIMIT ; + pp->res[0 ].end =SZ_64K -1 ; } pp->res[0 ].flags =IORESOURCE_IO ;if (request_resource (&ioport_resource, &pp->res[0 ]))@@ -541,8 +527,8 @@ static void tegra_pcie_setup_translations(void)/* Bar 2: downstream IO bar */ fpci_bar = ((__u32 )0xfdfc <<16 ); - size =MMIO_SIZE ; - axi_address =MMIO_BASE ; + size =SZ_64K ; + axi_address =TEGRA_PCIE_IO_BASE ;afi_writel (axi_address,AFI_AXI_BAR2_START );afi_writel (size >>12 ,AFI_AXI_BAR2_SZ );afi_writel (fpci_bar,AFI_FPCI_BAR2 );@@ -776,7 +762,6 @@ static void tegra_pcie_clocks_put(void)static int __init tegra_pcie_get_resources (void ) { -struct resource *res_mmio = &tegra_pcie.res_mmio;int err; err =tegra_pcie_clocks_get ();@@ -798,34 +783,16 @@ static int __init tegra_pcie_get_resources(void) goto err_map_reg; } - err =request_resource (&iomem_resource, res_mmio); -if (err) { -pr_err ("PCIE: Failed to request resources: %d\n" , err); - goto err_req_io; - } - - tegra_pcie_io_base =ioremap_nocache (res_mmio->start, -resource_size (res_mmio)); -if (tegra_pcie_io_base ==NULL ) { -pr_err ("PCIE: Failed to map IO\n" ); - err = -ENOMEM ; - goto err_map_io; - } - err =request_irq (INT_PCIE_INTR , tegra_pcie_isr,IRQF_SHARED ,"PCIE" , &tegra_pcie);if (err) {pr_err ("PCIE: Failed to register IRQ: %d\n" , err); - goto err_irq; + goto err_req_io; }set_irq_flags (INT_PCIE_INTR ,IRQF_VALID );return 0 ; -err_irq: -iounmap (tegra_pcie_io_base); -err_map_io: -release_resource (&tegra_pcie.res_mmio); err_req_io:iounmap (tegra_pcie.regs); err_map_reg:Signature · 1 line
1.7.9.5
PATCH 3/15 ARM: tegra: use fixed PCI i/o mapping
Quoted 7 lines · Rob Herring
Quoted 6 lines
I'm not very familiar with the inner workings of the iotable and the mappings initialized by it, but I wonder if this can be done dynamically at a later stage. The way this is currently done in this patch, the I/O region is statically mapped from a fixed offset within the PCIe address range. Part of the patches to add DT support is to allow this region to be defined by the DT, so that will obviously also create problems.
Quoted 7 lines
Is the i/o address something you could extract from DT earlier? This can be done separately if it doesn't require information from the driver.
I'm sure exactly how to do a fixed virtual mapping other than the
io_tablemappings. There was some discussion of use fixmap region previously, but doing so will be a bit more complex. I'll look into this some.
I think you can call ioremap_page_range() to do this.
Arnd
PATCH 3/15 ARM: tegra: use fixed PCI i/o mapping
Quoted 11 lines · Arnd Bergmann
Quoted 10 lines · Rob Herring
Quoted 6 lines
I'm not very familiar with the inner workings of the iotable and the mappings initialized by it, but I wonder if this can be done dynamically at a later stage. The way this is currently done in this patch, the I/O region is statically mapped from a fixed offset within the PCIe address range. Part of the patches to add DT support is to allow this region to be defined by the DT, so that will obviously also create problems.
Is the i/o address something you could extract from DT earlier? This can be done separately if it doesn't require information from the driver.
Quoted 6 lines
Quoted 4 lines
I'm sure exactly how to do a fixed virtual mapping other than the
io_tablemappings. There was some discussion of use fixmap region previously, but doing so will be a bit more complex. I'll look into this some.I think you can call
ioremap_page_range()to do this.
Thanks for the pointer. But this has to be in 2 steps. First reserve the virtual space and then map it. For the first part I think something like this function will work:
void __init pci_reserve_io(void)
{
struct vm_struct *vm;
vm = early_alloc_aligned(sizeof(*vm), __alignof__(*vm));
vm->addr = (void *)PCI_IO_VIRT_BASE;
vm->size = SZ_1M;
vm->phys_addr = 0;
vm->flags = VM_IOREMAP | VM_ARM_STATIC_MAPPING;
vm->flags |= VM_ARM_MTYPE(MT_DEVICE);
vm->caller = pci_reserve_io;
vm_area_add_early(vm++);
}There's a big fat warning on vm_area_add_early from Nico to not use unless you know what you're doing. I'll pretend I do...
Rob
PATCH 3/15 ARM: tegra: use fixed PCI i/o mapping
Quoted 38 lines · Rob Herring
Quoted 11 lines · Arnd Bergmann
Quoted 10 lines · Rob Herring
Quoted 6 lines
I'm not very familiar with the inner workings of the iotable and the mappings initialized by it, but I wonder if this can be done dynamically at a later stage. The way this is currently done in this patch, the I/O region is statically mapped from a fixed offset within the PCIe address range. Part of the patches to add DT support is to allow this region to be defined by the DT, so that will obviously also create problems.
Is the i/o address something you could extract from DT earlier? This can be done separately if it doesn't require information from the driver.
Quoted 6 lines
Quoted 4 lines
I'm sure exactly how to do a fixed virtual mapping other than the
io_tablemappings. There was some discussion of use fixmap region previously, but doing so will be a bit more complex. I'll look into this some.I think you can call
ioremap_page_range()to do this.Thanks for the pointer. But this has to be in 2 steps. First reserve the virtual space and then map it. For the first part I think something like this function will work:
void
__initpci_reserve_io(void){ struct vm_struct *vm; vm = early_alloc_aligned(sizeof(*vm), __alignof__(*vm)); vm->addr = (void *)PCI_IO_VIRT_BASE; vm->size = SZ_1M; vm->phys_addr = 0; vm->flags = VM_IOREMAP | VM_ARM_STATIC_MAPPING; vm->flags |= VM_ARM_MTYPE(MT_DEVICE); vm->caller = pci_reserve_io; vm_area_add_early(vm++); }
Quoted 2 lines
There's a big fat warning on
vm_area_add_earlyfrom Nico to not use unless you know what you're doing. I'll pretend I do...
:-)
This warning was inherited from vm_area_register_early() which used to make the core of what vm_area_add_early() is today.
Your usage of vm_area_add_early() should be fine as long as it is done before vmalloc_init(() is called.
Nicolas
PATCH 4/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 | 9 ++---- 4 files changed, 7 insertions(+), 40 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 +3 -6
@@ -49,6 +49,7 @@#include <asm/mach/arch.h> #include <asm/mach/irq.h> #include <asm/mach/map.h> +#include <asm/mach/pci.h> #include <asm/mach/time.h> #include <plat/fpga-irq.h>
@@ -72,7 +73,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,16 +147,12 @@ 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 } };static void __init ap_map_io (void ) { +pci_map_io_single (PHYS_PCI_IO_BASE );iotable_init (ap_io_desc,ARRAY_SIZE (ap_io_desc)); vga_base =PCI_MEMORY_VADDR ; }
Signature · 1 line
1.7.9.5
PATCH 5/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 1MB, but nothing is using that much space AFAICT.
--- arch/arm/Kconfig | 1 - arch/arm/mach-shark/core.c | 14 ++------------ 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 ------------------ 5 files changed, 8 insertions(+), 35 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 +2 -12
@@ -18,11 +18,10 @@#include <asm/system_misc.h> #include <asm/mach/map.h> +#include <asm/mach/pci.h> #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,18 +103,9 @@ 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)); +pci_map_io_single (IO_START ); }#define IRQ_TIMER 0
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
Signature · 1 line
1.7.9.5
PATCH 6/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 | 10 ++++------ .../arm/mach-footbridge/include/mach/debug-macro.S | 3 ++- arch/arm/mach-footbridge/include/mach/io.h | 12 ++---------- 4 files changed, 9 insertions(+), 18 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 +4 -6
@@ -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 };
@@ -196,8 +192,10 @@ void __init footbridge_map_io(void)* Now, work out what we've got to map in addition on this * platform. */ -if (footbridge_cfn_mode ()) +if (footbridge_cfn_mode ()) { +pci_map_io_single (DC21285_PCI_IO );iotable_init (ebsa285_host_io_desc,ARRAY_SIZE (ebsa285_host_io_desc)); + } }void footbridge_restart (char mode,const char *cmd)
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 7/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 | 15 +++++---------- arch/arm/mach-dove/include/mach/dove.h | 2 -- arch/arm/mach-dove/include/mach/io.h | 19 ------------------- arch/arm/mach-dove/pcie.c | 9 ++------- 5 files changed, 7 insertions(+), 39 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 +5 -10
@@ -49,21 +49,16 @@ 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, }, };void __init dove_map_io (void ) { +unsigned long pci_io_pfn[] = { +__phys_to_pfn (DOVE_PCIE0_IO_PHYS_BASE ), +__phys_to_pfn (DOVE_PCIE1_IO_PHYS_BASE ), + }; +pci_map_io_pfn (pci_io_pfn,ARRAY_SIZE (pci_io_pfn),SZ_1M );iotable_init (dove_io_desc,ARRAY_SIZE (dove_io_desc)); }
arch/arm/mach-dove/include/mach/dove.h +0 -2
@@ -50,12 +50,10 @@#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_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
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 +2 -7
@@ -60,13 +60,8 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys) "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 ].start = nr *SZ_1M ; + pp->res[0 ].end = pp->res[0 ].start +SZ_64K -1 ; pp->res[0 ].flags =IORESOURCE_IO ;if (request_resource (&ioport_resource, &pp->res[0 ]))panic ("Request PCIe IO resource failed\n" );
Signature · 1 line
1.7.9.5
PATCH 7/15 ARM: dove: use fixed PCI i/o mapping
Quoted 8 lines · Rob Herring
arch/arm/mach-dove/pcie.c +0
-2@@ -60,13 +60,8 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys) "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 ;
arch/arm/mach-dove/pcie.c static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys) · line 67
Quoted 10 lines
arch/arm/mach-dove/pcie.c +2
-5- 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 ].start = nr *SZ_1M ; + pp->res[0 ].end = pp->res[0 ].start +SZ_64K -1 ; pp->res[0 ].flags =IORESOURCE_IO ;if (request_resource (&ioport_resource, &pp->res[0 ]))panic ("Request PCIe IO resource failed\n" );
Why use SZ_64K here when the mapping is actually 1M?
Arnd
PATCH 7/15 ARM: dove: use fixed PCI i/o mapping
Quoted 13 lines · Arnd Bergmann
Quoted 12 lines · Rob Herring
arch/arm/mach-dove/pcie.c +0
-6@@ -60,13 +60,8 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys) "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 ;
Quoted 8 lines
arch/arm/mach-dove/pcie.c static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys) · line 67
Quoted 6 lines
arch/arm/mach-dove/pcie.c +2
-1- } + pp->res[0 ].start = nr *SZ_1M ; + pp->res[0 ].end = pp->res[0 ].start +SZ_64K -1 ; pp->res[0 ].flags =IORESOURCE_IO ;if (request_resource (&ioport_resource, &pp->res[0 ]))panic ("Request PCIe IO resource failed\n" );Why use
SZ_64Khere when the mapping is actually 1M?
Why use 1M when 64K is enough based on our prior conversations? The more we standardize the configuration, the more we can make common. I think the majority of the pci setup functions can be consolidated. It's really just data differences for the resource setup. I only used 1M alignment in case there were some alignment requirements in the h/w and it can't handle a starting pci bus address of 0x10000. I think it's just the Marvell parts that do this, so if anyone knowledgeable on those parts can comment it would help.
Rob
PATCH 7/15 ARM: dove: use fixed PCI i/o mapping
Quoted 8 lines · Rob Herring
Why use 1M when 64K is enough based on our prior conversations? The more we standardize the configuration, the more we can make common. I think the majority of the pci setup functions can be consolidated. It's really just data differences for the resource setup. I only used 1M alignment in case there were some alignment requirements in the h/w and it can't handle a starting pci bus address of
0x10000. I think it's just the Marvell parts that do this, so if anyone knowledgeable on those parts can comment it would help.
IIRC among the plat-orion platforms (dove, kirkwood, mv78xx0, orion), this one is the only one where you use 64kb in the resource but 1MB for the mapping, while in the other ones they are always the same. I agree that the 64kb resource doesn't hurt, we should just be more consistent.
Arnd
PATCH 7/15 ARM: dove: use fixed PCI i/o mapping
In reply to Rob HerringQuoted 8 lines · Rob Herring
Why use 1M when 64K is enough based on our prior conversations? The more we standardize the configuration, the more we can make common. I think the majority of the pci setup functions can be consolidated. It's really just data differences for the resource setup. I only used 1M alignment in case there were some alignment requirements in the h/w and it can't handle a starting pci bus address of
0x10000. I think it's just the Marvell parts that do this, so if anyone knowledgeable on those parts can comment it would help.
The only Marvell board I have which can accommodate a PCI card does support 3.3V PCI cards only. Otherwise this is all PCI Express. And the only PCI cards with I/O space I've seen are 5V PCI cards.
So I'd say: go for the option with the best consolidation outcome. No one is using cards with I/O space on those platforms.
Nicolas
PATCH 7/15 ARM: dove: use fixed PCI i/o mapping
Quoted 11 lines · Nicolas Pitre
Quoted 8 lines · Rob Herring
Why use 1M when 64K is enough based on our prior conversations? The more we standardize the configuration, the more we can make common. I think the majority of the pci setup functions can be consolidated. It's really just data differences for the resource setup. I only used 1M alignment in case there were some alignment requirements in the h/w and it can't handle a starting pci bus address of
0x10000. I think it's just the Marvell parts that do this, so if anyone knowledgeable on those parts can comment it would help.
Quoted 3 lines
The only Marvell board I have which can accommodate a PCI card does support 3.3V PCI cards only. Otherwise this is all PCI Express. And the only PCI cards with I/O space I've seen are 5V PCI cards.
All graphics cards and ATA controllers support backwards compatible PIO access to the VGA or IDE registers, and they are available for PCI express.
A lot of PCIe legacy I/O cards (uart, printer, GPIO) can also use PIO
mode to be backwards compatible.
Quoted 2 lines
So I'd say: go for the option with the best consolidation outcome. No one is using cards with I/O space on those platforms.
That is probably true.
Arnd
PATCH 8/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 | 17 +++++++---------- arch/arm/mach-kirkwood/include/mach/io.h | 24 ------------------------ arch/arm/mach-kirkwood/include/mach/kirkwood.h | 2 -- 4 files changed, 7 insertions(+), 37 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 +7 -10
@@ -22,6 +22,7 @@#include <asm/timex.h> #include <asm/kexec.h> #include <asm/mach/map.h> +#include <asm/mach/pci.h> #include <asm/mach/time.h> #include <mach/kirkwood.h> #include <mach/bridge-regs.h>
@@ -41,16 +42,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 ,
@@ -60,6 +51,12 @@ static struct map_desc kirkwood_io_desc[] __initdata = {void __init kirkwood_map_io (void ) { +unsigned long pci_io_pfn[] = { +__phys_to_pfn (KIRKWOOD_PCIE_IO_PHYS_BASE ), +__phys_to_pfn (KIRKWOOD_PCIE1_IO_PHYS_BASE ), + }; +pci_map_io_pfn (pci_io_pfn,ARRAY_SIZE (pci_io_pfn),SZ_1M ); +iotable_init (kirkwood_io_desc,ARRAY_SIZE (kirkwood_io_desc)); }
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 +0 -2
@@ -37,12 +37,10 @@#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_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
Signature · 1 line
1.7.9.5
PATCH 9/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 | 16 ++++++---------- arch/arm/mach-orion5x/include/mach/io.h | 22 ---------------------- arch/arm/mach-orion5x/include/mach/orion5x.h | 14 ++++++-------- 4 files changed, 12 insertions(+), 41 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 +6 -10
@@ -26,6 +26,7 @@#include <asm/timex.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> +#include <asm/mach/pci.h> #include <asm/mach/time.h> #include <mach/bridge-regs.h> #include <mach/hardware.h>
@@ -47,16 +48,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,
@@ -66,6 +57,11 @@ static struct map_desc orion5x_io_desc[] __initdata = {void __init orion5x_map_io (void ) { +unsigned long pci_io_pfn[] = { +__phys_to_pfn (ORION5X_PCIE_IO_PHYS_BASE ), +__phys_to_pfn (ORION5X_PCI_IO_PHYS_BASE ), + }; +pci_map_io_pfn (pci_io_pfn,ARRAY_SIZE (pci_io_pfn),SZ_1M );iotable_init (orion5x_io_desc,ARRAY_SIZE (orion5x_io_desc)); }
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 +6 -8
@@ -31,22 +31,20 @@* 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 1M PCIe I/O space +* fef00000 f2100000 1M 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_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
@@ -55,7 +53,7 @@/* 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
Signature · 1 line
1.7.9.5
PATCH 10/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 11/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 | 6 ++---- arch/arm/mach-iop13xx/setup.c | 17 +++++++--------- 4 files changed, 9 insertions(+), 43 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 +2 -4
@@ -69,12 +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 +* 0x1000 + 64K 0x0.fffb.1000 0xfef0.1000 PCIX outbound i/o window +* 0x1000 + 64K 0x0.fffd.1000 0xfef1.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 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 +\
@@ -103,7 +102,6 @@ extern unsigned long get_iop_tick_rate(void);/* 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 +\
arch/arm/mach-iop13xx/setup.c +7 -10
@@ -24,6 +24,7 @@#include <linux/mtd/physmap.h> #endif #include <asm/mach/map.h> +#include <asm/mach/pci.h> #include <mach/hardware.h> #include <asm/irq.h> #include <asm/hardware/iop_adma.h>
@@ -40,16 +41,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, }, };
@@ -363,6 +354,12 @@ static struct platform_device iop13xx_adma_2_channel = {void __init iop13xx_map_io (void ) { +unsigned long pfn[] = { +__phys_to_pfn (IOP13XX_PCIX_LOWER_IO_PA ), +__phys_to_pfn (IOP13XX_PCIE_LOWER_IO_PA ), + }; +pci_map_io_pfn (pfn,ARRAY_SIZE (pfn),SZ_1M ); +/* Initialize the Static Page Table maps */ iotable_init (iop13xx_std_desc,ARRAY_SIZE (iop13xx_std_desc)); }
Signature · 1 line
1.7.9.5
PATCH 12/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 | 1 + arch/arm/mach-mv78xx0/common.c | 18 ++++++++++++----- arch/arm/mach-mv78xx0/include/mach/io.h | 24 ---------------------- arch/arm/mach-mv78xx0/include/mach/mv78xx0.h | 22 +++++++++----------- arch/arm/mach-mv78xx0/pcie.c | 28 +++++--------------------- 6 files changed, 29 insertions(+), 65 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 +1 -0
@@ -13,6 +13,7 @@#include <linux/mbus.h> #include <linux/io.h> #include <plat/addr-map.h> +#include <mach/mv78xx0.h> #include "common.h" /*
arch/arm/mach-mv78xx0/common.c +13 -5
@@ -17,6 +17,7 @@#include <linux/ethtool.h> #include <asm/mach/map.h> #include <asm/mach/time.h> +#include <asm/mach/pci.h> #include <mach/mv78xx0.h> #include <mach/bridge-regs.h> #include <plat/cache-feroceon-l2.h>
@@ -135,11 +136,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,
@@ -150,6 +146,18 @@ static struct map_desc mv78xx0_io_desc[] __initdata = {void __init mv78xx0_map_io (void ) {unsigned long phys; +unsigned long pci_io_pfn[] = { +__phys_to_pfn (MV78XX0_PCIE_IO_PHYS_BASE (0 )), +__phys_to_pfn (MV78XX0_PCIE_IO_PHYS_BASE (1 )), +__phys_to_pfn (MV78XX0_PCIE_IO_PHYS_BASE (2 )), +__phys_to_pfn (MV78XX0_PCIE_IO_PHYS_BASE (3 )), +__phys_to_pfn (MV78XX0_PCIE_IO_PHYS_BASE (4 )), +__phys_to_pfn (MV78XX0_PCIE_IO_PHYS_BASE (5 )), +__phys_to_pfn (MV78XX0_PCIE_IO_PHYS_BASE (6 )), +__phys_to_pfn (MV78XX0_PCIE_IO_PHYS_BASE (7 )), + }; + +pci_map_io_pfn (pci_io_pfn,ARRAY_SIZE (pci_io_pfn),SZ_64K );/* * Map the right set of per-core registers depending on
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 -12
@@ -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,9 @@#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 +5 -23
@@ -15,6 +15,7 @@#include <asm/mach/pci.h> #include <plat/pcie.h> #include <plat/addr-map.h> +#include <mach/mv78xx0.h> #include "common.h" struct pcie_port {
@@ -30,9 +31,6 @@ struct pcie_port {static struct pcie_port pcie_port[8 ];static int num_pcie_ports; -static struct resource pcie_io_space; -static struct resource pcie_mem_space; -void __init mv78xx0_pcie_id (u32 *dev,u32 *rev) {
@@ -47,22 +45,6 @@ static void __init mv78xx0_pcie_preinit(void)u32 start;int win; - pcie_io_space.name ="PCIe I/O Space" ; - pcie_io_space.start =MV78XX0_PCIE_IO_PHYS_BASE (0 ); - pcie_io_space.end = -MV78XX0_PCIE_IO_PHYS_BASE (0 ) +MV78XX0_PCIE_IO_SIZE *8 -1 ; - pcie_io_space.flags =IORESOURCE_IO ; -if (request_resource (&iomem_resource, &pcie_io_space)) -panic ("can't allocate PCIe I/O space" ); - - pcie_mem_space.name ="PCIe MEM Space" ; - pcie_mem_space.start =MV78XX0_PCIE_MEM_PHYS_BASE ; - pcie_mem_space.end = -MV78XX0_PCIE_MEM_PHYS_BASE +MV78XX0_PCIE_MEM_SIZE -1 ; - pcie_mem_space.flags =IORESOURCE_MEM ; -if (request_resource (&iomem_resource, &pcie_mem_space)) -panic ("can't allocate PCIe MEM space" ); -for (i =0 ; i < num_pcie_ports; i++) {struct pcie_port *pp = pcie_port + i;
@@ -70,8 +52,8 @@ static void __init mv78xx0_pcie_preinit(void) "PCIe %d.%d I/O", pp->maj, pp->min); pp->io_space_name[sizeof (pp->io_space_name) -1 ] =0 ; pp->res[0 ].name = pp->io_space_name; - pp->res[0 ].start =MV78XX0_PCIE_IO_PHYS_BASE (i); - pp->res[0 ].end = pp->res[0 ].start +MV78XX0_PCIE_IO_SIZE -1 ; + pp->res[0 ].start = i *SZ_64K ; + pp->res[0 ].end = pp->res[0 ].start +SZ_64K -1 ; pp->res[0 ].flags =IORESOURCE_IO ; snprintf(pp->mem_space_name, sizeof(pp->mem_space_name),
@@ -118,10 +100,10 @@ static void __init mv78xx0_pcie_preinit(void)for (i =0 ; i < num_pcie_ports; i++) {struct pcie_port *pp = pcie_port + i; -if (request_resource (&pcie_io_space, &pp->res[0 ])) +if (request_resource (&ioport_resource, &pp->res[0 ]))panic ("can't allocate PCIe I/O sub-space" ); -if (request_resource (&pcie_mem_space, &pp->res[1 ])) +if (request_resource (&iomem_resource, &pp->res[1 ]))panic ("can't allocate PCIe MEM sub-space" ); }
Signature · 1 line
1.7.9.5
PATCH 13/15 i2c: iop3xx: clean-up trailing whitespace
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Remove a bunch of trailing whitespace. No functional changes.
--- drivers/i2c/busses/i2c-iop3xx.c | 112 +++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 56 deletions(-)
drivers/i2c/busses/i2c-iop3xx.c +56 -56
@@ -4,13 +4,13 @@/* Copyright (C) 2003 Peter Milne, D-TACQ Solutions Ltd * <Peter dot Milne@D hyphen TACQ dot com> * -* With acknowledgements to i2c-algo-ibm_ocp.c by +* With acknowledgements to i2c-algo-ibm_ocp.c by * Ian DaSilva, MontaVista Software, Inc. idasilva at mvista.com * * And i2c-algo-pcf.c, which was created by Simon G. Vogl and Hans Berglund: * * Copyright (C) 1995-1997 Simon G. Vogl, 1998-2000 Hans Berglund -* +* * And which acknowledged Ky?sti M?lkki <[email protected]>, * Frodo Looijaard <[email protected]>, Martin Bailey<[email protected]> *
@@ -45,8 +45,8 @@/* global unit counter */ static int i2c_id; -static inline unsigned char -iic_cook_addr (struct i2c_msg *msg) +static inline unsigned char +iic_cook_addr (struct i2c_msg *msg) {unsigned char addr;
@@ -55,24 +55,24 @@ iic_cook_addr(struct i2c_msg *msg)if (msg->flags &I2C_M_RD ) addr |=1 ; -return addr; +return addr; } -static void +static void iop3xx_i2c_reset (struct i2c_algo_iop3xx_data *iop3xx_adap) {/* Follows devman 9.3 */ __raw_writel (IOP3XX_ICR_UNIT_RESET , iop3xx_adap->ioaddr +CR_OFFSET );__raw_writel (IOP3XX_ISR_CLEARBITS , iop3xx_adap->ioaddr +SR_OFFSET );__raw_writel (0 , iop3xx_adap->ioaddr +CR_OFFSET ); -} +} -static void +static void iop3xx_i2c_enable (struct i2c_algo_iop3xx_data *iop3xx_adap) {u32 cr =IOP3XX_ICR_GCD |IOP3XX_ICR_SCLEN |IOP3XX_ICR_UE ; -/* +/* * Every time unit enable is asserted, GPOD needs to be cleared * on IOP3XX to avoid data corruption on the bus. */
@@ -86,7 +86,7 @@ iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap) }#endif /* NB SR bits not same position as CR IE bits :-( */ - iop3xx_adap->SR_enabled = + iop3xx_adap->SR_enabled =IOP3XX_ISR_ALD |IOP3XX_ISR_BERRD |IOP3XX_ISR_RXFULL |IOP3XX_ISR_TXEMPTY ;
@@ -96,23 +96,23 @@ iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap)__raw_writel (cr, iop3xx_adap->ioaddr +CR_OFFSET ); } -static void +static void iop3xx_i2c_transaction_cleanup (struct i2c_algo_iop3xx_data *iop3xx_adap) {unsigned long cr =__raw_readl (iop3xx_adap->ioaddr +CR_OFFSET ); - - cr &= ~(IOP3XX_ICR_MSTART |IOP3XX_ICR_TBYTE | + + cr &= ~(IOP3XX_ICR_MSTART |IOP3XX_ICR_TBYTE |IOP3XX_ICR_MSTOP |IOP3XX_ICR_SCLEN );__raw_writel (cr, iop3xx_adap->ioaddr +CR_OFFSET ); } -/* -* NB: the handler has to clear the source of the interrupt! +/* +* NB: the handler has to clear the source of the interrupt! * Then it passes the SR flags of interest to BH via adap data */ -static irqreturn_t -iop3xx_i2c_irq_handler (int this_irq,void *dev_id) +static irqreturn_t +iop3xx_i2c_irq_handler (int this_irq,void *dev_id) {struct i2c_algo_iop3xx_data *iop3xx_adap = dev_id;u32 sr =__raw_readl (iop3xx_adap->ioaddr +SR_OFFSET );
@@ -126,7 +126,7 @@ iop3xx_i2c_irq_handler(int this_irq, void *dev_id) }/* check all error conditions, clear them , report most important */ -static int +static int iop3xx_i2c_error (u32 sr) {int rc =0 ;
@@ -135,12 +135,12 @@ iop3xx_i2c_error(u32 sr)if ( !rc ) rc = -I2C_ERR_BERR ; }if ((sr &IOP3XX_ISR_ALD )) { -if ( !rc ) rc = -I2C_ERR_ALD ; +if ( !rc ) rc = -I2C_ERR_ALD ; } -return rc; +return rc; } -static inline u32 +static inline u32 iop3xx_i2c_get_srstat (struct i2c_algo_iop3xx_data *iop3xx_adap) {unsigned long flags;
@@ -161,8 +161,8 @@ iop3xx_i2c_get_srstat(struct i2c_algo_iop3xx_data *iop3xx_adap)typedef int (*compare_func )(unsigned test,unsigned mask);/* returns 1 on correct comparison */ -static int -iop3xx_i2c_wait_event (struct i2c_algo_iop3xx_data *iop3xx_adap, +static int +iop3xx_i2c_wait_event (struct i2c_algo_iop3xx_data *iop3xx_adap,unsigned flags,unsigned * status,compare_func compare) {
@@ -192,47 +192,47 @@ iop3xx_i2c_wait_event(struct i2c_algo_iop3xx_data *iop3xx_adap, }/* -* Concrete compare_funcs +* Concrete compare_funcs */ -static int +static int all_bits_clear (unsigned test,unsigned mask) {return (test & mask) ==0 ; } -static int +static int any_bits_set (unsigned test,unsigned mask) {return (test & mask) !=0 ; } -static int +static int iop3xx_i2c_wait_tx_done (struct i2c_algo_iop3xx_data *iop3xx_adap,int *status) { -return iop3xx_i2c_wait_event ( - iop3xx_adap, +return iop3xx_i2c_wait_event ( + iop3xx_adap,IOP3XX_ISR_TXEMPTY |IOP3XX_ISR_ALD |IOP3XX_ISR_BERRD , status, any_bits_set); } -static int +static int iop3xx_i2c_wait_rx_done (struct i2c_algo_iop3xx_data *iop3xx_adap,int *status) { -return iop3xx_i2c_wait_event ( - iop3xx_adap, +return iop3xx_i2c_wait_event ( + iop3xx_adap,IOP3XX_ISR_RXFULL |IOP3XX_ISR_ALD |IOP3XX_ISR_BERRD , status, any_bits_set); } -static int +static int iop3xx_i2c_wait_idle (struct i2c_algo_iop3xx_data *iop3xx_adap,int *status) { -return iop3xx_i2c_wait_event ( +return iop3xx_i2c_wait_event ( iop3xx_adap,IOP3XX_ISR_UNITBUSY , status, all_bits_clear); } -static int -iop3xx_i2c_send_target_addr (struct i2c_algo_iop3xx_data *iop3xx_adap, +static int +iop3xx_i2c_send_target_addr (struct i2c_algo_iop3xx_data *iop3xx_adap,struct i2c_msg * msg) {unsigned long cr =__raw_readl (iop3xx_adap->ioaddr +CR_OFFSET );
@@ -247,7 +247,7 @@ iop3xx_i2c_send_target_addr(struct i2c_algo_iop3xx_data *iop3xx_adap, }__raw_writel (iic_cook_addr (msg), iop3xx_adap->ioaddr +DBR_OFFSET ); - + cr &= ~(IOP3XX_ICR_MSTOP |IOP3XX_ICR_NACK ); cr |=IOP3XX_ICR_MSTART |IOP3XX_ICR_TBYTE ;
@@ -257,8 +257,8 @@ iop3xx_i2c_send_target_addr(struct i2c_algo_iop3xx_data *iop3xx_adap,return rc; } -static int -iop3xx_i2c_write_byte (struct i2c_algo_iop3xx_data *iop3xx_adap,char byte, +static int +iop3xx_i2c_write_byte (struct i2c_algo_iop3xx_data *iop3xx_adap,char byte,int stop) {unsigned long cr =__raw_readl (iop3xx_adap->ioaddr +CR_OFFSET );
@@ -277,10 +277,10 @@ iop3xx_i2c_write_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char byte, rc =iop3xx_i2c_wait_tx_done (iop3xx_adap, &status);return rc; -} +} -static int -iop3xx_i2c_read_byte (struct i2c_algo_iop3xx_data *iop3xx_adap,char * byte, +static int +iop3xx_i2c_read_byte (struct i2c_algo_iop3xx_data *iop3xx_adap,char * byte,int stop) {unsigned long cr =__raw_readl (iop3xx_adap->ioaddr +CR_OFFSET );
@@ -304,19 +304,19 @@ iop3xx_i2c_read_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char* byte,return rc; } -static int +static int iop3xx_i2c_writebytes (struct i2c_adapter *i2c_adap,const char *buf,int count) {struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data;int ii;int rc =0 ; -for (ii =0 ; rc ==0 && ii != count; ++ii) +for (ii =0 ; rc ==0 && ii != count; ++ii) rc =iop3xx_i2c_write_byte (iop3xx_adap, buf[ii], ii==count-1 );return rc; } -static int +static int iop3xx_i2c_readbytes (struct i2c_adapter *i2c_adap,char *buf,int count) {struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data;
@@ -325,7 +325,7 @@ iop3xx_i2c_readbytes(struct i2c_adapter *i2c_adap, char *buf, int count)for (ii =0 ; rc ==0 && ii != count; ++ii) rc =iop3xx_i2c_read_byte (iop3xx_adap, &buf[ii], ii==count-1 ); - +return rc; }
@@ -336,8 +336,8 @@ iop3xx_i2c_readbytes(struct i2c_adapter *i2c_adap, char *buf, int count)* Each transfer (i.e. a read or a write) is separated by a repeated start * condition. */ -static int -iop3xx_i2c_handle_msg (struct i2c_adapter *i2c_adap,struct i2c_msg * pmsg) +static int +iop3xx_i2c_handle_msg (struct i2c_adapter *i2c_adap,struct i2c_msg * pmsg) {struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data;int rc;
@@ -357,8 +357,8 @@ iop3xx_i2c_handle_msg(struct i2c_adapter *i2c_adap, struct i2c_msg* pmsg)/* * master_xfer() - main read/write entry */ -static int -iop3xx_i2c_master_xfer (struct i2c_adapter *i2c_adap,struct i2c_msg *msgs, +static int +iop3xx_i2c_master_xfer (struct i2c_adapter *i2c_adap,struct i2c_msg *msgs,int num) {struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data;
@@ -375,14 +375,14 @@ iop3xx_i2c_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, }iop3xx_i2c_transaction_cleanup (iop3xx_adap); - +if (ret)return ret; -return im; +return im; } -static u32 +static u32 iop3xx_i2c_func (struct i2c_adapter *adap) {return I2C_FUNC_I2C |I2C_FUNC_SMBUS_EMUL ;
@@ -393,11 +393,11 @@ static const struct i2c_algorithm iop3xx_i2c_algo = { .functionality = iop3xx_i2c_func, }; -static int +static int iop3xx_i2c_remove (struct platform_device *pdev) {struct i2c_adapter *padapter =platform_get_drvdata (pdev); -struct i2c_algo_iop3xx_data *adapter_data = +struct i2c_algo_iop3xx_data *adapter_data = (struct i2c_algo_iop3xx_data *)padapter->algo_data;struct resource *res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );unsigned long cr =__raw_readl (adapter_data->ioaddr +CR_OFFSET );
@@ -419,7 +419,7 @@ iop3xx_i2c_remove(struct platform_device *pdev)return 0 ; } -static int +static int iop3xx_i2c_probe (struct platform_device *pdev) {struct resource *res;
Signature · 1 line
1.7.9.5
PATCH 14/15 i2c: iop3xx: use standard gpiolib functions
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Instead of using the custom iop3xx gpio functions, use the gpiolib variants. This should be functionally the same since the gpiolib just calls the iop3xx gpio functions. This is needed in preparation of removing iop3xx mach/io.h headers.
--- drivers/i2c/busses/i2c-iop3xx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-iop3xx.c +5 -4
@@ -39,6 +39,7 @@#include <linux/platform_device.h> #include <linux/i2c.h> #include <linux/io.h> +#include <linux/gpio.h> #include "i2c-iop3xx.h"
@@ -78,11 +79,11 @@ iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap)*/ #if defined(CONFIG_ARCH_IOP32X ) || defined(CONFIG_ARCH_IOP33X )if (iop3xx_adap->id ==0 ) { -gpio_line_set (IOP3XX_GPIO_LINE (7 ),GPIO_LOW ); -gpio_line_set (IOP3XX_GPIO_LINE (6 ),GPIO_LOW ); +gpio_set_value (7 ,0 ); +gpio_set_value (6 ,0 ); }else { -gpio_line_set (IOP3XX_GPIO_LINE (5 ),GPIO_LOW ); -gpio_line_set (IOP3XX_GPIO_LINE (4 ),GPIO_LOW ); +gpio_set_value (5 ,0 ); +gpio_set_value (4 ,0 ); }#endif /* NB SR bits not same position as CR IE bits :-( */
Signature · 1 line
1.7.9.5
PATCH 14/15 i2c: iop3xx: use standard gpiolib functions
Quoted 7 lines · Rob Herring
From: Rob Herring <[email protected]>
Instead of using the custom iop3xx gpio functions, use the gpiolib variants. This should be functionally the same since the gpiolib just calls the iop3xx gpio functions. This is needed in preparation of removing iop3xx
mach/io.hheaders.
Quoted 5 lines
Signed-off-by Rob Herring <[email protected]>Cc "Jean Delvare (PC drivers, core)" <[email protected]>Cc "Ben Dooks (embedded platforms)" <[email protected]>Cc "Wolfram Sang (embedded platforms)" <[email protected]>Cc linux-i2c at vger.kernel.org
Is this dependent on another patch from this series? Or can this go via the I2C tree? I am fine with just acking this one, but the whitespace removal should better go via I2C I think.
Thanks,
Wolfram
Quoted 35 lines
--- drivers/i2c/busses/i2c-iop3xx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)drivers/i2c/busses/i2c-iop3xx.c +5
-4@@ -39,6 +39,7 @@#include <linux/platform_device.h> #include <linux/i2c.h> #include <linux/io.h> +#include <linux/gpio.h> #include "i2c-iop3xx.h" @@ -78,11 +79,11 @@ iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap)*/ #if defined(CONFIG_ARCH_IOP32X ) || defined(CONFIG_ARCH_IOP33X )if (iop3xx_adap->id ==0 ) { -gpio_line_set (IOP3XX_GPIO_LINE (7 ),GPIO_LOW ); -gpio_line_set (IOP3XX_GPIO_LINE (6 ),GPIO_LOW ); +gpio_set_value (7 ,0 ); +gpio_set_value (6 ,0 ); }else { -gpio_line_set (IOP3XX_GPIO_LINE (5 ),GPIO_LOW ); -gpio_line_set (IOP3XX_GPIO_LINE (4 ),GPIO_LOW ); +gpio_set_value (5 ,0 ); +gpio_set_value (4 ,0 ); }#endif /* NB SR bits not same position as CR IE bits :-( */ Signature · 1 line
1.7.9.5
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120708/d79ddf16/attachment-0001.sig>
PATCH 14/15 i2c: iop3xx: use standard gpiolib functions
Quoted 14 lines · Wolfram Sang
Quoted 7 lines · Rob Herring
From: Rob Herring <[email protected]>
Instead of using the custom iop3xx gpio functions, use the gpiolib variants. This should be functionally the same since the gpiolib just calls the iop3xx gpio functions. This is needed in preparation of removing iop3xx
mach/io.hheaders.Quoted 5 lines
Signed-off-by Rob Herring <[email protected]>Cc "Jean Delvare (PC drivers, core)" <[email protected]>Cc "Ben Dooks (embedded platforms)" <[email protected]>Cc "Wolfram Sang (embedded platforms)" <[email protected]>Cc linux-i2c at vger.kernel.org
Quoted 3 lines
Is this dependent on another patch from this series? Or can this go via the I2C tree? I am fine with just acking this one, but the whitespace removal should better go via I2C I think.
They can go in via i2c tree. The rest probably won't make 3.6.
Rob
Quoted 41 lines
Thanks,
Wolfram
Quoted 35 lines
--- drivers/i2c/busses/i2c-iop3xx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)drivers/i2c/busses/i2c-iop3xx.c +5
-4@@ -39,6 +39,7 @@#include <linux/platform_device.h> #include <linux/i2c.h> #include <linux/io.h> +#include <linux/gpio.h> #include "i2c-iop3xx.h" @@ -78,11 +79,11 @@ iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap)*/ #if defined(CONFIG_ARCH_IOP32X ) || defined(CONFIG_ARCH_IOP33X )if (iop3xx_adap->id ==0 ) { -gpio_line_set (IOP3XX_GPIO_LINE (7 ),GPIO_LOW ); -gpio_line_set (IOP3XX_GPIO_LINE (6 ),GPIO_LOW ); +gpio_set_value (7 ,0 ); +gpio_set_value (6 ,0 ); }else { -gpio_line_set (IOP3XX_GPIO_LINE (5 ),GPIO_LOW ); -gpio_line_set (IOP3XX_GPIO_LINE (4 ),GPIO_LOW ); +gpio_set_value (5 ,0 ); +gpio_set_value (4 ,0 ); }#endif /* NB SR bits not same position as CR IE bits :-( */ Signature · 1 line
1.7.9.5
PATCH 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 | 4 ++-- arch/arm/plat-iop/setup.c | 7 ++----- 6 files changed, 5 insertions(+), 58 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 +2 -2
@@ -196,8 +196,8 @@ int iop3xx_pci_setup(int nr, struct pci_sys_data *sys)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 ].start =IOP3XX_PCI_LOWER_IO_BA ; + res[0 ].end =IOP3XX_PCI_LOWER_IO_BA +SZ_64K -1 ; res[0 ].name ="IOP3XX PCI I/O Space" ; res[0 ].flags =IORESOURCE_IO ;request_resource (&ioport_resource, &res[0 ]);
arch/arm/plat-iop/setup.c +2 -5
@@ -13,6 +13,7 @@#include <linux/mm.h> #include <linux/init.h> #include <asm/mach/map.h> +#include <asm/mach/pci.h> #include <asm/hardware/iop3xx.h> /*
@@ -25,15 +26,11 @@ 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, }, };void __init iop3xx_map_io (void ) { +pci_map_io_single (IOP3XX_PCI_LOWER_IO_PA );iotable_init (iop3xx_std_desc,ARRAY_SIZE (iop3xx_std_desc)); }
Signature · 1 line
1.7.9.5
cover PCI io.h cleanups
In reply to Rob HerringQuoted 10 lines · Rob Herring
From: Rob Herring <[email protected]>
I've finally gotten back to this after several months. 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.As several platforms have 2 1MB I/O windows, I've changed the fixed mapping to 2MB (vs. 1MB in the prior posting) and allow platforms to control the size. This also allows using a single 1MB section mapping rather than 4KB pages.
Looks really good, feel free to add my Reviewed-by on patches 2-15, since I've done a line-by-line walkthrough and could not find anything besides the trivial comments I gave.
Quoted 3 lines
I've only tested versatilepb under qemu, 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.
Did you try running any devices that actually use I/O space in qemu? I think there are plenty of devices that you could use for testing that.
Arnd
cover PCI io.h cleanups
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · Rob Herring
From: Rob Herring <[email protected]>
I've finally gotten back to this after several months. 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.
Quoted 8 lines
Quoted 4 lines
As several platforms have 2 1MB I/O windows, I've changed the fixed mapping to 2MB (vs. 1MB in the prior posting) and allow platforms to control the size. This also allows using a single 1MB section mapping rather than 4KB pages.
Looks really good, feel free to add my Reviewed-by on patches 2-15, since I've done a line-by-line walkthrough and could not find anything besides the trivial comments I gave.
Thanks for the review. It's going to change a bit with using ioremap_page_range. Hope to have new version out soon.
Quoted 6 lines
Quoted 3 lines
I've only tested versatilepb under qemu, 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.
Did you try running any devices that actually use I/O space in qemu? I think there are plenty of devices that you could use for testing that.
I had with sym53c8xx, but it defaulted to memory accesses. Now that I enable i/o access mode, it fails due to pcibios_min_io = 0x44000000. With that removed it gets into the driver setup but then fails (with or without my changes). Might be a qemu model issue. I'll try some other devices.
Rob
Quoted 3 lines
Arnd
cover PCI io.h cleanups
Quoted 13 lines · Rob Herring
Quoted 12 lines · Arnd Bergmann
Quoted 10 lines · Rob Herring
From: Rob Herring <[email protected]>
I've finally gotten back to this after several months. 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.As several platforms have 2 1MB I/O windows, I've changed the fixed mapping to 2MB (vs. 1MB in the prior posting) and allow platforms to control the size. This also allows using a single 1MB section mapping rather than 4KB pages.
Quoted 6 lines
Quoted 3 lines
Looks really good, feel free to add my Reviewed-by on patches 2-15, since I've done a line-by-line walkthrough and could not find anything besides the trivial comments I gave.
Thanks for the review. It's going to change a bit with using
ioremap_page_range. Hope to have new version out soon.
Beware the fact that you can't use ioremap_page_range() early on during the boot as it uses the standard page allocator.
Nicolas