Skip to contentSkip to conversation

configs: ls2080ardb: Make MC_INIT access flash memory as per spi-mem

PATCH New Kuldeep Singh 2 participants 5 messages Mar 18, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 configs: ls2080ardb: Make MC_INIT access flash memory as per spi-mem

MC_INIT command currently access spi-nor flash memory directly. As per spi-mem framework, flash memory access via absolute addresses is no more possible. Use flash APIs to access memory instead of directly using it.

---
v3:
-Use complete MC size, 1M works but MC has 3M assigned space. -Rebase to top

v2:
-Rebase to top
-reword commit message

 include/configs/ls2080ardb.h | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)
include/configs/ls2080ardb.h +18 -10
index c1819d2..d36e928 100644
@@ -321,11 +321,15 @@ unsigned long get_board_sys_clk(void);
 #include <config_distro_bootcmd.h>
 
 #ifdef CONFIG_TFABOOT
-#define QSPI_MC_INIT_CMD			\
-	"env exists secureboot && "		\
-	"esbc_validate 0x20640000 && "		\
-	"esbc_validate 0x20680000;"		\
-	"fsl_mc start mc 0x20a00000 0x20e00000 \0"
+#define QSPI_MC_INIT_CMD				\
+	"sf probe 0:0; "				\
+	"sf read 0x80640000 0x640000 0x80000; "		\
+	"env exists secureboot && "			\
+	"esbc_validate 0x80640000 && "			\
+	"esbc_validate 0x80680000; "			\
+	"sf read 0x80a00000 0xa00000 0x300000; "	\
+	"sf read 0x80e00000 0xe00000 0x100000; "	\
+	"fsl_mc start mc 0x80a00000 0x80e00000 \0"
 #define SD_MC_INIT_CMD				\
 	"mmcinfo;mmc read 0x80a00000 0x5000 0x1200;" \
 	"mmc read 0x80e00000 0x7000 0x800;"	\
@@ -342,11 +346,15 @@ unsigned long get_board_sys_clk(void);
 	"fsl_mc start mc 0x580a00000 0x580e00000 \0"
 #else
 #ifdef CONFIG_QSPI_BOOT
-#define MC_INIT_CMD				\
-	"mcinitcmd=env exists secureboot && "	\
-	"esbc_validate 0x20640000 && "		\
-	"esbc_validate 0x20680000;"		\
-	"fsl_mc start mc 0x20a00000 0x20e00000 \0"
+#define MC_INIT_CMD					\
+	"mcinitcmd=sf probe 0:0; "			\
+	"sf read 0x80640000 0x640000 0x80000; "		\
+	"env exists secureboot && "			\
+	"esbc_validate 0x80640000 && "			\
+	"esbc_validate 0x80680000; "			\
+	"sf read 0x80a00000 0xa00000 0x300000; "	\
+	"sf read 0x80e00000 0xe00000 0x100000; "	\
+	"fsl_mc start mc 0x80a00000 0x80e00000 \0"
 #elif defined(CONFIG_SD_BOOT)
 #define MC_INIT_CMD                             \
 	"mcinitcmd=mmcinfo;mmc read 0x80000000 0x5000 0x800;" \
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 2/2 configs: ls2080ardb: Make BOOT command access flash memory as per spi-mem

BOOT command currently access spi-nor flash memory directly. As per spi-mem framework, flash memory access via absolute addresses is no more possible. Use flash APIs to access memory instead of directly using it.

---
v3:
-Rebase

v2:
-Rebase to top
-Reword commit message

 include/configs/ls2080ardb.h | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
include/configs/ls2080ardb.h +10 -4
index d36e928..b8e5dd3 100644
@@ -508,10 +508,13 @@ unsigned long get_board_sys_clk(void);
 
 #ifdef CONFIG_TFABOOT
 #define QSPI_NOR_BOOTCOMMAND						\
+			"sf probe 0:0; "				\
+			"sf read 0x806c0000 0x6c0000 0x40000; "		\
 			"env exists mcinitcmd && env exists secureboot "\
-			"&& esbc_validate 0x206C0000; "			\
+			"&& esbc_validate 0x806c0000; "			\
+			"sf read 0x80d00000 0xd00000 0x100000; "	\
 			"env exists mcinitcmd && "			\
