All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/15] PCI io.h cleanups
@ 2012-07-06 18:40 Rob Herring
  2012-07-06 18:40 ` [PATCH 01/15] ARM: Add fixed PCI i/o mapping Rob Herring
                   ` (14 more replies)
  0 siblings, 15 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

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

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 01/15] ARM: Add fixed PCI i/o mapping
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
@ 2012-07-06 18:40 ` Rob Herring
  2012-07-09 16:21   ` Arnd Bergmann
  2012-07-06 18:40 ` [PATCH 02/15] ARM: versatile: use " Rob Herring
                   ` (13 subsequent siblings)
  14 siblings, 1 reply; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

This adds a fixed virtual mapping for PCI i/o addresses. The mapping is
located at the last 2MB of vmalloc region (0xfee00000-0xff000000).

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Russell King <linux@arm.linux.org.uk>
Acked-by: Nicolas Pitre <nico@linaro.org>
---
 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(+)

diff --git a/Documentation/arm/memory.txt b/Documentation/arm/memory.txt
index 208a2d4..4bfb9ff 100644
--- a/Documentation/arm/memory.txt
+++ b/Documentation/arm/memory.txt
@@ -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.
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 815c669..e8bb4d2 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -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
diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h
index 26c511f..20a04af 100644
--- a/arch/arm/include/asm/mach/pci.h
+++ b/arch/arm/include/asm/mach/pci.h
@@ -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;
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 2555250..0ea0135 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -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;
+	}
+}
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 02/15] ARM: versatile: use fixed PCI i/o mapping
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
  2012-07-06 18:40 ` [PATCH 01/15] ARM: Add fixed PCI i/o mapping Rob Herring
@ 2012-07-06 18:40 ` Rob Herring
  2012-07-06 18:40 ` [PATCH 03/15] ARM: tegra: " Rob Herring
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

Move versatile PCI to fixed i/o mapping and remove io.h.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 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

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a91009c..8fb7e4a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index cd8ea35..49c0801 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -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));
 }
 
diff --git a/arch/arm/mach-versatile/include/mach/hardware.h b/arch/arm/mach-versatile/include/mach/hardware.h
index 408e58d..3e5d425 100644
--- a/arch/arm/mach-versatile/include/mach/hardware.h
+++ b/arch/arm/mach-versatile/include/mach/hardware.h
@@ -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)
diff --git a/arch/arm/mach-versatile/include/mach/io.h b/arch/arm/mach-versatile/include/mach/io.h
deleted file mode 100644
index 0406513..0000000
--- a/arch/arm/mach-versatile/include/mach/io.h
+++ /dev/null
@@ -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
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
index bec933b..9710d2c 100644
--- a/arch/arm/mach-versatile/pci.c
+++ b/arch/arm/mach-versatile/pci.c
@@ -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);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 03/15] ARM: tegra: use fixed PCI i/o mapping
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
  2012-07-06 18:40 ` [PATCH 01/15] ARM: Add fixed PCI i/o mapping Rob Herring
  2012-07-06 18:40 ` [PATCH 02/15] ARM: versatile: use " Rob Herring
@ 2012-07-06 18:40 ` Rob Herring
  2012-07-06 19:44   ` Stephen Warren
  2012-07-08  6:09   ` Thierry Reding
  2012-07-06 18:40 ` [PATCH 04/15] ARM: integrator: " Rob Herring
                   ` (11 subsequent siblings)
  14 siblings, 2 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

Move tegra PCI to fixed i/o mapping and remove io.h.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Colin Cross <ccross@android.com>
Cc: Olof Johansson <olof@lixom.net>
Acked-by: Stephen Warren <swarren@nvidia.com>
---
 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

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 8fb7e4a..ac446e3 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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,
diff --git a/arch/arm/mach-tegra/include/mach/io.h b/arch/arm/mach-tegra/include/mach/io.h
deleted file mode 100644
index fe700f9..0000000
--- a/arch/arm/mach-tegra/include/mach/io.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * arch/arm/mach-tegra/include/mach/io.h
- *
- * Copyright (C) 2010 Google, Inc.
- *
- * Author:
- *	Colin Cross <ccross@google.com>
- *	Erik Gilling <konkers@google.com>
- *
- * 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
diff --git a/arch/arm/mach-tegra/include/mach/iomap.h b/arch/arm/mach-tegra/include/mach/iomap.h
index 7e76da7..fee3a94 100644
--- a/arch/arm/mach-tegra/include/mach/iomap.h
+++ b/arch/arm/mach-tegra/include/mach/iomap.h
@@ -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)))
 
diff --git a/arch/arm/mach-tegra/io.c b/arch/arm/mach-tegra/io.c
index 58b4baf..7a29e10 100644
--- a/arch/arm/mach-tegra/io.c
+++ b/arch/arm/mach-tegra/io.c
@@ -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));
 }
diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c
index 0e09137..c989a8e 100644
--- a/arch/arm/mach-tegra/pcie.c
+++ b/arch/arm/mach-tegra/pcie.c
@@ -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:
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 04/15] ARM: integrator: use fixed PCI i/o mapping
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
                   ` (2 preceding siblings ...)
  2012-07-06 18:40 ` [PATCH 03/15] ARM: tegra: " Rob Herring
@ 2012-07-06 18:40 ` Rob Herring
  2012-07-06 18:40 ` [PATCH 05/15] ARM: shark: " Rob Herring
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

Move integrator PCI to fixed i/o mapping and remove io.h.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 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

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ac446e3..5d37628 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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
diff --git a/arch/arm/mach-integrator/include/mach/io.h b/arch/arm/mach-integrator/include/mach/io.h
deleted file mode 100644
index 8de70de..0000000
--- a/arch/arm/mach-integrator/include/mach/io.h
+++ /dev/null
@@ -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
diff --git a/arch/arm/mach-integrator/include/mach/platform.h b/arch/arm/mach-integrator/include/mach/platform.h
index ec467ba..4c03475 100644
--- a/arch/arm/mach-integrator/include/mach/platform.h
+++ b/arch/arm/mach-integrator/include/mach/platform.h
@@ -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
  * ------------------------------------------------------------------------
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index c857501..ceebba9 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -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;
 }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 05/15] ARM: shark: use fixed PCI i/o mapping
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
                   ` (3 preceding siblings ...)
  2012-07-06 18:40 ` [PATCH 04/15] ARM: integrator: " Rob Herring
