Skip to contentSkip to conversation

at91: sama5d2: Do not use the contents of BSC_CR if the DISABLE_BSCR bit is set in the fuse

PATCH Applied Alexander Shiyan 2 participants 2 messages Mar 5, 2025 – Mar 7, 2025 Arm/Microchip (AT91) SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 at91: sama5d2: Do not use the contents of BSC_CR if the DISABLE_BSCR bit is set in the fuse

The DISABLE_BSCR bit in Fuse means "Does not read BSC_CR content, so the Boot settings are those from the Fuse".
Let's ignore BSC_CR it this case.

---
 include/mach/at91/sama5d2.h | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
include/mach/at91/sama5d2.h +10 -8
index 90b566ffc4..d8a450255f 100644
@@ -305,16 +305,18 @@ static inline void __iomem *sama5d2_pio_map_bank(int bank, unsigned *id)
 
 static inline u32 sama5d2_bootcfg(void)
 {
-	u32 __iomem *bureg = SAMA5D2_BASE_SECURAM + 0x1400;
-	u32 bsc_cr = readl(SAMA5D2_BASE_SYSC + 0x54);
-	u32 __iomem *bootcfg;
+	u32 bsc_cr, bootcfg = readl(SAMA5D2_SFC_DR(16));
 
-	if (bsc_cr & SAMA5D2_BUREG_VALID)
-		bootcfg = &bureg[FIELD_GET(SAMA5D2_BUREG_INDEX, bsc_cr)];
-	else
-		bootcfg = SAMA5D2_SFC_DR(512 / 32);
+	if (bootcfg & SAMA5D2_DISABLE_BSC_CR)
+		return bootcfg;
 
-	return readl(bootcfg);
+	bsc_cr = readl(SAMA5D2_BASE_SYSC + 0x54);
+	if (bsc_cr & SAMA5D2_BUREG_VALID) {
+		u32 __iomem *bureg = SAMA5D2_BASE_SECURAM + 0x1400;
+		bootcfg = readl(&bureg[FIELD_GET(SAMA5D2_BUREG_INDEX, bsc_cr)]);
+	}
+
+	return bootcfg;
 }
 
 #endif
Signature · 1 line
2.39.1
Applied
#1 lore raw
Quoted 5 lines · Alexander Shiyan

The DISABLE_BSCR bit in Fuse means "Does not read BSC_CR content, so the Boot settings are those from the Fuse".
Let's ignore BSC_CR it this case.

Applied, thanks!

[1/1] at91: sama5d2: Do not use the contents of BSC_CR if the DISABLE_BSCR bit is set in the fuse
https://git.pengutronix.de/cgit/barebox/commit/?id=1d0c9343b7f4 (link may not be stable)

Best regards,

Signature · 1 line
Sascha Hauer <[email protected]>