Skip to contentSkip to conversation

rk3399: Add boot flash script offet, size

PATCH New Jagan Teki 3 participants 3 messages Feb 3, 2020 – Feb 4, 2020 1 message not in the archive Arm Rockchip

lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

PATCH 1/2 rk3399: Add boot flash script offet, size

Most of the SPI flash devices in rockchip (rk3399) are 16MiB size. So, let's use the script offset at the end of 8K.

This way it cannot overlap any offsets being used by software components in flash layout.

---
 include/configs/rk3399_common.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/rk3399_common.h +2 -0
index 89a8a44bbe..01a9174bd2 100644
@@ -48,6 +48,8 @@
 
 #define ENV_MEM_LAYOUT_SETTINGS \
 	"scriptaddr=0x00500000\0" \
+	"script_offset_f=0xffe000\0" \
+	"script_size_f=0x2000\0" \
 	"pxefile_addr_r=0x00600000\0" \
 	"fdt_addr_r=0x01f00000\0" \
 	"kernel_addr_r=0x02080000\0" \
Signature · 1 line
2.17.1

A message that is not in the archive (sent off-list or not yet received): 20200203091924.15385-1-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org

#2 lore raw

PATCH 2/2 rockchip: Add SF distro bootcmd

Add distro boot command support for SPI flash in Rockchip.

This distro boot will read the boot script at specific location at the flash and start sourcing the same.

Included the SF device at the last of the target devices list since all the rest of the devices on the list have more possibility to boot the distribution due to the size of the SPI flash is concern.

---
 include/configs/rockchip-common.h | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
include/configs/rockchip-common.h +16 -1
index b55e09a9ca..8e7c994266 100644
@@ -41,11 +41,26 @@
 	#define BOOT_TARGET_DHCP(func)
 #endif
 
+#if CONFIG_IS_ENABLED(CMD_SF)
+	#define BOOT_TARGET_SF(func)	func(SF, sf, na)
+#else
+	#define BOOT_TARGET_SF(func)
+#endif
+
+#define BOOTENV_DEV_SF(devtypeu, devtypel, instance) \
+	"bootcmd_sf=sf probe 0 0 0 && " \
+		"sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
+		"source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_SF(devtypeu, devtypel, instance) \
+	"sf "
+
 #define BOOT_TARGET_DEVICES(func) \
 	BOOT_TARGET_MMC(func) \
 	BOOT_TARGET_USB(func) \
 	BOOT_TARGET_PXE(func) \
-	BOOT_TARGET_DHCP(func)
+	BOOT_TARGET_DHCP(func) \
+	BOOT_TARGET_SF(func)
 
 #ifdef CONFIG_ARM64
 #define ROOT_UUID "B921B045-1DF0-41C3-AF44-4C6F280D3FAE;\0"
Signature · 1 line
2.17.1
#3 lore raw

Re: [PATCH 2/2] rockchip: Add SF distro bootcmd

Quoted 37 lines · Jagan Teki

Add distro boot command support for SPI flash in Rockchip.

This distro boot will read the boot script at specific location at the flash and start sourcing the same.

Included the SF device at the last of the target devices list since all the rest of the devices on the list have more possibility to boot the distribution due to the size of the SPI flash is concern.

---
 include/configs/rockchip-common.h | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
include/configs/rockchip-common.h +14 -0
index b55e09a9ca..8e7c994266 100644
@@ -41,11 +41,26 @@
 	#define BOOT_TARGET_DHCP(func)
 #endif
 
+#if CONFIG_IS_ENABLED(CMD_SF)
+	#define BOOT_TARGET_SF(func)	func(SF, sf, na)
+#else
+	#define BOOT_TARGET_SF(func)
+#endif
+
+#define BOOTENV_DEV_SF(devtypeu, devtypel, instance) \
+	"bootcmd_sf=sf probe 0 0 0 && " \
+		"sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
+		"source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_SF(devtypeu, devtypel, instance) \
+	"sf "
+

include/configs/rockchip-common.h line 66

Quoted 10 lines
include/configs/rockchip-common.h +2 -1
 #define BOOT_TARGET_DEVICES(func) \
 	BOOT_TARGET_MMC(func) \
 	BOOT_TARGET_USB(func) \
 	BOOT_TARGET_PXE(func) \
-	BOOT_TARGET_DHCP(func)
+	BOOT_TARGET_DHCP(func) \
+	BOOT_TARGET_SF(func)
 
 #ifdef CONFIG_ARM64
 #define ROOT_UUID "B921B045-1DF0-41C3-AF44-4C6F280D3FAE;\0"

Something I lamented in another thread is that we need to move things to include/environment/ so that they can be re-used easily. Lets start by putting the "distro boot" SF stuff in to include/environment/distro/sf.h and #include that here. That way anything else that really does have something written to SPI flash in this manner can opt-in without duplication of the logic.

Thanks!

Signature · 1 line
Tom