@ 2012-07-06 18:40 ` Rob Herring
  2012-07-06 18:40 ` [PATCH 06/15] ARM: footbridge: " Rob Herring
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

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.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Russell King <linux@arm.linux.org.uk>
---
 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

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5d37628..3dfc555 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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>).
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c
index 2704bcd..6a2183a 100644
--- a/arch/arm/mach-shark/core.c
+++ b/arch/arm/mach-shark/core.c
@@ -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
diff --git a/arch/arm/mach-shark/include/mach/debug-macro.S b/arch/arm/mach-shark/include/mach/debug-macro.S
index 20eb2bf..d129119 100644
--- a/arch/arm/mach-shark/include/mach/debug-macro.S
+++ b/arch/arm/mach-shark/include/mach/debug-macro.S
@@ -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
diff --git a/arch/arm/mach-shark/include/mach/entry-macro.S b/arch/arm/mach-shark/include/mach/entry-macro.S
index 5901b09..c9e49f0 100644
--- a/arch/arm/mach-shark/include/mach/entry-macro.S
+++ b/arch/arm/mach-shark/include/mach/entry-macro.S
@@ -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
diff --git a/arch/arm/mach-shark/include/mach/io.h b/arch/arm/mach-shark/include/mach/io.h
deleted file mode 100644
index 1a45fc0..0000000
--- a/arch/arm/mach-shark/include/mach/io.h
+++ /dev/null
@@ -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
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 06/15] ARM: footbridge: use fixed PCI i/o mapping
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
                   ` (4 preceding siblings ...)
  2012-07-06 18:40 ` [PATCH 05/15] ARM: shark: " Rob Herring
@ 2012-07-06 18:40 ` Rob Herring
  2012-07-06 18:40 ` [PATCH 07/15] ARM: dove: " Rob Herring
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

Move footbridge PCI to fixed i/o mapping. io.h is still needed for the
!MMU case.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Russell King <linux@arm.linux.org.uk>
---
 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(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3dfc555..7215ebf 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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
diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c
index 3e6aaa6..8a739e0 100644
--- a/arch/arm/mach-footbridge/common.c
+++ b/arch/arm/mach-footbridge/common.c
@@ -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)
diff --git a/arch/arm/mach-footbridge/include/mach/debug-macro.S b/arch/arm/mach-footbridge/include/mach/debug-macro.S
index e5acde2..c169f0c 100644
--- a/arch/arm/mach-footbridge/include/mach/debug-macro.S
+++ b/arch/arm/mach-footbridge/include/mach/debug-macro.S
@@ -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
 
diff --git a/arch/arm/mach-footbridge/include/mach/io.h b/arch/arm/mach-footbridge/include/mach/io.h
index aba531ee..aba4638 100644
--- a/arch/arm/mach-footbridge/include/mach/io.h
+++ b/arch/arm/mach-footbridge/include/mach/io.h
@@ -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
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 07/15] ARM: dove: use fixed PCI i/o mapping
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
                   ` (5 preceding siblings ...)
  2012-07-06 18:40 ` [PATCH 06/15] ARM: footbridge: " Rob Herring
@ 2012-07-06 18:40 ` Rob Herring
  2012-07-09 15:50   ` Arnd Bergmann
  2012-07-06 18:40 ` [PATCH 08/15] ARM: kirkwood: " Rob Herring
                   ` (7 subsequent siblings)
  14 siblings, 1 reply; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

The i/o regions are changed from 1MB to 64KB. It's likely that the 2nd
bus is not setup correctly.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
---
 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

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7215ebf..ed930ad 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 9493076..83b38eb 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -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));
 }
 
diff --git a/arch/arm/mach-dove/include/mach/dove.h b/arch/arm/mach-dove/include/mach/dove.h
index d52b0ef..9936ed3 100644
--- a/arch/arm/mach-dove/include/mach/dove.h
+++ b/arch/arm/mach-dove/include/mach/dove.h
@@ -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
 
diff --git a/arch/arm/mach-dove/include/mach/io.h b/arch/arm/mach-dove/include/mach/io.h
deleted file mode 100644
index 29c8b85..0000000
--- a/arch/arm/mach-dove/include/mach/io.h
+++ /dev/null
@@ -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
diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c
index 47921b0..eba60dd 100644
--- a/arch/arm/mach-dove/pcie.c
+++ b/arch/arm/mach-dove/pcie.c
@@ -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");
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 08/15] ARM: kirkwood: use fixed PCI i/o mapping
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
                   ` (6 preceding siblings ...)
  2012-07-06 18:40 ` [PATCH 07/15] ARM: dove: " Rob Herring
@ 2012-07-06 18:40 ` Rob Herring
  2012-07-06 18:40 ` [PATCH 09/15] ARM: orion5x: " Rob Herring
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

Move kirkwood PCI to fixed i/o mapping and remove io.h.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Lennert Buytenhek <kernel@wantstofly.org>
Acked-by: Nicolas Pitre <nico@linaro.org>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
---
 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

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ed930ad..8a74244 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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:
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index f261cd2..45d9793 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -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));
 }
 
diff --git a/arch/arm/mach-kirkwood/include/mach/io.h b/arch/arm/mach-kirkwood/include/mach/io.h
deleted file mode 100644
index 5d0ab61..0000000
--- a/arch/arm/mach-kirkwood/include/mach/io.h
+++ /dev/null
@@ -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
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
index c5b6851..43e4f9b 100644
--- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h
+++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
@@ -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
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 09/15] ARM: orion5x: use fixed PCI i/o mapping
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
                   ` (7 preceding siblings ...)
  2012-07-06 18:40 ` [PATCH 08/15] ARM: kirkwood: " Rob Herring
@ 2012-07-06 18:40 ` Rob Herring
  2012-07-06 18:40 ` [PATCH 10/15] iop13xx: use more regular PCI I/O space handling Rob Herring
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

Move orion5x PCI to fixed i/o mapping and remove io.h.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Lennert Buytenhek <kernel@wantstofly.org>
Acked-by: Nicolas Pitre <nico@linaro.org>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
---
 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

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 8a74244..e542f99 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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:
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 9148b22..82a2502 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -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));
 }
 
