3 * Kamil Lulko, <kamil.lulko@gmail.com>
5 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/armv7m.h>
11 #include <asm/arch/stm32.h>
18 int arch_cpu_init(void)
21 * Configure the memory protection unit (MPU)
22 * 0x00000000 - 0xffffffff: Strong-order, Shareable
23 * 0xC0000000 - 0xC0800000: Normal, Outer and inner Non-cacheable
27 writel(0, &V7M_MPU->ctrl);
30 0x00000000 /* address */
36 /* Strong-order, Shareable */
37 /* TEX=000, S=1, C=0, B=0*/
39 (V7M_MPU_RASR_XN_ENABLE
40 | V7M_MPU_RASR_AP_RW_RW
41 | 0x01 << V7M_MPU_RASR_S_SHIFT
42 | 0x00 << V7M_MPU_RASR_TEX_SHIFT
43 | V7M_MPU_RASR_SIZE_4GB
49 0xC0000000 /* address */
55 /* Normal, Outer and inner Non-cacheable */
56 /* TEX=001, S=0, C=0, B=0*/
58 (V7M_MPU_RASR_XN_ENABLE
59 | V7M_MPU_RASR_AP_RW_RW
60 | 0x01 << V7M_MPU_RASR_TEX_SHIFT
61 | V7M_MPU_RASR_SIZE_8MB
67 writel(V7M_MPU_CTRL_ENABLE | V7M_MPU_CTRL_HFNMIENA, &V7M_MPU->ctrl);