Vikas Manocha | 29645ec | 2017-05-03 16:38:55 -0700 | [diff] [blame] | 1 | /* |
Patrice Chotard | 789ee0e | 2017-10-23 09:53:58 +0200 | [diff] [blame] | 2 | * Copyright (C) 2017, STMicroelectronics - All Rights Reserved |
| 3 | * Author(s): Vikas Manocha, <vikas.manocha@st.com> for STMicroelectronics. |
Vikas Manocha | 29645ec | 2017-05-03 16:38:55 -0700 | [diff] [blame] | 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
| 8 | enum region_number { |
| 9 | REGION_0 = 0, |
| 10 | REGION_1, |
| 11 | REGION_2, |
| 12 | REGION_3, |
| 13 | REGION_4, |
| 14 | REGION_5, |
| 15 | REGION_6, |
| 16 | REGION_7, |
| 17 | }; |
| 18 | |
| 19 | enum ap { |
| 20 | NO_ACCESS = 0, |
| 21 | PRIV_RW_USR_NO, |
| 22 | PRIV_RW_USR_RO, |
| 23 | PRIV_RW_USR_RW, |
| 24 | UNPREDICTABLE, |
| 25 | PRIV_RO_USR_NO, |
| 26 | PRIV_RO_USR_RO, |
| 27 | }; |
| 28 | |
| 29 | enum mr_attr { |
| 30 | STRONG_ORDER = 0, |
| 31 | SHARED_WRITE_BUFFERED, |
| 32 | O_I_WT_NO_WR_ALLOC, |
| 33 | O_I_WB_NO_WR_ALLOC, |
| 34 | O_I_NON_CACHEABLE, |
| 35 | O_I_WB_RD_WR_ALLOC, |
| 36 | DEVICE_NON_SHARED, |
| 37 | }; |
| 38 | enum size { |
| 39 | REGION_8MB = 22, |
| 40 | REGION_16MB, |
| 41 | REGION_32MB, |
| 42 | REGION_64MB, |
| 43 | REGION_128MB, |
| 44 | REGION_256MB, |
| 45 | REGION_512MB, |
| 46 | REGION_1GB, |
| 47 | REGION_2GB, |
| 48 | REGION_4GB, |
| 49 | }; |
| 50 | |
| 51 | enum xn { |
| 52 | XN_DIS = 0, |
| 53 | XN_EN, |
| 54 | }; |
| 55 | |
| 56 | struct mpu_region_config { |
| 57 | uint32_t start_addr; |
| 58 | enum region_number region_no; |
| 59 | enum xn xn; |
| 60 | enum ap ap; |
| 61 | enum mr_attr mr_attr; |
| 62 | enum size reg_size; |
| 63 | }; |
| 64 | |
| 65 | void disable_mpu(void); |
| 66 | void enable_mpu(void); |
| 67 | void mpu_config(struct mpu_region_config *reg_config); |