[PATCH 08/12] arm: mach-k3: Add weak do_board_detect() to common file
Andrew Davis
afd at ti.com
Thu Mar 30 22:28:53 CEST 2023
This matches how it was done for pre-K3 TI platforms and it allows
us to move the forward declaration out of sys_proto.h.
It also removes the need to check for TI_I2C_BOARD_DETECT before
calling this function, which might not be the right guard ifdef
should a board use a different method for board detection.
Signed-off-by: Andrew Davis <afd at ti.com>
---
arch/arm/mach-k3/am642_init.c | 3 +--
arch/arm/mach-k3/am654_init.c | 3 +--
arch/arm/mach-k3/common.c | 10 ++++++++++
arch/arm/mach-k3/common.h | 2 ++
arch/arm/mach-k3/include/mach/sys_proto.h | 2 --
arch/arm/mach-k3/j721e_init.c | 6 ++----
6 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/arch/arm/mach-k3/am642_init.c b/arch/arm/mach-k3/am642_init.c
index b29b7376ffd..192c8f785de 100644
--- a/arch/arm/mach-k3/am642_init.c
+++ b/arch/arm/mach-k3/am642_init.c
@@ -100,8 +100,7 @@ void do_dt_magic(void)
{
int ret, rescan;
- if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT))
- do_board_detect();
+ do_board_detect();
/*
* Board detection has been done.
diff --git a/arch/arm/mach-k3/am654_init.c b/arch/arm/mach-k3/am654_init.c
index 5b8e506c793..5a9a780f521 100644
--- a/arch/arm/mach-k3/am654_init.c
+++ b/arch/arm/mach-k3/am654_init.c
@@ -246,8 +246,7 @@ void board_init_f(ulong dummy)
k3_sysfw_print_ver();
/* Perform EEPROM-based board detection */
- if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT))
- do_board_detect();
+ do_board_detect();
#if defined(CONFIG_CPU_V7R) && defined(CONFIG_K3_AVS0)
ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(k3_avs),
diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index 4f2e14c3105..115f5959734 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -636,3 +636,13 @@ int misc_init_r(void)
return 0;
}
+
+/**
+ * do_board_detect() - Detect board description
+ *
+ * Function to detect board description. This is expected to be
+ * overridden in the SoC family board file where desired.
+ */
+void __weak do_board_detect(void)
+{
+}
diff --git a/arch/arm/mach-k3/common.h b/arch/arm/mach-k3/common.h
index 531be0be54c..130f5021123 100644
--- a/arch/arm/mach-k3/common.h
+++ b/arch/arm/mach-k3/common.h
@@ -35,3 +35,5 @@ void mmr_unlock(phys_addr_t base, u32 partition);
bool is_rom_loaded_sysfw(struct rom_extended_boot_data *data);
enum k3_device_type get_device_type(void);
void ti_secure_image_post_process(void **p_image, size_t *p_size);
+struct ti_sci_handle *get_ti_sci_handle(void);
+void do_board_detect(void);
diff --git a/arch/arm/mach-k3/include/mach/sys_proto.h b/arch/arm/mach-k3/include/mach/sys_proto.h
index 8cc75b636b5..939de0f79b4 100644
--- a/arch/arm/mach-k3/include/mach/sys_proto.h
+++ b/arch/arm/mach-k3/include/mach/sys_proto.h
@@ -10,8 +10,6 @@
void sdelay(unsigned long loops);
u32 wait_on_value(u32 read_bit_mask, u32 match_value, void *read_addr,
u32 bound);
-struct ti_sci_handle *get_ti_sci_handle(void);
-int do_board_detect(void);
int fdt_disable_node(void *blob, char *node_path);
void k3_spl_init(void);
diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index 6c18778c73e..92f11133c85 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -160,8 +160,7 @@ void do_dt_magic(void)
int ret, rescan, mmc_dev = -1;
static struct mmc *mmc;
- if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT))
- do_board_detect();
+ do_board_detect();
/*
* Board detection has been done.
@@ -288,8 +287,7 @@ void board_init_f(ulong dummy)
k3_sysfw_print_ver();
/* Perform EEPROM-based board detection */
- if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT))
- do_board_detect();
+ do_board_detect();
#if defined(CONFIG_CPU_V7R) && defined(CONFIG_K3_AVS0)
ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(k3_avs),
--
2.39.2
More information about the U-Boot
mailing list