[PATCH 4/5] dm: adc: Add SPL_ADC Kconfig symbol for use of ADC in SPL

Jonas Karlman jonas at kwiboo.se
Thu Aug 1 23:47:29 CEST 2024


Hi Quentin,

On 2024-08-01 11:26, Quentin Schulz wrote:
> Hi Jonas,
> 
> On 7/31/24 4:10 PM, Jonas Karlman wrote:
>  > Hi Quentin,
>  >
>  > On 2024-07-31 14:42, Quentin Schulz wrote:
>  >> Hi Jonas,
>  >>
>  >> On 7/31/24 8:50 AM, Jonas Karlman wrote:
>  >>   > What model of Radxa ZERO 3W/3E boards can be identified using ADC at
>  >>   > runtime, add a Kconfig symbol to allow use of ADC in SPL.
>  >>   >
>  >>   > This will be used to identify board model in SPL to allow loading
>  >>   > correct FIT configuration and FDT for U-Boot proper at SPL phase.
>  >>   >
>  >>   > Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
>  >>   > ---
>  >>   >   drivers/Makefile    | 2 +-
>  >>   >   drivers/adc/Kconfig | 4 ++++
>  >>   >   2 files changed, 5 insertions(+), 1 deletion(-)
>  >>   >
>  >>   > diff --git a/drivers/Makefile b/drivers/Makefile
>  >>   > index 9195dafd37e0..1acd94f3c17e 100644
>  >>   > --- a/drivers/Makefile
>  >>   > +++ b/drivers/Makefile
>  >>   > @@ -1,5 +1,6 @@
>  >>   >   # SPDX-License-Identifier: GPL-2.0+
>  >>   >
>  >>   > +obj-$(CONFIG_$(SPL_TPL_)ADC) += adc/
>  >>   >   obj-$(CONFIG_$(SPL_TPL_)BIOSEMU) += bios_emulator/
>  >>   >   obj-$(CONFIG_$(SPL_TPL_)BLK) += block/
>  >>   >   obj-$(CONFIG_$(SPL_TPL_)BOOTCOUNT_LIMIT) += bootcount/
>  >>   > @@ -81,7 +82,6 @@ endif
>  >>   >
>  >>   >   ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
>  >>   >
>  >>   > -obj-y += adc/
>  >>   >   obj-y += ata/
>  >>   >   obj-$(CONFIG_DM_DEMO) += demo/
>  >>   >   obj-y += block/
>  >>   > diff --git a/drivers/adc/Kconfig b/drivers/adc/Kconfig
>  >>   > index c9cdbe6942de..eb705f9e0fb8 100644
>  >>   > --- a/drivers/adc/Kconfig
>  >>   > +++ b/drivers/adc/Kconfig
>  >>   > @@ -11,6 +11,10 @@ config ADC
>  >>   >          - support supply's phandle with auto-enable
>  >>   >          - supply polarity setting in fdt
>  >>   >
>  >>   > +config SPL_ADC
>  >>   > +     bool "Enable ADC drivers using Driver Model in SPL"
>  >>   > +     depends on ADC
>  >>   > +
>  >>
>  >> This is just because you didn't modify the drivers/adc/Makefile to have
>  >> obj-$(CONFIG_$(SPL_TPL_)ADC) += adc-uclass.o
>  >> I assume? It's a bit odd to require a "proper" symbol for an SPL symbol.
>  >>
>  >> Additionally, since you use $(SPL_TPL_) maybe add that TPL symbol too in
>  >> the Kconfig?
>  >
>  > Agree, this could have been done differently, I added the depends on ADC
>  > a few minutes before I send the series to ensure next user of ADC in SPL
>  > does not miss it.
>  >
> 
> I would rather not depend on a hack if we can avoid it. I believe:
> obj-$(CONFIG_$(SPL_TPL_)ADC) += adc-uclass.o
> should be enough of a change here?

I thinks so to, will change to that in a v2.

> 
> I'm actually wondering if we can't simply have
> obj-y += adc-uclass.o
> ? considering that this Makefile is only included if
> $(CONFIG_$(SPL_TPL_)ADC)?

Should be possible, but it is probably better to be explicit in case the
condition in drivers/Makefile ever changes in the future.

Regards,
Jonas

> 
> Cheers,
> Quentin



More information about the U-Boot mailing list