]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: mach-k3: Move J721e SoC detection out of common section
authorAndrew Davis <afd@ti.com>
Thu, 6 Apr 2023 16:38:11 +0000 (11:38 -0500)
committerTom Rini <trini@konsulko.com>
Mon, 24 Apr 2023 17:18:47 +0000 (13:18 -0400)
This belongs in the J721e specific file as it is the only place
this is used. Any board level users should use the SOC driver.

While here, move the J721e and J7200 SoC IDs out of sys_proto.h
and into hardware.h. Use a macro borrowed from Rockchip and add
the rest of the SoC IDs for completeness and later use.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
arch/arm/mach-k3/common.c
arch/arm/mach-k3/common.h
arch/arm/mach-k3/include/mach/hardware.h
arch/arm/mach-k3/include/mach/sys_proto.h

index 6870f13c5200e7b0cec362debcde39019ffd820c..6e084de692c99747e2bfff45fcfb0f2adcc7ba4c 100644 (file)
@@ -488,26 +488,6 @@ int print_cpuinfo(void)
 }
 #endif
 
-bool soc_is_j721e(void)
-{
-       u32 soc;
-
-       soc = (readl(CTRLMMR_WKUP_JTAG_ID) &
-               JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT;
-
-       return soc == J721E;
-}
-
-bool soc_is_j7200(void)
-{
-       u32 soc;
-
-       soc = (readl(CTRLMMR_WKUP_JTAG_ID) &
-               JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT;
-
-       return soc == J7200;
-}
-
 #ifdef CONFIG_ARM64
 void board_prep_linux(struct bootm_headers *images)
 {
index 8f38fcef7f01033cf4941ace8b6e15a0d9316e84..531be0be54cbad57c167d7107d77cc8969274fc2 100644 (file)
@@ -9,9 +9,6 @@
 #include <asm/armv7_mpu.h>
 #include <asm/hardware.h>
 
-#define J721E  0xbb64
-#define J7200  0xbb6d
-
 struct fwl_data {
        const char *name;
        u16 fwl_id;
index 2c60ef85432bc1405b576033df70f005cc5c7b6c..9faf1d6ff064b5028004b8888f80b989c653bcb4 100644 (file)
@@ -6,6 +6,8 @@
 #ifndef _ASM_ARCH_HARDWARE_H_
 #define _ASM_ARCH_HARDWARE_H_
 
+#include <asm/io.h>
+
 #ifdef CONFIG_SOC_K3_AM654
 #include "am6_hardware.h"
 #endif
 #define JTAG_ID_VARIANT_MASK   (0xf << 28)
 #define JTAG_ID_PARTNO_SHIFT   12
 #define JTAG_ID_PARTNO_MASK    (0xffff << 12)
+#define JTAG_ID_PARTNO_AM65X   0xbb5a
+#define JTAG_ID_PARTNO_J721E   0xbb64
+#define JTAG_ID_PARTNO_J7200   0xbb6d
+#define JTAG_ID_PARTNO_AM64X   0xbb38
+#define JTAG_ID_PARTNO_J721S2  0xbb75
+#define JTAG_ID_PARTNO_AM62X   0xbb7e
+#define JTAG_ID_PARTNO_AM62AX   0xbb8d
+
+#define K3_SOC_ID(id, ID) \
+static inline bool soc_is_##id(void) \
+{ \
+       u32 soc = (readl(CTRLMMR_WKUP_JTAG_ID) & \
+               JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT; \
+       return soc == JTAG_ID_PARTNO_##ID; \
+}
+K3_SOC_ID(am65x, AM65X)
+K3_SOC_ID(j721e, J721E)
+K3_SOC_ID(j7200, J7200)
+K3_SOC_ID(am64x, AM64X)
+K3_SOC_ID(j721s2, J721S2)
+K3_SOC_ID(am62x, AM62X)
+K3_SOC_ID(am62ax, AM62AX)
+
 #define K3_SEC_MGR_SYS_STATUS          0x44234100
 #define SYS_STATUS_DEV_TYPE_SHIFT      0
 #define SYS_STATUS_DEV_TYPE_MASK       (0xf)
index 0b5d606eaa2908c11e58b77790a1eb1665b06b65..d5d4b787b7d6a40d0bda7e48066b5a1f40b98de3 100644 (file)
@@ -15,9 +15,6 @@ int do_board_detect(void);
 void release_resources_for_core_shutdown(void);
 int fdt_disable_node(void *blob, char *node_path);
 
-bool soc_is_j721e(void);
-bool soc_is_j7200(void);
-
 void k3_spl_init(void);
 void k3_mem_init(void);
 bool check_rom_loaded_sysfw(void);