arm64: synquacer: DeveloperBox updates
Subsystems (2)
cover arm64: synquacer: DeveloperBox updates
Hi,
Here is the series of patches to update the DeveloperBox support.
[1/6] board: synquacer: Initialize SCBM SMMU at board_init()
- This is a driver cleanup, split the SMMU setup from the driver.
[2/6] configs: synquacer: Make U-Boot binary position independent
- This makes U-Boot position independent for usability.
[3/6] dts: synquacer: Add partition information to the spi-nor [4/6] configs: synquacer: Remove mtdparts settings and update DFU setting
- These are the fixes according to the MTD subsystem update. (Thanks Marek!)
[5/6] configs: synquacer: Drop Ext2/4 support by default [6/6] configs: synquacer: Enable UEFI secure boot
- These are making U-Boot more likely to EDK2 behaviors.
Thank you,
---
Masami Hiramatsu (6):
board: synquacer: Initialize SCBM SMMU at board_init()
configs: synquacer: Make U-Boot binary position independent
dts: synquacer: Add partition information to the spi-nor
configs: synquacer: Remove mtdparts settings and update DFU setting
configs: synquacer: Drop Ext2/4 support by default
configs: synquacer: Enable UEFI secure boot
.../dts/synquacer-sc2a11-developerbox-u-boot.dtsi | 42 ++++++++++++++++++++ board/socionext/developerbox/developerbox.c | 15 +++++++ configs/synquacer_developerbox_defconfig | 9 ++-- drivers/net/sni_netsec.c | 7 --- include/configs/synquacer.h | 2 - 5 files changed, 62 insertions(+), 13 deletions(-)
--
Masami Hiramatsu <[email protected]>
PATCH 1/6 board: synquacer: Initialize SCBM SMMU at board_init()
Since the SCBM SMMU is not only connected to the NETSEC but also shared with the F_SDH30 (eMMC controller), that should be initialized at board level instead of NETSEC.
Move the SMMU initialization code into board support and call it from board_init().
Without this fix, if the NETSEC is disabled, the Linux eMMC ADMA cause an error because SMMU is not initialized.
--- board/socionext/developerbox/developerbox.c | 15 +++++++++++++++ drivers/net/sni_netsec.c | 7 ------- 2 files changed, 15 insertions(+), 7 deletions(-)
board/socionext/developerbox/developerbox.c +15 -0
@@ -62,6 +62,19 @@ DECLARE_GLOBAL_DATA_PTR;#define LOAD_OFFSET 0x100 +/* SCBM System MMU is used for eMMC and NETSEC */ +#define SCBM_SMMU_ADDR (0x52e00000UL) +#define SMMU_SCR0_OFFS (0x0) +#define SMMU_SCR0_SHCFG_INNER (0x2 << 22) +#define SMMU_SCR0_MTCFG (0x1 << 20) +#define SMMU_SCR0_MEMATTR_INNER_OUTER_WB (0xf << 16) + +static void synquacer_setup_scbm_smmu (void ) +{ +writel (SMMU_SCR0_SHCFG_INNER |SMMU_SCR0_MTCFG |SMMU_SCR0_MEMATTR_INNER_OUTER_WB , +SCBM_SMMU_ADDR +SMMU_SCR0_OFFS ); +} +/* * Miscellaneous platform dependent initialisations */
@@ -71,6 +84,8 @@ int board_init(void) gd->env_addr = (ulong)&default_environment[0 ]; +synquacer_setup_scbm_smmu (); +return 0 ; }
drivers/net/sni_netsec.c +0 -7
@@ -1059,18 +1059,11 @@ static int netsec_of_to_plat(struct udevice *dev)return 0 ; } -#define SMMU_SCR0_SHCFG_INNER (0x2 << 22) -#define SMMU_SCR0_MTCFG (0x1 << 20) -#define SMMU_SCR0_MEMATTR_INNER_OUTER_WB (0xf << 16) -static int netsec_probe (struct udevice *dev) {struct netsec_priv *priv =dev_get_priv (dev);int ret; -writel (SMMU_SCR0_SHCFG_INNER |SMMU_SCR0_MTCFG |SMMU_SCR0_MEMATTR_INNER_OUTER_WB , - (phys_addr_t )0x52E00000 ); -netsec_reset_hardware (priv, true); ret =netsec_mdiobus_init (priv, dev->name);
PATCH 2/6 configs: synquacer: Make U-Boot binary position independent
In reply to Masami HiramatsuMake the U-Boot bianry for SynQuacer position independent so that the previous bootloader (SCP firmware or BL2) can load the U-Boot anywhere.
--- configs/synquacer_developerbox_defconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
configs/synquacer_developerbox_defconfig +3 -1
@@ -1,11 +1,13 @@ CONFIG_ARM=y CONFIG_ARCH_SYNQUACER=y -CONFIG_SYS_TEXT_BASE=0x08200000 +CONFIG_SYS_TEXT_BASE=0x00000000 CONFIG_ENV_SIZE=0x30000 CONFIG_ENV_OFFSET=0x300000 CONFIG_DEBUG_UART_BASE=0x2a400000 CONFIG_DEBUG_UART_CLOCK=62500000 CONFIG_ENV_SECT_SIZE=0x10000 +CONFIG_POSITION_INDEPENDENT=y +CONFIG_INIT_SP_RELATIVE=y CONFIG_DM_GPIO=y CONFIG_TARGET_DEVELOPERBOX=y CONFIG_DEFAULT_DEVICE_TREE="synquacer-sc2a11-developerbox"
Re: [PATCH 2/6] configs: synquacer: Make U-Boot binary position independent
Quoted 1 line · On Fri, 9 Jul 2021 19:50:18 +0900 Masami Hiramatsu…
Make the U-Boot bianry for SynQuacer position independent so
*binary
Re: [PATCH 2/6] configs: synquacer: Make U-Boot binary position independent
Hi Marek,
2021年7月9日(金) 19:52 Marek Behún <[email protected]>:
Quoted 6 lines
Quoted 1 line · On Fri, 9 Jul 2021 19:50:18 +0900 Masami Hiramatsu…
Make the U-Boot bianry for SynQuacer position independent so
*binary
OK, let me update the series. (with updating the devicetree)
Thank you,
Signature · 1 line
Masami Hiramatsu
PATCH 3/6 dts: synquacer: Add partition information to the spi-nor
In reply to Masami HiramatsuAdd partition information to the spi-nor flash. This is required for accessing NOR flash via mtdparts.
--- .../dts/synquacer-sc2a11-developerbox-u-boot.dtsi | 42 ++++++++++++++++++++ 1 file changed, 42 insertions(+)
arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi +42 -0
@@ -31,6 +31,48 @@ spi-max-frequency = <31250000>; spi-rx-bus-width = <0x1>; spi-tx-bus-width = <0x1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BootStrap-BL1"; + reg = <0x0 0x70000>; + read-only; + }; + partition@70000 { + label = "Flash-Writer"; + reg = <0x70000 0x90000>; + read-only; + }; + partition@100000 { + label = "SCP-BL2"; + reg = <0x100000 0x80000>; + read-only; + }; + partition@180000 { + label = "FIP-TFA"; + reg = <0x180000 0x78000>; + }; + partition@1f8000 { + label = "Stage2Tables"; + reg = <0x1f8000 0x8000>; + }; + partition@200000 { + label = "U-Boot"; + reg = <0x200000 0x100000>; + }; + partition@300000 { + label = "UBoot-Env"; + reg = <0x300000 0x100000>; + }; + partition@500000 { + label = "Ex-OPTEE"; + reg = <0x500000 0x200000>; + }; + }; }; };
Re: [PATCH 3/6] dts: synquacer: Add partition information to the spi-nor
Quoted 52 lines · On Fri, 9 Jul 2021 19:50:27 +0900 Masami Hiramatsu…
Add partition information to the spi-nor flash. This is required for accessing NOR flash via mtdparts.
Signed-off-by Masami Hiramatsu <[email protected]>--- .../dts/synquacer-sc2a11-developerbox-u-boot.dtsi | 42++++++++++++++++++++ 1 file changed, 42 insertions(+)
(quoted diff) +0
-0
b/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsiindex2f13a42235..245ebcda01100644 ---a/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi+++b/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi@@ -31,6 +31,48 @@ spi-max-frequency = <31250000>;arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi +34
-0spi-rx-bus-width = <0x1>; spi-tx-bus-width = <0x1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BootStrap-BL1"; + reg = <0x0 0x70000>; + read-only; + }; + partition@70000 { + label = "Flash-Writer"; + reg = <0x70000 0x90000>; + read-only; + }; + partition@100000 { + label = "SCP-BL2"; + reg = <0x100000 0x80000>; + read-only; + }; + partition@180000 { + label = "FIP-TFA"; + reg = <0x180000 0x78000>; + }; + partition@1f8000 { + label = "Stage2Tables"; + reg = <0x1f8000 0x8000>; + }; + partition@200000 { + label = "U-Boot"; + reg = <0x200000 0x100000>; + }; + partition@300000 {
arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi line 77
Quoted 10 lines
arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi +8
-0+ label = "UBoot-Env"; + reg = <0x300000 0x100000>; + }; + partition@500000 { + label = "Ex-OPTEE"; + reg = <0x500000 0x200000>; + }; + }; }; };
Just a style hint: the individual partition nodes should be IMO separated by an additional newline character, i.e.:
partition@0 {
label = "BootStrap-BL1";
reg = <0x0 0x70000>;
read-only;
};
partition@70000 {
label = "Flash-Writer";
reg = <0x70000 0x90000>;
read-only;
};
partition@100000 {
label = "SCP-BL2";
reg = <0x100000 0x80000>;
read-only;
};Other than that:
Btw, did you test this? Does this work correctly with mtd command?
Re: [PATCH 3/6] dts: synquacer: Add partition information to the spi-nor
Hi Marek,
2021年7月9日(金) 19:54 Marek Behún <[email protected]>:
Quoted 61 lines
Quoted 57 lines · On Fri, 9 Jul 2021 19:50:27 +0900 Masami Hiramatsu…
Add partition information to the spi-nor flash. This is required for accessing NOR flash via mtdparts.
Signed-off-by Masami Hiramatsu <[email protected]>--- .../dts/synquacer-sc2a11-developerbox-u-boot.dtsi | 42++++++++++++++++++++ 1 file changed, 42 insertions(+)
(quoted diff) +0
-0
b/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsiindex2f13a42235..245ebcda01100644 ---a/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi+++b/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi@@ -31,6+31,48 @@ spi-max-frequency = <31250000>; spi-rx-bus-width = <0x1>; spi-tx-bus-width = <0x1>;arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi +41
-0+ + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BootStrap-BL1"; + reg = <0x0 0x70000>; + read-only; + }; + partition@70000 { + label = "Flash-Writer"; + reg = <0x70000 0x90000>; + read-only; + }; + partition@100000 { + label = "SCP-BL2"; + reg = <0x100000 0x80000>; + read-only; + }; + partition@180000 { + label = "FIP-TFA"; + reg = <0x180000 0x78000>; + }; + partition@1f8000 { + label = "Stage2Tables"; + reg = <0x1f8000 0x8000>; + }; + partition@200000 { + label = "U-Boot"; + reg = <0x200000 0x100000>; + }; + partition@300000 { + label = "UBoot-Env"; + reg = <0x300000 0x100000>; + }; + partition@500000 { + label = "Ex-OPTEE"; + reg = <0x500000 0x200000>; + };
Quoted 8 lines
Quoted 5 lines
+ }; }; };Just a style hint: the individual partition nodes should be IMO separated by an additional newline character, i.e.:
Ah, OK.
Quoted 19 lines
partition@0 {
label = "BootStrap-BL1";
reg = <0x0 0x70000>;
read-only;
};
partition@70000 {
label = "Flash-Writer";
reg = <0x70000 0x90000>;
read-only;
};
partition@100000 {
label = "SCP-BL2";
reg = <0x100000 0x80000>;
read-only;
};Quoted 5 lines
Other than that:
Reviewed-by Marek Behún <[email protected]>Btw, did you test this? Does this work correctly with mtd command?
Yes, I've tested that, and mtd list works. But it seems "mtd erase" commands don't work well.
See the log below;
-------
=> log level 7
=> mtd list
List of MTD devices:
* mx66u51235f
- device: spi-flash@0
- parent: spi@54800000
- driver: jedec_spi_nor
- path: /spi@54800000/spi-flash@0
- type: NOR flash
- block size: 0x1000 bytes
- min I/O: 0x1 bytes
- 0x000000000000-0x000004000000 : "mx66u51235f"
- 0x000000000000-0x000000070000 : "BootStrap-BL1"
- 0x000000070000-0x000000100000 : "Flash-Writer"
- 0x000000100000-0x000000180000 : "SCP-BL2"
- 0x000000180000-0x0000001f8000 : "FIP-TFA"
- 0x0000001f8000-0x000000200000 : "Stage2Tables"
- 0x000000200000-0x000000400000 : "EDK2"
- 0x000000400000-0x000000500000 : "EDK2-Env"
- 0x000000500000-0x000000700000 : "Ex-OPTEE"
- 0x000000700000-0x000000800000 : "UBoot-Env"
- 0x000000800000-0x000000900000 : "U-Boot"
=> mtd erase Ex-OPTEE
Erasing 0x00000000 ... 0x001fffff (512 eraseblock(s)) jedec_spi_nor spi-flash@0: at 0x500000, len 4096 => mtd dump E
EDK2 EDK2-Env Ex-OPTEE
=> mtd dump Ex-OPTEE 0 10
Reading 16 byte(s) at offset 0x00000000 jedec_spi_nor spi-flash@0: from 0x00500000, len 16
Dump 16 data bytes from 0x0:0x00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
=> mtd dump Ex-OPTEE 1000 10
Reading 16 byte(s) at offset 0x00001000 jedec_spi_nor spi-flash@0: from 0x00501000, len 16
Dump 16 data bytes from 0x1000:0x00001000: 00 00 00 14 1f 20 03 d5 1f 20 03 d5 1f 20 03 d5
=>
-------
So it seems first 4k block is cleared, but other blocks are not erased. I think that is not a devicetree issue, but mtd subsystem issue.
Thank you,
Signature · 1 line
Masami Hiramatsu
Re: [PATCH 3/6] dts: synquacer: Add partition information to the spi-nor
Quoted 142 lines · On Fri, 9 Jul 2021 20:27:18 +0900 Masami Hiramatsu…
Hi Marek,
2021年7月9日(金) 19:54 Marek Behún <[email protected]>:
Quoted 61 lines
Quoted 57 lines · On Fri, 9 Jul 2021 19:50:27 +0900 Masami Hiramatsu…
Add partition information to the spi-nor flash. This is required for accessing NOR flash via mtdparts.
Signed-off-by Masami Hiramatsu <[email protected]>--- .../dts/synquacer-sc2a11-developerbox-u-boot.dtsi | 42++++++++++++++++++++ 1 file changed, 42 insertions(+)
diff --git
a/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsib/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsiindex2f13a42235..245ebcda01100644 ---a/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi+++b/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi@@ -31,6 +31,48 @@ spi-max-frequency = <31250000>; spi-rx-bus-width = <0x1>; spi-tx-bus-width = <0x1>;arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi +41
-0+ + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BootStrap-BL1"; + reg = <0x0 0x70000>; + read-only; + }; + partition@70000 { + label = "Flash-Writer"; + reg = <0x70000 0x90000>; + read-only; + }; + partition@100000 { + label = "SCP-BL2"; + reg = <0x100000 0x80000>; + read-only; + }; + partition@180000 { + label = "FIP-TFA"; + reg = <0x180000 0x78000>; + }; + partition@1f8000 { + label = "Stage2Tables"; + reg = <0x1f8000 0x8000>; + }; + partition@200000 { + label = "U-Boot"; + reg = <0x200000 0x100000>; + }; + partition@300000 { + label = "UBoot-Env"; + reg = <0x300000 0x100000>; + }; + partition@500000 { + label = "Ex-OPTEE"; + reg = <0x500000 0x200000>; + };Quoted 8 lines
Quoted 5 lines
+ }; }; };Just a style hint: the individual partition nodes should be IMO separated by an additional newline character, i.e.:
Ah, OK.
Quoted 19 lines
partition@0 { label = "BootStrap-BL1"; reg = <0x0 0x70000>; read-only; }; partition@70000 { label = "Flash-Writer"; reg = <0x70000 0x90000>; read-only; }; partition@100000 { label = "SCP-BL2"; reg = <0x100000 0x80000>; read-only; };Quoted 5 lines
Other than that:
Reviewed-by Marek Behún <[email protected]>Btw, did you test this? Does this work correctly with mtd command?
Yes, I've tested that, and mtd list works. But it seems "mtd erase" commands don't work well.
See the log below;-------
=> log level 7
=> mtd list
List of MTD devices:
* mx66u51235f
- device: spi-flash@0
- parent: spi@54800000
- driver:jedec_spi_nor
- path: /spi@54800000/spi-flash@0
- type: NOR flash
- block size:0x1000bytes
- min I/O:0x1bytes
- 0x000000000000-0x000004000000 : "mx66u51235f"
- 0x000000000000-0x000000070000 : "BootStrap-BL1"
- 0x000000070000-0x000000100000 : "Flash-Writer"
- 0x000000100000-0x000000180000 : "SCP-BL2"
- 0x000000180000-0x0000001f8000 : "FIP-TFA"
- 0x0000001f8000-0x000000200000 : "Stage2Tables"
- 0x000000200000-0x000000400000 : "EDK2"
- 0x000000400000-0x000000500000 : "EDK2-Env"
- 0x000000500000-0x000000700000 : "Ex-OPTEE"
- 0x000000700000-0x000000800000 : "UBoot-Env"
- 0x000000800000-0x000000900000 : "U-Boot"
=> mtd erase Ex-OPTEE
Erasing0x00000000...0x001fffff(512 eraseblock(s))jedec_spi_norspi-flash@0: at0x500000, len 4096 => mtd dump E
EDK2 EDK2-Env Ex-OPTEE
=> mtd dump Ex-OPTEE 0 10
Reading 16 byte(s) at offset0x00000000jedec_spi_norspi-flash@0: from0x00500000, len 16Dump 16 data bytes from
0x0:0x00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
=> mtd dump Ex-OPTEE 1000 10
Reading 16 byte(s) at offset0x00001000jedec_spi_norspi-flash@0: from0x00501000, len 16
Quoted 8 lines
Dump 16 data bytes from
0x1000:0x00001000: 00 00 00 14 1f 20 03 d5 1f 20 03 d5 1f 20 03 d5
=>
-------So it seems first 4k block is cleared, but other blocks are not erased. I think that is not a devicetree issue, but mtd subsystem issue.
Can reproduce, going to look into this.
Marek
PATCH 4/6 configs: synquacer: Remove mtdparts settings and update DFU setting
In reply to Masami HiramatsuSince MTD partitions are based on the devicetree name, remove unneeded mtdparts settings and update DFU setting.
--- configs/synquacer_developerbox_defconfig | 2 -- include/configs/synquacer.h | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-)
configs/synquacer_developerbox_defconfig +0 -2
@@ -45,8 +45,6 @@ CONFIG_CMD_EXT2=y CONFIG_CMD_EXT4=y CONFIG_CMD_FAT=y CONFIG_CMD_MTDPARTS=y -CONFIG_MTDPARTS_DEFAULT="nor1:448k(BootStrap-BL1),576k(Flash-Writer),512k(SCP-BL2),480k(FIP-TFA),32k(Stg2-Tables),1m@2m(U-Boot),1m@3m(UBoot-Env),2m@5m(Ex-OPTEE)" -CONFIG_MTDIDS_DEFAULT="nor1=nor1" CONFIG_CMD_LOG=y CONFIG_PARTITION_TYPE_GUID=y CONFIG_EFI_PARTITION=y
include/configs/synquacer.h +1 -1
@@ -62,7 +62,7 @@/* #define CONFIG_SYS_PCI_64BIT 1 */ #define DEFAULT_DFU_ALT_INFO "dfu_alt_info=" \ - "mtd nor1=u-boot.bin raw 200000 100000;" \ + "mtd mx66u51235f=u-boot.bin raw 200000 100000;" \ "fip.bin raw 180000 78000;" \ "optee.bin raw 500000 100000\0"
PATCH 5/6 configs: synquacer: Drop Ext2/4 support by default
In reply to Masami HiramatsuSince the U-Boot for the SynQuacer DeveloperBox is designed for compatible with EDK2 boot, we don't need to support Ext2/4 fs support by default. Drop it.
--- configs/synquacer_developerbox_defconfig | 2 -- 1 file changed, 2 deletions(-)
configs/synquacer_developerbox_defconfig +0 -2
@@ -41,8 +41,6 @@ CONFIG_CMD_SATA=y CONFIG_CMD_NVME=y CONFIG_CMD_USB=y CONFIG_CMD_FS_GENERIC=y -CONFIG_CMD_EXT2=y -CONFIG_CMD_EXT4=y CONFIG_CMD_FAT=y CONFIG_CMD_MTDPARTS=y CONFIG_CMD_LOG=y
PATCH 6/6 configs: synquacer: Enable UEFI secure boot
In reply to Masami HiramatsuEnable UEFI secure boot on synquacer. Note that unless user setup their keys, the secure boot will not work.
--- configs/synquacer_developerbox_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/synquacer_developerbox_defconfig +1 -0
@@ -115,6 +115,7 @@ CONFIG_EFI_CAPSULE_FIRMWARE=y CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y CONFIG_EFI_CAPSULE_FMP_HEADER=y +CONFIG_EFI_SECURE_BOOT=y CONFIG_FLASH_CFI_MTD=y CONFIG_CMD_DFU=y CONFIG_DFU_TFTP=y