-			"fsl_mc lazyapply dpl 0x20d00000; "		\
+			"fsl_mc lazyapply dpl 0x80d00000; "		\
 			"run distro_bootcmd;run qspi_bootcmd; "		\
 			"env exists secureboot && esbc_halt;"
 
@@ -538,10 +541,13 @@ unsigned long get_board_sys_clk(void);
 #ifdef CONFIG_QSPI_BOOT
 /* Try to boot an on-QSPI kernel first, then do normal distro boot */
 #define CONFIG_BOOTCOMMAND						\
+			"sf probe 0:0; "				\
+			"sf read 0x806c0000 0x6c0000 0x40000; "		\
 			"env exists mcinitcmd && env exists secureboot "\
-			"&& esbc_validate 0x206C0000; "			\
+			"&& esbc_validate 0x806C0000; "			\
+			"sf read 0x80d00000 0xd00000 0x100000; "	\
 			"env exists mcinitcmd && "			\
-			"fsl_mc lazyapply dpl 0x20d00000; "		\
+			"fsl_mc lazyapply dpl 0x80d00000; "		\
 			"run distro_bootcmd;run qspi_bootcmd; "		\
 			"env exists secureboot && esbc_halt;"
 #elif defined(CONFIG_SD_BOOT)
Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 2/2 configs: ls2080ardb: Make BOOT command access flash memory as per spi-mem

Quoted 70 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Kuldeep Singh
Sent: Wednesday, March 18, 2020 11:57 AM
To: Priyanka Jain <[email protected]>; u-boot at lists.denx.de
Cc: Kuldeep Singh <[email protected]>
Subject: [Patch v3 2/2] configs: ls2080ardb: Make BOOT command access flash memory as per spi-mem

BOOT command currently access spi-nor flash memory directly. As per spi- mem framework, flash memory access via absolute addresses is no more possible.
Use flash APIs to access memory instead of directly using it.

---
v3:
-Rebase

v2:

(quoted diff) +0 -2
-Rebase to top
-Reword commit message

include/configs/ls2080ardb.h | 14 ++++++++++----

1 file changed, 10 insertions(+), 4 deletions(-)
include/configs/ls2080ardb.h index renamed from include/configs/ls2080ardb.h +0 -0

d36e928..b8e5dd3 100644

include/configs/ls2080ardb.h +5 -2
@@ -508,10 +508,13 @@ unsigned long get_board_sys_clk(void);
 
 #ifdef CONFIG_TFABOOT
 #define QSPI_NOR_BOOTCOMMAND
 	\
+			"sf probe 0:0; "				\
+			"sf read 0x806c0000 0x6c0000 0x40000; "
 	\
 			"env exists mcinitcmd && env exists secureboot "\
-			"&& esbc_validate 0x206C0000; "
 	\
+			"&& esbc_validate 0x806c0000; "
 	\
+			"sf read 0x80d00000 0xd00000 0x100000; "	\
 			"env exists mcinitcmd && "			\
-			"fsl_mc lazyapply dpl 0x20d00000; "		\
+			"fsl_mc lazyapply dpl 0x80d00000; "		\
			"run distro_bootcmd;run qspi_bootcmd; "
	\
			"env exists secureboot && esbc_halt;"
include/configs/ls2080ardb.h +0 -0
@@ -538,10 +541,13 @@ unsigned long get_board_sys_clk(void);  #ifdef

CONFIG_QSPI_BOOT
/* Try to boot an on-QSPI kernel first, then do normal distro boot */

#define CONFIG_BOOTCOMMAND
	\
include/configs/ls2080ardb.h +2 -0
+			"sf probe 0:0; "				\
+			"sf read 0x806c0000 0x6c0000 0x40000; "
	\
			"env exists mcinitcmd && env exists secureboot "\
include/configs/ls2080ardb.h +0 -1
-			"&& esbc_validate 0x206C0000; "
	\
include/configs/ls2080ardb.h +1 -0
+			"&& esbc_validate 0x806C0000; "
	\
include/configs/ls2080ardb.h +1 -0
+			"sf read 0x80d00000 0xd00000 0x100000; "	\
			"env exists mcinitcmd && "			\
