arm: core: mpu: Add Allow write on Flash

This patch adds the allow flash write CONFIG option to the ARM MPU
configuration in privileged mode.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Signed-off-by: David Brown <david.brown@linaro.org>
This commit is contained in:
Vincenzo Frascino 2017-05-10 11:41:44 +01:00 committed by Kumar Gala
commit de81c16c5a
2 changed files with 7 additions and 1 deletions

View file

@ -41,7 +41,7 @@ config NXP_MPU
config MPU_ALLOW_FLASH_WRITE
bool "Add MPU access to write to flash"
depends on NXP_MPU
depends on ARM_MPU || NXP_MPU
default n
help
Enable this to allow MPU RWX access to flash memory

View file

@ -89,8 +89,14 @@ struct arm_mpu {
#define REGION_RAM_ATTR(size) \
(NORMAL_OUTER_INNER_NON_CACHEABLE_NON_SHAREABLE | \
NOT_EXEC | size | FULL_ACCESS)
#if defined(CONFIG_MPU_ALLOW_FLASH_WRITE)
#define REGION_FLASH_ATTR(size) \
(NORMAL_OUTER_INNER_NON_CACHEABLE_NON_SHAREABLE | size | \
P_RW_U_RO)
#else
#define REGION_FLASH_ATTR(size) \
(NORMAL_OUTER_INNER_NON_CACHEABLE_NON_SHAREABLE | size | RO)
#endif
#define REGION_PPB_ATTR(size) (STRONGLY_ORDERED_SHAREABLE | size | FULL_ACCESS)
#define REGION_IO_ATTR(size) (DEVICE_NON_SHAREABLE | size | FULL_ACCESS)