All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: u-boot@lists.denx.de
Subject: [PATCH v4 4/5] rpi4: add a mapping for the PCIe XHCI controller MMIO registers (ARM 32bit)
Date: Tue,  2 Jun 2020 14:04:22 +0200	[thread overview]
Message-ID: <20200602120423.6285-5-m.szyprowski@samsung.com> (raw)
In-Reply-To: <20200602120423.6285-1-m.szyprowski@samsung.com>

Create a non-cacheable mapping for the 0x600000000 physical memory region,
where MMIO registers for the PCIe XHCI controller are instantiated by the
PCIe bridge. Due to 32bit limit in the CPU virtual address space in ARM
32bit mode, this region is mapped at 0xff800000 CPU virtual address.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I032641c782e915fa1f999a1e208dd915a22515f7
---
 arch/arm/mach-bcm283x/Kconfig             |  1 +
 arch/arm/mach-bcm283x/include/mach/base.h |  8 ++++++++
 arch/arm/mach-bcm283x/init.c              | 21 +++++++++++++++++++++
 3 files changed, 30 insertions(+)

diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
index e6eb904e7f9..b3287ce8bce 100644
--- a/arch/arm/mach-bcm283x/Kconfig
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -36,6 +36,7 @@ config BCM2711_32B
 	select BCM2711
 	select ARMV7_LPAE
 	select CPU_V7A
+	select PHYS_64BIT
 
 config BCM2711_64B
 	bool "Broadcom BCM2711 SoC 64-bit support"
diff --git a/arch/arm/mach-bcm283x/include/mach/base.h b/arch/arm/mach-bcm283x/include/mach/base.h
index c4ae39852f1..4ccaf69693d 100644
--- a/arch/arm/mach-bcm283x/include/mach/base.h
+++ b/arch/arm/mach-bcm283x/include/mach/base.h
@@ -8,4 +8,12 @@
 
 extern unsigned long rpi_bcm283x_base;
 
+#ifdef CONFIG_ARMV7_LPAE
+#ifdef CONFIG_TARGET_RPI_4_32B
+#include <addr_map.h>
+#define phys_to_virt addrmap_phys_to_virt
+#define virt_to_phys addrmap_virt_to_phys
+#endif
+#endif
+
 #endif
diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c
index cf4c5b245d2..f2a54116237 100644
--- a/arch/arm/mach-bcm283x/init.c
+++ b/arch/arm/mach-bcm283x/init.c
@@ -146,6 +146,27 @@ int mach_cpu_init(void)
 }
 
 #ifdef CONFIG_ARMV7_LPAE
+#ifdef CONFIG_TARGET_RPI_4_32B
+#define BCM2711_RPI4_PCIE_XHCI_MMIO_VIRT	0xff800000UL
+#include <addr_map.h>
+#include <asm/system.h>
+
+void init_addr_map(void)
+{
+	mmu_set_region_dcache_behaviour_phys(BCM2711_RPI4_PCIE_XHCI_MMIO_VIRT,
+					     BCM2711_RPI4_PCIE_XHCI_MMIO_PHYS,
+					     BCM2711_RPI4_PCIE_XHCI_MMIO_SIZE,
+					     DCACHE_OFF);
+
+	/* identity mapping for 0..BCM2711_RPI4_PCIE_XHCI_MMIO_VIRT */
+	addrmap_set_entry(0, 0, BCM2711_RPI4_PCIE_XHCI_MMIO_VIRT, 0);
+	/* XHCI MMIO on PCIe at BCM2711_RPI4_PCIE_XHCI_MMIO_VIRT */
+	addrmap_set_entry(BCM2711_RPI4_PCIE_XHCI_MMIO_VIRT,
+			  BCM2711_RPI4_PCIE_XHCI_MMIO_PHYS,
+			  BCM2711_RPI4_PCIE_XHCI_MMIO_SIZE, 1);
+}
+#endif
+
 void enable_caches(void)
 {
 	dcache_enable();
-- 
2.17.1

  parent reply	other threads:[~2020-06-02 12:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200602120704eucas1p29ca38e04d720f89bb6d1a099d41d9abb@eucas1p2.samsung.com>
2020-06-02 12:04 ` [PATCH v4 0/5] ARM: arbitrary virtual-physical mappings for RPi4 XHCI support Marek Szyprowski
     [not found]   ` <CGME20200602120705eucas1p208a323aa45431cf267e12ae157c507c3@eucas1p2.samsung.com>
2020-06-02 12:04     ` [PATCH v4 1/5] powerpc: move ADDR_MAP to Kconfig Marek Szyprowski
2020-06-02 14:28       ` Tom Rini
     [not found]   ` <CGME20200602120706eucas1p1d0bba520d15d775bc5d7d1928b1e5cb5@eucas1p1.samsung.com>
2020-06-02 12:04     ` [PATCH v4 2/5] arm: provide a function for boards init code to modify MMU virtual-physical map Marek Szyprowski
2020-06-02 14:28       ` Tom Rini
     [not found]   ` <CGME20200602120707eucas1p1b4e31f4f658bcf218550c483eb513705@eucas1p1.samsung.com>
2020-06-02 12:04     ` [PATCH v4 3/5] mmc: bcm283x: fix int to pointer cast Marek Szyprowski
     [not found]   ` <CGME20200602120707eucas1p1a4472732abbbf0ae089daa39ed050c3c@eucas1p1.samsung.com>
2020-06-02 12:04     ` Marek Szyprowski [this message]
     [not found]   ` <CGME20200602120708eucas1p2e1d1b2afd0228f6568489623ec3f307c@eucas1p2.samsung.com>
2020-06-02 12:04     ` [PATCH v4 5/5] config: Enable support for the XHCI controller on RPI4 board Marek Szyprowski

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=20200602120423.6285-5-m.szyprowski@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=u-boot@lists.denx.de \
    /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 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.