public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Andrew Davis <afd@ti.com>
To: Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
	<u-boot@lists.denx.de>
Cc: Andrew Davis <afd@ti.com>
Subject: [PATCH 08/12] arm: mach-k3: Add weak do_board_detect() to common file
Date: Thu, 30 Mar 2023 15:28:53 -0500	[thread overview]
Message-ID: <20230330202857.8216-8-afd@ti.com> (raw)
In-Reply-To: <20230330202857.8216-1-afd@ti.com>

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@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


  parent reply	other threads:[~2023-03-30 20:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30 20:28 [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
2023-03-30 20:28 ` [PATCH 02/12] arm: mach-k3: Move J721e SoC detection out of common section Andrew Davis
2023-03-30 20:28 ` [PATCH 03/12] soc: soc_ti_k3: Use hardware.h to remove definition duplication Andrew Davis
2023-03-30 20:28 ` [PATCH 04/12] configs: j721x_evm.h: Remove unneeded check for SYS_K3_SPL_ATF Andrew Davis
2023-03-30 20:28 ` [PATCH 05/12] configs: j721s2_evm.h: Remove refrences to J7200 EVM Andrew Davis
2023-03-30 20:28 ` [PATCH 06/12] arm: mach-k3: Make release_resources_for_core_shutdown() common Andrew Davis
2023-03-30 20:28 ` [PATCH 07/12] arm: mach-k3: Move sysfw-loader.h out of mach includes Andrew Davis
2023-03-30 20:28 ` Andrew Davis [this message]
2023-04-02 10:44   ` [PATCH 08/12] arm: mach-k3: Add weak do_board_detect() to common file Christian Gmeiner
2023-04-05 14:42     ` Andrew Davis
2023-03-30 20:28 ` [PATCH 09/12] arm: mach-k3: Remove unused fdt_disable_node() Andrew Davis
2023-03-30 20:28 ` [PATCH 10/12] arm: mach-k3: Move sdelay() and wait_on_value() declaration Andrew Davis
2023-03-30 20:28 ` [PATCH 11/12] arm: mach-k3: Move J721s2 SPL init functions to mach-k3 Andrew Davis
2023-03-30 20:28 ` [PATCH 12/12] arm: mach-k3: Remove empty sys_proto.h include Andrew Davis
2023-04-02 10:47 ` [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Christian Gmeiner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230330202857.8216-8-afd@ti.com \
    --to=afd@ti.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox