Skip to contentSkip to conversation

arm: Introduce v7R support

PATCH New Lokesh Vutla 3 participants 18 messages Apr 26, 2018 – May 8, 2018

Subsystems (12)
lore
Share & tools
lore
#0 lore raw

v2 cover arm: Introduce v7R support

The Cortex-R* processors are a mid-range CPUs for use in deeply-embedded, real-time systems. It implements the ARMv7-R architecture, and includes Thumb-2 technology for optimum code density and processing throughput.

Except for MPU(Memory Protection Unit) and few CP15 registers, most of the features are compatible with v7 architecture. This series adds minimal support for v7-R architecture by reusing the v7 support. Also adding support for MPU.

Travis-ci build report: https://travis-ci.org/lokeshvutla/u-boot/builds/371442638

Changes since v1:
- Renamed file armv7m_mpu.h to armv7_mpu.h
- Removed an unnecessary guard for an include

Changes since RFC:
- Renamed CPUV7 as CPU_V7A
- Renamed MMU as SYS_ARM_MMU
- Added SYS_ARM_CACHE_CP15

Lokesh Vutla (6):
arm: v7: Update VBAR only if available
arm: v7: Kconfig: Rename CPU_V7 as CPU_V7A
arm: v7: Kconfig: Add entry for MMU
arm: v7: Kconfig: Introduce SYS_ARM_CACHE_CP15
arm: v7R: Add support for MPU
arm: v7R: Add support for enabling caches

Michal Simek (1):
arm: v7R: Add initial support

 arch/arm/Kconfig                  |  95 ++++++++++++++++------
 arch/arm/Makefile                 |   8 +-
 arch/arm/cpu/armv7/Kconfig        |   4 +-
 arch/arm/cpu/armv7/Makefile       |   2 +
 arch/arm/cpu/armv7/mpu_v7r.c      | 120 +++++++++++++++++++++++++++
 arch/arm/cpu/armv7/start.S        |   4 +
 arch/arm/cpu/armv7m/Makefile      |   3 +-
 arch/arm/cpu/armv7m/mpu.c         |  43 +---------
 arch/arm/include/asm/armv7_mpu.h  | 131 ++++++++++++++++++++++++++++++
 arch/arm/include/asm/armv7m_mpu.h |  67 ---------------
 arch/arm/include/asm/system.h     |   4 +-
 arch/arm/lib/Makefile             |   6 +-
 arch/arm/lib/cache-cp15.c         |  14 +++-
 arch/arm/mach-at91/Kconfig        |  12 +--
 arch/arm/mach-at91/Makefile       |   2 +-
 arch/arm/mach-at91/config.mk      |   2 +-
 arch/arm/mach-bcm283x/Kconfig     |   4 +-
 arch/arm/mach-exynos/Kconfig      |   4 +-
 arch/arm/mach-exynos/Makefile     |   2 +-
 arch/arm/mach-exynos/soc.c        |   2 +-
 arch/arm/mach-mvebu/Kconfig       |   2 +-
 arch/arm/mach-qemu/Kconfig        |   2 +-
 arch/arm/mach-rmobile/Kconfig     |   2 +-
 arch/arm/mach-rockchip/Kconfig    |  12 +--
 arch/arm/mach-stm32/soc.c         |   2 +-
 arch/arm/mach-stm32mp/Kconfig     |   2 +-
 arch/arm/mach-sunxi/Kconfig       |  22 ++---
 arch/arm/mach-tegra/Kconfig       |   2 +-
 arch/arm/mach-uniphier/Kconfig    |   2 +-
 arch/arm/mach-uniphier/Makefile   |   2 +-
 cmd/Kconfig                       |   2 +-
 drivers/serial/arm_dcc.c          |   2 +-
 32 files changed, 392 insertions(+), 191 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/mpu_v7r.c
 create mode 100644 arch/arm/include/asm/armv7_mpu.h
 delete mode 100644 arch/arm/include/asm/armv7m_mpu.h
Signature · 1 line
2.17.0
#1 lore raw

PATCH v2 1/7 arm: v7: Update VBAR only if available

Not all ARM V7 based cpus has VBAR for remapping vector base address. So, update VBAR only if it available.

---
 arch/arm/cpu/armv7/start.S | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/cpu/armv7/start.S +2 -0
index 7e2695761e..937f7051fe 100644
@@ -73,9 +73,11 @@ switch_to_hypervisor_ret:
 	bic	r0, #CR_V		@ V = 0
 	mcr	p15, 0, r0, c1, c0, 0	@ Write CP15 SCTLR Register
 
+#ifdef CONFIG_HAS_VBAR
 	/* Set vector address in CP15 VBAR register */
 	ldr	r0, =_start
 	mcr	p15, 0, r0, c12, c0, 0	@Set VBAR
+#endif
 #endif
 
 	/* the mask ROM code should have PLL and others stable */
Signature · 1 line
2.17.0
#2 lore raw

PATCH v2 1/7 arm: v7: Update VBAR only if available

Quoted 5 lines · Lokesh Vutla

Not all ARM V7 based cpus has VBAR for remapping vector base address. So, update VBAR only if it available.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180507/323dfb25/attachment.sig>
#3 lore raw

PATCH v2 2/7 arm: v7: Kconfig: Rename CPU_V7 as CPU_V7A

In reply to Lokesh Vutla

Currently CPU_V7 kconfig symbol supports only ARMv7A architectures under armv7 folder. This led to a misconception of creating separate folders for armv7m and armv7r. There is no reason to create separate folder for other armv7 based architectures when it can co-exist with few Kconfig symbols.

As a first step towards a common folder, rename CPU_V7 as CPUV7A. Later separate Kconfig symbols can be added for CPU_V7R and CPU_V7M and can co exist in the same folder.

---
 arch/arm/Kconfig                | 54 ++++++++++++++++-----------------
 arch/arm/Makefile               |  6 ++--
 arch/arm/cpu/armv7/Kconfig      |  4 +--
 arch/arm/include/asm/system.h   |  4 +--
 arch/arm/lib/cache-cp15.c       |  2 +-
 arch/arm/mach-at91/Kconfig      | 12 ++++----
 arch/arm/mach-at91/Makefile     |  2 +-
 arch/arm/mach-at91/config.mk    |  2 +-
 arch/arm/mach-bcm283x/Kconfig   |  4 +--
 arch/arm/mach-exynos/Kconfig    |  4 +--
 arch/arm/mach-exynos/Makefile   |  2 +-
 arch/arm/mach-exynos/soc.c      |  2 +-
 arch/arm/mach-mvebu/Kconfig     |  2 +-
 arch/arm/mach-qemu/Kconfig      |  2 +-
 arch/arm/mach-rmobile/Kconfig   |  2 +-
 arch/arm/mach-rockchip/Kconfig  | 12 ++++----
 arch/arm/mach-stm32mp/Kconfig   |  2 +-
 arch/arm/mach-sunxi/Kconfig     | 22 +++++++-------
 arch/arm/mach-tegra/Kconfig     |  2 +-
 arch/arm/mach-uniphier/Kconfig  |  2 +-
 arch/arm/mach-uniphier/Makefile |  2 +-
 cmd/Kconfig                     |  2 +-
 drivers/serial/arm_dcc.c        |  2 +-
 23 files changed, 75 insertions(+), 75 deletions(-)
