The AFEC Control register (AFEC_CR) enables the AFEC at the cell level. Before programming the AFEC_CR to enable the AFEC, the AFEC must be enabled from the Power Management Controller (PMC).
Code example for the AFEC0:
/* Enabling the AFEC in the PMC */
PMC->PMC_PCER0 = 1 << AFEC_ID
/* Reset the controller */
AFEC0->AFEC_CR = AFEC_CR_SWRST;
/* Reset Mode Register */
AFEC0->AFEC_MR = 0;