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)
23 * Configure the memory protection unit (MPU)
24 * 0x00000000 - 0xffffffff: Strong-order, Shareable
25 * 0xC0000000 - 0xC0800000: Normal, Outer and inner Non-cacheable
29 writel(0, &V7M_MPU->ctrl);
32 0x00000000 /* address */
38 /* Strong-order, Shareable */
39 /* TEX=000, S=1, C=0, B=0*/
41 (V7M_MPU_RASR_XN_ENABLE
42 | V7M_MPU_RASR_AP_RW_RW
43 | 0x01 << V7M_MPU_RASR_S_SHIFT
44 | 0x00 << V7M_MPU_RASR_TEX_SHIFT
45 | V7M_MPU_RASR_SIZE_4GB
51 0xC0000000 /* address */
57 /* Normal, Outer and inner Non-cacheable */
58 /* TEX=001, S=0, C=0, B=0*/
60 (V7M_MPU_RASR_XN_ENABLE
61 | V7M_MPU_RASR_AP_RW_RW
62 | 0x01 << V7M_MPU_RASR_TEX_SHIFT
63 | V7M_MPU_RASR_SIZE_8MB
69 writel(V7M_MPU_CTRL_ENABLE | V7M_MPU_CTRL_HFNMIENA, &V7M_MPU->ctrl);