samd: Added an errata workaround for the SAMD11 DFLL48M which can have issues if left unrequested before configuration.

This commit is contained in:
dragonmux 2022-08-08 05:42:03 +01:00 committed by Piotr Esden-Tempski
parent 663f2a329a
commit b795cb7ef4
1 changed files with 22 additions and 0 deletions

View File

@ -298,6 +298,22 @@ static void samd20_revB_halt_resume(target *t, bool step)
target_mem_write32(t, SAMD_DSU_CTRLSTAT, SAMD_STATUSA_CRSTEXT); target_mem_write32(t, SAMD_DSU_CTRLSTAT, SAMD_STATUSA_CRSTEXT);
} }
/*
* Release the target from extended reset before running the normal cortexm_attach routine.
* This prevents tripping up over errata ref 9905
*
* Only required for SAM D11 silicon.
*/
static bool samd11_attach(target *t)
{
/* Exit extended reset */
if (target_mem_read32(t, SAMD_DSU_CTRLSTAT) & SAMD_STATUSA_CRSTEXT)
/* Write bit to clear from extended reset */
target_mem_write32(t, SAMD_DSU_CTRLSTAT, SAMD_STATUSA_CRSTEXT);
return cortexm_attach(t);
}
/* /*
* Overload the default cortexm attach for when the samd is protected. * Overload the default cortexm attach for when the samd is protected.
* *
@ -505,6 +521,12 @@ bool samd_probe(target *t)
*/ */
t->detach = samd20_revB_detach; t->detach = samd20_revB_detach;
t->halt_resume = samd20_revB_halt_resume; t->halt_resume = samd20_revB_halt_resume;
} else if (samd.series == 11) {
/*
* Attach routine that checks for an extended reset and releases it.
* This works around Errata 38.2.5 ref 9905
*/
t->attach = samd11_attach;
} }
if (protected) { if (protected) {