From: Dragan Simic <dsimic@manjaro.org>
To: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Cc: Jonas Karlman <jonas@kwiboo.se>,
Quentin Schulz <foss+uboot@0leil.net>,
Simon Glass <sjg@chromium.org>,
Philipp Tomsich <philipp.tomsich@vrull.eu>,
Kever Yang <kever.yang@rock-chips.com>,
Tom Rini <trini@konsulko.com>,
Alper Nebi Yasak <alpernebiyasak@gmail.com>,
Peter Robinson <pbrobinson@gmail.com>,
Jagan Teki <jagan@amarulasolutions.com>,
Klaus Goger <klaus.goger@theobroma-systems.com>,
Heiko Stuebner <heiko.stuebner@cherry.de>,
Otavio Salvador <otavio@ossystems.com.br>,
Andy Yan <andy.yan@rock-chips.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
Lukasz Majewski <lukma@denx.de>,
Sean Anderson <seanga2@gmail.com>,
Joe Hershberger <joe.hershberger@ni.com>,
Ramon Fried <rfried.dev@gmail.com>,
Sughosh Ganu <sughosh.ganu@linaro.org>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
Anatolij Gustschin <agust@denx.de>,
heiko@sntech.de, u-boot@lists.denx.de
Subject: Re: [PATCH 08/18] rockchip: pine64: rockpro64: migrate to rockchip_early_misc_init_r
Date: Tue, 06 Feb 2024 13:42:38 +0100 [thread overview]
Message-ID: <d65b0fe6ddee07b0c2dac006fe06cc17@manjaro.org> (raw)
In-Reply-To: <90ff670b-7b77-4d7b-89b4-9a05d68b79bc@theobroma-systems.com>
On 2024-02-06 13:37, Quentin Schulz wrote:
> On 2/6/24 13:33, Dragan Simic wrote:
>> On 2024-02-06 13:26, Quentin Schulz wrote:
>>> On 2/4/24 11:39, Dragan Simic wrote:
>>>> On 2024-02-04 10:46, Jonas Karlman wrote:
>>>>> On 2024-02-04 05:21, Dragan Simic wrote:
>>>>>> On 2024-02-03 16:18, Dragan Simic wrote:
>>>>>>> On 2024-02-03 15:18, Jonas Karlman wrote:
>>>>>>>> On 2024-02-03 14:19, Dragan Simic wrote:
>>>>>>>>> We should add more ifdef guards to rockchip_setup_macaddr(),
>>>>>>>>> to prevent the execution of its body for devices such as the
>>>>>>>>> ones listed above, which eliminates the unneeded code from the
>>>>>>>>> resulting U-Boot images, making them a bit smaller, and saves
>>>>>>>>> some CPU cycles and a bit of time on boot. It also prevents
>>>>>>>>> the unneeded "ethaddr" and "eth1addr" variables from being
>>>>>>>>> added to the environment.
>>>>>>>>
>>>>>>>> Adding the ethernet addresses only adds a few ms to boot, if you
>>>>>>>> care
>>>>>>>> about boot speed, please look into if we can disable
>>>>>>>> CONFIG_USE_PREBOOT
>>>>>>>> for these boards, running "usb start" as preboot adds several
>>>>>>>> seconds
>>>>>>>> to the boot.
>>>>>>>
>>>>>>> I see, but I personally don't care that much about how long the
>>>>>>> U-Boot takes to execute; a couple of seconds more don't bother
>>>>>>> me
>>>>>>> much. I care more about excluding the unneded code.
>>>>>>>
>>>>>>>>> The patch below should do the trick, which also performs a few
>>>>>>>>> small code cleanups for additional file-level consistency:
>>>>>>>>>
>>>>>>>>> diff --git a/arch/arm/mach-rockchip/misc.c
>>>>>>>>> b/arch/arm/mach-rockchip/misc.c
>>>>>>>>> index 7d03f0c2b679..ed5bdab5a648 100644
>>>>>>>>> --- a/arch/arm/mach-rockchip/misc.c
>>>>>>>>> +++ b/arch/arm/mach-rockchip/misc.c
>>>>>>>>> @@ -23,7 +23,8 @@
>>>>>>>>>
>>>>>>>>> int rockchip_setup_macaddr(void)
>>>>>>>>> {
>>>>>>>>> -#if CONFIG_IS_ENABLED(HASH) && CONFIG_IS_ENABLED(SHA256)
>>>>>>>>> +#if CONFIG_IS_ENABLED(HASH) && CONFIG_IS_ENABLED(SHA256) && \
>>>>>>>>> + CONFIG_IS_ENABLED(GMAC_ROCKCHIP)
>>>>>>>>
>>>>>>>> This would exclude any board not enabling GMAC_ROCKCHIP in
>>>>>>>> U-Boot
>>>>>>>> but
>>>>>>>> want a mac-address being set in DT fixup. And for newer RK35xx
>>>>>>>> SoCs
>>>>>>>> the
>>>>>>>> GMAC_ROCKCHIP driver is not used.
>>>>>>>
>>>>>>> Thanks for pointing that out. Not good.
>>>>>>>
>>>>>>>> A new Kconfig option should be introduced if there is a need for
>>>>>>>> some
>>>>>>>> boards to disable this.
>>>>>>>
>>>>>>> Is there any simpler way to achieve that? If there isn't,
>>>>>>> perhaps
>>>>>>> we could leave rockchip_setup_macaddr() generate the MAC address
>>>>>>> and rely on fdt_fixup_ethernet() ending up doing nothing when no
>>>>>>> ethernetX aliases exist.
>>>>>
>>>>> As Chen-Yu Tsai pointed out in one of my prior patches [2]:
>>>>>
>>>>> The user might be loading a custom FDT for the kernel, or have DT
>>>>> overlays stacked on, either could have the "ethernet1" alias while
>>>>> the U-boot DT doesn't.
>>>>>
>>>>> So the common rockchip_setup_macaddr() cannot rely on checking for
>>>>> ethernetX alias, because the fixup may not run against the bundled
>>>>> DT.
>>>>>
>>>>> [2]
>>>>> https://lore.kernel.org/u-boot/CAGb2v66hR5e3nBPZ0C3=h29fS4Um7whfBu7XTAi1sRbzXRAPxg@mail.gmail.com/
>>>>
>>>> I see, we unfortunately cannot know the final outcome in advance, to
>>>> be able to avoid polluting the environment by adding the "eth1addr"
>>>> variable if it actually isn't needed, for example.
>>>>
>>>> Though, why can't the user supply an FDT that contains ethernetX
>>>> aliases 0 through 2, for example, in which case we wouldn't provide
>>>> a stable MAC address for ethernet2? Am I missing something, i.e. is
>>>> there something preventing an ethernet2 alias from being present?
>>>>
>>>>>> After going through the source code once again, I think that
>>>>>> adding
>>>>>> new configuration option would be warranted, because it would
>>>>>> exclude
>>>>>> two sizable chunks of code from the resulting U-Boot images, and
>>>>>> because it would avoid polluting the environment with a couple of
>>>>>> unneeded variables.
>>>>>
>>>>> Yes a new Kconfig option would be preferred.
>>>>>
>>>>>> I'll go ahead and implement this, and I hope that the patch will
>>>>>> be
>>>>>> received well.
>>>>>
>>>>> Great :-)
>>>>
>>>> Thanks. :) Got it implemented already and tested a bit. I need to
>>>> write the patch and series summaries, and I'll send them over.
>>>>
>>>> Regarding the above-described uncertainty about what ethernetX
>>>> aliases
>>>> the final FDT containts, I'd say that ignoring the ethernetX aliases
>>>> completely for the Pinebook Pro and the Pinephone Pro is safe and
>>>> valid,
>>>> because those are actual devices, instead of being development
>>>> boards
>>>> for which the final hardware configuration is determined by the
>>>> user.
>>>> I can hardly see anyone adding an Ethernet interface to them, except
>>>> by plugging in a USB Ethernet dongle.
>>>>
>>>> I hope you agree.
>>>
>>> What should be done with the patches for Pinephone/Pinebook Pro then?
>>> Since I was asked to wait on your answer/patches before respinning
>>> the
>>> patch series, I would like to know what to do with them :) Drop the
>>> patches for now or keep them as is?
>>
>> Your patches are fine, just please update their subjects as I already
>> suggested. The patches I'll send a bit later will resolve the issues
>> I raised previously for your patches, together with doing a bit more,
>> so there's no need to change your patches further.
>
> I would rather not break devices if I have a choice. Is merging those
> patches without yours going to break those devices?
Don't worry, I don't see how they could end up broken that way. There
should only be some redundant code built into the resulting U-Boot
images,
and some redundant variables added to the environment at runtime.
next prev parent reply other threads:[~2024-02-06 12:42 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-23 14:49 [PATCH 00/18] rockchip: add support for Theobroma JAGUAR SBC-RK3588-AMR Quentin Schulz
2024-01-23 14:49 ` [PATCH 01/18] rockchip: rk3588: use mainline pmu-grf compatible Quentin Schulz
2024-02-01 2:47 ` Kever Yang
2024-02-02 4:25 ` Weizhao Ouyang
2024-01-23 14:49 ` [PATCH 02/18] rockchip: rk3588: sync rk3588s dtsi from v6.8-rc1 Quentin Schulz
2024-02-01 2:47 ` Kever Yang
2024-01-23 14:49 ` [PATCH 03/18] rockchip: avoid out-of-bounds when computing cpuid Quentin Schulz
2024-02-01 2:48 ` Kever Yang
2024-01-23 14:49 ` [PATCH 04/18] rockchip: add weak function symbol called at the beginning of misc_init_r Quentin Schulz
2024-02-01 2:48 ` Kever Yang
2024-02-03 13:16 ` Dragan Simic
2024-01-23 14:49 ` [PATCH 05/18] rockchip: google: gru: migrate to rockchip_early_misc_init_r Quentin Schulz
2024-02-01 2:48 ` Kever Yang
2024-01-23 14:49 ` [PATCH 06/18] rockchip: pine64: pinebook: " Quentin Schulz
2024-02-01 2:48 ` Kever Yang
2024-02-01 4:02 ` Dragan Simic
2024-02-01 17:46 ` Quentin Schulz
2024-02-01 17:56 ` Dragan Simic
2024-02-03 13:18 ` Dragan Simic
2024-01-23 14:49 ` [PATCH 07/18] rockchip: pine64: pinephone: " Quentin Schulz
2024-02-01 2:48 ` Kever Yang
2024-02-03 13:18 ` Dragan Simic
2024-01-23 14:49 ` [PATCH 08/18] rockchip: pine64: rockpro64: " Quentin Schulz
2024-02-01 2:48 ` Kever Yang
2024-02-03 13:19 ` Dragan Simic
2024-02-03 14:18 ` Jonas Karlman
2024-02-03 15:18 ` Dragan Simic
2024-02-04 4:21 ` Dragan Simic
2024-02-04 9:46 ` Jonas Karlman
2024-02-04 10:39 ` Dragan Simic
2024-02-06 12:26 ` Quentin Schulz
2024-02-06 12:33 ` Dragan Simic
2024-02-06 12:37 ` Quentin Schulz
2024-02-06 12:42 ` Dragan Simic [this message]
2024-01-23 14:49 ` [PATCH 09/18] rockchip: theobroma-systems: puma: " Quentin Schulz
2024-02-01 2:49 ` Kever Yang
2024-01-23 14:49 ` [PATCH 10/18] rockchip: theobroma-systems: ringneck: " Quentin Schulz
2024-02-01 2:49 ` Kever Yang
2024-01-23 14:49 ` [PATCH 11/18] rockchip: merge misc.c into board.c Quentin Schulz
2024-02-01 2:49 ` Kever Yang
2024-01-23 14:49 ` [PATCH 12/18] rockchip: transform rockchip_capsule_update_board_setup into a weak function symbol Quentin Schulz
2024-02-01 2:49 ` Kever Yang
2024-01-23 14:49 ` [PATCH 13/18] rockchip: rk3588: fix non-working SD controller if booting from other media Quentin Schulz
2024-01-24 10:19 ` Kever Yang
2024-01-24 10:50 ` Quentin Schulz
2024-01-25 10:29 ` Kever Yang
2024-01-25 11:02 ` Quentin Schulz
2024-01-26 2:57 ` Kever Yang
2024-01-26 10:37 ` Quentin Schulz
2024-01-26 11:04 ` Dragan Simic
2024-01-26 11:09 ` Quentin Schulz
2024-01-26 11:24 ` Dragan Simic
2024-01-26 11:29 ` Quentin Schulz
2024-01-26 11:33 ` Dragan Simic
2024-01-26 13:46 ` Quentin Schulz
2024-01-26 19:42 ` Dragan Simic
2024-01-23 14:49 ` [PATCH 14/18] rockchip: rk3588: add constants for some register address spaces Quentin Schulz
2024-02-01 2:58 ` Kever Yang
2024-01-23 14:49 ` [PATCH 15/18] rockchip: migrate hardware.h inclusion into appropriate files Quentin Schulz
2024-01-24 10:46 ` Kever Yang
2024-01-24 11:12 ` Quentin Schulz
2024-01-29 9:55 ` Kever Yang
2024-01-23 14:49 ` [PATCH 16/18] rockchip: include asm/io.h directly in asm/arch-rockchip/hardware.h Quentin Schulz
2024-02-01 2:59 ` Kever Yang
2024-01-23 14:49 ` [PATCH 17/18] rockchip: rk3588: bind MMC controllers in U-Boot proper pre-reloc Quentin Schulz
2024-01-24 10:35 ` Kever Yang
2024-01-24 11:04 ` Quentin Schulz
2024-01-26 8:58 ` Kever Yang
2024-01-26 9:32 ` Quentin Schulz
2024-01-26 10:56 ` Kever Yang
2024-01-26 16:18 ` Quentin Schulz
2024-01-29 10:35 ` Kever Yang
2024-01-31 17:55 ` Quentin Schulz
2024-02-01 2:43 ` Kever Yang
2024-01-23 14:49 ` [PATCH 18/18] board: rockchip: add Theobroma-Systems RK3588 Jaguar SBC Quentin Schulz
2024-01-23 18:04 ` Quentin Schulz
2024-02-01 2:46 ` Kever Yang
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=d65b0fe6ddee07b0c2dac006fe06cc17@manjaro.org \
--to=dsimic@manjaro.org \
--cc=agust@denx.de \
--cc=alpernebiyasak@gmail.com \
--cc=andy.yan@rock-chips.com \
--cc=foss+uboot@0leil.net \
--cc=heiko.stuebner@cherry.de \
--cc=heiko@sntech.de \
--cc=jagan@amarulasolutions.com \
--cc=joe.hershberger@ni.com \
--cc=jonas@kwiboo.se \
--cc=kever.yang@rock-chips.com \
--cc=klaus.goger@theobroma-systems.com \
--cc=lukma@denx.de \
--cc=manivannan.sadhasivam@linaro.org \
--cc=otavio@ossystems.com.br \
--cc=pbrobinson@gmail.com \
--cc=philipp.tomsich@vrull.eu \
--cc=quentin.schulz@theobroma-systems.com \
--cc=rfried.dev@gmail.com \
--cc=seanga2@gmail.com \
--cc=sjg@chromium.org \
--cc=sughosh.ganu@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.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