diff --git a/arch/arm/mach-orion5x/include/mach/io.h b/arch/arm/mach-orion5x/include/mach/io.h
deleted file mode 100644
index 1aa5d0a..0000000
--- a/arch/arm/mach-orion5x/include/mach/io.h
+++ /dev/null
@@ -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
diff --git a/arch/arm/mach-orion5x/include/mach/orion5x.h b/arch/arm/mach-orion5x/include/mach/orion5x.h
index 683e085..e997a42 100644
--- a/arch/arm/mach-orion5x/include/mach/orion5x.h
+++ b/arch/arm/mach-orion5x/include/mach/orion5x.h
@@ -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
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 10/15] iop13xx: use more regular PCI I/O space handling
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
                   ` (8 preceding siblings ...)
  2012-07-06 18:40 ` [PATCH 09/15] ARM: orion5x: " Rob Herring
@ 2012-07-06 18:40 ` Rob Herring
  2012-07-06 18:40 ` [PATCH 11/15] ARM: iop13xx: use fixed PCI i/o mapping Rob Herring
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 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(-)

diff --git a/arch/arm/mach-iop13xx/include/mach/io.h b/arch/arm/mach-iop13xx/include/mach/io.h
index f131885..e197cb8 100644
--- a/arch/arm/mach-iop13xx/include/mach/io.h
+++ b/arch/arm/mach-iop13xx/include/mach/io.h
@@ -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
diff --git a/arch/arm/mach-iop13xx/include/mach/iop13xx.h b/arch/arm/mach-iop13xx/include/mach/iop13xx.h
index e190dcd..d3777db 100644
--- a/arch/arm/mach-iop13xx/include/mach/iop13xx.h
+++ b/arch/arm/mach-iop13xx/include/mach/iop13xx.h
@@ -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 -\
diff --git a/arch/arm/mach-iop13xx/io.c b/arch/arm/mach-iop13xx/io.c
index 3c36419..851dc8f 100644
--- a/arch/arm/mach-iop13xx/io.c
+++ b/arch/arm/mach-iop13xx/io.c
@@ -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;
 	}
diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c
index 861cb12..1bb905a 100644
--- a/arch/arm/mach-iop13xx/pci.c
+++ b/arch/arm/mach-iop13xx/pci.c
@@ -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:
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 11/15] ARM: iop13xx: use fixed PCI i/o mapping
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
                   ` (9 preceding siblings ...)
  2012-07-06 18:40 ` [PATCH 10/15] iop13xx: use more regular PCI I/O space handling Rob Herring
@ 2012-07-06 18:40 ` Rob Herring
  2012-07-06 18:40 ` [PATCH 12/15] ARM: mv78xx0: use fixed pci " Rob Herring
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

Move iop13xx PCI to fixed i/o mapping and remove io.h.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 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

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e542f99..c61e0a4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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
diff --git a/arch/arm/mach-iop13xx/include/mach/io.h b/arch/arm/mach-iop13xx/include/mach/io.h
deleted file mode 100644
index e197cb8..0000000
--- a/arch/arm/mach-iop13xx/include/mach/io.h
+++ /dev/null
@@ -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
diff --git a/arch/arm/mach-iop13xx/include/mach/iop13xx.h b/arch/arm/mach-iop13xx/include/mach/iop13xx.h
index d3777db..8153ed2 100644
--- a/arch/arm/mach-iop13xx/include/mach/iop13xx.h
+++ b/arch/arm/mach-iop13xx/include/mach/iop13xx.h
@@ -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 +\
diff --git a/arch/arm/mach-iop13xx/setup.c b/arch/arm/mach-iop13xx/setup.c
index daabb1f..6c1d763 100644
--- a/arch/arm/mach-iop13xx/setup.c
+++ b/arch/arm/mach-iop13xx/setup.c
@@ -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));
 }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 12/15] ARM: mv78xx0: use fixed pci i/o mapping
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
                   ` (10 preceding siblings ...)
  2012-07-06 18:40 ` [PATCH 11/15] ARM: iop13xx: use fixed PCI i/o mapping Rob Herring
@ 2012-07-06 18:40 ` Rob Herring
       [not found] ` <1341600040-30993-1-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

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.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
---
 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

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c61e0a4..1b7faa5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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:
diff --git a/arch/arm/mach-mv78xx0/addr-map.c b/arch/arm/mach-mv78xx0/addr-map.c
index 62b53d7..da9806a 100644
--- a/arch/arm/mach-mv78xx0/addr-map.c
+++ b/arch/arm/mach-mv78xx0/addr-map.c
@@ -13,6 +13,7 @@
 #include <linux/mbus.h>
 #include <linux/io.h>
 #include <plat/addr-map.h>
