diff mbox series

[7/8] arm64: renesas: Deduplicate board_early_init_f()

Message ID 20250112223528.179828-7-marek.vasut+renesas@mailbox.org
State Accepted
Delegated to: Marek Vasut
Headers show
Series [1/8] ARM: renesas: Rename board/renesas/rcar-common to board/renesas/common | expand

Commit Message

Marek Vasut Jan. 12, 2025, 10:34 p.m. UTC
Introduce common weak board_early_init_f() in rcar64-common.c
which is the default implementation in case there is no other
board specific board_early_init_f(). Remove board_early_init_f()
from Salvator-X, ULCB and Draak boards where this function is
empty.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Adam Ford <aford173@gmail.com>
Cc: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Paul Barker <paul.barker.ct@bp.renesas.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
---
 board/renesas/common/rcar64-common.c  | 5 +++++
 board/renesas/draak/draak.c           | 5 -----
 board/renesas/salvator-x/salvator-x.c | 5 -----
 board/renesas/ulcb/ulcb.c             | 5 -----
 4 files changed, 5 insertions(+), 15 deletions(-)

Comments

Adam Ford Jan. 13, 2025, 3:40 p.m. UTC | #1
On Sun, Jan 12, 2025 at 4:36 PM Marek Vasut
<marek.vasut+renesas@mailbox.org> wrote:
>
> Introduce common weak board_early_init_f() in rcar64-common.c
> which is the default implementation in case there is no other
> board specific board_early_init_f(). Remove board_early_init_f()
> from Salvator-X, ULCB and Draak boards where this function is
> empty.

Isn't there a config option to enable/disable board_early_init_f?  If
they are do-nothing functions, can the config option be disabled?

adam
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---
> Cc: Adam Ford <aford173@gmail.com>
> Cc: Biju Das <biju.das.jz@bp.renesas.com>
> Cc: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> Cc: Paul Barker <paul.barker.ct@bp.renesas.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: u-boot@lists.denx.de
> ---
>  board/renesas/common/rcar64-common.c  | 5 +++++
>  board/renesas/draak/draak.c           | 5 -----
>  board/renesas/salvator-x/salvator-x.c | 5 -----
>  board/renesas/ulcb/ulcb.c             | 5 -----
>  4 files changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/board/renesas/common/rcar64-common.c b/board/renesas/common/rcar64-common.c
> index 74ec0a46e6f..69229ea3cb0 100644
> --- a/board/renesas/common/rcar64-common.c
> +++ b/board/renesas/common/rcar64-common.c
> @@ -65,3 +65,8 @@ int __weak board_init(void)
>  {
>         return 0;
>  }
> +
> +int __weak board_early_init_f(void)
> +{
> +       return 0;
> +}
> diff --git a/board/renesas/draak/draak.c b/board/renesas/draak/draak.c
> index a8c40ff1f07..6caa63d553f 100644
> --- a/board/renesas/draak/draak.c
> +++ b/board/renesas/draak/draak.c
> @@ -12,11 +12,6 @@
>  #include <asm/arch/rcar-mstp.h>
>  #include <asm/arch/renesas.h>
>
> -int board_early_init_f(void)
> -{
> -       return 0;
> -}
> -
>  #define HSUSB_MSTP704          BIT(4)  /* HSUSB */
>
>  /* HSUSB block registers */
> diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c
> index abb17c3fdc5..9bfcf0d66ad 100644
> --- a/board/renesas/salvator-x/salvator-x.c
> +++ b/board/renesas/salvator-x/salvator-x.c
> @@ -14,11 +14,6 @@
>  #include <asm/arch/renesas.h>
>  #include <init.h>
>
> -int board_early_init_f(void)
> -{
> -       return 0;
> -}
> -
>  #define HSUSB_MSTP704          BIT(4)  /* HSUSB */
>
>  /* HSUSB block registers */
> diff --git a/board/renesas/ulcb/ulcb.c b/board/renesas/ulcb/ulcb.c
> index a441ff0e0d8..bd06db23b16 100644
> --- a/board/renesas/ulcb/ulcb.c
> +++ b/board/renesas/ulcb/ulcb.c
> @@ -15,11 +15,6 @@
>
>  #define HSUSB_MSTP704          BIT(4)  /* HSUSB */
>
> -int board_early_init_f(void)
> -{
> -       return 0;
> -}
> -
>  /* HSUSB block registers */
>  #define HSUSB_REG_LPSTS                        0xE6590102
>  #define HSUSB_REG_LPSTS_SUSPM_NORMAL   BIT(14)
> --
> 2.45.2
>
Marek Vasut Jan. 18, 2025, 7:59 a.m. UTC | #2
On 1/13/25 4:40 PM, Adam Ford wrote:
> On Sun, Jan 12, 2025 at 4:36 PM Marek Vasut
> <marek.vasut+renesas@mailbox.org> wrote:
>>
>> Introduce common weak board_early_init_f() in rcar64-common.c
>> which is the default implementation in case there is no other
>> board specific board_early_init_f(). Remove board_early_init_f()
>> from Salvator-X, ULCB and Draak boards where this function is
>> empty.
> 
> Isn't there a config option to enable/disable board_early_init_f?  If
> they are do-nothing functions, can the config option be disabled?
There is , but I am still on the fence whether it wouldn't be better to 
remove it in favor of weak symbol, which would get optimized out. I 
think it is more user friendly as user does not have to fiddle with any 
config options, only fill in the non-weak symbol with content in their 
board file and it automatically takes effect.
diff mbox series