include/configs/ls2080ardb.h +1 -1
-			"fsl_mc lazyapply dpl 0x20d00000; "		\
+			"fsl_mc lazyapply dpl 0x80d00000; "		\
			"run distro_bootcmd;run qspi_bootcmd; "
	\
			"env exists secureboot && esbc_halt;"
Quoted 3 lines

#elif defined(CONFIG_SD_BOOT)
--
2.7.4

Same comment as previous, please provide testing status for both secure and non-secure boot

Regards
Priyanka

#3 lore raw

PATCH v3 2/2 configs: ls2080ardb: Make BOOT command access flash memory as per spi-mem

Quoted 79 lines

-----Original Message-----
From: Priyanka Jain (OSS) <[email protected]>
Sent: Wednesday, March 18, 2020 4:03 PM
To: Kuldeep Singh <[email protected]>; u-boot at lists.denx.de
Cc: Kuldeep Singh <[email protected]>
Subject: RE: [Patch v3 2/2] configs: ls2080ardb: Make BOOT command access flash memory as per spi-mem

Quoted 2 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Kuldeep

Singh

Quoted 66 lines

Sent: Wednesday, March 18, 2020 11:57 AM
To: Priyanka Jain <[email protected]>; u-boot at lists.denx.de
Cc: Kuldeep Singh <[email protected]>
Subject: [Patch v3 2/2] configs: ls2080ardb: Make BOOT command access flash memory as per spi-mem

BOOT command currently access spi-nor flash memory directly. As per spi- mem framework, flash memory access via absolute addresses is no more possible.
Use flash APIs to access memory instead of directly using it.

---
v3:
-Rebase

v2:

(quoted diff) +0 -2
-Rebase to top
-Reword commit message

include/configs/ls2080ardb.h | 14 ++++++++++----

1 file changed, 10 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/include/configs/ls2080ardb.h index
d36e928..b8e5dd3 100644

include/configs/ls2080ardb.h +5 -2
@@ -508,10 +508,13 @@ unsigned long get_board_sys_clk(void);
 
 #ifdef CONFIG_TFABOOT
 #define QSPI_NOR_BOOTCOMMAND
 	\
+			"sf probe 0:0; "				\
+			"sf read 0x806c0000 0x6c0000 0x40000; "
 	\
 			"env exists mcinitcmd && env exists secureboot "\
-			"&& esbc_validate 0x206C0000; "
 	\
+			"&& esbc_validate 0x806c0000; "
 	\
+			"sf read 0x80d00000 0xd00000 0x100000; "	\
 			"env exists mcinitcmd && "			\
-			"fsl_mc lazyapply dpl 0x20d00000; "		\
+			"fsl_mc lazyapply dpl 0x80d00000; "		\
			"run distro_bootcmd;run qspi_bootcmd; "
	\
			"env exists secureboot && esbc_halt;"
include/configs/ls2080ardb.h +0 -0
@@ -538,10 +541,13 @@ unsigned long get_board_sys_clk(void);  #ifdef

CONFIG_QSPI_BOOT
/* Try to boot an on-QSPI kernel first, then do normal distro boot */

#define CONFIG_BOOTCOMMAND
	\
include/configs/ls2080ardb.h +2 -0
+			"sf probe 0:0; "				\
+			"sf read 0x806c0000 0x6c0000 0x40000; "
	\
			"env exists mcinitcmd && env exists secureboot "\
include/configs/ls2080ardb.h +0 -1
-			"&& esbc_validate 0x206C0000; "
	\
include/configs/ls2080ardb.h +1 -0
+			"&& esbc_validate 0x806C0000; "
	\
include/configs/ls2080ardb.h +1 -0
+			"sf read 0x80d00000 0xd00000 0x100000; "	\
			"env exists mcinitcmd && "			\
include/configs/ls2080ardb.h +1 -1
-			"fsl_mc lazyapply dpl 0x20d00000; "		\
+			"fsl_mc lazyapply dpl 0x80d00000; "		\
Quoted 8 lines
Quoted 6 lines
			"run distro_bootcmd;run qspi_bootcmd; "
	\
			"env exists secureboot && esbc_halt;"

#elif defined(CONFIG_SD_BOOT)
--
2.7.4