+#include <mach/mv78xx0.h>
 #include "common.h"
 
 /*
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index b4c53b8..e018d8c 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -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
diff --git a/arch/arm/mach-mv78xx0/include/mach/io.h b/arch/arm/mach-mv78xx0/include/mach/io.h
deleted file mode 100644
index c7d9d00..0000000
--- a/arch/arm/mach-mv78xx0/include/mach/io.h
+++ /dev/null
@@ -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
diff --git a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
index e807c4c..10fc138 100644
--- a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
+++ b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
@@ -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
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c
index 2e56e86..a51a1e4 100644
--- a/arch/arm/mach-mv78xx0/pcie.c
+++ b/arch/arm/mach-mv78xx0/pcie.c
@@ -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");
 	}
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 13/15] i2c: iop3xx: clean-up trailing whitespace
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
@ 2012-07-06 18:40     ` Rob Herring
  2012-07-06 18:40 ` [PATCH 02/15] ARM: versatile: use " Rob Herring
                       ` (13 subsequent siblings)
  14 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Arnd Bergmann, Olof Johansson, Nicolas Pitre, Andrew Lunn,
	Colin Cross, Jason Cooper,
	thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB,
	bhelgaas-hpIqsD4AKlfQT0dZR+AlfA, Stephen Warren, Russell King,
	Rob Herring, Jean Delvare (PC drivers, core),
	Ben Dooks (embedded platforms), Wolfram Sang (embedded platforms),
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

From: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>

Remove a bunch of trailing whitespace. No functional changes.

Signed-off-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
Cc: "Jean Delvare (PC drivers, core)" <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: "Ben Dooks (embedded platforms)" <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
Cc: "Wolfram Sang (embedded platforms)" <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
 drivers/i2c/busses/i2c-iop3xx.c |  112 +++++++++++++++++++--------------------
 1 file changed, 56 insertions(+), 56 deletions(-)

diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
index 93f147a..567d873 100644
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -4,13 +4,13 @@
 /* Copyright (C) 2003 Peter Milne, D-TACQ Solutions Ltd
  *                    <Peter dot Milne at 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-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org
  *
  * 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 <kmalkki-kf+aQKke1yb1KXRcyAk9cg@public.gmane.org>,
  * Frodo Looijaard <frodol-B0qZmFHriGg@public.gmane.org>, Martin Bailey<mbailey@littlefeet-inc.com>
  *
@@ -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;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 13/15] i2c: iop3xx: clean-up trailing whitespace
@ 2012-07-06 18:40     ` Rob Herring
  0 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

Remove a bunch of trailing whitespace. No functional changes.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: "Jean Delvare (PC drivers, core)" <khali@linux-fr.org>
Cc: "Ben Dooks (embedded platforms)" <ben-linux@fluff.org>
Cc: "Wolfram Sang (embedded platforms)" <w.sang@pengutronix.de>
Cc: linux-i2c at vger.kernel.org
---
 drivers/i2c/busses/i2c-iop3xx.c |  112 +++++++++++++++++++--------------------
 1 file changed, 56 insertions(+), 56 deletions(-)

diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
index 93f147a..567d873 100644
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -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 <kmalkki@cc.hut.fi>,
  * Frodo Looijaard <frodol@dds.nl>, Martin Bailey<mbailey@littlefeet-inc.com>
  *
@@ -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;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 14/15] i2c: iop3xx: use standard gpiolib functions
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
@ 2012-07-06 18:40     ` Rob Herring
  2012-07-06 18:40 ` [PATCH 02/15] ARM: versatile: use " Rob Herring
                       ` (13 subsequent siblings)
  14 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Arnd Bergmann, Olof Johansson, Nicolas Pitre, Andrew Lunn,
	Colin Cross, Jason Cooper,
	thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB,
	bhelgaas-hpIqsD4AKlfQT0dZR+AlfA, Stephen Warren, Russell King,
	Rob Herring, Jean Delvare (PC drivers, core),
	Ben Dooks (embedded platforms), Wolfram Sang (embedded platforms),
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

From: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>

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.

Signed-off-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
Cc: "Jean Delvare (PC drivers, core)" <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: "Ben Dooks (embedded platforms)" <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
Cc: "Wolfram Sang (embedded platforms)" <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
 drivers/i2c/busses/i2c-iop3xx.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
index 567d873..2f99613 100644
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -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 :-( */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 14/15] i2c: iop3xx: use standard gpiolib functions
@ 2012-07-06 18:40     ` Rob Herring
  0 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

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.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: "Jean Delvare (PC drivers, core)" <khali@linux-fr.org>
Cc: "Ben Dooks (embedded platforms)" <ben-linux@fluff.org>
Cc: "Wolfram Sang (embedded platforms)" <w.sang@pengutronix.de>
Cc: linux-i2c at vger.kernel.org
---
 drivers/i2c/busses/i2c-iop3xx.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
index 567d873..2f99613 100644
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -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 :-( */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 15/15] ARM: iop3xx: use fixed PCI i/o mapping
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
                   ` (12 preceding siblings ...)
       [not found] ` <1341600040-30993-1-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-07-06 18:40 ` Rob Herring
  2012-07-09 16:28 ` [PATCH 00/15] PCI io.h cleanups Arnd Bergmann
  14 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-06 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

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

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

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 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

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1b7faa5..58bb75e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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
diff --git a/arch/arm/include/asm/hardware/iop3xx.h b/arch/arm/include/asm/hardware/iop3xx.h
index 2ff2c75..02fe2fb 100644
--- a/arch/arm/include/asm/hardware/iop3xx.h
+++ b/arch/arm/include/asm/hardware/iop3xx.h
@@ -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__
 
diff --git a/arch/arm/mach-iop32x/include/mach/io.h b/arch/arm/mach-iop32x/include/mach/io.h
deleted file mode 100644
index e2ada26..0000000
--- a/arch/arm/mach-iop32x/include/mach/io.h
+++ /dev/null
@@ -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
diff --git a/arch/arm/mach-iop33x/include/mach/io.h b/arch/arm/mach-iop33x/include/mach/io.h
deleted file mode 100644
index f7c1b65..0000000
--- a/arch/arm/mach-iop33x/include/mach/io.h
+++ /dev/null
@@ -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
diff --git a/arch/arm/plat-iop/pci.c b/arch/arm/plat-iop/pci.c
index 8daae9b..a9472bc 100644
--- a/arch/arm/plat-iop/pci.c
+++ b/arch/arm/plat-iop/pci.c
@@ -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]);
diff --git a/arch/arm/plat-iop/setup.c b/arch/arm/plat-iop/setup.c
index bade586..1ab725b 100644
--- a/arch/arm/plat-iop/setup.c
+++ b/arch/arm/plat-iop/setup.c
@@ -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));
 }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 03/15] ARM: tegra: use fixed PCI i/o mapping
  2012-07-06 18:40 ` [PATCH 03/15] ARM: tegra: " Rob Herring
@ 2012-07-06 19:44   ` Stephen Warren
  2012-07-06 20:11     ` Rob Herring
  2012-07-08  6:09   ` Thierry Reding
  1 sibling, 1 reply; 42+ messages in thread
From: Stephen Warren @ 2012-07-06 19:44 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/06/2012 12:40 PM, Rob Herring wrote:
> From: Rob Herring <rob.herring@calxeda.com>
> 
> 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:

> PCIE: port 1: link down, retrying
> PCIE: port 1: link down, retrying
> PCIE: port 1: link down, ignoring
> PCI host bridge to bus 0000:00
> pci_bus 0000:00: root bus resource [io  0x1000-0x8fff]
> pci_bus 0000:00: root bus resource [mem 0x90000000-0x97ffffff]
> pci_bus 0000:00: root bus resource [mem 0xa0000000-0xa7ffffff pref]
> pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
> pci_bus 0000:00: busn_res: [bus 00-ff] is inserted under domain [bus 00-ff]
> pci 0000:00:00.0: [10de:0bf0] type 01 class 0x060000
> pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot D3cold
> PCI: bus0: Fast back to back transfers disabled
> pci_bus 0000:01: busn_res: [bus 01-ff] is inserted under [bus 00-ff]
> pci 0000:01:00.0: [10ec:8168] type 00 class 0x020000
> 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 disabled
> pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
> pci_bus 0000: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: (unregistered net_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)

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 03/15] ARM: tegra: use fixed PCI i/o mapping
  2012-07-06 19:44   ` Stephen Warren
