From 0d9de4db679436581f554242d7635ddef4b96773 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 8 Jan 2012 15:08:14 +0100 Subject: Implement SAM3U Errata 46.2.1.4 about reading Unique Identifier --- memories/flash/flashd_eefc.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'memories') diff --git a/memories/flash/flashd_eefc.c b/memories/flash/flashd_eefc.c index 45b9038..a367c8d 100644 --- a/memories/flash/flashd_eefc.c +++ b/memories/flash/flashd_eefc.c @@ -472,6 +472,7 @@ __attribute__ ((section (".ramfunc"))) unsigned char FLASHD_ReadUniqueID (unsigned long * uniqueID) { unsigned char error; + AT91S_EFC *pEfc = AT91C_BASE_EFC0; SANITY_CHECK(uniqueID != NULL); @@ -480,6 +481,9 @@ unsigned char FLASHD_ReadUniqueID (unsigned long * uniqueID) uniqueID[2] = 0; uniqueID[3] = 0; + /* SAM3U Errata 46.2.1.4 */ + pEfc->EFC_FMR |= (1 << 16); + EFC_StartCommand(AT91C_BASE_EFC, AT91C_EFC_FCMD_STUI, 0); uniqueID[0] = *(unsigned int *)AT91C_IFLASH; @@ -488,6 +492,10 @@ unsigned char FLASHD_ReadUniqueID (unsigned long * uniqueID) uniqueID[3] = *(unsigned int *)(AT91C_IFLASH + 12); error = EFC_PerformCommand(AT91C_BASE_EFC, AT91C_EFC_FCMD_SPUI, 0); + + /* SAM3U Errata 46.2.1.4 */ + pEfc->EFC_FMR &= ~(1 << 16); + if (error) return error; return 0; -- cgit v1.2.3