On Sat, Oct 3, 2026 at 5:31 AM Dave Klotz <[email protected]> wrote:
>
> pmic_init() and nor_early_init() panic when the board device tree
> describes no PMIC or no SPI controller to the SPL. The OrangePi R2S
> boots from eMMC with its rails already up, and boards that boot from
> eMMC or microSD need no SPI NOR, so the SPL stops before it can load
> U-Boot.
>
> Log the missing device and carry on instead. If the SPL then has to
> boot from SPI without a controller, spl_spi_load_image() reports it.
>
> Signed-off-by: Dave Klotz <[email protected]>
> ---
>  board/spacemit/k1/spl.c | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/board/spacemit/k1/spl.c b/board/spacemit/k1/spl.c
> index ef23db62d6..96ee4449c4 100644
> --- a/board/spacemit/k1/spl.c
> +++ b/board/spacemit/k1/spl.c
> @@ -301,8 +301,16 @@ void pmic_init(void)
>         int ret;
>
>         ret = uclass_get_device(UCLASS_PMIC, 0, &pmic_dev);
> -       if (ret)
> -               panic("Fail to detect PMIC (%d)\n", ret);
> +       if (ret) {
> +               /*
> +                * Not every K1 board describes its PMIC to the SPL, and on 
> some
> +                * the rails are already up when the SPL runs. Only boards 
> whose
> +                * DDR bring-up depends on programming the bucks need one, so 
> a
> +                * missing PMIC is not fatal here.
> +                */
> +               log_info("No PMIC (%d), leaving rails as found\n", ret);
> +               return;
> +       }
>         set_vdd_core();
>         set_vdd_1v8();
>         set_vdd_mmc();
> @@ -412,9 +420,15 @@ void nor_early_init(void)
>         struct udevice *dev;
>         int ret;
>
> +       /*
> +        * A board that boots from eMMC or microSD may describe no SPI
> +        * controller at all; that is not fatal unless the SPL boots from SPI.
> +        */
>         ret = uclass_get_device(UCLASS_SPI, 0, &dev);
> -       if (ret)
> -               panic("Fail to detect spi controller.\n");
> +       if (ret) {
> +               log_info("No SPI controller (%d)\n", ret);
> +               return;
> +       }
>         udelay(10);
>         ret = uclass_get_device(UCLASS_SPI_FLASH, 0, &dev);
>         if (ret)
> --
> 2.55.0
>
>

Reviewed-by: Eric Chung <[email protected]>

Reply via email to