@ 2012-07-06 20:11     ` Rob Herring
  2012-07-06 20:16       ` Stephen Warren
  0 siblings, 1 reply; 42+ messages in thread
From: Rob Herring @ 2012-07-06 20:11 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/06/2012 02:44 PM, Stephen Warren wrote:
> On 07/06/2012 12:40 PM, Rob Herring wrote:
>> From: Rob Herring <rob.herring@calxeda.com>
>>
>> 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:

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
> 
>> PCIE: port 1: link down, retrying
>> PCIE: port 1: link down, retrying
>> PCIE: port 1: link down, ignoring
>> PCI host bridge to bus 0000:00
>> pci_bus 0000:00: root bus resource [io  0x1000-0x8fff]
>> pci_bus 0000:00: root bus resource [mem 0x90000000-0x97ffffff]
>> pci_bus 0000:00: root bus resource [mem 0xa0000000-0xa7ffffff pref]
>> pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
>> pci_bus 0000:00: busn_res: [bus 00-ff] is inserted under domain [bus 00-ff]
>> pci 0000:00:00.0: [10de:0bf0] type 01 class 0x060000
>> pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot D3cold
>> PCI: bus0: Fast back to back transfers disabled
>> pci_bus 0000:01: busn_res: [bus 01-ff] is inserted under [bus 00-ff]
>> pci 0000:01:00.0: [10ec:8168] type 00 class 0x020000
>> 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 disabled
>> pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
>> pci_bus 0000: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: (unregistered net_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)

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 03/15] ARM: tegra: use fixed PCI i/o mapping
  2012-07-06 20:11     ` Rob Herring
@ 2012-07-06 20:16       ` Stephen Warren
  2012-07-06 20:36         ` Stephen Warren
  0 siblings, 1 reply; 42+ messages in thread
From: Stephen Warren @ 2012-07-06 20:16 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/06/2012 02:11 PM, Rob Herring wrote:
> On 07/06/2012 02:44 PM, Stephen Warren wrote:
>> On 07/06/2012 12:40 PM, Rob Herring wrote:
>>> From: Rob Herring <rob.herring@calxeda.com>
>>>
>>> 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:
> 
> 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:-)

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 03/15] ARM: tegra: use fixed PCI i/o mapping
  2012-07-06 20:16       ` Stephen Warren
@ 2012-07-06 20:36         ` Stephen Warren
       [not found]           ` <4FF74C61.4060903-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
  0 siblings, 1 reply; 42+ messages in thread
From: Stephen Warren @ 2012-07-06 20:36 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/06/2012 02:16 PM, Stephen Warren wrote:
> On 07/06/2012 02:11 PM, Rob Herring wrote:
>> On 07/06/2012 02:44 PM, Stephen Warren wrote:
>>> On 07/06/2012 12:40 PM, Rob Herring wrote:
>>>> From: Rob Herring <rob.herring@calxeda.com>
>>>>
>>>> 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:
>>
>> 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.

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 03/15] ARM: tegra: use fixed PCI i/o mapping
  2012-07-06 20:36         ` Stephen Warren
@ 2012-07-06 21:01               ` Stephen Warren
  0 siblings, 0 replies; 42+ messages in thread
From: Stephen Warren @ 2012-07-06 21:01 UTC (permalink / raw)
  To: thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB
  Cc: Rob Herring, linux-tegra-u79uwXL29TY76Z2rM5mHXA, Colin Cross,
	Olof Johansson,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

(cutting down CCs for Tegra-specific discussion)

On 07/06/2012 02:36 PM, Stephen Warren wrote:
> On 07/06/2012 02:16 PM, Stephen Warren wrote:
>> On 07/06/2012 02:11 PM, Rob Herring wrote:
>>> On 07/06/2012 02:44 PM, Stephen Warren wrote:
>>>> On 07/06/2012 12:40 PM, Rob Herring wrote:
>>>>> From: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
>>>>>
>>>>> 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:
>>>
>>> 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.

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:

diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c
b/arch/arm/mach-tegra/board-dt-tegra20.c
index 70a19a9..74aefaf 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -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

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 03/15] ARM: tegra: use fixed PCI i/o mapping
@ 2012-07-06 21:01               ` Stephen Warren
  0 siblings, 0 replies; 42+ messages in thread
From: Stephen Warren @ 2012-07-06 21:01 UTC (permalink / raw)
  To: linux-arm-kernel

(cutting down CCs for Tegra-specific discussion)

On 07/06/2012 02:36 PM, Stephen Warren wrote:
> On 07/06/2012 02:16 PM, Stephen Warren wrote:
>> On 07/06/2012 02:11 PM, Rob Herring wrote:
>>> On 07/06/2012 02:44 PM, Stephen Warren wrote:
>>>> On 07/06/2012 12:40 PM, Rob Herring wrote:
>>>>> From: Rob Herring <rob.herring@calxeda.com>
>>>>>
>>>>> 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:
>>>
>>> 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.

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:

diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c
b/arch/arm/mach-tegra/board-dt-tegra20.c
index 70a19a9..74aefaf 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -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

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 03/15] ARM: tegra: use fixed PCI i/o mapping
  2012-07-06 18:40 ` [PATCH 03/15] ARM: tegra: " Rob Herring
  2012-07-06 19:44   ` Stephen Warren
@ 2012-07-08  6:09   ` Thierry Reding
  2012-07-08 14:17     ` Rob Herring
  1 sibling, 1 reply; 42+ messages in thread
From: Thierry Reding @ 2012-07-08  6:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 06, 2012 at 01:40:28PM -0500, Rob Herring wrote:
> From: Rob Herring <rob.herring@calxeda.com>
> 
> Move tegra PCI to fixed i/o mapping and remove io.h.
> 
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> Cc: Colin Cross <ccross@android.com>
> Cc: Olof Johansson <olof@lixom.net>
> Acked-by: Stephen Warren <swarren@nvidia.com>
> ---
>  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

> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 8fb7e4a..ac446e3 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -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,
> diff --git a/arch/arm/mach-tegra/include/mach/io.h b/arch/arm/mach-tegra/include/mach/io.h
> deleted file mode 100644
> index fe700f9..0000000
> --- a/arch/arm/mach-tegra/include/mach/io.h
> +++ /dev/null
> @@ -1,46 +0,0 @@
> -/*
> - * arch/arm/mach-tegra/include/mach/io.h
> - *
> - * Copyright (C) 2010 Google, Inc.
> - *
> - * Author:
> - *	Colin Cross <ccross@google.com>
> - *	Erik Gilling <konkers@google.com>
> - *
> - * 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
> diff --git a/arch/arm/mach-tegra/include/mach/iomap.h b/arch/arm/mach-tegra/include/mach/iomap.h
> index 7e76da7..fee3a94 100644
> --- a/arch/arm/mach-tegra/include/mach/iomap.h
> +++ b/arch/arm/mach-tegra/include/mach/iomap.h
> @@ -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)))
>  
> diff --git a/arch/arm/mach-tegra/io.c b/arch/arm/mach-tegra/io.c
> index 58b4baf..7a29e10 100644
> --- a/arch/arm/mach-tegra/io.c
> +++ b/arch/arm/mach-tegra/io.c
> @@ -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));
>  }
> diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c
> index 0e09137..c989a8e 100644
> --- a/arch/arm/mach-tegra/pcie.c
> +++ b/arch/arm/mach-tegra/pcie.c
> @@ -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:
> -- 
> 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>

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 14/15] i2c: iop3xx: use standard gpiolib functions
  2012-07-06 18:40     ` Rob Herring
