[PATCH v2 08/12] arm: mach-k3: Add weak do_board_detect() to common file

Christian Gmeiner christian.gmeiner at gmail.com
Wed Apr 5 22:09:05 CEST 2023


Hi

>
> 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 at 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..9a34a3f9451 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 EEPROM-based board detection */

Can we remove that comment as it is not true? I use this to
perform an fpga based board detection on a am642 platform.

That comment goes for every occurance of that line in this patch.

> +       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..5a9a780f521 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 EEPROM-based 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 b5a69255f76..3fda2dfaa1b 100644
> --- a/arch/arm/mach-k3/j721e_init.c
> +++ b/arch/arm/mach-k3/j721e_init.c
> @@ -160,8 +160,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 EEPROM-based board detection */
> +       do_board_detect();
>
>         /*
>          * Board detection has been done.
> @@ -287,8 +287,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 EEPROM-based 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
>


-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy


More information about the U-Boot mailing list