diff mbox series

rk3399: boot_devices fix spinor node name

Message ID 20210526093227.273974-1-art@khadas.com
State Accepted
Commit e8a663cc60a30f60edb5dbb7649b558da5a47be8
Delegated to: Kever Yang
Headers show
Series rk3399: boot_devices fix spinor node name | expand

Commit Message

Art Nikpal May 26, 2021, 9:32 a.m. UTC
Problem: board_spl_was_booted_from return wrong boot_devices[3] value 
/spi@ff1d0000 and same-as-spl dont work properly for SPINOR flash
because arch/arm/mach-rockchip/spl-boot-order.c spl_node_to_boot_device 
need parse SPINOR flash node as UCLASS_SPI_FLASH

spl-boot-order: same-as-spl > *** BOOT_SOURCE_ID 3 (2:emmc 3:spi 5:sd ...
/spi@ff1d0000 > board_boot_order: could not map node @618 to a boot-device
/sdhci@fe330000 > /mmc@fe320000

Solution: just change it to /spi@ff1d0000/flash@0

spl-boot-order: same-as-spl > *** BOOT_SOURCE_ID 3 (2:emmc 3:spi 5:sd ...
/spi@ff1d0000/flash@0 > /sdhci@fe330000 > /mmc@fe320000

Signed-off-by: Artem Lapkin <art@khadas.com>
---
 arch/arm/mach-rockchip/rk3399/rk3399.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kever Yang June 1, 2021, 12:09 p.m. UTC | #1
Hi Artem,

On 2021/5/26 下午5:32, Artem Lapkin wrote:
> Problem: board_spl_was_booted_from return wrong boot_devices[3] value
> /spi@ff1d0000 and same-as-spl dont work properly for SPINOR flash
> because arch/arm/mach-rockchip/spl-boot-order.c spl_node_to_boot_device
> need parse SPINOR flash node as UCLASS_SPI_FLASH
>
> spl-boot-order: same-as-spl > *** BOOT_SOURCE_ID 3 (2:emmc 3:spi 5:sd ...
> /spi@ff1d0000 > board_boot_order: could not map node @618 to a boot-device
> /sdhci@fe330000 > /mmc@fe320000
>
> Solution: just change it to /spi@ff1d0000/flash@0

I don't understand why the solution is add "/flash@0" and why 
"/spi@ff1d0000 " is not work, this drivers should be work for other 
boards before.


Thanks,

- Kever

>
> spl-boot-order: same-as-spl > *** BOOT_SOURCE_ID 3 (2:emmc 3:spi 5:sd ...
> /spi@ff1d0000/flash@0 > /sdhci@fe330000 > /mmc@fe320000
>
> Signed-off-by: Artem Lapkin <art@khadas.com>
> ---
>   arch/arm/mach-rockchip/rk3399/rk3399.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c
> index 869d2159..69e0c8c2 100644
> --- a/arch/arm/mach-rockchip/rk3399/rk3399.c
> +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
> @@ -28,7 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;
>   
>   const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
>   	[BROM_BOOTSOURCE_EMMC] = "/sdhci@fe330000",
> -	[BROM_BOOTSOURCE_SPINOR] = "/spi@ff1d0000",
> +	[BROM_BOOTSOURCE_SPINOR] = "/spi@ff1d0000/flash@0",
>   	[BROM_BOOTSOURCE_SD] = "/mmc@fe320000",
>   };
>
Art Nikpal June 2, 2021, 2:19 a.m. UTC | #2
hi
> why "/spi@ff1d0000" is not work, this drivers should be work for other boards before.

i`m sure now is not work (maybe nobody test it ) i have test it and
can see its doesn't works properly

because /spi@ff1d0000 just spi bus node - its not SPINOR-Flash node as
was written before

if we check u-boot,spl-boot-order for rk3399 boards is must be
bootable devices list (for example &norflash | &spi_flash | &spliflash
 is alias for  /spi@ff1d0000/flash@0 )

grep same-as-spl arch/arm/dts/*rk3399* | grep flash
arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi:
u-boot,spl-boot-order = "same-as-spl", &sdhci, &spiflash, &sdmmc;
arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi:            "same-as-spl",
&norflash, &sdhci, &sdmmc;
arch/arm/dts/rk3399-rockpro64-u-boot.dtsi:
u-boot,spl-boot-order = "same-as-spl", &spi_flash, &sdmmc, &sdhci;
arch/arm/dts/rk3399-roc-pc-u-boot.dtsi:        u-boot,spl-boot-order =
"same-as-spl", &spi_flash, &sdhci, &sdmmc;

"same-as-spl" same must be translated to same devices ( &spi_flash,
&sdhci, &sdmmc  )

grep "same device the SPL was" -A22 arch/arm/mach-rockchip/spl-boot-order.c

        /* Handle the case of 'same device the SPL was loaded from' */
        if (strncmp(conf, "same-as-spl", 11) == 0) {
            conf = board_spl_was_booted_from();
            if (!conf)
                continue;
        }

        /* First check if the list element is an alias */
        alias = fdt_get_alias(blob, conf);
        if (alias)
            conf = alias;

        /* Try to resolve the config item (or alias) as a path */

        node = fdt_path_offset(blob, conf);
        if (node < 0) {
            debug("%s: could not find %s in FDT\n", __func__, conf);
            continue;
        }

        /* Try to map this back onto SPL boot devices */
        boot_device = spl_node_to_boot_device(node);
        if (boot_device < 0) {

            debug("%s: could not map node @%x to a boot-device\n",

grep "UCLASS_SPI_FLASH"  arch/arm/mach-rockchip/spl-boot-order.c

    } else if (!uclass_get_device_by_of_offset(UCLASS_SPI_FLASH, node,
    if (!uclass_get_device_by_of_offset(UCLASS_SPI_FLASH, node, &parent))


grep SPINOR arch/arm/mach-rockchip/rk3399/rk3399.c

    [BROM_BOOTSOURCE_SPINOR] = "/spi@ff1d0000",

but its not SPI_FLASH and spl_node_to_boot_device(/spi@ff1d0000)
return always -1 and
u-boot,spl-boot-order = "same-as-spl" never works properly for spinorflash

PS: i have test spi@ff1d0000/flash@0 works properly as expected

On Tue, Jun 1, 2021 at 8:09 PM Kever Yang <kever.yang@rock-chips.com> wrote:
>
> Hi Artem,
>
> On 2021/5/26 下午5:32, Artem Lapkin wrote:
> > Problem: board_spl_was_booted_from return wrong boot_devices[3] value
> > /spi@ff1d0000 and same-as-spl dont work properly for SPINOR flash
> > because arch/arm/mach-rockchip/spl-boot-order.c spl_node_to_boot_device
> > need parse SPINOR flash node as UCLASS_SPI_FLASH
> >
> > spl-boot-order: same-as-spl > *** BOOT_SOURCE_ID 3 (2:emmc 3:spi 5:sd ...
> > /spi@ff1d0000 > board_boot_order: could not map node @618 to a boot-device
> > /sdhci@fe330000 > /mmc@fe320000
> >
> > Solution: just change it to /spi@ff1d0000/flash@0
>
> I don't understand why the solution is add "/flash@0" and why
> "/spi@ff1d0000 " is not work, this drivers should be work for other
> boards before.
>
>
> Thanks,
>
> - Kever
>
> >
> > spl-boot-order: same-as-spl > *** BOOT_SOURCE_ID 3 (2:emmc 3:spi 5:sd ...
> > /spi@ff1d0000/flash@0 > /sdhci@fe330000 > /mmc@fe320000
> >
> > Signed-off-by: Artem Lapkin <art@khadas.com>
> > ---
> >   arch/arm/mach-rockchip/rk3399/rk3399.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c
> > index 869d2159..69e0c8c2 100644
> > --- a/arch/arm/mach-rockchip/rk3399/rk3399.c
> > +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
> > @@ -28,7 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;
> >
> >   const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
> >       [BROM_BOOTSOURCE_EMMC] = "/sdhci@fe330000",
> > -     [BROM_BOOTSOURCE_SPINOR] = "/spi@ff1d0000",
> > +     [BROM_BOOTSOURCE_SPINOR] = "/spi@ff1d0000/flash@0",
> >       [BROM_BOOTSOURCE_SD] = "/mmc@fe320000",
> >   };
> >
>
>
Kever Yang Aug. 11, 2021, 9:45 a.m. UTC | #3
Artem Lapkin <email2tema@gmail.com> 于2021年5月26日周三 下午5:33写道:
>
> Problem: board_spl_was_booted_from return wrong boot_devices[3] value
> /spi@ff1d0000 and same-as-spl dont work properly for SPINOR flash
> because arch/arm/mach-rockchip/spl-boot-order.c spl_node_to_boot_device
> need parse SPINOR flash node as UCLASS_SPI_FLASH
>
> spl-boot-order: same-as-spl > *** BOOT_SOURCE_ID 3 (2:emmc 3:spi 5:sd ...
> /spi@ff1d0000 > board_boot_order: could not map node @618 to a boot-device
> /sdhci@fe330000 > /mmc@fe320000
>
> Solution: just change it to /spi@ff1d0000/flash@0
>
> spl-boot-order: same-as-spl > *** BOOT_SOURCE_ID 3 (2:emmc 3:spi 5:sd ...
> /spi@ff1d0000/flash@0 > /sdhci@fe330000 > /mmc@fe320000
>
> Signed-off-by: Artem Lapkin <art@khadas.com>

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>  arch/arm/mach-rockchip/rk3399/rk3399.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c
> index 869d2159..69e0c8c2 100644
> --- a/arch/arm/mach-rockchip/rk3399/rk3399.c
> +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
> @@ -28,7 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;
>
>  const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
>         [BROM_BOOTSOURCE_EMMC] = "/sdhci@fe330000",
> -       [BROM_BOOTSOURCE_SPINOR] = "/spi@ff1d0000",
> +       [BROM_BOOTSOURCE_SPINOR] = "/spi@ff1d0000/flash@0",
>         [BROM_BOOTSOURCE_SD] = "/mmc@fe320000",
>  };
>
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c
index 869d2159..69e0c8c2 100644
--- a/arch/arm/mach-rockchip/rk3399/rk3399.c
+++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
@@ -28,7 +28,7 @@  DECLARE_GLOBAL_DATA_PTR;
 
 const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
 	[BROM_BOOTSOURCE_EMMC] = "/sdhci@fe330000",
-	[BROM_BOOTSOURCE_SPINOR] = "/spi@ff1d0000",
+	[BROM_BOOTSOURCE_SPINOR] = "/spi@ff1d0000/flash@0",
 	[BROM_BOOTSOURCE_SD] = "/mmc@fe320000",
 };