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>,
	Christian Gmeiner <christian.gmeiner@gmail.com>,
	<u-boot@lists.denx.de>
Cc: Andrew Davis <afd@ti.com>
Subject: [PATCH v3 08/12] arm: mach-k3: Add weak do_board_detect() to common file
Date: Thu, 6 Apr 2023 09:09:59 -0500	[thread overview]
Message-ID: <20230406141003.17511-9-afd@ti.com> (raw)
In-Reply-To: <20230406141003.17511-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 for K3_BOARD_DETECT as one is free to simply
override the weak function in their board files as needed.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm/mach-k3/Kconfig                  |  5 -----
 arch/arm/mach-k3/am642_init.c             |  4 ++--
 arch/arm/mach-k3/am654_init.c             |  4 ++--
 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             |  8 ++++----
 board/ti/common/Kconfig                   |  1 -
 8 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
index 7edbac26ccc..a8c3a593d57 100644
--- a/arch/arm/mach-k3/Kconfig
+++ b/arch/arm/mach-k3/Kconfig
@@ -187,11 +187,6 @@ config K3_X509_SWRV
 	help
 	  SWRV for X509 certificate used for boot images
 
-config K3_BOARD_DETECT
-	bool "Support for Board detection"
-	help
-	   Support for board detection.
-
 source "board/ti/am65x/Kconfig"
 source "board/ti/am64x/Kconfig"
 source "board/ti/am62x/Kconfig"
diff --git a/arch/arm/mach-k3/am642_init.c b/arch/arm/mach-k3/am642_init.c
index c7720cbaf35..ef84aad819c 100644
--- a/arch/arm/mach-k3/am642_init.c
+++ b/arch/arm/mach-k3/am642_init.c
@@ -100,8 +100,8 @@ void do_dt_magic(void)
 {
 	int ret, rescan;
 
-	if (IS_ENABLED(CONFIG_K3_BOARD_DETECT))
-		do_board_detect();
+	/* Perform board detection */
+	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 12d74635cb0..2336da4b454 100644
--- a/arch/arm/mach-k3/am654_init.c
+++ b/arch/arm/mach-k3/am654_init.c
@@ -245,8 +245,8 @@ void board_init_f(ulong dummy)
 	/* Output System Firmware version info */
 	k3_sysfw_print_ver();
 
-	if (IS_ENABLED(CONFIG_K3_BOARD_DETECT))
-		do_board_detect();
+	/* Perform board detection */
+	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 eec5b726b95..31d324e2179 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -140,8 +140,8 @@ void do_dt_magic(void)
 	int ret, rescan, mmc_dev = -1;
 	static struct mmc *mmc;
 
-	if (IS_ENABLED(CONFIG_K3_BOARD_DETECT))
-		do_board_detect();
+	/* Perform board detection */
+	do_board_detect();
 
 	/*
 	 * Board detection has been done.
@@ -267,8 +267,8 @@ void board_init_f(ulong dummy)
 	/* Output System Firmware version info */
 	k3_sysfw_print_ver();
 
-	if (IS_ENABLED(CONFIG_K3_BOARD_DETECT))
-		do_board_detect();
+	/* Perform board detection */
+	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/board/ti/common/Kconfig b/board/ti/common/Kconfig
index f03357cc751..49edd98014a 100644
--- a/board/ti/common/Kconfig
+++ b/board/ti/common/Kconfig
@@ -1,6 +1,5 @@
 config TI_I2C_BOARD_DETECT
 	bool "Support for Board detection for TI platforms"
-	select K3_BOARD_DETECT if ARCH_K3
 	help
 	   Support for detection board information on Texas Instrument's
 	   Evaluation Boards which have I2C based EEPROM detection
-- 
2.39.2


  parent reply	other threads:[~2023-04-06 14:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06 14:09 [PATCH v3 00/12] Remove K3 misc sys_proto.h header Andrew Davis
2023-04-06 14:09 ` [PATCH v3 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
2023-04-06 14:09 ` [PATCH v3 02/12] arm: mach-k3: Move J721e SoC detection out of common section Andrew Davis
2023-04-06 15:59   ` Christian Gmeiner
2023-04-06 16:29     ` Andrew Davis
2023-04-06 14:09 ` [PATCH v3 03/12] soc: soc_ti_k3: Use hardware.h to remove definition duplication Andrew Davis
2023-04-06 14:09 ` [PATCH v3 04/12] configs: j721x_evm: Remove unneeded check for SYS_K3_SPL_ATF Andrew Davis
2023-04-06 14:09 ` [PATCH v3 05/12] configs: j721s2_evm.h: Remove refrences to J7200 EVM Andrew Davis
2023-04-06 14:09 ` [PATCH v3 06/12] arm: mach-k3: Make release_resources_for_core_shutdown() common Andrew Davis
2023-04-06 14:09 ` [PATCH v3 07/12] arm: mach-k3: Move sysfw-loader.h out of mach includes Andrew Davis
2023-04-06 14:09 ` Andrew Davis [this message]
2023-04-06 16:01   ` [PATCH v3 08/12] arm: mach-k3: Add weak do_board_detect() to common file Christian Gmeiner
2023-04-06 14:10 ` [PATCH v3 09/12] arm: mach-k3: Remove unused fdt_disable_node() Andrew Davis
2023-04-06 14:10 ` [PATCH v3 10/12] arm: mach-k3: Move sdelay() and wait_on_value() declaration Andrew Davis
2023-04-06 14:10 ` [PATCH v3 11/12] arm: mach-k3: Move J721s2 SPL init functions to mach-k3 Andrew Davis
2023-04-06 14:10 ` [PATCH v3 12/12] arm: mach-k3: Remove empty sys_proto.h include Andrew Davis
2023-04-06 16:02   ` 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=20230406141003.17511-9-afd@ti.com \
    --to=afd@ti.com \
    --cc=christian.gmeiner@gmail.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