CONFIG_SYS_EARLY_PCI_INIT for PCI-attached eMMC

Mark Kettenis mark.kettenis at xs4all.nl
Thu Aug 14 14:52:39 CEST 2025


> From: Fabio Estevam <festevam at gmail.com>
> Date: Thu, 14 Aug 2025 09:22:57 -0300
> 
> On Thu, Aug 14, 2025 at 6:11 AM Jan Kiszka <jan.kiszka at siemens.com> wrote:
> >
> > Hi all,
> >
> > I'm currently playing with eMMC emulation for qemu-system-aarch64 -M
> > virt and will likely propose upstream to allow user-instantiate emmc
> > devices (-> -device sdhci-pci -device emmc).
> >
> > To make U-Boot recognize such a setup, I currently need this:
> >
> > diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h
> > index e296f398798..4e22aa36fa6 100644
> > --- a/include/configs/qemu-arm.h
> > +++ b/include/configs/qemu-arm.h
> > @@ -11,4 +11,6 @@
> >
> >  /* For timer, QEMU emulates an ARMv7/ARMv8 architected timer */
> >
> > +#define CONFIG_SYS_EARLY_PCI_INIT      1
> > +
> >  #endif /* __CONFIG_H */
> >
> > Is this the right way to achieve? Then a patch for U-Boot would follow
> > as well.
> 
> CONFIG_SYS_EARLY_PCI_INIT is not defined anywhere as a Kconfig symbol.
> 
> I'm wondering if we should change it like this instead:

Not without removing the 2nd pci_init_r() that is conditionalized on
!CONFIG_IS_ENABLED(SYS_EARLY_PCI_INIT).

That would require some thorough testing though; I certainly wouldn't
be sure calling pci_init_r() is safe at that point on the boards I
maintain.

> diff --git a/common/board_r.c b/common/board_r.c
> index 143d51d06330..3da749b05fcc 100644
> --- a/common/board_r.c
> +++ b/common/board_r.c
> @@ -685,7 +685,7 @@ static void initcall_run_r(void)
>         INITCALL(post_output_backlog);
>  #endif
>         WATCHDOG_RESET();
> -#if CONFIG_IS_ENABLED(PCI_INIT_R) && CONFIG_IS_ENABLED(SYS_EARLY_PCI_INIT)
> +#if CONFIG_IS_ENABLED(PCI_INIT_R)
>         /*
>          * Do early PCI configuration _before_ the flash gets initialised,
>          * because PCU resources are crucial for flash access on some boards.
> 


More information about the U-Boot mailing list