arch/arm/Kconfig +27 -27
index 7212fc5afa..df475626e7 100644
@@ -180,7 +180,7 @@ config CPU_ARM1176
 	select HAS_VBAR
 	select SYS_CACHE_SHIFT_5
 
-config CPU_V7
+config CPU_V7A
 	bool
 	select HAS_VBAR
 	select HAS_THUMB2
@@ -207,7 +207,7 @@ config SYS_CPU
 	default "arm946es" if CPU_ARM946ES
 	default "arm1136" if CPU_ARM1136
 	default "arm1176" if CPU_ARM1176
-	default "armv7" if CPU_V7
+	default "armv7" if CPU_V7A
 	default "armv7m" if CPU_V7M
 	default "pxa" if CPU_PXA
 	default "sa1100" if CPU_SA1100
@@ -221,7 +221,7 @@ config SYS_ARM_ARCH
 	default 5 if CPU_ARM946ES
 	default 6 if CPU_ARM1136
 	default 6 if CPU_ARM1176
-	default 7 if CPU_V7
+	default 7 if CPU_V7A
 	default 7 if CPU_V7M
 	default 5 if CPU_PXA
 	default 4 if CPU_SA1100
@@ -244,7 +244,7 @@ config SYS_CACHELINE_SIZE
 
 config ARM_SMCCC
 	bool "Support for ARM SMC Calling Convention (SMCCC)"
-	depends on CPU_V7 || ARM64
+	depends on CPU_V7A || ARM64
 	select ARM_PSCI_FW
 	help
 	  Say Y here if you want to enable ARM SMC Calling Convention.
@@ -429,7 +429,7 @@ config TARGET_SPEAR600
 
 config TARGET_STV0991
 	bool "Support stv0991"
-	select CPU_V7
+	select CPU_V7A
 	select DM
 	select DM_SERIAL
 	select DM_SPI
@@ -481,36 +481,36 @@ config ARCH_BCM283X
 
 config TARGET_VEXPRESS_CA15_TC2
 	bool "Support vexpress_ca15_tc2"
-	select CPU_V7
+	select CPU_V7A
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
 	select PL011_SERIAL
 
 config TARGET_VEXPRESS_CA5X2
 	bool "Support vexpress_ca5x2"
-	select CPU_V7
+	select CPU_V7A
 	select PL011_SERIAL
 
 config TARGET_VEXPRESS_CA9X4
 	bool "Support vexpress_ca9x4"
-	select CPU_V7
+	select CPU_V7A
 	select PL011_SERIAL
 
 config TARGET_BCM23550_W1D
 	bool "Support bcm23550_w1d"
-	select CPU_V7
+	select CPU_V7A
 	imply CRC32_VERIFY
 	imply FAT_WRITE
 
 config TARGET_BCM28155_AP
 	bool "Support bcm28155_ap"
-	select CPU_V7
+	select CPU_V7A
 	imply CRC32_VERIFY
 	imply FAT_WRITE
 
 config TARGET_BCMCYGNUS
 	bool "Support bcmcygnus"
-	select CPU_V7
+	select CPU_V7A
 	imply CRC32_VERIFY
 	imply CMD_HASH
 	imply FAT_WRITE
@@ -521,7 +521,7 @@ config TARGET_BCMCYGNUS
 
 config TARGET_BCMNSP
 	bool "Support bcmnsp"
-	select CPU_V7
+	select CPU_V7A
 
 config TARGET_BCMNS2
 	bool "Support Broadcom Northstar2"
@@ -544,7 +544,7 @@ config ARCH_EXYNOS
 
 config ARCH_S5PC1XX
 	bool "Samsung S5PC1XX"
-	select CPU_V7
+	select CPU_V7A
 	select DM
 	select DM_SERIAL
 	select DM_GPIO
@@ -552,7 +552,7 @@ config ARCH_S5PC1XX
 
 config ARCH_HIGHBANK
 	bool "Calxeda Highbank"
-	select CPU_V7
+	select CPU_V7A
 	select PL011_SERIAL
 
 config ARCH_INTEGRATOR
@@ -563,7 +563,7 @@ config ARCH_INTEGRATOR
 
 config ARCH_KEYSTONE
 	bool "TI Keystone"
-	select CPU_V7
+	select CPU_V7A
 	select SUPPORT_SPL
 	select SYS_THUMB_BUILD
 	select CMD_POWEROFF
@@ -573,7 +573,7 @@ config ARCH_KEYSTONE
 
 config ARCH_OMAP2PLUS
 	bool "TI OMAP2+"
-	select CPU_V7
+	select CPU_V7A
 	select SPL_BOARD_INIT if SPL
 	select SPL_STACK_R if SPL
 	select SUPPORT_SPL
@@ -611,13 +611,13 @@ config ARCH_MX28
 
 config ARCH_MX7ULP
         bool "NXP MX7ULP"
-        select CPU_V7
+	select CPU_V7A
 	select ROM_UNIFIED_SECTIONS
 	imply MXC_GPIO
 
 config ARCH_MX7
 	bool "Freescale MX7"
-	select CPU_V7
+	select CPU_V7A
 	select SYS_FSL_HAS_SEC if SECURE_BOOT
 	select SYS_FSL_SEC_COMPAT_4
 	select SYS_FSL_SEC_LE
@@ -627,7 +627,7 @@ config ARCH_MX7
 
 config ARCH_MX6
 	bool "Freescale MX6"
-	select CPU_V7
+	select CPU_V7A
 	select SYS_FSL_HAS_SEC if SECURE_BOOT
 	select SYS_FSL_SEC_COMPAT_4
 	select SYS_FSL_SEC_LE
@@ -641,7 +641,7 @@ endif
 
 config ARCH_MX5
 	bool "Freescale MX5"
-	select CPU_V7
+	select CPU_V7A
 	select BOARD_EARLY_INIT_F
 	imply MXC_GPIO
 
@@ -677,7 +677,7 @@ config ARCH_SNAPDRAGON
 
 config ARCH_SOCFPGA
 	bool "Altera SOCFPGA family"
