From: Marek Szyprowski <m.szyprowski@samsung.com>
To: u-boot@lists.denx.de
Subject: [RFC PATCH v2 1/2] arm: provide a function for boards init code to modify MMU virtual-physical map
Date: Fri, 15 May 2020 13:20:15 +0200 [thread overview]
Message-ID: <20200515112016.24522-2-m.szyprowski@samsung.com> (raw)
In-Reply-To: <20200515112016.24522-1-m.szyprowski@samsung.com>
Provide a function for setting arbitrary virtual-physical MMU mapping
for the given region.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
arch/arm/include/asm/mmu.h | 8 ++++++++
arch/arm/include/asm/system.h | 11 +++++++++++
arch/arm/lib/cache-cp15.c | 24 ++++++++++++++++++------
3 files changed, 37 insertions(+), 6 deletions(-)
create mode 100644 arch/arm/include/asm/mmu.h
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
new file mode 100644
index 0000000..fe3d793
--- /dev/null
+++ b/arch/arm/include/asm/mmu.h
@@ -0,0 +1,8 @@
+#ifndef __ASM_ARM_MMU_H
+#define __ASM_ARM_MMU_H
+
+#ifdef CONFIG_ADDR_MAP
+extern void init_addr_map(void);
+#endif
+
+#endif
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 81ccead..5b9f31c 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -573,6 +573,17 @@ s32 psci_features(u32 function_id, u32 psci_fid);
void save_boot_params_ret(void);
/**
+ * Change the virt/phys mapping and cache settings for a region.
+ *
+ * \param virt virtual start address of memory region to change
+ * \param phys physical address for the memory region to set
+ * \param size size of memory region to change
+ * \param option dcache option to select
+ */
+void mmu_set_region_dcache_behaviour_phys(phys_addr_t virt, phys_addr_t phys,
+ size_t size, enum dcache_option option);
+
+/**
* Change the cache settings for a region.
*
* \param start start address of memory region to change
diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c
index f8d2096..84ddad3 100644
--- a/arch/arm/lib/cache-cp15.c
+++ b/arch/arm/lib/cache-cp15.c
@@ -24,7 +24,8 @@ __weak void arm_init_domains(void)
{
}
-void set_section_dcache(int section, enum dcache_option option)
+static void set_section_phys(int section, phys_addr_t phys,
+ enum dcache_option option)
{
#ifdef CONFIG_ARMV7_LPAE
u64 *page_table = (u64 *)gd->arch.tlb_addr;
@@ -36,7 +37,7 @@ void set_section_dcache(int section, enum dcache_option option)
#endif
/* Add the page offset */
- value |= ((u32)section << MMU_SECTION_SHIFT);
+ value |= phys;
/* Add caching bits */
value |= option;
@@ -45,13 +46,18 @@ void set_section_dcache(int section, enum dcache_option option)
page_table[section] = value;
}
+void set_section_dcache(int section, enum dcache_option option)
+{
+ set_section_phys(section, (u32)section << MMU_SECTION_SHIFT, option);
+}
+
__weak void mmu_page_table_flush(unsigned long start, unsigned long stop)
{
debug("%s: Warning: not implemented\n", __func__);
}
-void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,
- enum dcache_option option)
+void mmu_set_region_dcache_behaviour_phys(phys_addr_t start, phys_addr_t phys,
+ size_t size, enum dcache_option option)
{
#ifdef CONFIG_ARMV7_LPAE
u64 *page_table = (u64 *)gd->arch.tlb_addr;
@@ -70,8 +76,8 @@ void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,
debug("%s: start=%pa, size=%zu, option=0x%x\n", __func__, &start, size,
option);
#endif
- for (upto = start; upto < end; upto++)
- set_section_dcache(upto, option);
+ for (upto = start; upto < end; upto++, phys += MMU_SECTION_SIZE)
+ set_section_phys(upto, phys, option);
/*
* Make sure range is cache line aligned
@@ -86,6 +92,12 @@ void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,
mmu_page_table_flush(startpt, stoppt);
}
+void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,
+ enum dcache_option option)
+{
+ mmu_set_region_dcache_behaviour_phys(start, start, size, option);
+}
+
__weak void dram_bank_mmu_setup(int bank)
{
bd_t *bd = gd->bd;
--
1.9.1
next prev parent reply other threads:[~2020-05-15 11:20 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200504124532eucas1p1603b3576c1e938a0bc0d11c075b289e0@eucas1p1.samsung.com>
2020-05-04 12:45 ` [PATCH v2 00/10] USB host support for Raspberry Pi 4 board Sylwester Nawrocki
2020-05-04 12:45 ` [PATCH v2 01/10] usb: xhci: Add missing cache flush in the scratchpad array initialization Sylwester Nawrocki
2020-05-04 12:45 ` [PATCH v2 02/10] usb: xhci: Use only 32-bit accesses in xhci_writeq/xhci_readq Sylwester Nawrocki
2020-05-04 12:45 ` [PATCH v2 03/10] pci: Move some PCIe register offset definitions to a common header Sylwester Nawrocki
2020-05-04 12:45 ` [PATCH v2 04/10] rpi4: shorten a mapping for the DRAM Sylwester Nawrocki
2020-05-04 12:45 ` [PATCH v2 05/10] rpi4: add a mapping for the PCIe XHCI controller MMIO registers (ARM 64bit) Sylwester Nawrocki
2020-05-05 14:00 ` Matthias Brugger
2020-05-05 14:07 ` Matthias Brugger
2020-05-05 14:10 ` Marek Szyprowski
2020-05-05 14:13 ` Matthias Brugger
2020-05-04 12:45 ` [PATCH v2 06/10] rpi4: add a mapping for the PCIe XHCI controller MMIO registers (ARM 32bit) Sylwester Nawrocki
2020-05-05 14:25 ` Matthias Brugger
2020-05-05 14:43 ` Marek Szyprowski
2020-05-08 21:26 ` Matthias Brugger
2020-05-11 19:44 ` Tom Rini
2020-05-11 19:47 ` Matthias Brugger
2020-05-12 10:25 ` Sylwester Nawrocki
2020-05-12 12:04 ` Marek Szyprowski
2020-05-12 13:17 ` [RFC PATCH 0/2] ARM: arbitrary virtual-physical mappings for RPi4 XHCI support Marek Szyprowski
2020-05-12 13:17 ` [RFC PATCH 1/2] arm: provide a function for boards init code to modify MMU virtual-physical map Marek Szyprowski
2020-05-12 15:11 ` Sylwester Nawrocki
2020-05-12 13:17 ` [RFC PATCH 2/2] rpi4: add a mapping for the PCIe XHCI controller MMIO registers (ARM 32bit) Marek Szyprowski
2020-05-15 11:20 ` [RFC PATCH v2 0/2] ARM: arbitrary virtual-physical mappings for RPi4 XHCI support Marek Szyprowski
2020-05-15 11:20 ` Marek Szyprowski [this message]
2020-05-15 11:20 ` [RFC PATCH v2 2/2] rpi4: add a mapping for the PCIe XHCI controller MMIO registers (ARM 32bit) Marek Szyprowski
2020-05-04 12:45 ` [PATCH v2 07/10] linux/bitfield.h: Add primitives for manipulating bitfields both in host- and fixed-endian Sylwester Nawrocki
2020-05-05 11:10 ` Bin Meng
2020-05-04 12:45 ` [PATCH v2 08/10] pci: Add some PCI Express capability register offset definitions Sylwester Nawrocki
2020-05-04 12:45 ` [PATCH v2 09/10] pci: Add driver for Broadcom STB PCIe controller Sylwester Nawrocki
2020-05-05 14:13 ` Nicolas Saenz Julienne
2020-05-06 8:36 ` Sylwester Nawrocki
2020-05-05 15:45 ` Nicolas Saenz Julienne
2020-05-06 8:59 ` Sylwester Nawrocki
2020-05-06 14:47 ` Simon Glass
2020-05-08 9:50 ` Nicolas Saenz Julienne
2020-05-08 14:25 ` Jim Quinlan
2020-05-08 14:54 ` Nicolas Saenz Julienne
2020-05-08 18:33 ` Simon Glass
2020-05-12 16:42 ` Sylwester Nawrocki
2020-05-12 16:46 ` Jim Quinlan
2020-05-08 11:46 ` Sylwester Nawrocki
2020-05-08 13:08 ` Simon Glass
2020-05-04 12:45 ` [PATCH v2 10/10] config: Enable support for the XHCI controller on RPI4 board Sylwester Nawrocki
2020-05-05 11:15 ` Bin Meng
2020-05-05 11:18 ` Nicolas Saenz Julienne
2020-05-05 11:19 ` Marek Szyprowski
2020-05-05 14:09 ` [PATCH v2 00/10] USB host support for Raspberry Pi 4 board Nicolas Saenz Julienne
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=20200515112016.24522-2-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox