From: Detlev Casanova <detlev.casanova@collabora.com>
To: Jonas Karlman <jonas@kwiboo.se>
Cc: Joe Hershberger <joe.hershberger@ni.com>,
Ramon Fried <rfried.dev@gmail.com>, Tom Rini <trini@konsulko.com>,
Philipp Tomsich <philipp.tomsich@vrull.eu>,
Kever Yang <kever.yang@rock-chips.com>,
Marek Vasut <marek.vasut+renesas@mailbox.org>,
Simon Glass <sjg@chromium.org>, Fabio Estevam <festevam@denx.de>,
u-boot@lists.denx.de
Subject: Re: [PATCH 2/3] rockchip: Add a board_gen_ethaddr() function
Date: Tue, 02 Apr 2024 11:38:41 -0400 [thread overview]
Message-ID: <3001977.mvXUDI8C0e@arisu> (raw)
In-Reply-To: <55dcdf42-b446-4718-a99a-1e454d14c5cf@kwiboo.se>
[-- Attachment #1: Type: text/plain, Size: 3563 bytes --]
Hi Jonas,
On Thursday, March 14, 2024 2:38:30 P.M. EDT Jonas Karlman wrote:
> Hi Detlev,
>
> On 2024-03-14 15:43, Detlev Casanova wrote:
> > Set the MAC address based on the CPU ID only if the ethernet device has
> > no ROM or DT address set.
>
> This patch changes behavior and once again require CONFIG_NET to fixup
> the device tree with local-mac-address for the ethernet0/1 alias nodes.
>
> I.e. reverts one of the intentions with the commit 628fb0683b65
> ("rockchip: misc: Set eth1addr mac address"), fixup of ethaddr in DT
> should not depend on enabled and working ethernet in U-Boot.
I see the intention, that makes sense.
> Maybe just having a Kconfig to control if ENV ethaddr should overwrite
> ROM ethaddr could as easily solve your issue?
If that is ok for everybody, it would indeed be enough for this issue and keep
the eth driver less complex.
> Please also note that misc.c is merging into board.c in another pending
> series, see custodian u-boot-rockchip/for-next branch.
>
> > Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
> > ---
> >
> > arch/arm/Kconfig | 1 +
> > arch/arm/include/asm/arch-rockchip/misc.h | 1 +
> > arch/arm/mach-rockchip/board.c | 30 ++++++++++++++++++-----
> > arch/arm/mach-rockchip/misc.c | 22 ++++++++++++-----
> > 4 files changed, 42 insertions(+), 12 deletions(-)
> >
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index 01d6556c42b..21b41675ef6 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -2003,6 +2003,7 @@ config ARCH_ROCKCHIP
> >
> > select DM_SPI_FLASH
> > select DM_USB_GADGET if USB_DWC3_GADGET
> > select ENABLE_ARM_SOC_BOOT0_HOOK
> >
> > + select NET_BOARD_ETHADDR
>
> You are selecting here, so why the need for IS_ENABLED checks below?
>
> > select OF_CONTROL
> > select MTD
> > select SPI
> >
> > diff --git a/arch/arm/include/asm/arch-rockchip/misc.h
> > b/arch/arm/include/asm/arch-rockchip/misc.h index
> > 4155af8c3b0..6e972de6279 100644
> > --- a/arch/arm/include/asm/arch-rockchip/misc.h
> > +++ b/arch/arm/include/asm/arch-rockchip/misc.h
> > @@ -10,5 +10,6 @@ int rockchip_cpuid_from_efuse(const u32 cpuid_offset,
> >
> > const u32 cpuid_length,
> > u8 *cpuid);
> >
> > int rockchip_cpuid_set(const u8 *cpuid, const u32 cpuid_length);
> >
> > +int rockchip_gen_macaddr(int dev_num, u8 *mac_addr);
> >
> > int rockchip_setup_macaddr(void);
> > void rockchip_capsule_update_board_setup(void);
> >
> > diff --git a/arch/arm/mach-rockchip/board.c
> > b/arch/arm/mach-rockchip/board.c index 2620530e03f..283d3b9ed3a 100644
> > --- a/arch/arm/mach-rockchip/board.c
> > +++ b/arch/arm/mach-rockchip/board.c
> > @@ -296,8 +296,8 @@ int fastboot_set_reboot_flag(enum
> > fastboot_reboot_reason reason)>
> > }
> > #endif
> >
> > -#ifdef CONFIG_MISC_INIT_R
> > -__weak int misc_init_r(void)
> > +#if IS_ENABLED(CONFIG_MISC_INIT_R) ||
> > IS_ENABLED(CONFIG_NET_BOARD_ETHADDR)
>
> NET_BOARD_ETHADDR is selected so this #if will always be true.
>
> > +static int set_cpuid(void)
> >
> > {
> >
> > const u32 cpuid_offset = CFG_CPUID_OFFSET;
> > const u32 cpuid_length = 0x10;
> >
> > @@ -309,10 +309,6 @@ __weak int misc_init_r(void)
> >
> > return ret;
> >
> > ret = rockchip_cpuid_set(cpuid, cpuid_length);
> >
> > - if (ret)
> > - return ret;
> > -
> > - ret = rockchip_setup_macaddr();
> >
> > return ret;
> >
> > }
> >
> > @@ -349,3 +345,25 @@ __weak int board_rng_seed(struct abuf *buf)
> >
> > return 0;
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2024-04-02 15:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-14 14:43 [PATCH 0/3] net: Add a CONFIG_NET_BOARD_ETHADDR Detlev Casanova
2024-03-14 14:43 ` [PATCH 1/3] " Detlev Casanova
2024-03-14 17:36 ` Marek Vasut
2024-03-14 14:43 ` [PATCH 2/3] rockchip: Add a board_gen_ethaddr() function Detlev Casanova
2024-03-14 17:37 ` Marek Vasut
2024-03-14 18:38 ` Jonas Karlman
2024-04-02 15:38 ` Detlev Casanova [this message]
2024-03-14 14:43 ` [PATCH 3/3] net: eth-uclass: Add driver source possibility Detlev Casanova
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=3001977.mvXUDI8C0e@arisu \
--to=detlev.casanova@collabora.com \
--cc=festevam@denx.de \
--cc=joe.hershberger@ni.com \
--cc=jonas@kwiboo.se \
--cc=kever.yang@rock-chips.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=philipp.tomsich@vrull.eu \
--cc=rfried.dev@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