Skip to contentSkip to conversation

environment: distro: Add SF distro support

PATCH In review Jagan Teki 4 participants 8 messages Apr 10, 2020 – Apr 20, 2020 3 messages not in the archive Arm Rockchip

lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

v2 cover environment: distro: Add SF distro support

This patch is based on Tom comments from previous version[1] for adding new distro support separately as in include/environment/distro/sf.h

This new sf distro command not touch the existing
include/config_distro_bootcmd.h.

Used this new SF distro command in rk3399 platform.

[1] https://patchwork.ozlabs.org/patch/1232666/

Any inputs?
Jagan.

Jagan Teki (3):
environment: distro: Add SF distro command
rk3399: Add boot flash script offset, size
rockchip: Enable SF distro bootcmd

 include/configs/rk3399_common.h   |  3 +++
 include/configs/rockchip-common.h |  9 ++++++-
 include/environment/distro/sf.h   | 41 +++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 include/environment/distro/sf.h
Signature · 1 line
2.17.1

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

#2 lore raw

PATCH v2 1/3 environment: distro: Add SF distro command

Add distro boot command support for SPI flash (SF).

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

This file need to include on required include/config file.

---
Changes for v2:
- new patch

 include/environment/distro/sf.h | 41 +++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 include/environment/distro/sf.h
include/environment/distro/sf.h new file +41 -0
new file mode 100644
index 0000000000..e793be06c6
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2020 Amarula Solutions(India)
+ *
+ * SF distro configurations.
+ */
+
+#ifndef __DISTRO_SF_CONFIG_H
+#define __DISTRO_SF_CONFIG_H
+
+#if CONFIG_IS_ENABLED(CMD_SF)
+#define BOOTENV_SHARED_SF(devtypel)				\
+	#devtypel "_boot=" 					\
+	"if " #devtypel " probe ${busnum}; then "		\
+		"devtype=" #devtypel "; "	  		\
+		"run scan_sf_for_scripts; "	  		\
+	"fi\0"
+#define BOOTENV_DEV_SF(devtypeu, devtypel, instance) 		\
+	"bootcmd_" #devtypel #instance "=" 			\
+		"busnum=" #instance "; " 			\
+		"run " #devtypel "_boot\0"
+#define BOOTENV_DEV_NAME_SF(devtypeu, devtypel, instance) 	\
+	#devtypel #instance " "
+#else
+#define BOOTENV_SHARED_SF(devtypel)
+#define BOOTENV_DEV_SF \
+	BOOT_TARGET_DEVICES_references_SF_without_CONFIG_CMD_SF
+#define BOOTENV_DEV_NAME_SF \
+	BOOT_TARGET_DEVICES_references_SF_without_CONFIG_CMD_SF
+
+#endif /* CONFIG_CMD_SF */
+
+#define BOOTENV_SF \
+	BOOTENV_SHARED_SF(sf) \
+	"scan_sf_for_scripts="					\
+		"${devtype} read ${scriptaddr} "		\
+			"${script_offset_f} ${script_size_f}; "	\
+		"source ${scriptaddr}; "			\
+		"echo SCRIPT FAILED: continuing...\0"
+
+#endif /* __DISTRO_SF_CONFIG_H */
Signature · 1 line
2.17.1
Reviewed-by on v2 1/3
#3 lore raw

Re: [PATCH v2 1/3] environment: distro: Add SF distro command

Quoted 10 lines · Jagan Teki

Add distro boot command support for SPI flash (SF).

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

This file need to include on required include/config file.

Signature · 1 line
Tom
#4 lore raw

PATCH v2 2/3 rk3399: Add boot flash script offset, size

In reply to a message not in the archive

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.

---
Changes for v2:
- new patch

 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 · 7 lines
2.17.1


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

#6 lore raw

Re: [PATCH v2 2/3] rk3399: Add boot flash script offset, size

Quoted 3 lines

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

You wouldn't have the commands for writing the idbloader.img/u-boot.itb to these SPI flash on one of these devices by chance?

Peter

Quoted 28 lines

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

---
Changes for v2:
- new patch

 include/configs/rk3399_common.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/rk3399_common.h +2 -1
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" \
--

2.17.1

A message that is not in the archive (sent off-list or not yet received): CALeDE9O2QaO7CnHPb1nQ2-J6NCWYD=PDSbhtMi-3N68Azm=nVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#9 lore raw

PATCH v2 3/3 rockchip: Enable SF distro bootcmd

In reply to a message not in the archive

Enable SPI flash(SF) distro boot command 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.

---
Changes for v2:
- update BOOT_TARGET_SF

 include/configs/rk3399_common.h   | 1 +
 include/configs/rockchip-common.h | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
include/configs/rk3399_common.h +1 -0
index 01a9174bd2..f0ae6e67a7 100644
@@ -60,6 +60,7 @@
 #endif
 
 #include <config_distro_bootcmd.h>
+#include <environment/distro/sf.h>
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	ENV_MEM_LAYOUT_SETTINGS \
 	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
include/configs/rockchip-common.h +8 -1
index b55e09a9ca..d97395db90 100644
@@ -41,11 +41,18 @@
 	#define BOOT_TARGET_DHCP(func)
 #endif
 
+#if CONFIG_IS_ENABLED(CMD_SF)
+	#define BOOT_TARGET_SF(func)	func(SF, sf, 0)
+#else
+	#define BOOT_TARGET_SF(func)
+#endif
+
 #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
author
#10 lore raw
In reply to Jagan Teki
Quoted 12 lines · Jagan Teki

This patch is based on Tom comments from previous version[1] for adding new distro support separately as in include/environment/distro/sf.h

This new sf distro command not touch the existing
include/config_distro_bootcmd.h.

Used this new SF distro command in rk3399 platform.

[1] https://patchwork.ozlabs.org/patch/1232666/

Quoted 7 lines

Any inputs?
Jagan.

Jagan Teki (3):
environment: distro: Add SF distro command
rk3399: Add boot flash script offset, size
rockchip: Enable SF distro bootcmd

Applied to u-boot-spi/master