@ 2012-07-08 11:29         ` Wolfram Sang
  -1 siblings, 0 replies; 42+ messages in thread
From: Wolfram Sang @ 2012-07-08 11:29 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Arnd Bergmann,
	Olof Johansson, Nicolas Pitre, Andrew Lunn, Colin Cross,
	Jason Cooper, thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB,
	bhelgaas-hpIqsD4AKlfQT0dZR+AlfA, Stephen Warren, Russell King,
	Rob Herring, Jean Delvare (PC drivers, core),
	Ben Dooks (embedded platforms),
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 2300 bytes --]

On Fri, Jul 06, 2012 at 01:40:39PM -0500, Rob Herring wrote:
> From: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
> 
> 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.
> 
> Signed-off-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
> Cc: "Jean Delvare (PC drivers, core)" <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> Cc: "Ben Dooks (embedded platforms)" <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
> Cc: "Wolfram Sang (embedded platforms)" <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.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

> ---
>  drivers/i2c/busses/i2c-iop3xx.c |    9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
> index 567d873..2f99613 100644
> --- a/drivers/i2c/busses/i2c-iop3xx.c
> +++ b/drivers/i2c/busses/i2c-iop3xx.c
> @@ -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 :-( */
> -- 
> 1.7.9.5
> 

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 14/15] i2c: iop3xx: use standard gpiolib functions
@ 2012-07-08 11:29         ` Wolfram Sang
  0 siblings, 0 replies; 42+ messages in thread
From: Wolfram Sang @ 2012-07-08 11:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 06, 2012 at 01:40:39PM -0500, Rob Herring wrote:
> From: Rob Herring <rob.herring@calxeda.com>
> 
> 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.
> 
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> Cc: "Jean Delvare (PC drivers, core)" <khali@linux-fr.org>
> Cc: "Ben Dooks (embedded platforms)" <ben-linux@fluff.org>
> Cc: "Wolfram Sang (embedded platforms)" <w.sang@pengutronix.de>
> 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

> ---
>  drivers/i2c/busses/i2c-iop3xx.c |    9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
> index 567d873..2f99613 100644
> --- a/drivers/i2c/busses/i2c-iop3xx.c
> +++ b/drivers/i2c/busses/i2c-iop3xx.c
> @@ -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 :-( */
> -- 
> 1.7.9.5
> 

-- 
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>

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 03/15] ARM: tegra: use fixed PCI i/o mapping
  2012-07-08  6:09   ` Thierry Reding
@ 2012-07-08 14:17     ` Rob Herring
  2012-07-08 16:35       ` Arnd Bergmann
  0 siblings, 1 reply; 42+ messages in thread
From: Rob Herring @ 2012-07-08 14:17 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/08/2012 01:09 AM, Thierry Reding wrote:
> On Fri, Jul 06, 2012 at 01:40:28PM -0500, Rob Herring wrote:
>> From: Rob Herring <rob.herring@calxeda.com>
>>
>> Move tegra PCI to fixed i/o mapping and remove io.h.
>>
>> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
>> Cc: Colin Cross <ccross@android.com>
>> Cc: Olof Johansson <olof@lixom.net>
>> Acked-by: Stephen Warren <swarren@nvidia.com>
>> ---
>>  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.

This function can only be called during .map_io anyway, so the __init is
irrelevant.

> 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

> If both of those issues can be easily addressed, then this certainly
> looks very nice.
> 
> Thierry
> 
>>
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index 8fb7e4a..ac446e3 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -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,
>> diff --git a/arch/arm/mach-tegra/include/mach/io.h b/arch/arm/mach-tegra/include/mach/io.h
>> deleted file mode 100644
>> index fe700f9..0000000
>> --- a/arch/arm/mach-tegra/include/mach/io.h
>> +++ /dev/null
>> @@ -1,46 +0,0 @@
>> -/*
>> - * arch/arm/mach-tegra/include/mach/io.h
>> - *
>> - * Copyright (C) 2010 Google, Inc.
>> - *
>> - * Author:
>> - *	Colin Cross <ccross@google.com>
>> - *	Erik Gilling <konkers@google.com>
>> - *
>> - * 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
>> diff --git a/arch/arm/mach-tegra/include/mach/iomap.h b/arch/arm/mach-tegra/include/mach/iomap.h
>> index 7e76da7..fee3a94 100644
>> --- a/arch/arm/mach-tegra/include/mach/iomap.h
>> +++ b/arch/arm/mach-tegra/include/mach/iomap.h
>> @@ -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)))
>>  
>> diff --git a/arch/arm/mach-tegra/io.c b/arch/arm/mach-tegra/io.c
>> index 58b4baf..7a29e10 100644
>> --- a/arch/arm/mach-tegra/io.c
>> +++ b/arch/arm/mach-tegra/io.c
>> @@ -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));
>>  }
>> diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c
>> index 0e09137..c989a8e 100644
>> --- a/arch/arm/mach-tegra/pcie.c
>> +++ b/arch/arm/mach-tegra/pcie.c
>> @@ -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:
>> -- 
>> 1.7.9.5
>>
>>
>>

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 14/15] i2c: iop3xx: use standard gpiolib functions
  2012-07-08 11:29         ` Wolfram Sang
