From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 20/30] iop13xx: use more regular PCI I/O space handling
Date: Thu, 1 Mar 2012 21:13:32 -0600 [thread overview]
Message-ID: <1330658022-14559-21-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1330658022-14559-1-git-send-email-robherring2@gmail.com>
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 07e9ff7..ee1dfd2 100644
--- a/arch/arm/mach-iop13xx/include/mach/iop13xx.h
+++ b/arch/arm/mach-iop13xx/include/mach/iop13xx.h
@@ -68,17 +68,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\
@@ -107,10 +105,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 70f716f..e0ecb38 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);
-
void __iomem * __iop13xx_ioremap(unsigned long cookie, size_t size,
unsigned int mtype)
{
@@ -67,12 +48,6 @@ void __iomem * __iop13xx_ioremap(unsigned long cookie, size_t size,
(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;
@@ -102,8 +77,6 @@ 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 b8f5a87..d72eddf 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.5.4
next prev parent reply other threads:[~2012-03-02 3:13 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-02 3:13 [PATCH v3 00/30] mach/io.h cleanup and removal Rob Herring
2012-03-02 3:13 ` [PATCH v3 01/30] usb: ohci-pxa27x: add explicit include of hardware.h Rob Herring
2012-03-02 3:13 ` [PATCH v3 02/30] ARM: provide runtime hook for ioremap/iounmap Rob Herring
2012-03-05 19:21 ` Nicolas Pitre
2012-03-05 20:13 ` Arnd Bergmann
2012-03-05 21:11 ` Nicolas Pitre
2012-03-06 4:02 ` [PATCH v4 1/4] " Rob Herring
2012-03-06 4:02 ` [PATCH v4 2/4] ARM: imx: convert to common runtime ioremap hook Rob Herring
2012-03-06 4:02 ` [PATCH v4 3/4] ARM: msm: use " Rob Herring
2012-03-06 20:59 ` David Brown
2012-03-06 21:10 ` Rob Herring
2012-03-06 4:03 ` [PATCH v4 4/4] ARM: iop13xx: " Rob Herring
2012-03-06 16:53 ` [PATCH v4 1/4] ARM: provide runtime hook for ioremap/iounmap Arnd Bergmann
2012-03-06 17:18 ` Nicolas Pitre
2012-03-06 4:07 ` [PATCH v3 02/30] " Rob Herring
2012-03-06 17:20 ` Nicolas Pitre
2012-03-06 21:45 ` [PATCH v5 1/7] " Rob Herring
2012-03-06 21:45 ` [PATCH v5 2/7] ARM: imx: convert to common runtime ioremap hook Rob Herring
2012-03-06 21:45 ` [PATCH v5 3/7] ARM: msm: use " Rob Herring
2012-03-06 21:45 ` [PATCH v5 4/7] ARM: iop13xx: " Rob Herring
2012-03-06 21:45 ` [PATCH v5 5/7] ARM: ixp4xx: " Rob Herring
2012-03-06 22:11 ` Russell King - ARM Linux
2012-03-06 22:49 ` Rob Herring
2012-03-06 22:50 ` Rob Herring
2012-03-06 21:45 ` [PATCH v5 6/7] ARM: ebsa110: " Rob Herring
2012-03-06 22:06 ` Nicolas Pitre
2012-03-07 3:36 ` [PATCH] " Rob Herring
2012-03-06 21:45 ` [PATCH v5 7/7] ARM: remove compile time __arch_ioremap/__arch_iounmap Rob Herring
2012-03-06 22:01 ` Nicolas Pitre
2012-03-06 21:57 ` [PATCH v5 1/7] ARM: provide runtime hook for ioremap/iounmap Nicolas Pitre
2012-03-02 3:13 ` [PATCH v3 03/30] ARM: imx: convert to common runtime ioremap hook Rob Herring
2012-03-02 3:13 ` [PATCH v3 04/30] ARM: msm: use " Rob Herring
2012-03-02 3:13 ` [PATCH v3 05/30] ARM: msm: clean-up mach/io.h Rob Herring
2012-03-02 3:13 ` [PATCH v3 06/30] ARM: iop13xx: use runtime ioremap hook Rob Herring
2012-03-02 3:13 ` [PATCH v3 07/30] ARM: iop13xx: move io.h externs to pci.h Rob Herring
2012-03-02 3:13 ` [PATCH v3 08/30] ARM: OMAP: Remove remaining includes for mach/io.h Rob Herring
2012-03-02 3:13 ` [PATCH v3 09/30] [media] davinci: remove includes of mach/io.h Rob Herring
2012-03-02 3:13 ` [PATCH v3 10/30] ARM: davinci: remove unneeded mach/io.h include Rob Herring
2012-03-02 3:13 ` [PATCH v3 11/30] ARM: orion5x: clean-up mach/io.h Rob Herring
2012-03-05 19:14 ` Nicolas Pitre
2012-03-02 3:13 ` [PATCH v3 12/30] ARM: tegra: " Rob Herring
2012-03-02 3:13 ` [PATCH v3 13/30] ARM: ep93xx: " Rob Herring
2012-03-02 3:13 ` [PATCH v3 14/30] ARM: at91: add explicit include of hardware.h to uncompressor Rob Herring
2012-03-02 3:13 ` [PATCH v3 15/30] ARM: dove: add explicit include of dove.h to addr-map.c Rob Herring
2012-03-05 19:26 ` Nicolas Pitre
2012-03-02 3:13 ` [PATCH v3 16/30] ARM: clps711x: remove unneeded include of mach/io.h Rob Herring
2012-03-02 3:13 ` [PATCH v3 17/30] ARM: make mach/io.h include optional Rob Herring
2012-03-05 19:31 ` Nicolas Pitre
2012-03-02 3:13 ` [PATCH v3 18/30] ARM: remove bunch of now unused mach/io.h files Rob Herring
2012-03-05 19:33 ` Nicolas Pitre
2012-03-02 3:13 ` [PATCH v3 19/30] ARM: kill off __mem_pci Rob Herring
2012-03-02 3:13 ` Rob Herring [this message]
2012-03-02 3:13 ` [PATCH v3 21/30] ARM: Add fixed PCI i/o mapping Rob Herring
2012-03-05 19:41 ` Nicolas Pitre
2012-03-02 3:13 ` [PATCH v3 22/30] ARM: tegra: use " Rob Herring
2012-03-02 6:59 ` Thierry Reding
2012-03-02 3:13 ` [PATCH v3 23/30] ARM: integrator: " Rob Herring
2012-03-02 3:13 ` [PATCH v3 24/30] ARM: shark: " Rob Herring
2012-03-02 3:13 ` [PATCH v3 25/30] ARM: footbridge: " Rob Herring
2012-03-02 3:13 ` [PATCH v3 26/30] ARM: dove: " Rob Herring
2012-03-05 20:12 ` Nicolas Pitre
2012-03-02 3:13 ` [PATCH v3 27/30] ARM: kirkwood: " Rob Herring
2012-03-05 19:59 ` Nicolas Pitre
2012-03-02 3:13 ` [PATCH v3 28/30] ARM: ixp23xx: " Rob Herring
2012-03-02 3:13 ` [PATCH v3 29/30] ARM: iop13xx: " Rob Herring
2012-03-02 3:13 ` [PATCH v3 30/30] ARM: orion5x: " Rob Herring
2012-03-05 20:13 ` Nicolas Pitre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1330658022-14559-21-git-send-email-robherring2@gmail.com \
--to=robherring2@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).