From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/15] ARM: Add fixed PCI i/o mapping
Date: Fri, 6 Jul 2012 13:40:26 -0500 [thread overview]
Message-ID: <1341600040-30993-2-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1341600040-30993-1-git-send-email-robherring2@gmail.com>
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
next prev parent reply other threads:[~2012-07-06 18:40 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-06 18:40 [PATCH 00/15] PCI io.h cleanups Rob Herring
2012-07-06 18:40 ` Rob Herring [this message]
2012-07-09 16:21 ` [PATCH 01/15] ARM: Add fixed PCI i/o mapping 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
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
2012-07-06 18:40 ` [PATCH 13/15] i2c: iop3xx: clean-up trailing whitespace Rob Herring
2012-07-06 18:40 ` [PATCH 14/15] i2c: iop3xx: use standard gpiolib functions Rob Herring
2012-07-08 11:29 ` Wolfram Sang
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
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=1341600040-30993-2-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).