@ 2012-07-08 14:29             ` Rob Herring
  -1 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-08 14:29 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Arnd Bergmann,
	Olof Johansson, Nicolas Pitre, Andrew Lunn, Colin Cross,
	Jason Cooper, thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB,
	bhelgaas-hpIqsD4AKlfQT0dZR+AlfA, Stephen Warren, Russell King,
	Rob Herring, Jean Delvare (PC drivers, core),
	Ben Dooks (embedded platforms),
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

On 07/08/2012 06:29 AM, Wolfram Sang wrote:
> On Fri, Jul 06, 2012 at 01:40:39PM -0500, Rob Herring wrote:
>> From: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
>>
>> 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.
>>
>> Signed-off-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
>> Cc: "Jean Delvare (PC drivers, core)" <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
>> Cc: "Ben Dooks (embedded platforms)" <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
>> Cc: "Wolfram Sang (embedded platforms)" <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>> Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.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.

They can go in via i2c tree. The rest probably won't make 3.6.

Rob

> 
> Thanks,
> 
>    Wolfram
> 
>> ---
>>  drivers/i2c/busses/i2c-iop3xx.c |    9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
>> index 567d873..2f99613 100644
>> --- a/drivers/i2c/busses/i2c-iop3xx.c
>> +++ b/drivers/i2c/busses/i2c-iop3xx.c
>> @@ -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 :-( */
>> -- 
>> 1.7.9.5
>>
> 

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 14/15] i2c: iop3xx: use standard gpiolib functions
@ 2012-07-08 14:29             ` Rob Herring
  0 siblings, 0 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-08 14:29 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/08/2012 06:29 AM, Wolfram Sang wrote:
> On Fri, Jul 06, 2012 at 01:40:39PM -0500, Rob Herring wrote:
>> From: Rob Herring <rob.herring@calxeda.com>
>>
>> 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.
>>
>> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
>> Cc: "Jean Delvare (PC drivers, core)" <khali@linux-fr.org>
>> Cc: "Ben Dooks (embedded platforms)" <ben-linux@fluff.org>
>> Cc: "Wolfram Sang (embedded platforms)" <w.sang@pengutronix.de>
>> 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.

They can go in via i2c tree. The rest probably won't make 3.6.

Rob

> 
> Thanks,
> 
>    Wolfram
> 
>> ---
>>  drivers/i2c/busses/i2c-iop3xx.c |    9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
>> index 567d873..2f99613 100644
>> --- a/drivers/i2c/busses/i2c-iop3xx.c
>> +++ b/drivers/i2c/busses/i2c-iop3xx.c
>> @@ -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 :-( */
>> -- 
>> 1.7.9.5
>>
> 

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 03/15] ARM: tegra: use fixed PCI i/o mapping
  2012-07-08 14:17     ` Rob Herring
@ 2012-07-08 16:35       ` Arnd Bergmann
  2012-07-08 20:33         ` Rob Herring
  0 siblings, 1 reply; 42+ messages in thread
From: Arnd Bergmann @ 2012-07-08 16:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Sunday 08 July 2012, Rob Herring wrote:
> > 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.

I think you can call ioremap_page_range() to do this.

	Arnd

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 03/15] ARM: tegra: use fixed PCI i/o mapping
  2012-07-08 16:35       ` Arnd Bergmann
@ 2012-07-08 20:33         ` Rob Herring
  2012-07-09  2:53           ` Nicolas Pitre
  0 siblings, 1 reply; 42+ messages in thread
From: Rob Herring @ 2012-07-08 20:33 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/08/2012 11:35 AM, Arnd Bergmann wrote:
> On Sunday 08 July 2012, Rob Herring wrote:
>>> 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.
> 
> 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

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 03/15] ARM: tegra: use fixed PCI i/o mapping
  2012-07-08 20:33         ` Rob Herring
@ 2012-07-09  2:53           ` Nicolas Pitre
  0 siblings, 0 replies; 42+ messages in thread
From: Nicolas Pitre @ 2012-07-09  2:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, 8 Jul 2012, Rob Herring wrote:

> On 07/08/2012 11:35 AM, Arnd Bergmann wrote:
> > On Sunday 08 July 2012, Rob Herring wrote:
> >>> 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.
> > 
> > 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...

:-)

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

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 07/15] ARM: dove: use fixed PCI i/o mapping
  2012-07-06 18:40 ` [PATCH 07/15] ARM: dove: " Rob Herring
@ 2012-07-09 15:50   ` Arnd Bergmann
  2012-07-09 18:29     ` Rob Herring
  0 siblings, 1 reply; 42+ messages in thread
From: Arnd Bergmann @ 2012-07-09 15:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 06 July 2012, Rob Herring wrote:
> --- a/arch/arm/mach-dove/pcie.c
> +++ b/arch/arm/mach-dove/pcie.c
> @@ -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");

Why use SZ_64K here when the mapping is actually 1M?

	Arnd

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 01/15] ARM: Add fixed PCI i/o mapping
  2012-07-06 18:40 ` [PATCH 01/15] ARM: Add fixed PCI i/o mapping Rob Herring
@ 2012-07-09 16:21   ` Arnd Bergmann
  0 siblings, 0 replies; 42+ messages in thread
From: Arnd Bergmann @ 2012-07-09 16:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 06 July 2012, Rob Herring wrote:
>  /*
> + * 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));
> +}

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

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 00/15] PCI io.h cleanups
  2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
                   ` (13 preceding siblings ...)
  2012-07-06 18:40 ` [PATCH 15/15] ARM: iop3xx: use fixed PCI i/o mapping Rob Herring
@ 2012-07-09 16:28 ` Arnd Bergmann
  2012-07-09 18:42   ` Rob Herring
  14 siblings, 1 reply; 42+ messages in thread
From: Arnd Bergmann @ 2012-07-09 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 06 July 2012, Rob Herring wrote:
> From: Rob Herring <rob.herring@calxeda.com>
> 
> 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.

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.

> 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

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 07/15] ARM: dove: use fixed PCI i/o mapping
  2012-07-09 15:50   ` Arnd Bergmann
