This sequence works to save the pain for the next person....
#define MAX_TRIES 100
void FSBL_pfe_init(void)
{
/* Enable */
/* Setup DMA coherency */
volatile uint32_t tries;
RDC.RD2_CTRL_REG.B.RD2_CTRL_UNLOCK = 1;
RDC.RD2_CTRL_REG.B.RD2_INTERCONNECT_INTERFACE_DISABLE = 0;
tries = 0;
while (RDC.RD2_STAT_REG.B.RD2_INTERCONNECT_INTERFACE_DISABLE_REQ_ACK_STAT != 0 )
{
tries++;
if (tries > MAX_TRIES)
{
break;
}
}
tries = 0;
while (RDC.RD2_STAT_REG.B.RD2_INTERCONNECT_INTERFACE_DISABLE_STAT != 0)
{
tries++;
if (tries > MAX_TRIES)
{
break;
}
}
/**((volatile unsigned int *)0x4007ca00) = 0x3f; */
S32G_GPR.PFE_COH_EN.B.DDR = true;
S32G_GPR.PFE_COH_EN.B.HIF0 = true;
S32G_GPR.PFE_COH_EN.B.HIF1 = true;
S32G_GPR.PFE_COH_EN.B.HIF2 = true;
S32G_GPR.PFE_COH_EN.B.HIF3 = true;
S32G_GPR.PFE_COH_EN.B.UTIL = true;
/* Setup EMAC modes */
/**((volatile unsigned int *)0x4007ca04) = 0x111;*/
S32G_GPR.PFE_EMACX_INTF_SEL.B.EMAC0 = 1;
S32G_GPR.PFE_EMACX_INTF_SEL.B.EMAC1 = 1;
S32G_GPR.PFE_EMACX_INTF_SEL.B.EMAC2 = 1;
/* Enable power for PFE */
/**((volatile unsigned int *)0x4007ca20) = 0x0; */
S32G_GPR.PFE_PWR_CTRL.B.PWRACK = 0;
S32G_GPR.PFE_PWR_CTRL.B.PWRCLAMP = 0;
S32G_GPR.PFE_PWR_CTRL.B.PWRDWN = 0;
S32G_GPR.PFE_PWR_CTRL.B.PWRISO = 0;
/* Put PFE in reset */
/**((volatile unsigned int *)0x40078050) = 0x1; */
MC_RGM.PRST_0[2].PRST_0.B.PERIPH_0_RST = 1;
tries = 0;
while (MC_RGM.PSTAT_0[2].PSTAT_0.B.PERIPH_0_STAT != 1)
{
tries++;
if (tries > MAX_TRIES)
{
break;
}
}
/**((volatile unsigned int *)0x4007caE4) = 0x0; */
S32G_GPR.GENCTRL1.B.CTRL = 0;
/* Take the PFE out of reset */
/**((volatile unsigned int *)0x40078050) = 0x0; */
MC_RGM.PRST_0[2].PRST_0.B.PERIPH_0_RST = 0;
MC_ME.PRTN2_PCONF.B.OSSE = 1;
MC_ME.PRTN2_PCONF.B.PCE = 1;
MC_ME.PRTN2_PUPD.B.OSSUD = 1;
MC_ME.PRTN2_PUPD.B.PCUD = 1;
/* Tell hardware to check above registers for changes */
Write_Control_Key();
tries = 0;
while (MC_RGM.PSTAT_0[2].PSTAT_0.B.PERIPH_0_STAT != 0)
{
tries++;
if (tries > MAX_TRIES)
{
break;
}
}
/**((volatile unsigned int *)0x4007caE4) = 0x1; */
S32G_GPR.GENCTRL1.B.CTRL = 1;
/* Setup & Enable the PFE Sys Clock */
/* See above clocking images */
/* Setup and Enable the PFE PE Clock */
/* *((volatile unsigned int *)0x4007ca44) = 0x0; */
S32G_GPR.LLCE_CTRL.B.EXEVENT = 0;
S32G_GPR.LLCE_CTRL.B.LINDIVSEL = 0;
S32G_GPR.LLCE_CTRL.B.LLCE_HTM0_TRC_DIS = 0;
S32G_GPR.LLCE_CTRL.B.LLCE_HTM1_TRC_DIS = 0;
S32G_GPR.LLCE_CTRL.B.LLCE_LSPI_TRIG_IN = 0;
S32G_GPR.LLCE_CTRL.B.PFE_2_LLCE_INT_HS_BP = 0;
/* Take the PFE out of reset */
/**((volatile unsigned int *)0x40078050) = 0x0; */
MC_RGM.PRST_0[2].PRST_0.B.PERIPH_0_RST = 0;
MC_ME.PRTN2_PCONF.B.OSSE = 1;
MC_ME.PRTN2_PCONF.B.PCE = 1;
MC_ME.PRTN2_PUPD.B.OSSUD = 1;
MC_ME.PRTN2_PUPD.B.PCUD = 1;
/* Tell hardware to check above registers for changes */
Write_Control_Key();
tries = 0;
while (MC_RGM.PSTAT_0[2].PSTAT_0.B.PERIPH_0_STAT != 0)
{
tries++;
if (tries > MAX_TRIES)
{
break;
}
}
MC_ME.PRTN2_PCONF.B.OSSE = 0;
MC_ME.PRTN2_PCONF.B.PCE = 1;
MC_ME.PRTN2_PUPD.B.OSSUD = 1;
MC_ME.PRTN2_PUPD.B.PCUD = 1;
/* Tell hardware to check above registers for changes */
Write_Control_Key();
tries = 0;
while (MC_RGM.PSTAT_0[2].PSTAT_0.B.PERIPH_0_STAT != 0)
{
tries++;
if (tries > MAX_TRIES)
{
break;
}
}
/**((volatile unsigned int *)0x4007caE4) = 0x1; */
S32G_GPR.GENCTRL1.B.CTRL = 1;
/* Setup EMAC Tx/RX clocks */
/* *((volatile unsigned int *)0x4007caE0) = 0x0; */
S32G_GPR.GENCTRL0.B.ACCEL_FLXNC_RD0_IDLEREQ = 0; /* normal operation */
S32G_GPR.GENCTRL0.B.ACCEL_FLXNC_REF_DIV = 0; /* Divide by 2 */
S32G_GPR.GENCTRL0.B.USBPWRFLT = 0;
}
After the above code is running I can read and write to all the PFE GMACs,,,
PFE EMAC0 base - 0x460A0000
0x460A011C-0x460A0128
PFE EMAC1 base - 0x460A4000
0x460A411C-0x460A4128
PFE EMAC2 base - 0x460A8000
0x460A811C-0x460A8128