Patch

diff --git a/board/renesas/common/rcar64-common.c b/board/renesas/common/rcar64-common.c
index 74ec0a46e6f..69229ea3cb0 100644
--- a/board/renesas/common/rcar64-common.c
+++ b/board/renesas/common/rcar64-common.c
@@ -65,3 +65,8 @@  int __weak board_init(void)
 {
 	return 0;
 }
+
+int __weak board_early_init_f(void)
+{
+	return 0;
+}
diff --git a/board/renesas/draak/draak.c b/board/renesas/draak/draak.c
index a8c40ff1f07..6caa63d553f 100644
--- a/board/renesas/draak/draak.c
+++ b/board/renesas/draak/draak.c
@@ -12,11 +12,6 @@ 
 #include <asm/arch/rcar-mstp.h>
 #include <asm/arch/renesas.h>
 
-int board_early_init_f(void)
-{
-	return 0;
-}
-
 #define HSUSB_MSTP704		BIT(4)	/* HSUSB */
 
 /* HSUSB block registers */
diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c
index abb17c3fdc5..9bfcf0d66ad 100644
--- a/board/renesas/salvator-x/salvator-x.c
+++ b/board/renesas/salvator-x/salvator-x.c
@@ -14,11 +14,6 @@ 
 #include <asm/arch/renesas.h>
 #include <init.h>
 
-int board_early_init_f(void)
-{
-	return 0;
-}
-
 #define HSUSB_MSTP704		BIT(4)	/* HSUSB */
 
 /* HSUSB block registers */
diff --git a/board/renesas/ulcb/ulcb.c b/board/renesas/ulcb/ulcb.c
index a441ff0e0d8..bd06db23b16 100644
--- a/board/renesas/ulcb/ulcb.c
+++ b/board/renesas/ulcb/ulcb.c
@@ -15,11 +15,6 @@ 
 
 #define HSUSB_MSTP704		BIT(4)	/* HSUSB */
 
-int board_early_init_f(void)
-{
-	return 0;
-}
-
 /* HSUSB block registers */
 #define HSUSB_REG_LPSTS			0xE6590102
 #define HSUSB_REG_LPSTS_SUSPM_NORMAL	BIT(14)