-	select CPU_V7
+	select CPU_V7A
 	select SUPPORT_SPL
 	select OF_CONTROL
 	select SPL_OF_CONTROL
@@ -734,7 +734,7 @@ config ARCH_SUNXI
 
 config ARCH_VF610
 	bool "Freescale Vybrid"
-	select CPU_V7
+	select CPU_V7A
 	select SYS_FSL_ERRATUM_ESDHC111
 	imply CMD_MTDPARTS
 	imply NAND
@@ -742,7 +742,7 @@ config ARCH_VF610
 config ARCH_ZYNQ
 	bool "Xilinx Zynq based platform"
 	select BOARD_LATE_INIT
-	select CPU_V7
+	select CPU_V7A
 	select SUPPORT_SPL
 	select OF_CONTROL
 	select SPL_BOARD_INIT if SPL
@@ -982,7 +982,7 @@ config TARGET_LS1088ARDB
 config TARGET_LS1021AQDS
 	bool "Support ls1021aqds"
 	select BOARD_LATE_INIT
-	select CPU_V7
+	select CPU_V7A
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
 	select SUPPORT_SPL
@@ -996,7 +996,7 @@ config TARGET_LS1021AQDS
 config TARGET_LS1021ATWR
 	bool "Support ls1021atwr"
 	select BOARD_LATE_INIT
-	select CPU_V7
+	select CPU_V7A
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
 	select SUPPORT_SPL
@@ -1009,7 +1009,7 @@ config TARGET_LS1021ATWR
 config TARGET_LS1021AIOT
 	bool "Support ls1021aiot"
 	select BOARD_LATE_INIT
-	select CPU_V7
+	select CPU_V7A
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
 	select SUPPORT_SPL
@@ -1125,7 +1125,7 @@ config STM32
 
 config ARCH_STI
 	bool "Support STMicrolectronics SoCs"
-	select CPU_V7
+	select CPU_V7A
 	select DM
 	select DM_SERIAL
 	select BLK
arch/arm/Makefile +3 -3
index 4fa8b38397..2979ad86fd 100644
@@ -3,7 +3,7 @@
 #
 
 ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TEGRA),yy)
-CONFIG_CPU_V7=
+CONFIG_CPU_V7A=
 CONFIG_CPU_ARM720T=y
 endif
 
@@ -16,7 +16,7 @@ arch-$(CONFIG_CPU_SA1100)	=-march=armv4
 arch-$(CONFIG_CPU_PXA)		=
 arch-$(CONFIG_CPU_ARM1136)	=-march=armv5
 arch-$(CONFIG_CPU_ARM1176)	=-march=armv5t
-arch-$(CONFIG_CPU_V7)		=$(call cc-option, -march=armv7-a, \
+arch-$(CONFIG_CPU_V7A)		=$(call cc-option, -march=armv7-a, \
 				 $(call cc-option, -march=armv7, -march=armv5))
 arch-$(CONFIG_ARM64)		=-march=armv8-a
 
@@ -40,7 +40,7 @@ tune-$(CONFIG_CPU_SA1100)	=-mtune=strongarm1100
 tune-$(CONFIG_CPU_PXA)		=-mcpu=xscale
 tune-$(CONFIG_CPU_ARM1136)	=
 tune-$(CONFIG_CPU_ARM1176)	=
-tune-$(CONFIG_CPU_V7)		=
+tune-$(CONFIG_CPU_V7A)		=
 tune-$(CONFIG_ARM64)		=
 
 # Evaluate tune cc-option calls now
arch/arm/cpu/armv7/Kconfig +2 -2
index b9c4f4e79b..37a0be932e 100644
@@ -1,4 +1,4 @@
-if CPU_V7
+if CPU_V7A
 
 config CPU_V7_HAS_NONSEC
         bool
@@ -52,7 +52,7 @@ config ARMV7_PSCI_NR_CPUS
 
 config ARMV7_LPAE
 	bool "Use LPAE page table format" if EXPERT
-	depends on CPU_V7
+	depends on CPU_V7A
 	default n
 	---help---
 	Say Y here to use the long descriptor page table format. This is
arch/arm/include/asm/system.h +2 -2
index 4f043cad0b..c1f87f9caf 100644
@@ -451,7 +451,7 @@ enum dcache_option {
 	DCACHE_WRITEBACK = TTB_SECT | TTB_SECT_MAIR(2),
 	DCACHE_WRITEALLOC = TTB_SECT | TTB_SECT_MAIR(3),
 };
-#elif defined(CONFIG_CPU_V7)
+#elif defined(CONFIG_CPU_V7A)
 /* Short-Descriptor Translation Table Level 1 Bits */
 #define TTB_SECT_NS_MASK	(1 << 19)
 #define TTB_SECT_NG_MASK	(1 << 17)
@@ -493,7 +493,7 @@ enum {
 	MMU_SECTION_SIZE	= 1 << MMU_SECTION_SHIFT,
 };
 
-#ifdef CONFIG_CPU_V7
+#ifdef CONFIG_CPU_V7A
 /* TTBR0 bits */
 #define TTBR0_BASE_ADDR_MASK	0xFFFFC000
 #define TTBR0_RGN_NC			(0 << 3)
arch/arm/lib/cache-cp15.c +1 -1
index f0c1b03728..b09c631636 100644
@@ -161,7 +161,7 @@ static inline void mmu_setup(void)
 		asm volatile("mcr p15, 0, %0, c10, c2, 0"
 			: : "r" (MEMORY_ATTRIBUTES) : "memory");
 	}
