Skip to content

Commit c1ebc0a

Browse files
mmahadevan108kjbracey
authored andcommitted
K64F, K66F: Update the SYSMPU implementation
Do not disable SYSMPU, instead add access for ENET bus master Signed-off-by: Mahesh Mahadevan <[email protected]>
1 parent e4dfe63 commit c1ebc0a

File tree

2 files changed

+64
-10
lines changed

2 files changed

+64
-10
lines changed

features/netsocket/emac-drivers/TARGET_Freescale_EMAC/TARGET_K64F/hardware_init_MK64F12.c

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,45 @@
2929
*/
3030

3131
#include "fsl_port.h"
32+
#include "fsl_sysmpu.h"
33+
34+
/* Initialize the region 1, master 0, 1, 2, 3 - core access rights supervisior r/w/x , user r/w/x. */
35+
sysmpu_rwxrights_master_access_control_t right =
36+
{
37+
kSYSMPU_SupervisorEqualToUsermode,
38+
kSYSMPU_UserReadWriteExecute,
39+
#if FSL_FEATURE_SYSMPU_HAS_PROCESS_IDENTIFIER
40+
false,
41+
#endif /* FSL_FEATURE_SYSMPU_HAS_PROCESS_IDENTIFIER */
42+
};
3243

3344
/*******************************************************************************
3445
* Code
3546
******************************************************************************/
36-
void k64f_init_eth_hardware(void)
47+
void kinetis_init_eth_hardware(void)
3748
{
3849
port_pin_config_t configENET = {0};
50+
sysmpu_region_config_t regConfig;
51+
sysmpu_config_t config;
52+
53+
memset(&regConfig, 0, sizeof(sysmpu_region_config_t));
54+
memset(&config, 0, sizeof(sysmpu_config_t));
55+
56+
regConfig.regionNum = 1;
57+
regConfig.startAddress = 0U;
58+
regConfig.endAddress = 0xFFFFFFFFU;
59+
regConfig.accessRights1[0] = right;
60+
regConfig.accessRights1[1] = right;
61+
regConfig.accessRights1[2] = right;
62+
regConfig.accessRights1[3] = right;
63+
64+
#if FSL_FEATURE_SYSMPU_HAS_PROCESS_IDENTIFIER
65+
regConfig.processIdentifier = 1U;
66+
regConfig.processIdMask = 0U;
67+
#endif
3968

40-
#ifndef FEATURE_UVISOR
41-
/* Disable MPU only when uVisor is not around. */
42-
MPU->CESR &= ~MPU_CESR_VLD_MASK;
43-
#endif/*FEATURE_UVISOR*/
69+
config.regionConfig = regConfig;
70+
SYSMPU_Init(SYSMPU, &config);
4471

4572
CLOCK_EnableClock(kCLOCK_PortC);
4673
CLOCK_EnableClock(kCLOCK_PortB);

features/netsocket/emac-drivers/TARGET_Freescale_EMAC/TARGET_K66F/hardware_init_MK66F18.c

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,45 @@
2929
*/
3030

3131
#include "fsl_port.h"
32+
#include "fsl_sysmpu.h"
33+
34+
/* Initialize the region 1, master 0, 1, 2, 3 - core access rights supervisior r/w/x , user r/w/x. */
35+
sysmpu_rwxrights_master_access_control_t right =
36+
{
37+
kSYSMPU_SupervisorEqualToUsermode,
38+
kSYSMPU_UserReadWriteExecute,
39+
#if FSL_FEATURE_SYSMPU_HAS_PROCESS_IDENTIFIER
40+
false,
41+
#endif /* FSL_FEATURE_SYSMPU_HAS_PROCESS_IDENTIFIER */
42+
};
3243

3344
/*******************************************************************************
3445
* Code
3546
******************************************************************************/
36-
void k66f_init_eth_hardware(void)
47+
void kinetis_init_eth_hardware(void)
3748
{
3849
port_pin_config_t configENET = {0};
50+
sysmpu_region_config_t regConfig;
51+
sysmpu_config_t config;
52+
53+
memset(&regConfig, 0, sizeof(sysmpu_region_config_t));
54+
memset(&config, 0, sizeof(sysmpu_config_t));
55+
56+
regConfig.regionNum = 1;
57+
regConfig.startAddress = 0U;
58+
regConfig.endAddress = 0xFFFFFFFFU;
59+
regConfig.accessRights1[0] = right;
60+
regConfig.accessRights1[1] = right;
61+
regConfig.accessRights1[2] = right;
62+
regConfig.accessRights1[3] = right;
63+
64+
#if FSL_FEATURE_SYSMPU_HAS_PROCESS_IDENTIFIER
65+
regConfig.processIdentifier = 1U;
66+
regConfig.processIdMask = 0U;
67+
#endif
3968

40-
#ifndef FEATURE_UVISOR
41-
/* Disable MPU only when uVisor is not around. */
42-
SYSMPU->CESR &= ~SYSMPU_CESR_VLD_MASK;
43-
#endif/*FEATURE_UVISOR*/
69+
config.regionConfig = regConfig;
70+
SYSMPU_Init(SYSMPU, &config);
4471

4572
/* Ungate the port clock */
4673
CLOCK_EnableClock(kCLOCK_PortA);

0 commit comments

Comments
 (0)