Skip to content

Commit

Permalink
Merge COREA-19-Fee
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Lundell committed Nov 21, 2014
2 parents c8c6e20 + 5234c5b commit aa1bc01
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 50 deletions.
15 changes: 3 additions & 12 deletions arch/ppc/mpc55xx/drivers/Mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -998,9 +998,6 @@ static void Mcu_ConfigureFlash(void)
/* Enable pipelined reads again. */
FLASH.MCR.B.PRD = 0;

/* Enable error reporting on Flash (FEAR, etc will be updated) */
WRITE8(ECSM_BASE+ECSM_ECR,2);

#elif defined(CFG_MPC5668)
/* Check values from cookbook and MPC5668x Microcontroller Data Sheet */

Expand All @@ -1020,22 +1017,16 @@ static void Mcu_ConfigureFlash(void)
#elif defined(CFG_MPC560X)
CFLASH.PFCR0.R = 0x10840B6F; /* Instruction prefetch enabled and other according to cookbook */
#endif

/* Enable error reporting on Flash (FEAR, etc will be updated) */
WRITE8(ECSM_BASE+ECSM_ECR,ESR_F1BC+ESR_FNCE);
}

uint32 EccErrReg = 0;

void McuE_GetECCError( uint32 *err ) {

/* Clear interrupt flag */
#if defined(CFG_MPC5668)
if(ECSM.ESR.B.PFNCE){
ECSM.ESR.B.PFNCE = 1;
}
*err = EccErrReg;
#else
*err = 0;
#endif

/* Clear stored */
EccErrReg = 0;
}
42 changes: 5 additions & 37 deletions arch/ppc/mpc55xx/integration/mpc5xxx_callout_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void Mpc5xxx_Panic( uint32_t error, void *pData ) {
static uint32_t checkEcc(void) {
uint32_t rv = EXC_NOT_HANDLED;

#if defined(USE_FEE) || defined(CFG_MPC5XXX_TEST)
#if defined(USE_FEE)

uint8 esr;
do {
Expand All @@ -103,38 +103,24 @@ static uint32_t checkEcc(void) {
#endif

/* Find FLS errors */

if (esr & ESR_FNCE) {

/* Record that something bad has happened */
EccErrReg = READ8( ECSM_BASE + ECSM_ESR );
/* Clear the exception */
WRITE8(ECSM_BASE+ECSM_ESR,ESR_F1BC+ESR_FNCE);

#if defined(USE_FEE)
/* Check if we are in FEE range */
if ( ((FEE_BANK1_OFFSET >= excAddr) &&
(FEE_BANK1_OFFSET + FEE_BANK1_LENGTH < excAddr)) ||
((FEE_BANK2_OFFSET >= excAddr) &&
(FEE_BANK2_OFFSET + FEE_BANK2_LENGTH < excAddr)) )
if ( ((FEE_BANK1_OFFSET >= excAddr) && ( excAddr < (FEE_BANK1_OFFSET + FEE_BANK1_LENGTH))) ||
((FEE_BANK2_OFFSET >= excAddr) && ( excAddr < (FEE_BANK2_OFFSET + FEE_BANK2_LENGTH))) )
{
rv = EXC_HANDLED | EXC_ADJUST_ADDR;
rv = (EXC_HANDLED | EXC_ADJUST_ADDR);
}
#endif
}
#endif /* USE_FLS */

#if defined(CFG_MPC5XXX_TEST)
if( esr & (ESR_R1BC+ESR_RNCE) ) {
/* ECC RAM problems */
Mpc5xxx_Esr = esr;
WRITE8(ECSM_BASE+ECSM_ESR,ESR_R1BC+ESR_RNCE);
rv = (EXC_HANDLED | EXC_ADJUST_ADDR);
} else if (esr & ESR_FNCE) {
Mpc5xxx_Esr = esr;
WRITE8(ECSM_BASE+ECSM_ESR,ESR_F1BC+ESR_FNCE);
rv = (EXC_HANDLED | EXC_ADJUST_ADDR);
}
#endif
return rv;
}

Expand All @@ -151,33 +137,15 @@ static uint32_t checkEcc(void) {
uint32_t Mpc5xxx_ExceptionHandler(uint32_t exceptionVector) {
uint32_t rv = EXC_NOT_HANDLED;

#if defined(CFG_MPC5XXX_TEST)
Mpc5xxx_vectorMask |= (1<<exceptionVector);
#endif

switch (exceptionVector) {
case 1:
/* CSRR0, CSRR1, MCSR */
/* ECC: MSR[EE] = 0 */
#if defined(CFG_MPC5XXX_TEST)
if( get_spr(SPR_MCSR) & ( MCSR_BUS_DRERR | MCSR_BUS_WRERR )) {
/* We have a bus error */
rv = EXC_HANDLED | EXC_ADJUST_ADDR;
break;
}
#endif
rv = checkEcc();
break;
case 2:
/* SRR0, SRR1, ESR, DEAR */
/* ECC: MSR[EE] = 1 */
#if defined(CFG_MPC5XXX_TEST)
if( get_spr(SPR_ESR) & ESR_XTE) {
/* We have a external termination bus error */
rv = EXC_HANDLED | EXC_ADJUST_ADDR;
break;
}
#endif
rv = checkEcc();
break;
case 3:
Expand Down
2 changes: 1 addition & 1 deletion boards/mpc5606b_xpc560b/build_config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ MOD_USE += MCU KERNEL ECUM
# Default cross compiler
COMPILER?=cw
DEFAULT_CROSS_COMPILE = /opt/powerpc-eabispe/bin/powerpc-eabispe-
DEFAULT_CW_COMPILE= /opt/cw
DEFAULT_CW_COMPILE= /c/devtools/Freescale/cw_mpc5xxx_2.10

# Defines
def-y += SRAM_SIZE=0x14000

0 comments on commit aa1bc01

Please sign in to comment.