@ 2012-07-09 18:29     ` Rob Herring
  2012-07-09 20:37       ` Arnd Bergmann
  2012-07-09 20:47       ` Nicolas Pitre
  0 siblings, 2 replies; 42+ messages in thread
From: Rob Herring @ 2012-07-09 18:29 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/09/2012 10:50 AM, Arnd Bergmann wrote:
> On Friday 06 July 2012, Rob Herring wrote:
>> --- a/arch/arm/mach-dove/pcie.c
>> +++ b/arch/arm/mach-dove/pcie.c
>> @@ -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");
> 
> Why use SZ_64K here 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

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 00/15] PCI io.h cleanups
  2012-07-09 16:28 ` [PATCH 00/15] PCI io.h cleanups Arnd Bergmann
@ 2012-07-09 18:42   ` Rob Herring
  2012-07-09 20:24     ` Nicolas Pitre
  0 siblings, 1 reply; 42+ messages in thread
From: Rob Herring @ 2012-07-09 18:42 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/09/2012 11:28 AM, Arnd Bergmann wrote:
> On Friday 06 July 2012, Rob Herring wrote:
>> From: Rob Herring <rob.herring@calxeda.com>
>>
>> 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.
> 
> 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.

>> 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

> 
> 	Arnd
> 

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 00/15] PCI io.h cleanups
  2012-07-09 18:42   ` Rob Herring
@ 2012-07-09 20:24     ` Nicolas Pitre
  0 siblings, 0 replies; 42+ messages in thread
From: Nicolas Pitre @ 2012-07-09 20:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 9 Jul 2012, Rob Herring wrote:

> On 07/09/2012 11:28 AM, Arnd Bergmann wrote:
> > On Friday 06 July 2012, Rob Herring wrote:
> >> From: Rob Herring <rob.herring@calxeda.com>
> >>
> >> 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.
> > 
> > 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

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 07/15] ARM: dove: use fixed PCI i/o mapping
  2012-07-09 18:29     ` Rob Herring
@ 2012-07-09 20:37       ` Arnd Bergmann
  2012-07-09 20:47       ` Nicolas Pitre
  1 sibling, 0 replies; 42+ messages in thread
From: Arnd Bergmann @ 2012-07-09 20:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 09 July 2012, Rob Herring wrote:
> 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

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 07/15] ARM: dove: use fixed PCI i/o mapping
  2012-07-09 18:29     ` Rob Herring
  2012-07-09 20:37       ` Arnd Bergmann
@ 2012-07-09 20:47       ` Nicolas Pitre
  2012-07-10  7:50         ` Arnd Bergmann
  1 sibling, 1 reply; 42+ messages in thread
From: Nicolas Pitre @ 2012-07-09 20:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 9 Jul 2012, Rob Herring wrote:

> 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

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 07/15] ARM: dove: use fixed PCI i/o mapping
  2012-07-09 20:47       ` Nicolas Pitre
@ 2012-07-10  7:50         ` Arnd Bergmann
  0 siblings, 0 replies; 42+ messages in thread
From: Arnd Bergmann @ 2012-07-10  7:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 09 July 2012, Nicolas Pitre wrote:
> On Mon, 9 Jul 2012, Rob Herring wrote:
> 
> > 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.

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.

> 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

^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2012-07-10  7:50 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
2012-07-06 18:40 ` [PATCH 01/15] ARM: Add fixed PCI i/o mapping Rob Herring
2012-07-09 16:21   ` Arnd Bergmann
2012-07-06 18:40 ` [PATCH 02/15] ARM: versatile: use " Rob Herring
2012-07-06 18:40 ` [PATCH 03/15] ARM: tegra: " Rob Herring
2012-07-06 19:44   ` Stephen Warren
2012-07-06 20:11     ` Rob Herring
2012-07-06 20:16       ` Stephen Warren
2012-07-06 20:36         ` Stephen Warren
     [not found]           ` <4FF74C61.4060903-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-07-06 21:01             ` Stephen Warren
2012-07-06 21:01               ` Stephen Warren
2012-07-08  6:09   ` Thierry Reding
2012-07-08 14:17     ` Rob Herring
2012-07-08 16:35       ` Arnd Bergmann
2012-07-08 20:33         ` Rob Herring
2012-07-09  2:53           ` Nicolas Pitre
2012-07-06 18:40 ` [PATCH 04/15] ARM: integrator: " Rob Herring
2012-07-06 18:40 ` [PATCH 05/15] ARM: shark: " Rob Herring
2012-07-06 18:40 ` [PATCH 06/15] ARM: footbridge: " Rob Herring
2012-07-06 18:40 ` [PATCH 07/15] ARM: dove: " Rob Herring
2012-07-09 15:50   ` Arnd Bergmann
2012-07-09 18:29     ` Rob Herring
2012-07-09 20:37       ` Arnd Bergmann
2012-07-09 20:47       ` Nicolas Pitre
2012-07-10  7:50         ` Arnd Bergmann
2012-07-06 18:40 ` [PATCH 08/15] ARM: kirkwood: " Rob Herring
2012-07-06 18:40 ` [PATCH 09/15] ARM: orion5x: " Rob Herring
2012-07-06 18:40 ` [PATCH 10/15] iop13xx: use more regular PCI I/O space handling Rob Herring
2012-07-06 18:40 ` [PATCH 11/15] ARM: iop13xx: use fixed PCI i/o mapping Rob Herring
2012-07-06 18:40 ` [PATCH 12/15] ARM: mv78xx0: use fixed pci " Rob Herring
     [not found] ` <1341600040-30993-1-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-07-06 18:40   ` [PATCH 13/15] i2c: iop3xx: clean-up trailing whitespace Rob Herring
2012-07-06 18:40     ` Rob Herring
2012-07-06 18:40   ` [PATCH 14/15] i2c: iop3xx: use standard gpiolib functions Rob Herring
2012-07-06 18:40     ` Rob Herring
     [not found]     ` <1341600040-30993-15-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-07-08 11:29       ` Wolfram Sang
2012-07-08 11:29         ` Wolfram Sang
     [not found]         ` <20120708112903.GB18362-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-07-08 14:29           ` Rob Herring
2012-07-08 14:29             ` Rob Herring
2012-07-06 18:40 ` [PATCH 15/15] ARM: iop3xx: use fixed PCI i/o mapping Rob Herring
2012-07-09 16:28 ` [PATCH 00/15] PCI io.h cleanups Arnd Bergmann
2012-07-09 18:42   ` Rob Herring
2012-07-09 20:24     ` Nicolas Pitre

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.