Hi, On 2024-07-31 13:49, Pugemon wrote: > Orange Pi R1 Plus and LTS don't have eMMC > (default mmc0 in rk3328-u-boot.dtsi). > The device is equipped with SPI flash memory, which U-Boot tries to use for > reading configuration. However, the manufacturer has not provided any means > to utilize SPI flash memory. There is no documentation, > or software available for this purpose.
The U-Boot documentation contain limited information on how you can write the generated rockchip-u-boot-spi.bin to SPI flash, after that it will load U-Boot from the SPI flash instead. https://docs.u-boot.org/en/latest/board/rockchip/rockchip.html#spi > > As a result, during OpenWRT sysupgrade, the board fails to boot because the > script that switches the boot_device to an available one does not trigger. This sounds more like an issue in your script? > > This patch changes the alias of mmc0 from &emmc to &sdmmc, > ensuring the board boots correctly, > and sysupgrade completes successfully. There are aspects of the rockchip U-Boot code that depend on that mmc0 is emmc and mmc1 is sdmmc, so this change may introduce new issues and should be avoided. I have no issues booting my OrangePi R1 Plus LTS without this. Please explain what the issue is and what script you are referring too. Is this a U-Boot script or linux userspace script? also what version of U-Boot have you had issue with? Does your SPI flash come with a vendor U-Boot that is interfering with your sysupdate? > Additionally, this allows saving the U-Boot environment > by using saveenv with uboot-envtool. U-Boot will expect the environment on the mmc device that U-Boot was loaded from, and fallback on what U-Boot consider is the SD-card (mmc1). saveenv from U-Boot CLI should work as intended and already save the env to the sdmmc, unless there is other issues/modifications in your U-Boot. So this may also be an issue in userspace tool? > > Signed-off-by: Pugemon <islavaivano...@gmail.com> > Cc: Tianling Shen <cns...@gmail.com> > --- > arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi | 12 ++++++++++++ > arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi | 12 ++++++++++++ > 2 files changed, 24 insertions(+) > > diff --git a/arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi > b/arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi > index b50c1332b8..7063b188f2 100644 > --- a/arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi > +++ b/arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi > @@ -2,11 +2,23 @@ > /* > * (C) Copyright 2018-2019 Rockchip Electronics Co., Ltd > * (C) Copyright 2020 David Bauer > + * (C) Copyright 2024 Pugemon > */ > > #include "rk3328-u-boot.dtsi" > #include "rk3328-sdram-lpddr3-666.dtsi" > > +/ { > + aliases { > + mmc0 = &sdmmc; > + spi0 = &spi0; This is already defined in rk3328-u-boot.dtsi, no need to re-define it here. > + }; > + > + chosen { > + u-boot,spl-boot-order = "same-as-spl", &sdmmc; It should not be needed to change this, if the emmc node is disabled U-Boot should just skip it. Also the "same-as-spl" should already refer to the SPI flash or the SD-card depending on where TPL/SPL was loaded from. > + }; > +}; > + > &spi0 { > flash@0 { > bootph-pre-ram; > diff --git a/arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi > b/arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi > index 8ae003bbef..0374172527 100644 > --- a/arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi > +++ b/arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi > @@ -2,11 +2,23 @@ > /* > * (C) Copyright 2018-2019 Rockchip Electronics Co., Ltd > * (C) Copyright 2020 David Bauer > + * (C) Copyright 2024 Pugemon > */ > > #include "rk3328-u-boot.dtsi" > #include "rk3328-sdram-ddr4-666.dtsi" > > +/ { > + aliases { > + mmc0 = &sdmmc; > + spi0 = &spi0; Same as above. > + }; > + > + chosen { > + u-boot,spl-boot-order = "same-as-spl", &sdmmc; Same as above. Regards, Jonas > + }; > +}; > + > &spi0 { > flash@0 { > bootph-pre-ram;