[PATCH] ARM: at91: setup: improve address handling for DBGU and CHIPID detection

Alexander Shiyan eagle.alexander923 at gmail.com
Tue Jun 17 23:35:50 PDT 2025


This patch enhances type safety and replaces hardcoded addresses with
SoC-specific constants for DBGU and CHIPID detection.

Signed-off-by: Alexander Shiyan <eagle.alexander923 at gmail.com>
---
 arch/arm/mach-at91/setup.c   | 6 +++---
 include/mach/at91/hardware.h | 2 --
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index e8d45c30dd..e726495726 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -186,7 +186,7 @@ static void __init dbgu_soc_detect(u32 dbgu_base)
 	}
 }
 
-static void __init chipid_soc_detect(u32 chipid_base)
+static void __init chipid_soc_detect(void __iomem *chipid_base)
 {
 	u32 cidr, socid;
 
@@ -345,9 +345,9 @@ static int at91_detect(void)
 	if (!at91_soc_is_detected())
 		dbgu_soc_detect(AT91_BASE_DBGU1);
 	if (!at91_soc_is_detected())
-		dbgu_soc_detect(AT91_BASE_DBGU2);
+		dbgu_soc_detect(SAMA5D4_BASE_DBGU);
 	if (!at91_soc_is_detected())
-		chipid_soc_detect(0xfc069000);
+		chipid_soc_detect(SAMA5D2_BASE_CHIPID);
 
 	if (!at91_soc_is_detected())
 		panic("AT91: Impossible to detect the SOC type");
diff --git a/include/mach/at91/hardware.h b/include/mach/at91/hardware.h
index 5d2fd872ab..104ad11648 100644
--- a/include/mach/at91/hardware.h
+++ b/include/mach/at91/hardware.h
@@ -12,8 +12,6 @@
 #define AT91_BASE_DBGU0	0xfffff200
 /* 9263, 9g45 */
 #define AT91_BASE_DBGU1	0xffffee00
-/* sama5d4 */
-#define AT91_BASE_DBGU2	0xfc069000
 
 #include <mach/at91/at91rm9200.h>
 #include <mach/at91/at91sam9260.h>
-- 
2.39.1




More information about the barebox mailing list