diff mbox series

[04/18] rockchip: add weak function symbol called at the beginning of misc_init_r

Message ID 20240123-jaguar-v1-4-1eec1c34953c@theobroma-systems.com
State Superseded
Delegated to: Kever Yang
Headers show
Series rockchip: add support for Theobroma JAGUAR SBC-RK3588-AMR | expand

Commit Message

Quentin Schulz Jan. 23, 2024, 2:49 p.m. UTC
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

Most Rockchip boards who override misc_init_r do it only to call another
function and keep the rest unchanged. Therefore to allow for less
duplication, let's just add a weak function symbol that is called inside
misc_init_r.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 arch/arm/mach-rockchip/board.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Kever Yang Feb. 1, 2024, 2:48 a.m. UTC | #1
On 2024/1/23 22:49, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>
> Most Rockchip boards who override misc_init_r do it only to call another
> function and keep the rest unchanged. Therefore to allow for less
> duplication, let's just add a weak function symbol that is called inside
> misc_init_r.
>
> Cc: Quentin Schulz <foss+uboot@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>   arch/arm/mach-rockchip/board.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
>
> diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
> index 2620530e03f..d5cb59c10fa 100644
> --- a/arch/arm/mach-rockchip/board.c
> +++ b/arch/arm/mach-rockchip/board.c
> @@ -297,6 +297,11 @@ int fastboot_set_reboot_flag(enum fastboot_reboot_reason reason)
>   #endif
>   
>   #ifdef CONFIG_MISC_INIT_R
> +__weak int rockchip_early_misc_init_r(void)
> +{
> +	return 0;
> +}
> +
>   __weak int misc_init_r(void)
>   {
>   	const u32 cpuid_offset = CFG_CPUID_OFFSET;
> @@ -304,6 +309,10 @@ __weak int misc_init_r(void)
>   	u8 cpuid[cpuid_length];
>   	int ret;
>   
> +	ret = rockchip_early_misc_init_r();
> +	if (ret)
> +		return ret;
> +
>   	ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid);
>   	if (ret)
>   		return ret;
>
Dragan Simic Feb. 3, 2024, 1:16 p.m. UTC | #2
Hello Quentin,

This patch looks good to me, avoiding unnecessary code duplication
is always welcome.  My "Reviewed-by" is included below.

However, I've got some more comments,  which I'll send separately
for the other patches in this series.


On 2024-01-23 15:49, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> 
> Most Rockchip boards who override misc_init_r do it only to call 
> another
> function and keep the rest unchanged. Therefore to allow for less
> duplication, let's just add a weak function symbol that is called 
> inside
> misc_init_r.
> 
> Cc: Quentin Schulz <foss+uboot@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>

Reviewed-by: Dragan Simic <dsimic@manjaro.org>

> ---
>  arch/arm/mach-rockchip/board.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/arch/arm/mach-rockchip/board.c 
> b/arch/arm/mach-rockchip/board.c
> index 2620530e03f..d5cb59c10fa 100644
> --- a/arch/arm/mach-rockchip/board.c
> +++ b/arch/arm/mach-rockchip/board.c
> @@ -297,6 +297,11 @@ int fastboot_set_reboot_flag(enum
> fastboot_reboot_reason reason)
>  #endif
> 
>  #ifdef CONFIG_MISC_INIT_R
> +__weak int rockchip_early_misc_init_r(void)
> +{
> +	return 0;
> +}
> +
>  __weak int misc_init_r(void)
>  {
>  	const u32 cpuid_offset = CFG_CPUID_OFFSET;
> @@ -304,6 +309,10 @@ __weak int misc_init_r(void)
>  	u8 cpuid[cpuid_length];
>  	int ret;
> 
> +	ret = rockchip_early_misc_init_r();
> +	if (ret)
> +		return ret;
> +
>  	ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid);
>  	if (ret)
>  		return ret;
diff mbox series

Patch

diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
index 2620530e03f..d5cb59c10fa 100644
--- a/arch/arm/mach-rockchip/board.c
+++ b/arch/arm/mach-rockchip/board.c
@@ -297,6 +297,11 @@  int fastboot_set_reboot_flag(enum fastboot_reboot_reason reason)
 #endif
 
 #ifdef CONFIG_MISC_INIT_R
+__weak int rockchip_early_misc_init_r(void)
+{
+	return 0;
+}
+
 __weak int misc_init_r(void)
 {
 	const u32 cpuid_offset = CFG_CPUID_OFFSET;
@@ -304,6 +309,10 @@  __weak int misc_init_r(void)
 	u8 cpuid[cpuid_length];
 	int ret;
 
+	ret = rockchip_early_misc_init_r();
+	if (ret)
+		return ret;
+
 	ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid);
 	if (ret)
 		return ret;