-#elif defined(CONFIG_CPU_V7)
+#elif defined(CONFIG_CPU_V7A)
 	if (is_hyp()) {
 		/* Set HTCR to disable LPAE */
 		asm volatile("mcr p15, 4, %0, c2, c0, 2"
arch/arm/mach-at91/Kconfig +6 -6
index 3621dfa760..6f046875ab 100644
@@ -45,15 +45,15 @@ config AT91SAM9X5
 
 config SAMA5D2
 	bool
-	select CPU_V7
+	select CPU_V7A
 
 config SAMA5D3
 	bool
-	select CPU_V7
+	select CPU_V7A
 
 config SAMA5D4
 	bool
-	select CPU_V7
+	select CPU_V7A
 
 choice
 	prompt "Atmel AT91 board select"
@@ -158,7 +158,7 @@ config TARGET_SAMA5D2_XPLAINED
 
 config TARGET_SAMA5D27_SOM1_EK
 	bool "SAMA5D27 SOM1 EK board"
-	select CPU_V7
+	select CPU_V7A
 	select SUPPORT_SPL
 	select BOARD_EARLY_INIT_F
 	select BOARD_LATE_INIT
@@ -250,7 +250,7 @@ config TARGET_WB45N
 config TARGET_WB50N
 	bool "Support Laird WB50N"
 	select BOARD_LATE_INIT
-	select CPU_V7
+	select CPU_V7A
 	select SUPPORT_SPL
 	select BOARD_EARLY_INIT_F
 
@@ -293,6 +293,6 @@ source "board/laird/wb50n/Kconfig"
 
 config SPL_LDSCRIPT
 	default "arch/arm/mach-at91/arm926ejs/u-boot-spl.lds" if CPU_ARM926EJS
-	default "arch/arm/mach-at91/armv7/u-boot-spl.lds" if CPU_V7
+	default "arch/arm/mach-at91/armv7/u-boot-spl.lds" if CPU_V7A
 
 endif
arch/arm/mach-at91/Makefile +1 -1
index a908004b0a..2733a0bc7f 100644
@@ -18,4 +18,4 @@ endif
 obj-y += clock.o
 obj-$(CONFIG_CPU_ARM920T)	+= arm920t/
 obj-$(CONFIG_CPU_ARM926EJS)	+= arm926ejs/
-obj-$(CONFIG_CPU_V7)		+= armv7/
+obj-$(CONFIG_CPU_V7A)		+= armv7/
arch/arm/mach-at91/config.mk +1 -1
index 7168abbd58..9a023efb19 100644
@@ -2,7 +2,7 @@ ifeq ($(CONFIG_CPU_ARM926EJS),y)
 PLATFORM_CPPFLAGS += $(call cc-option,-mtune=arm926ejs,)
 endif
 
-ifeq ($(CONFIG_CPU_V7),y)
+ifeq ($(CONFIG_CPU_V7A),y)
 ifndef CONFIG_SPL_BUILD
 ALL-y	+= u-boot.img
 endif
arch/arm/mach-bcm283x/Kconfig +2 -2
index a78239d63e..821caedbf7 100644
@@ -7,7 +7,7 @@ config BCM2836
 	bool "Broadcom BCM2836 SoC support"
 	depends on ARCH_BCM283X
 	select ARMV7_LPAE
-	select CPU_V7
+	select CPU_V7A
 
 config BCM2837
 	bool "Broadcom BCM2837 SoC support"
@@ -18,7 +18,7 @@ config BCM2837_32B
 	depends on ARCH_BCM283X
 	select BCM2837
 	select ARMV7_LPAE
-	select CPU_V7
+	select CPU_V7A
 
 config BCM2837_64B
 	bool "Broadcom BCM2837 SoC 64-bit support"
arch/arm/mach-exynos/Kconfig +2 -2
index 5ac047d892..65d9168ae2 100644
@@ -6,7 +6,7 @@ choice
 
 config ARCH_EXYNOS4
 	bool "Exynos4 SoC family"
-	select CPU_V7
+	select CPU_V7A
 	select BOARD_EARLY_INIT_F
 	help
 	  Samsung Exynos4 SoC family are based on ARM Cortex-A9 CPU. There
@@ -15,7 +15,7 @@ config ARCH_EXYNOS4
 
 config ARCH_EXYNOS5
 	bool "Exynos5 SoC family"
-	select CPU_V7
+	select CPU_V7A
 	select BOARD_EARLY_INIT_F
 	select SHA_HW_ACCEL
 	imply CRC32_VERIFY
arch/arm/mach-exynos/Makefile +1 -1
index 0cc6c3253a..49a3e22927 100644
@@ -6,7 +6,7 @@
 #
 
 obj-y	+= soc.o
-obj-$(CONFIG_CPU_V7) += clock.o pinmux.o power.o system.o
+obj-$(CONFIG_CPU_V7A) += clock.o pinmux.o power.o system.o
 obj-$(CONFIG_ARM64)	+= mmu-arm64.o
 
 obj-$(CONFIG_EXYNOS5420)	+= sec_boot.o
arch/arm/mach-exynos/soc.c +1 -1
index cf149ad1a8..181656e7b0 100644
@@ -21,7 +21,7 @@ void *secondary_boot_addr = (void *)_main;
 
 void reset_cpu(ulong addr)
 {
-#ifdef CONFIG_CPU_V7
+#ifdef CONFIG_CPU_V7A
 	writel(0x1, samsung_get_base_swreset());
 #endif
 }
arch/arm/mach-mvebu/Kconfig +1 -1
index 01d700bf2e..ec42cf9044 100644
@@ -6,7 +6,7 @@ config HAVE_MVEBU_EFUSE
 
 config ARMADA_32BIT
 	bool
-	select CPU_V7
+	select CPU_V7A
 	select SUPPORT_SPL
 	select SPL_DM
 	select SPL_DM_SEQ_ALIAS
arch/arm/mach-qemu/Kconfig +1 -1
index 133163aecf..dfc43999a2 100644
@@ -14,7 +14,7 @@ endif
 config TARGET_QEMU_ARM_32BIT
 	bool "Support qemu_arm"
 	depends on ARCH_QEMU
-	select CPU_V7
+	select CPU_V7A
 	select ARCH_SUPPORT_PSCI
 
 config TARGET_QEMU_ARM_64BIT
arch/arm/mach-rmobile/Kconfig +1 -1
index 4b05d78839..fc4b3c3219 100644
@@ -6,7 +6,7 @@ choice
 
 config RCAR_32
 	bool "Renesas ARM SoCs R-Car Gen1/Gen2 (32bit)"
-	select CPU_V7
+	select CPU_V7A
 
 config RCAR_GEN3
 	bool "Renesas ARM SoCs R-Car Gen3 (64bit)"
arch/arm/mach-rockchip/Kconfig +6 -6
index 0adaed4367..34bc895967 100644
@@ -2,7 +2,7 @@ if ARCH_ROCKCHIP
 
 config ROCKCHIP_RK3036
 	bool "Support Rockchip RK3036"
-	select CPU_V7
+	select CPU_V7A
 	select SUPPORT_SPL
 	select SPL
 	imply USB_FUNCTION_ROCKUSB
@@ -15,7 +15,7 @@ config ROCKCHIP_RK3036
 
 config ROCKCHIP_RK3128
 	bool "Support Rockchip RK3128"
-	select CPU_V7
+	select CPU_V7A
 	help
 	  The Rockchip RK3128 is a ARM-based SoC with a quad-core Cortex-A7
 	  including NEON and GPU, Mali-400 graphics, several DDR3 options
@@ -24,7 +24,7 @@ config ROCKCHIP_RK3128
 
 config ROCKCHIP_RK3188
 	bool "Support Rockchip RK3188"
-	select CPU_V7
+	select CPU_V7A
 	select SPL_BOARD_INIT if SPL
 	select SUPPORT_SPL
 	select SPL
@@ -46,7 +46,7 @@ config ROCKCHIP_RK3188
 
 config ROCKCHIP_RK322X
 	bool "Support Rockchip RK3228/RK3229"
-	select CPU_V7
+	select CPU_V7A
 	select SUPPORT_SPL
 	select SPL
 	select ROCKCHIP_BROM_HELPER
@@ -59,7 +59,7 @@ config ROCKCHIP_RK322X
 
 config ROCKCHIP_RK3288
 	bool "Support Rockchip RK3288"
-	select CPU_V7
+	select CPU_V7A
 	select SPL_BOARD_INIT if SPL
 	select SUPPORT_SPL
 	select SPL
@@ -152,7 +152,7 @@ config ROCKCHIP_RK3399
 
 config ROCKCHIP_RV1108
 	bool "Support Rockchip RV1108"
-	select CPU_V7
+	select CPU_V7A
 	help
 	  The Rockchip RV1108 is a ARM-based SoC with a single-core Cortex-A7
 	  and a DSP.
arch/arm/mach-stm32mp/Kconfig +1 -1
index 8ca97bf0c9..bb3e287a55 100644
@@ -24,7 +24,7 @@ config SYS_SOC
 
 config TARGET_STM32MP1
 	bool "Support stm32mp1xx"
-	select CPU_V7
+	select CPU_V7A
 	select PINCTRL_STM32
 	select STM32_RESET
 	select SYSRESET_SYSCON
arch/arm/mach-sunxi/Kconfig +11 -11
index b868f0e350..f0c9d1b058 100644
@@ -136,7 +136,7 @@ choice
 
 config MACH_SUN4I
 	bool "sun4i (Allwinner A10)"
-	select CPU_V7
+	select CPU_V7A
 	select ARM_CORTEX_CPU_IS_UP
 	select DRAM_SUN4I
 	select SUNXI_GEN_SUN4I
@@ -144,7 +144,7 @@ config MACH_SUN4I
 
 config MACH_SUN5I
 	bool "sun5i (Allwinner A13)"
-	select CPU_V7
+	select CPU_V7A
 	select ARM_CORTEX_CPU_IS_UP
 	select DRAM_SUN4I
 	select SUNXI_GEN_SUN4I
@@ -153,7 +153,7 @@ config MACH_SUN5I
 
 config MACH_SUN6I
 	bool "sun6i (Allwinner A31)"
-	select CPU_V7
+	select CPU_V7A
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
 	select ARCH_SUPPORT_PSCI
@@ -166,7 +166,7 @@ config MACH_SUN6I
 
 config MACH_SUN7I
 	bool "sun7i (Allwinner A20)"
-	select CPU_V7
+	select CPU_V7A
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
 	select ARCH_SUPPORT_PSCI
@@ -177,7 +177,7 @@ config MACH_SUN7I
 
 config MACH_SUN8I_A23
 	bool "sun8i (Allwinner A23)"
-	select CPU_V7
+	select CPU_V7A
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
 	select ARCH_SUPPORT_PSCI
@@ -189,7 +189,7 @@ config MACH_SUN8I_A23
 
 config MACH_SUN8I_A33
 	bool "sun8i (Allwinner A33)"
-	select CPU_V7
+	select CPU_V7A
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
 	select ARCH_SUPPORT_PSCI
@@ -201,7 +201,7 @@ config MACH_SUN8I_A33
 
 config MACH_SUN8I_A83T
 	bool "sun8i (Allwinner A83T)"
-	select CPU_V7
+	select CPU_V7A
 	select DRAM_SUN8I_A83T
 	select SUNXI_GEN_SUN6I
 	select MMC_SUNXI_HAS_NEW_MODE
@@ -209,7 +209,7 @@ config MACH_SUN8I_A83T
 
 config MACH_SUN8I_H3
 	bool "sun8i (Allwinner H3)"
-	select CPU_V7
+	select CPU_V7A
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
 	select ARCH_SUPPORT_PSCI
@@ -218,7 +218,7 @@ config MACH_SUN8I_H3
 
 config MACH_SUN8I_R40
 	bool "sun8i (Allwinner R40)"
-	select CPU_V7
+	select CPU_V7A
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
 	select ARCH_SUPPORT_PSCI
@@ -229,7 +229,7 @@ config MACH_SUN8I_R40
 
 config MACH_SUN8I_V3S
 	bool "sun8i (Allwinner V3s)"
-	select CPU_V7
+	select CPU_V7A
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
 	select ARCH_SUPPORT_PSCI
@@ -241,7 +241,7 @@ config MACH_SUN8I_V3S
 
 config MACH_SUN9I
 	bool "sun9i (Allwinner A80)"
-	select CPU_V7
+	select CPU_V7A
 	select DRAM_SUN9I
 	select SUN6I_PRCM
 	select SUNXI_HIGH_SRAM
arch/arm/mach-tegra/Kconfig +1 -1
index fd0082d22a..d565f5d331 100644
@@ -49,7 +49,7 @@ config TEGRA_NO_BPMP
 
 config TEGRA_ARMV7_COMMON
 	bool "Tegra 32-bit common options"
-	select CPU_V7
+	select CPU_V7A
 	select SPL
 	select SPL_BOARD_INIT if SPL
 	select SUPPORT_SPL
arch/arm/mach-uniphier/Kconfig +1 -1
index cc759b3e01..91bea776e6 100644
@@ -5,7 +5,7 @@ config SYS_CONFIG_NAME
 
 config ARCH_UNIPHIER_32BIT
 	bool
-	select CPU_V7
+	select CPU_V7A
 	select CPU_V7_HAS_NONSEC
 	select ARMV7_NONSEC
 	select ARCH_SUPPORT_PSCI
arch/arm/mach-uniphier/Makefile +1 -1
index 7a0b25ad51..16890da22c 100644
@@ -33,5 +33,5 @@ obj-y += dram/
 
 obj-$(CONFIG_DEBUG_UART_UNIPHIER) += debug-uart/
 
-obj-$(CONFIG_CPU_V7) += arm32/
+obj-$(CONFIG_CPU_V7A) += arm32/
 obj-$(CONFIG_ARM64) += arm64/
cmd/Kconfig +1 -1
index bc1d2f31c0..511d9117a0 100644
@@ -1103,7 +1103,7 @@ config BOOTP_PXE_CLIENTARCH
 config BOOTP_VCI_STRING
 	string
 	depends on CMD_BOOTP
-	default "U-Boot.armv7" if CPU_V7 || CPU_V7M
+	default "U-Boot.armv7" if CPU_V7A || CPU_V7M
 	default "U-Boot.armv8" if ARM64
 	default "U-Boot.arm" if ARM
 	default "U-Boot"
drivers/serial/arm_dcc.c +1 -1
index 07981e18ee..b6769a94cf 100644
@@ -20,7 +20,7 @@
 #include <dm.h>
 #include <serial.h>
 
-#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V7)
+#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V7A)
 /*
  * ARMV6 & ARMV7
  */
Signature · 1 line
2.17.0
#4 lore raw

PATCH v2 2/7 arm: v7: Kconfig: Rename CPU_V7 as CPU_V7A

Quoted 6 lines · Lokesh Vutla

Currently CPU_V7 kconfig symbol supports only ARMv7A architectures under armv7 folder. This led to a misconception of creating separate folders for armv7m and armv7r. There is no reason to create separate folder for other armv7 based architectures when it can co-exist with few Kconfig symbols.

Quoted 8 lines

As a first step towards a common folder, rename CPU_V7 as CPUV7A. Later separate Kconfig symbols can be added for CPU_V7R and CPU_V7M and can co exist in the same folder.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180507/0eeab69d/attachment.sig>
#5 lore raw

PATCH v2 3/7 arm: v7: Kconfig: Add entry for MMU

In reply to Lokesh Vutla

Add a Kconfig entry for MMU and imply for all platforms using cache-cp15.c containing MMU setup. Using imply instead of select so that MMU can be disabled by defconfigs when not needed.

---
 arch/arm/Kconfig | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/Kconfig +15 -0
index df475626e7..8854227d9a 100644
@@ -74,6 +74,12 @@ config ARM_ASM_UNIFIED
 config THUMB2_KERNEL
 	bool
 
+config SYS_ARM_MMU
+	bool "MMU-based Paged Memory Management Support"
+	help
+	  Select if you want MMU-based virtualised addressing space
+	  support by paged memory management.
+
 # If set, the workarounds for these ARM errata are applied early during U-Boot
 # startup. Note that in general these options force the workarounds to be
 # applied; no CPU-type/version detection exists, unlike the similar options in
@@ -158,33 +164,40 @@ config ARM_ERRATA_855873
 config CPU_ARM720T
 	bool
 	select SYS_CACHE_SHIFT_5
+	imply SYS_ARM_MMU
 
 config CPU_ARM920T
 	bool
 	select SYS_CACHE_SHIFT_5
+	imply SYS_ARM_MMU
 
 config CPU_ARM926EJS
 	bool
 	select SYS_CACHE_SHIFT_5
+	imply SYS_ARM_MMU
 
 config CPU_ARM946ES
 	bool
 	select SYS_CACHE_SHIFT_5
+	imply SYS_ARM_MMU
 
 config CPU_ARM1136
 	bool
 	select SYS_CACHE_SHIFT_5
+	imply SYS_ARM_MMU
 
 config CPU_ARM1176
 	bool
 	select HAS_VBAR
 	select SYS_CACHE_SHIFT_5
+	imply SYS_ARM_MMU
 
 config CPU_V7A
 	bool
 	select HAS_VBAR
 	select HAS_THUMB2
 	select SYS_CACHE_SHIFT_6
+	imply SYS_ARM_MMU
 
 config CPU_V7M
 	bool
@@ -195,10 +208,12 @@ config CPU_V7M
 config CPU_PXA
 	bool
 	select SYS_CACHE_SHIFT_5
+	imply SYS_ARM_MMU
 
 config CPU_SA1100
 	bool
 	select SYS_CACHE_SHIFT_5
+	imply SYS_ARM_MMU
 
 config SYS_CPU
 	default "arm720t" if CPU_ARM720T
Signature · 1 line
2.17.0
#6 lore raw

PATCH v2 3/7 arm: v7: Kconfig: Add entry for MMU

Quoted 7 lines · Lokesh Vutla

Add a Kconfig entry for MMU and imply for all platforms using cache-cp15.c containing MMU setup. Using imply instead of select so that MMU can be disabled by defconfigs when not needed.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180507/3863ad9c/attachment.sig>
#7 lore raw

PATCH v2 4/7 arm: v7: Kconfig: Introduce SYS_ARM_CACHE_CP15

In reply to Lokesh Vutla

Certain ARM architectures like ARMv7-A, ARMv7-R has support for enabling caches using CP15 registers. To have a common support for all these architectures, introduce a Kconfig symbol SYS_ARM_CACHE_CP15 that selects cache-cp15.c

---
 arch/arm/Kconfig      | 7 +++++++
 arch/arm/lib/Makefile | 6 +-----
 2 files changed, 8 insertions(+), 5 deletions(-)
arch/arm/Kconfig +7 -0
index 8854227d9a..8efaccbcb8 100644
@@ -74,8 +74,15 @@ config ARM_ASM_UNIFIED
 config THUMB2_KERNEL
 	bool
 
+config SYS_ARM_CACHE_CP15
+	bool "CP15 based cache enabling support"
+	help
+	  Select this if your processor suports enabling caches by using
+	  CP15 registers.
+
 config SYS_ARM_MMU
 	bool "MMU-based Paged Memory Management Support"
+	select SYS_ARM_CACHE_CP15
 	help
 	  Select if you want MMU-based virtualised addressing space
 	  support by paged memory management.
arch/arm/lib/Makefile +1 -5
index 3d3085e917..39c0c693dc 100644
@@ -63,11 +63,7 @@ obj-y	+= reset.o
 endif
 
 obj-y	+= cache.o
-ifndef CONFIG_ARM64
-ifndef CONFIG_CPU_V7M
-obj-y	+= cache-cp15.o
-endif
-endif
+obj-$(CONFIG_SYS_ARM_CACHE_CP15)	+= cache-cp15.o
 
 obj-y	+= psci-dt.o
 
Signature · 1 line
2.17.0
#8 lore raw

PATCH v2 4/7 arm: v7: Kconfig: Introduce SYS_ARM_CACHE_CP15

Quoted 8 lines · Lokesh Vutla

Certain ARM architectures like ARMv7-A, ARMv7-R has support for enabling caches using CP15 registers. To have a common support for all these architectures, introduce a Kconfig symbol SYS_ARM_CACHE_CP15 that selects cache-cp15.c

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180507/25dd8525/attachment.sig>
#9 lore raw

PATCH v2 5/7 arm: v7R: Add initial support

In reply to Lokesh Vutla

From: Michal Simek <[email protected]>

The Cortex-R* processors are a mid-range CPUs for use in deeply-embedded, real-time systems. It implements the ARMv7-R architecture, and includes Thumb-2 technology for optimum code density and processing throughput.

Except for MPU(Memory Protection Unit) and few CP15 registers, most of the features are compatible with v7 architecture. So,reuse the same armv7 folder and introduce a new config CPU_V7R in order to differentiate from v7 based platforms.

---
 arch/arm/Kconfig           | 7 +++++++
 arch/arm/Makefile          | 2 ++
 arch/arm/cpu/armv7/start.S | 2 ++
 cmd/Kconfig                | 2 +-
 4 files changed, 12 insertions(+), 1 deletion(-)
arch/arm/Kconfig +7 -0
index 8efaccbcb8..fcdbded22a 100644
@@ -212,6 +212,11 @@ config CPU_V7M
 	select THUMB2_KERNEL
 	select SYS_CACHE_SHIFT_5
 
+config CPU_V7R
+	bool
+	select HAS_THUMB2
+	select SYS_CACHE_SHIFT_6
+
 config CPU_PXA
 	bool
 	select SYS_CACHE_SHIFT_5
@@ -230,6 +235,7 @@ config SYS_CPU
 	default "arm1136" if CPU_ARM1136
 	default "arm1176" if CPU_ARM1176
 	default "armv7" if CPU_V7A
+	default "armv7" if CPU_V7R
 	default "armv7m" if CPU_V7M
 	default "pxa" if CPU_PXA
 	default "sa1100" if CPU_SA1100
@@ -245,6 +251,7 @@ config SYS_ARM_ARCH
 	default 6 if CPU_ARM1176
 	default 7 if CPU_V7A
 	default 7 if CPU_V7M
+	default 7 if CPU_V7R
 	default 5 if CPU_PXA
 	default 4 if CPU_SA1100
 	default 8 if ARM64
arch/arm/Makefile +2 -0
index 2979ad86fd..3f5343bc01 100644
@@ -18,6 +18,7 @@ arch-$(CONFIG_CPU_ARM1136)	=-march=armv5
 arch-$(CONFIG_CPU_ARM1176)	=-march=armv5t
 arch-$(CONFIG_CPU_V7A)		=$(call cc-option, -march=armv7-a, \
 				 $(call cc-option, -march=armv7, -march=armv5))
+arch-$(CONFIG_CPU_V7R)		=-march=armv7-r
 arch-$(CONFIG_ARM64)		=-march=armv8-a
 
 # On Tegra systems we must build SPL for the armv4 core on the device
@@ -41,6 +42,7 @@ tune-$(CONFIG_CPU_PXA)		=-mcpu=xscale
 tune-$(CONFIG_CPU_ARM1136)	=
 tune-$(CONFIG_CPU_ARM1176)	=
 tune-$(CONFIG_CPU_V7A)		=
+tune-$(CONFIG_CPU_V7R)		=
 tune-$(CONFIG_ARM64)		=
 
 # Evaluate tune cc-option calls now
arch/arm/cpu/armv7/start.S +2 -0
index 937f7051fe..29b51f2a0f 100644
@@ -82,7 +82,9 @@ switch_to_hypervisor_ret:
 
 	/* the mask ROM code should have PLL and others stable */
 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
+#ifdef CONFIG_CPU_V7A
 	bl	cpu_init_cp15
+#endif
 #ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY
 	bl	cpu_init_crit
 #endif
cmd/Kconfig +1 -1
index 511d9117a0..9c1115db59 100644
@@ -1103,7 +1103,7 @@ config BOOTP_PXE_CLIENTARCH
 config BOOTP_VCI_STRING
 	string
 	depends on CMD_BOOTP
-	default "U-Boot.armv7" if CPU_V7A || CPU_V7M
+	default "U-Boot.armv7" if CPU_V7A || CPU_V7M || CPU_V7R
 	default "U-Boot.armv8" if ARM64
 	default "U-Boot.arm" if ARM
 	default "U-Boot"
Signature · 1 line
2.17.0
#10 lore raw

PATCH v2 5/7 arm: v7R: Add initial support

Quoted 11 lines · Lokesh Vutla

From: Michal Simek <[email protected]>

The Cortex-R* processors are a mid-range CPUs for use in deeply-embedded, real-time systems. It implements the ARMv7-R architecture, and includes Thumb-2 technology for optimum code density and processing throughput.

Except for MPU(Memory Protection Unit) and few CP15 registers, most of the features are compatible with v7 architecture. So,reuse the same armv7 folder and introduce a new config CPU_V7R in order to differentiate from v7 based platforms.

Quoted 4 lines

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180507/adebcc9c/attachment.sig>
#11 lore raw

PATCH v2 6/7 arm: v7R: Add support for MPU

In reply to Lokesh Vutla

The Memory Protection Unit(MPU) allows to partition memory into regions and set individual protection attributes for each region. In absence of MPU a default map[1] will take effect. Add support for configuring MPU on Cortex-R, by reusing the existing support for Cortex-M processor.

[1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0460d/I1002400.html

---
 arch/arm/Kconfig                  |  12 +++
 arch/arm/cpu/armv7/Makefile       |   2 +
 arch/arm/cpu/armv7/mpu_v7r.c      | 109 +++++++++++++++++++++++++
 arch/arm/cpu/armv7m/Makefile      |   3 +-
 arch/arm/cpu/armv7m/mpu.c         |  43 +---------
 arch/arm/include/asm/armv7_mpu.h  | 131 ++++++++++++++++++++++++++++++
 arch/arm/include/asm/armv7m_mpu.h |  67 ---------------
 arch/arm/mach-stm32/soc.c         |   2 +-
 8 files changed, 259 insertions(+), 110 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/mpu_v7r.c
 create mode 100644 arch/arm/include/asm/armv7_mpu.h
 delete mode 100644 arch/arm/include/asm/armv7m_mpu.h
arch/arm/Kconfig +12 -0
index fcdbded22a..99fb11435b 100644
@@ -87,6 +87,15 @@ config SYS_ARM_MMU
 	  Select if you want MMU-based virtualised addressing space
 	  support by paged memory management.
 
+config SYS_ARM_MPU
+	bool 'Use the ARM v7 PMSA Compliant MPU'
+	help
+	  Some ARM systems without an MMU have instead a Memory Protection
+	  Unit (MPU) that defines the type and permissions for regions of
+	  memory.
+	  If your CPU has an MPU then you should choose 'y' here unless you
+	  know that you do not want to use the MPU.
+
 # If set, the workarounds for these ARM errata are applied early during U-Boot
 # startup. Note that in general these options force the workarounds to be
 # applied; no CPU-type/version detection exists, unlike the similar options in
@@ -211,11 +220,14 @@ config CPU_V7M
 	select HAS_THUMB2
 	select THUMB2_KERNEL
 	select SYS_CACHE_SHIFT_5
+	select SYS_ARM_MPU
 
 config CPU_V7R
 	bool
 	select HAS_THUMB2
 	select SYS_CACHE_SHIFT_6
+	select SYS_ARM_MPU
+	select SYS_ARM_CACHE_CP15
 
 config CPU_PXA
 	bool
arch/arm/cpu/armv7/Makefile +2 -0
index b14ee54519..d085b3be93 100644
@@ -12,6 +12,8 @@ obj-y	+= cache_v7.o cache_v7_asm.o
 obj-y	+= cpu.o cp15.o
 obj-y	+= syslib.o
 
+obj-$(CONFIG_SYS_ARM_MPU) += mpu_v7r.o
+
 ifneq ($(CONFIG_SKIP_LOWLEVEL_INIT),y)
 obj-y	+= lowlevel_init.o
 endif
arch/arm/cpu/armv7/mpu_v7r.c new file +109 -0

109 lines not on this page · raw message

arch/arm/cpu/armv7m/Makefile +2 -1
index 257fc7faf3..c1742cb967 100644
@@ -6,5 +6,6 @@
 #
 
 extra-y := start.o
-obj-y += cpu.o cache.o mpu.o
+obj-y += cpu.o cache.o
+obj-$(CONFIG_SYS_ARM_MPU) += mpu.o
 obj-$(CONFIG_SYS_ARCH_TIMER) += systick-timer.o
arch/arm/cpu/armv7m/mpu.c +2 -41

61 lines not on this page · raw message

arch/arm/include/asm/armv7_mpu.h new file +131 -0

131 lines not on this page · raw message

arch/arm/include/asm/armv7m_mpu.h deleted +0 -67

67 lines not on this page · raw message

arch/arm/mach-stm32/soc.c +1 -1
index f6fd0b2e23..f4c5bb16ff 100644
@@ -7,7 +7,7 @@
 
 #include <common.h>
 #include <asm/io.h>
-#include <asm/armv7m_mpu.h>
+#include <asm/armv7_mpu.h>
 
 int arch_cpu_init(void)
 {
Signature · 1 line
2.17.0
#12 lore raw

PATCH v2 6/7 arm: v7R: Add support for MPU

Quoted 9 lines · Lokesh Vutla

The Memory Protection Unit(MPU) allows to partition memory into regions and set individual protection attributes for each region. In absence of MPU a default map[1] will take effect. Add support for configuring MPU on Cortex-R, by reusing the existing support for Cortex-M processor.

[1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0460d/I1002400.html

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180426/18c5da3b/attachment.sig>
#13 lore raw

PATCH v2 6/7 arm: v7R: Add support for MPU

In reply to Lokesh Vutla
Quoted 10 lines · Lokesh Vutla

The Memory Protection Unit(MPU) allows to partition memory into regions and set individual protection attributes for each region. In absence of MPU a default map[1] will take effect. Add support for configuring MPU on Cortex-R, by reusing the existing support for Cortex-M processor.

[1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0460d/I1002400.html

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180507/768d19f3/attachment.sig>
#14 lore raw

PATCH v2 7/7 arm: v7R: Add support for enabling caches

In reply to Lokesh Vutla

Cache maintenance procedure is same for v7A and v7R processors. So re-use cache-cp15.c file except for mmu parts.

---
 arch/arm/cpu/armv7/mpu_v7r.c | 11 +++++++++++
 arch/arm/lib/cache-cp15.c    | 12 +++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7/mpu_v7r.c +11 -0
index 1576511ec5..084ebd383e 100644
@@ -107,3 +107,14 @@ void setup_mpu_regions(struct mpu_region_config *rgns, u32 num_rgns)
 
 	icache_enable();
 }
+
+void enable_caches(void)
+{
+	/*
+	 * setup_mpu_regions() might have enabled Icache. So add a check
+	 * before enabling Icache
+	 */
+	if (!icache_status())
+		icache_enable();
+	dcache_enable();
+}
arch/arm/lib/cache-cp15.c +11 -1
index b09c631636..0e643395a0 100644
@@ -9,11 +9,13 @@
 #include <asm/system.h>
 #include <asm/cache.h>
 #include <linux/compiler.h>
+#include <asm/armv7_mpu.h>
 
 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_SYS_ARM_MMU
 __weak void arm_init_before_mmu(void)
 {
 }
@@ -202,15 +204,23 @@ static int mmu_enabled(void)
 {
 	return get_cr() & CR_M;
 }
+#endif /* CONFIG_SYS_ARM_MMU */
 
 /* cache_bit must be either CR_I or CR_C */
 static void cache_enable(uint32_t cache_bit)
 {
 	uint32_t reg;
 
-	/* The data cache is not active unless the mmu is enabled too */
+	/* The data cache is not active unless the mmu/mpu is enabled too */
+#ifdef CONFIG_SYS_ARM_MMU
 	if ((cache_bit == CR_C) && !mmu_enabled())
 		mmu_setup();
+#elif defined(CONFIG_SYS_ARM_MPU)
+	if ((cache_bit == CR_C) && !mpu_enabled()) {
+		printf("Consider enabling MPU before enabling caches\n");
+		return;
+	}
+#endif
 	reg = get_cr();	/* get control reg. */
 	set_cr(reg | cache_bit);
 }
Signature · 1 line
2.17.0
#15 lore raw

PATCH v2 7/7 arm: v7R: Add support for enabling caches

Quoted 6 lines · Lokesh Vutla

Cache maintenance procedure is same for v7A and v7R processors. So re-use cache-cp15.c file except for mmu parts.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180426/13b9dc29/attachment.sig>
#16 lore raw

PATCH v2 7/7 arm: v7R: Add support for enabling caches

In reply to Lokesh Vutla
Quoted 7 lines · Lokesh Vutla

Cache maintenance procedure is same for v7A and v7R processors. So re-use cache-cp15.c file except for mmu parts.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180507/5c18136b/attachment.sig>
#17 lore raw

v2 cover arm: Introduce v7R support

In reply to Lokesh Vutla
Quoted 10 lines · Lokesh Vutla

The Cortex-R* processors are a mid-range CPUs for use in deeply-embedded, real-time systems. It implements the ARMv7-R architecture, and includes Thumb-2 technology for optimum code density and processing throughput.

Except for MPU(Memory Protection Unit) and few CP15 registers, most of the features are compatible with v7 architecture. This series adds minimal support for v7-R architecture by reusing the v7 support. Also adding support for MPU.

Travis-ci build report: https://travis-ci.org/lokeshvutla/u-boot/builds/371442638

Looks pretty clean to me :).

Alex