Same comment as previous, please provide testing status for both secure and non-secure boot

These 2 patches are valid when new qspi driver is accepted.
i.e depends on https://patchwork.ozlabs.org/project/uboot/list/?series=159796

Moreover, I will give you status/logs for both secure and non-secure boot.

Thanks
Kuldeep

Quoted 2 lines

Regards
Priyanka

#4 lore raw

PATCH v3 1/2 configs: ls2080ardb: Make MC_INIT access flash memory as per spi-mem

In reply to Kuldeep Singh
Quoted 72 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Kuldeep Singh
Sent: Wednesday, March 18, 2020 11:57 AM
To: Priyanka Jain <[email protected]>; u-boot at lists.denx.de
Cc: Kuldeep Singh <[email protected]>
Subject: [Patch v3 1/2] configs: ls2080ardb: Make MC_INIT access flash memory as per spi-mem

MC_INIT command currently access spi-nor flash memory directly. As per spi- mem framework, flash memory access via absolute addresses is no more possible. Use flash APIs to access memory instead of directly using it.

---
v3:

(quoted diff) +0 -2
-Use complete MC size, 1M works but MC has 3M assigned space.
-Rebase to top

v2:

(quoted diff) +0 -2
-Rebase to top
-reword commit message

include/configs/ls2080ardb.h | 28 ++++++++++++++++++----------

1 file changed, 18 insertions(+), 10 deletions(-)
include/configs/ls2080ardb.h index renamed from include/configs/ls2080ardb.h +0 -0

c1819d2..d36e928 100644

include/configs/ls2080ardb.h +0 -0
@@ -321,11 +321,15 @@ unsigned long get_board_sys_clk(void);  #include

<config_distro_bootcmd.h>

#ifdef CONFIG_TFABOOT

include/configs/ls2080ardb.h +9 -5
-#define QSPI_MC_INIT_CMD			\
-	"env exists secureboot && "		\
-	"esbc_validate 0x20640000 && "		\
-	"esbc_validate 0x20680000;"		\
-	"fsl_mc start mc 0x20a00000 0x20e00000 \0"
+#define QSPI_MC_INIT_CMD				\
+	"sf probe 0:0; "				\
+	"sf read 0x80640000 0x640000 0x80000; "		\
+	"env exists secureboot && "			\
+	"esbc_validate 0x80640000 && "			\
+	"esbc_validate 0x80680000; "			\
+	"sf read 0x80a00000 0xa00000 0x300000; "	\
+	"sf read 0x80e00000 0xe00000 0x100000; "	\
+	"fsl_mc start mc 0x80a00000 0x80e00000 \0"
#define SD_MC_INIT_CMD				\
	"mmcinfo;mmc read 0x80a00000 0x5000 0x1200;" \
	"mmc read 0x80e00000 0x7000 0x800;"	\
include/configs/ls2080ardb.h +9 -6
@@ -342,11 +346,15 @@ unsigned long get_board_sys_clk(void);
 	"fsl_mc start mc 0x580a00000 0x580e00000 \0"
 #else
 #ifdef CONFIG_QSPI_BOOT
-#define MC_INIT_CMD				\
-	"mcinitcmd=env exists secureboot && "	\
-	"esbc_validate 0x20640000 && "		\
-	"esbc_validate 0x20680000;"		\
-	"fsl_mc start mc 0x20a00000 0x20e00000 \0"
+#define MC_INIT_CMD					\
+	"mcinitcmd=sf probe 0:0; "			\
+	"sf read 0x80640000 0x640000 0x80000; "		\
+	"env exists secureboot && "			\
+	"esbc_validate 0x80640000 && "			\
+	"esbc_validate 0x80680000; "			\
+	"sf read 0x80a00000 0xa00000 0x300000; "	\
+	"sf read 0x80e00000 0xe00000 0x100000; "	\
+	"fsl_mc start mc 0x80a00000 0x80e00000 \0"
 #elif defined(CONFIG_SD_BOOT)
 #define MC_INIT_CMD                             \
 	"mcinitcmd=mmcinfo;mmc read 0x80000000 0x5000 0x800;" \
--
Quoted 1 line

2.7.4

Please confirm if you tested this change for both secure and non-secure boot Regards
Priyanka