rockchip: spl: Cache boot source id for later use
Subsystems (3)
v2 cover rockchip: spl: Cache boot source id for later use
This series fixes an issue where /chosen/u-boot,spl-boot-device prop cannot be resolved to the SPI flash node path in spl_perform_fixups() if the affected device was booted from SPI flash.
Changes in v2:
- Add patch that sync boot source id enum with bootrom
- Add patch that adds missing SPI flash node path for SoCs with DTs having a jedec,spi-nor compatible flash@0 node.
- Only cache boot source id that can be resolved to a node path
- Make use of synced BROM_BOOTSOURCE_UNKNOWN enum value
- Update commit message
- Add fixes tag
- Collect r-b tag
Jason Zhu (1):
rockchip: bootrom: Sync bootsource id enum from bootrom
Jonas Karlman (2):
rockchip: spl: Cache boot source id for later use
rockchip: spl: Add SPI NOR flash to boot_devices array
arch/arm/include/asm/arch-rockchip/bootrom.h | 3 +++ arch/arm/mach-rockchip/px30/px30.c | 1 + arch/arm/mach-rockchip/rk3288/rk3288.c | 1 + arch/arm/mach-rockchip/rk3308/rk3308.c | 1 + arch/arm/mach-rockchip/rk3368/rk3368.c | 1 + arch/arm/mach-rockchip/rv1126/rv1126.c | 1 + arch/arm/mach-rockchip/spl.c | 14 +++++++++++--- 7 files changed, 19 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.2
PATCH v2 1/3 rockchip: bootrom: Sync bootsource id enum from bootrom
From: Jason Zhu <[email protected]>
Add more bootsource id:
1. BROM_BOOTSOURCE_UNKNOWN
2. BROM_BOOTSOURCE_I2C
3. BROM_BOOTSOURCE_SPI
---
v2:
- New patch
--- arch/arm/include/asm/arch-rockchip/bootrom.h | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/include/asm/arch-rockchip/bootrom.h +3 -0
@@ -43,11 +43,14 @@ void back_to_bootrom(enum rockchip_bootrom_cmd brom_cmd);* Boot-device identifiers as used by the BROM */ enum { +BROM_BOOTSOURCE_UNKNOWN =0 ,BROM_BOOTSOURCE_NAND =1 ,BROM_BOOTSOURCE_EMMC =2 ,BROM_BOOTSOURCE_SPINOR =3 ,BROM_BOOTSOURCE_SPINAND =4 ,BROM_BOOTSOURCE_SD =5 , +BROM_BOOTSOURCE_I2C =8 , +BROM_BOOTSOURCE_SPI =9 ,BROM_BOOTSOURCE_USB =10 ,BROM_LAST_BOOTSOURCE =BROM_BOOTSOURCE_USB };
Signature · 1 line
2.43.2
Re: [PATCH v2 1/3] rockchip: bootrom: Sync bootsource id enum from bootrom
Quoted 10 lines · Jonas Karlman
From: Jason Zhu <[email protected]>
Add more bootsource id:
1.BROM_BOOTSOURCE_UNKNOWN
2.BROM_BOOTSOURCE_I2C
3.BROM_BOOTSOURCE_SPISigned-off-by Jason Zhu <[email protected]>[[email protected]: Update commit message]Signed-off-by Jonas Karlman <[email protected]>
Looking good to me.
Quoted 28 lines
---
v2:
- New patch--- arch/arm/include/asm/arch-rockchip/bootrom.h | 3 +++ 1 file changed, 3 insertions(+)arch/arm/include/asm/arch-rockchip/bootrom.h +3
-0@@ -43,11 +43,14 @@ void back_to_bootrom(enum rockchip_bootrom_cmdbrom_cmd); * Boot-device identifiers as used by the BROM */ enum { +BROM_BOOTSOURCE_UNKNOWN =0 ,BROM_BOOTSOURCE_NAND =1 ,BROM_BOOTSOURCE_EMMC =2 ,BROM_BOOTSOURCE_SPINOR =3 ,BROM_BOOTSOURCE_SPINAND =4 ,BROM_BOOTSOURCE_SD =5 , +BROM_BOOTSOURCE_I2C =8 , +BROM_BOOTSOURCE_SPI =9 ,BROM_BOOTSOURCE_USB =10 ,BROM_LAST_BOOTSOURCE =BROM_BOOTSOURCE_USB };
PATCH v2 2/3 rockchip: spl: Cache boot source id for later use
In reply to Jonas KarlmanRockchip BROM writes a boot source id at CFG_IRAM_BASE + 0x10, this id indicates from what storage media TPL/SPL was loaded from.
SPL uses this id to determine what device "same-as-spl" represent when determining from where FIT should be loaded. This works as long as the boot_devices array contain a matching id <-> node path entry.
However, SPL typically load a small part of TF-A into SRAM and on RK3399 this overwrites the CFG_IRAM_BASE + 0x10 addr used for boot source id.
For affected devices the u-boot,spl-boot-device would not be set when booting from SPI flash and the flash@0 node was not explicitly listed in the u-boot,spl-boot-order prop.
Here boot source id is 3 before FIT images is loaded, and 0 after:
U-Boot SPL 2024.04-rc4 (Mar 15 2024 - 17:26:19 +0000)
board_spl_was_booted_from: brom_bootdevice_id 3 maps to '/spi@ff1d0000/flash@0' Trying to boot from SPI
## Checking hash(es) for config config-1 ... OK
## Checking hash(es) for Image atf-1 ... sha256+ OK
## Checking hash(es) for Image u-boot ... sha256+ OK
## Checking hash(es) for Image fdt-1 ... sha256+ OK
## Checking hash(es) for Image atf-2 ... sha256+ OK
## Checking hash(es) for Image atf-3 ... sha256+ OK
board_spl_was_booted_from: failed to resolve brom_bootdevice_id 0
spl_decode_boot_device: could not find udevice for /mmc@fe330000
spl_decode_boot_device: could not find udevice for /mmc@fe320000
spl_perform_fixups: could not map boot_device to ofpath: -19
Use a static brom_bootsource_id_cache to save the boot source id after an initial read from SRAM to fix this, this allow spl_perform_fixups() to resolve correct boot source path for "same-as-spl" after SPL have loaded TF-A related FIT images into memory.
With this the spl-boot-device prop can correctly be resolved to the SPI flash node in the control FDT:
=> fdt addr ${fdtcontroladdr}
Working FDT set to f1ee6710
=> fdt list /chosen
chosen {
u-boot,spl-boot-device = "/spi@ff1d0000/flash@0";
stdout-path = "serial2:1500000n8";
u-boot,spl-boot-order = "same-as-spl", "/mmc@fe330000", "/mmc@fe320000";
};---
v2:
- Only cache boot source id that can be resolved to a node path
- Make use of the new BROM_BOOTSOURCE_UNKNOWN enum value
- Update commit message
- Add fixes tag
- Collect r-b tag
--- arch/arm/mach-rockchip/spl.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
arch/arm/mach-rockchip/spl.c +11 -3
@@ -32,18 +32,26 @@ __weak const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {const char *board_spl_was_booted_from (void ) { -u32 bootdevice_brom_id =readl (BROM_BOOTSOURCE_ID_ADDR ); +static u32 brom_bootsource_id_cache =BROM_BOOTSOURCE_UNKNOWN ; +u32 bootdevice_brom_id;const char *bootdevice_ofpath =NULL ; +if (brom_bootsource_id_cache !=BROM_BOOTSOURCE_UNKNOWN ) + bootdevice_brom_id = brom_bootsource_id_cache; +else + bootdevice_brom_id =readl (BROM_BOOTSOURCE_ID_ADDR ); +if (bootdevice_brom_id <ARRAY_SIZE (boot_devices)) bootdevice_ofpath = boot_devices[bootdevice_brom_id]; -if (bootdevice_ofpath) +if (bootdevice_ofpath) { + brom_bootsource_id_cache = bootdevice_brom_id;debug ("%s: brom_bootdevice_id %x maps to '%s'\n" , __func__, bootdevice_brom_id, bootdevice_ofpath); -else + }else {debug ("%s: failed to resolve brom_bootdevice_id %x\n" , __func__, bootdevice_brom_id); + }return bootdevice_ofpath; }
Signature · 1 line
2.43.2
Quoted 46 lines · Jonas Karlman
Rockchip BROM writes a boot source id at
CFG_IRAM_BASE+0x10, this id indicates from what storage media TPL/SPL was loaded from.SPL uses this id to determine what device "same-as-spl" represent when determining from where FIT should be loaded. This works as long as the
boot_devicesarray contain a matching id <-> node path entry.However, SPL typically load a small part of TF-A into SRAM and on RK3399 this overwrites the
CFG_IRAM_BASE+0x10addr used for boot source id.For affected devices the u-boot,spl-boot-device would not be set when booting from SPI flash and the flash@0 node was not explicitly listed in the u-boot,spl-boot-order prop.
Here boot source id is 3 before FIT images is loaded, and 0 after:
U-Boot SPL 2024.04-rc4 (Mar 15 2024 - 17:26:19 +0000)
board_spl_was_booted_from:brom_bootdevice_id3 maps to
'/spi@ff1d0000/flash@0'
Trying to boot from SPI
## Checking hash(es) for config config-1 ... OK
## Checking hash(es) for Image atf-1 ... sha256+ OK
## Checking hash(es) for Image u-boot ... sha256+ OK ## Checking hash(es) for Image fdt-1 ... sha256+ OK
## Checking hash(es) for Image atf-2 ... sha256+ OK
## Checking hash(es) for Image atf-3 ... sha256+ OK
board_spl_was_booted_from: failed to resolvebrom_bootdevice_id0
spl_decode_boot_device: could not find udevice for /mmc@fe330000
spl_decode_boot_device: could not find udevice for /mmc@fe320000
spl_perform_fixups: could not mapboot_deviceto ofpath: -19Use a static
brom_bootsource_id_cacheto save the boot source id after an initial read from SRAM to fix this, this allowspl_perform_fixups()to resolve correct boot source path for "same-as-spl" after SPL have loaded TF-A related FIT images into memory.With this the spl-boot-device prop can correctly be resolved to the SPI flash node in the control FDT:
=> fdt addr ${fdtcontroladdr}
Working FDT set tof1ee6710
=> fdt list /chosenchosen { u-boot,spl-boot-device = "/spi@ff1d0000/flash@0"; stdout-path = "serial2:1500000n8"; u-boot,spl-boot-order = "same-as-spl", "/mmc@fe330000",
Quoted 7 lines
"/mmc@fe320000";
};Fixes d57e16c7e712 ("rockchip: find U-boot proper boot device byinverting the logic that sets it")
Signed-off-by Jonas Karlman <[email protected]>Reviewed-by Kever Yang <[email protected]>
Looking good to me! Thanks for taking the time to implement this version, as a more robust approach.
Quoted 46 lines
---
v2:
- Only cache boot source id that can be resolved to a node path
- Make use of the newBROM_BOOTSOURCE_UNKNOWNenum value
- Update commit message
- Add fixes tag
- Collect r-b tag--- arch/arm/mach-rockchip/spl.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)arch/arm/mach-rockchip/spl.c +11
-3@@ -32,18 +32,26 @@ __weak const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {const char *board_spl_was_booted_from (void ) { -u32 bootdevice_brom_id =readl (BROM_BOOTSOURCE_ID_ADDR ); +static u32 brom_bootsource_id_cache =BROM_BOOTSOURCE_UNKNOWN ; +u32 bootdevice_brom_id;const char *bootdevice_ofpath =NULL ; +if (brom_bootsource_id_cache !=BROM_BOOTSOURCE_UNKNOWN ) + bootdevice_brom_id = brom_bootsource_id_cache; +else + bootdevice_brom_id =readl (BROM_BOOTSOURCE_ID_ADDR ); +if (bootdevice_brom_id <ARRAY_SIZE (boot_devices)) bootdevice_ofpath = boot_devices[bootdevice_brom_id]; -if (bootdevice_ofpath) +if (bootdevice_ofpath) { + brom_bootsource_id_cache = bootdevice_brom_id;debug ("%s: brom_bootdevice_id %x maps to '%s'\n" , __func__, bootdevice_brom_id, bootdevice_ofpath); -else + }else {debug ("%s: failed to resolve brom_bootdevice_id %x\n" , __func__, bootdevice_brom_id); + }return bootdevice_ofpath;}
PATCH v2 3/3 rockchip: spl: Add SPI NOR flash to boot_devices array
In reply to Jonas KarlmanAdd missing boot source id <-> device tree node path mapping for SPI NOR flash on PX30, RK3288, RK3308, RK3368 and RV1126.
---
v2:
- New patch
--- arch/arm/mach-rockchip/px30/px30.c | 1 + arch/arm/mach-rockchip/rk3288/rk3288.c | 1 + arch/arm/mach-rockchip/rk3308/rk3308.c | 1 + arch/arm/mach-rockchip/rk3368/rk3368.c | 1 + arch/arm/mach-rockchip/rv1126/rv1126.c | 1 + 5 files changed, 5 insertions(+)
arch/arm/mach-rockchip/px30/px30.c +1 -0
@@ -19,6 +19,7 @@const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff390000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff3a0000/flash@0" , [BROM_BOOTSOURCE_SD ] ="/mmc@ff370000" , };
arch/arm/mach-rockchip/rk3288/rk3288.c +1 -0
@@ -28,6 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff0f0000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff130000/flash@0" , [BROM_BOOTSOURCE_SD ] ="/mmc@ff0c0000" , };
arch/arm/mach-rockchip/rk3308/rk3308.c +1 -0
@@ -141,6 +141,7 @@ enum {const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff490000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff4c0000/flash@0" , [BROM_BOOTSOURCE_SD ] ="/mmc@ff480000" , };
arch/arm/mach-rockchip/rk3368/rk3368.c +1 -0
@@ -55,6 +55,7 @@ struct mm_region *mem_map = rk3368_mem_map;const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff0f0000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff120000/flash@0" , [BROM_BOOTSOURCE_SD ] ="/mmc@ff0c0000" , };
arch/arm/mach-rockchip/rv1126/rv1126.c +1 -0
@@ -15,6 +15,7 @@const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ffc50000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ffc90000/flash@0" , [BROM_BOOTSOURCE_SD ] ="/mmc@ffc60000" , };
Signature · 1 line
2.43.2
Re: [PATCH v2 3/3] rockchip: spl: Add SPI NOR flash to boot_devices array
Hello Jonas,
Please see my comments below.
Quoted 21 lines · Jonas Karlman
Add missing boot source id <-> device tree node path mapping for SPI NOR flash on PX30, RK3288, RK3308, RK3368 and RV1126.
Signed-off-by Jonas Karlman <[email protected]>---
v2:
- New patch--- arch/arm/mach-rockchip/px30/px30.c | 1 + arch/arm/mach-rockchip/rk3288/rk3288.c | 1 + arch/arm/mach-rockchip/rk3308/rk3308.c | 1 + arch/arm/mach-rockchip/rk3368/rk3368.c | 1 + arch/arm/mach-rockchip/rv1126/rv1126.c | 1 + 5 files changed, 5 insertions(+)arch/arm/mach-rockchip/px30/px30.c +0
-0
arch/arm/mach-rockchip/px30/px30.c line 22
Quoted 4 lines
arch/arm/mach-rockchip/px30/px30.c +1
-0@@ -19,6 +19,7 @@const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff390000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff3a0000/flash@0" ,
AFAICT, no PX30-based board contains an SPI chip, but making this future-proof perhaps shouldn't hurt.
arch/arm/mach-rockchip/rk3288/rk3288.c DECLARE_GLOBAL_DATA_PTR; · line 31
Quoted 13 lines
arch/arm/mach-rockchip/px30/px30.c +0
-0[BROM_BOOTSOURCE_SD] = "/mmc@ff370000", };arch/arm/mach-rockchip/rk3288/rk3288.c +1
-0@@ -28,6 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff0f0000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff130000/flash@0" ,
Using spi2 for a flash chip applies to some RK3288-based boards, but AFAICT not to all of them. For example, arch/arm/dts/rk3288-evb.dtsi uses spi0 for a flash chip, which in turn translates to /spi@ff110000/flash@0. The same also applies to arch/arm/dts/rk3288-firefly.dtsi, for example.
arch/arm/mach-rockchip/rk3308/rk3308.c enum { · line 144
Quoted 13 lines
arch/arm/mach-rockchip/rk3288/rk3288.c +0
-0[BROM_BOOTSOURCE_SD] = "/mmc@ff0c0000", };arch/arm/mach-rockchip/rk3308/rk3308.c +1
-0@@ -141,6 +141,7 @@ enum {const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff490000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff4c0000/flash@0" ,
AFAICT, no RK3308-based board contains an SPI chip, and I'm not really sure where does /spi@ff4c0000/flash@0 come from.
arch/arm/mach-rockchip/rk3368/rk3368.c struct mm_region *mem_map = rk3368_mem_map; · line 58
Quoted 13 lines
arch/arm/mach-rockchip/rk3308/rk3308.c +0
-0[BROM_BOOTSOURCE_SD] = "/mmc@ff480000", };arch/arm/mach-rockchip/rk3368/rk3368.c +1
-0@@ -55,6 +55,7 @@ struct mm_region *mem_map = rk3368_mem_map;const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff0f0000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff120000/flash@0" ,
This is fine.
arch/arm/mach-rockchip/rv1126/rv1126.c line 18
Quoted 13 lines
arch/arm/mach-rockchip/rk3368/rk3368.c +0
-0[BROM_BOOTSOURCE_SD] = "/mmc@ff0c0000", };arch/arm/mach-rockchip/rv1126/rv1126.c +1
-0@@ -15,6 +15,7 @@const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ffc50000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ffc90000/flash@0" ,
This is also fine.
Quoted 2 lines
arch/arm/mach-rockchip/rv1126/rv1126.c +0
-0[BROM_BOOTSOURCE_SD] = "/mmc@ffc60000", };
Re: [PATCH v2 3/3] rockchip: spl: Add SPI NOR flash to boot_devices array
Hi Dragan,
Quoted 28 lines · Dragan Simic
Hello Jonas,
Please see my comments below.
Quoted 23 lines · Jonas Karlman
Add missing boot source id <-> device tree node path mapping for SPI NOR
flash on PX30, RK3288, RK3308, RK3368 and RV1126.Signed-off-by Jonas Karlman <[email protected]>---
v2:
- New patch--- arch/arm/mach-rockchip/px30/px30.c | 1 + arch/arm/mach-rockchip/rk3288/rk3288.c | 1 + arch/arm/mach-rockchip/rk3308/rk3308.c | 1 + arch/arm/mach-rockchip/rk3368/rk3368.c | 1 + arch/arm/mach-rockchip/rv1126/rv1126.c | 1 + 5 files changed, 5 insertions(+)arch/arm/mach-rockchip/px30/px30.c +0
-0@@ -19,6 +19,7 @@
Quoted 6 lines
arch/arm/mach-rockchip/px30/px30.c line 22
Quoted 3 lines
arch/arm/mach-rockchip/px30/px30.c +1
-0const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff390000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff3a0000/flash@0" ,AFAICT, no PX30-based board contains an SPI chip, but making this future-proof perhaps shouldn't hurt.
The rk3326-odroid-go2 variant of PX30 has a jedec,spi-nor node.
Quoted 11 lines
Quoted 11 lines
arch/arm/mach-rockchip/px30/px30.c +0
-0[BROM_BOOTSOURCE_SD] = "/mmc@ff370000", };arch/arm/mach-rockchip/rk3288/rk3288.c +0
-0@@ -28,6 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;
Quoted 10 lines
arch/arm/mach-rockchip/rk3288/rk3288.c DECLARE_GLOBAL_DATA_PTR; · line 31
Quoted 3 lines
arch/arm/mach-rockchip/rk3288/rk3288.c +1
-0const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff0f0000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff130000/flash@0" ,Using spi2 for a flash chip applies to some RK3288-based boards, but AFAICT
not to all of them. For example,arch/arm/dts/rk3288-evb.dtsiuses spi0 for a flash chip, which in turn translates to /spi@ff110000/flash@0. The
same also applies toarch/arm/dts/rk3288-firefly.dtsi, for example.
The RK3288 TRM explicitly mention that it can boot from SPI2 CS0.
Also I can only find jedec,spi-nor reference in rk3288-phycore-som.dtsi and rk3288-veyron.dtsi, nothing in rk3288-evb.dtsi or rk3288-firefly.dtsi.
Quoted 11 lines
Quoted 11 lines
arch/arm/mach-rockchip/rk3288/rk3288.c +0
-0[BROM_BOOTSOURCE_SD] = "/mmc@ff0c0000", };arch/arm/mach-rockchip/rk3308/rk3308.c +0
-0@@ -141,6 +141,7 @@ enum {
Quoted 6 lines
arch/arm/mach-rockchip/rk3308/rk3308.c enum { · line 144
Quoted 3 lines
arch/arm/mach-rockchip/rk3308/rk3308.c +1
-0const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff490000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff4c0000/flash@0" ,AFAICT, no RK3308-based board contains an SPI chip, and I'm not really sure where does /spi@ff4c0000/flash@0 come from.
RK3308 TRM mention that it can boot from the SFC. And yes there is no upstream board that currently have a jedec,spi-nor node, it however have the sfc (spi@ff4c0000) node so this adds correct node path.
Regards,
Jonas
Quoted 35 lines
Quoted 10 lines
arch/arm/mach-rockchip/rk3308/rk3308.c +0
-0[BROM_BOOTSOURCE_SD] = "/mmc@ff480000", };arch/arm/mach-rockchip/rk3368/rk3368.c +0
-0arch/arm/mach-rockchip/rk3368/rk3368.c struct mm_region *mem_map = rk3368_mem_map; · line 58
Quoted 4 lines
arch/arm/mach-rockchip/rk3368/rk3368.c +1
-0@@ -55,6 +55,7 @@ struct mm_region *mem_map = rk3368_mem_map;const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff0f0000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff120000/flash@0" ,This is fine.
arch/arm/mach-rockchip/rv1126/rv1126.c line 18
Quoted 13 lines
arch/arm/mach-rockchip/rk3368/rk3368.c +0
-0[BROM_BOOTSOURCE_SD] = "/mmc@ff0c0000", };arch/arm/mach-rockchip/rv1126/rv1126.c +1
-0@@ -15,6 +15,7 @@const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ffc50000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ffc90000/flash@0" ,This is also fine.
Quoted 2 lines
arch/arm/mach-rockchip/rv1126/rv1126.c +0
-0[BROM_BOOTSOURCE_SD] = "/mmc@ffc60000", };
Re: [PATCH v2 3/3] rockchip: spl: Add SPI NOR flash to boot_devices array
Quoted 27 lines · Jonas Karlman
Quoted 26 lines · Dragan Simic
Please see my comments below.
Quoted 23 lines · Jonas Karlman
Add missing boot source id <-> device tree node path mapping for SPI NOR
flash on PX30, RK3288, RK3308, RK3368 and RV1126.Signed-off-by Jonas Karlman <[email protected]>---
v2:
- New patch--- arch/arm/mach-rockchip/px30/px30.c | 1 + arch/arm/mach-rockchip/rk3288/rk3288.c | 1 + arch/arm/mach-rockchip/rk3308/rk3308.c | 1 + arch/arm/mach-rockchip/rk3368/rk3368.c | 1 + arch/arm/mach-rockchip/rv1126/rv1126.c | 1 + 5 files changed, 5 insertions(+)arch/arm/mach-rockchip/px30/px30.c +0
-0@@ -19,6 +19,7 @@
Quoted 8 lines
Quoted 6 lines
arch/arm/mach-rockchip/px30/px30.c line 22
Quoted 3 lines
arch/arm/mach-rockchip/px30/px30.c +1
-0const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff390000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff3a0000/flash@0" ,AFAICT, no PX30-based board contains an SPI chip, but making this future-proof perhaps shouldn't hurt.
The rk3326-odroid-go2 variant of PX30 has a jedec,spi-nor node.
Ah, I see, I missed that. Thanks for the clarification.
Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
arch/arm/mach-rockchip/px30/px30.c +0
-0[BROM_BOOTSOURCE_SD] = "/mmc@ff370000", };arch/arm/mach-rockchip/rk3288/rk3288.c +0
-0@@ -28,6 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;Quoted 9 lines
arch/arm/mach-rockchip/rk3288/rk3288.c DECLARE_GLOBAL_DATA_PTR; · line 31
Quoted 3 lines
arch/arm/mach-rockchip/rk3288/rk3288.c +1
-0const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff0f0000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff130000/flash@0" ,Using spi2 for a flash chip applies to some RK3288-based boards, but AFAICT not to all of them. For example,
arch/arm/dts/rk3288-evb.dtsiuses spi0 for a flash chip, which in turn translates to /spi@ff110000/flash@0. The same also applies toarch/arm/dts/rk3288-firefly.dtsi, for example.
Quoted 4 lines
The RK3288 TRM explicitly mention that it can boot from SPI2 CS0.
Also I can only find jedec,spi-nor reference in
rk3288-phycore-som.dtsiandrk3288-veyron.dtsi, nothing inrk3288-evb.dtsiorrk3288-firefly.dtsi.
Oh, I see now, you're right. I've checked the Firefly-RK3288 schematic and it just exposes the spi0 interface on one of its expansion headers.
Quoted 17 lines
Quoted 10 lines
Quoted 10 lines
arch/arm/mach-rockchip/rk3288/rk3288.c +0
-0[BROM_BOOTSOURCE_SD] = "/mmc@ff0c0000", };arch/arm/mach-rockchip/rk3308/rk3308.c +0
-0@@ -141,6 +141,7 @@ enum {Quoted 6 lines
arch/arm/mach-rockchip/rk3308/rk3308.c enum { · line 144
Quoted 3 lines
arch/arm/mach-rockchip/rk3308/rk3308.c +1
-0const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff490000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff4c0000/flash@0" ,AFAICT, no RK3308-based board contains an SPI chip, and I'm not really sure where does /spi@ff4c0000/flash@0 come from.
Quoted 3 lines
RK3308 TRM mention that it can boot from the SFC. And yes there is no upstream board that currently have a jedec,spi-nor node, it however have the sfc (spi@ff4c0000) node so this adds correct node path.
Hmm, I see no sfc node in any of the arch/arm/dts/rk3308* files? Maybe I'm missing something, but there's also no "ff4c0000" string in the entire arch/arm/dts directory.
Re: [PATCH v2 3/3] rockchip: spl: Add SPI NOR flash to boot_devices array
Quoted 85 lines · Dragan Simic
Quoted 27 lines · Jonas Karlman
Quoted 26 lines · Dragan Simic
Please see my comments below.
Quoted 23 lines · Jonas Karlman
Add missing boot source id <-> device tree node path mapping for SPI NOR
flash on PX30, RK3288, RK3308, RK3368 and RV1126.Signed-off-by Jonas Karlman <[email protected]>---
v2:
- New patch--- arch/arm/mach-rockchip/px30/px30.c | 1 + arch/arm/mach-rockchip/rk3288/rk3288.c | 1 + arch/arm/mach-rockchip/rk3308/rk3308.c | 1 + arch/arm/mach-rockchip/rk3368/rk3368.c | 1 + arch/arm/mach-rockchip/rv1126/rv1126.c | 1 + 5 files changed, 5 insertions(+)arch/arm/mach-rockchip/px30/px30.c +0
-0@@ -19,6 +19,7 @@Quoted 8 lines
Quoted 6 lines
arch/arm/mach-rockchip/px30/px30.c line 22
Quoted 3 lines
arch/arm/mach-rockchip/px30/px30.c +1
-0const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff390000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff3a0000/flash@0" ,AFAICT, no PX30-based board contains an SPI chip, but making this future-proof perhaps shouldn't hurt.
The rk3326-odroid-go2 variant of PX30 has a jedec,spi-nor node.
Ah, I see, I missed that. Thanks for the clarification.
Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
arch/arm/mach-rockchip/px30/px30.c +0
-0[BROM_BOOTSOURCE_SD] = "/mmc@ff370000", };arch/arm/mach-rockchip/rk3288/rk3288.c +0
-0@@ -28,6 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;Quoted 9 lines
arch/arm/mach-rockchip/rk3288/rk3288.c DECLARE_GLOBAL_DATA_PTR; · line 31
Quoted 3 lines
arch/arm/mach-rockchip/rk3288/rk3288.c +1
-0const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff0f0000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff130000/flash@0" ,Using spi2 for a flash chip applies to some RK3288-based boards, but AFAICT not to all of them. For example,
arch/arm/dts/rk3288-evb.dtsiuses spi0 for a flash chip, which in turn translates to /spi@ff110000/flash@0. The same also applies toarch/arm/dts/rk3288-firefly.dtsi, for example.Quoted 5 lines
The RK3288 TRM explicitly mention that it can boot from SPI2 CS0.
Also I can only find jedec,spi-nor reference in
rk3288-phycore-som.dtsiandrk3288-veyron.dtsi, nothing inrk3288-evb.dtsiorrk3288-firefly.dtsi.Oh, I see now, you're right. I've checked the Firefly-RK3288 schematic and it just exposes the spi0 interface on one of its expansion headers.
Quoted 17 lines
Quoted 16 lines
arch/arm/mach-rockchip/rk3308/rk3308.c enum { · line 144
Quoted 13 lines
arch/arm/mach-rockchip/rk3288/rk3288.c +0
-0[BROM_BOOTSOURCE_SD] = "/mmc@ff0c0000", };arch/arm/mach-rockchip/rk3308/rk3308.c +1
-0@@ -141,6 +141,7 @@ enum {const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff490000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff4c0000/flash@0" ,AFAICT, no RK3308-based board contains an SPI chip, and I'm not really sure where does /spi@ff4c0000/flash@0 come from.
Quoted 7 lines
Quoted 3 lines
RK3308 TRM mention that it can boot from the SFC. And yes there is no upstream board that currently have a jedec,spi-nor node, it however have the sfc (spi@ff4c0000) node so this adds correct node path.
Hmm, I see no sfc node in any of the
arch/arm/dts/rk3308*files? Maybe I'm missing something, but there's also no "ff4c0000" string in the entirearch/arm/dtsdirectory.
The rk3308 DTs in U-Boot is very outdated so the sfc node cannot be found in current master branch.
The sfc node is part of linux upstream DT, should also match in dts/upstream in next branch and after the rk3308 DT sync series [1].
rockchip: rk3308: Sync DT with linux v6.8 and update defconfigs:
[1] https://patchwork.ozlabs.org/cover/1912830/
Regards,
Jonas
Dragan Simic
Reviewed-byRe: [PATCH v2 3/3] rockchip: spl: Add SPI NOR flash to boot_devices array
Quoted 26 lines · Jonas Karlman
Quoted 17 lines · Dragan Simic
Quoted 16 lines · Jonas Karlman
Quoted 14 lines · Dragan Simic
arch/arm/mach-rockchip/rk3308/rk3308.c enum { · line 144
Quoted 10 lines · Jonas Karlman
arch/arm/mach-rockchip/rk3308/rk3308.c +1
-0@@ -141,6 +141,7 @@ enum {const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="/mmc@ff490000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi@ff4c0000/flash@0" ,AFAICT, no RK3308-based board contains an SPI chip, and I'm not really sure where does /spi@ff4c0000/flash@0 come from.
Quoted 7 lines
Quoted 3 lines
RK3308 TRM mention that it can boot from the SFC. And yes there is no upstream board that currently have a jedec,spi-nor node, it however have the sfc (spi@ff4c0000) node so this adds correct node path.
Hmm, I see no sfc node in any of the
arch/arm/dts/rk3308*files? Maybe I'm missing something, but there's also no "ff4c0000" string in the entirearch/arm/dtsdirectory.
Quoted 8 lines
The rk3308 DTs in U-Boot is very outdated so the sfc node cannot be found in current master branch.
The sfc node is part of linux upstream DT, should also match in dts/upstream in next branch and after the rk3308 DT sync series [1].
rockchip: rk3308: Sync DT with linux v6.8 and update defconfigs:
[1] https://patchwork.ozlabs.org/cover/1912830/
All good, thanks for explaining it further. Please add