[PATCH v1 00/12] powerpc: mpc85xx: fixes and updates for socrates board

Patchseries is based on 53c47c59e6: ("Merge tag 'dm-pull-18jan23' of https://source.denx.de/u-boot/custodians/u-boot-dm")
It brings back socrates board working with current mainline, and adds also some small updates:
- newer U-Boot needs more space in Flash, so set new textbase. adapt default environment - remove Flash on CS1 as not used anymore - support MTDPARTS - add boot retry feature - add support for i2c eeprom - add autbootdelay string - enable protected environement - enable signed fit images boot see thread: https://lists.denx.de/pipermail/u-boot/2023-January/504249.html
commit bcc85b96b5ff: ("cmd: source: Support specifying config name")
fixes this problem for me!
patch 0002-powerpc-mpc85xx-socrates-rework-socrates-build-proce.patch is a combination of patches from Pali http://patchwork.ozlabs.org/project/uboot/patch/20221228200437.30971-1-pali@... http://patchwork.ozlabs.org/project/uboot/patch/20221228200437.30971-2-pali@...
which is a base for patch 0003-powerpc-mpc85xx-drop-socrates-specific-image-creatio.patch which drops socrates board specific image creation and uses standard mpc85xx way by enabling MPC85XX_HAVE_RESET_VECTOR, drop CONFIG_OF_BOARD and use common u-boot.dtsi, so no specials anymore for this board.
azure build: https://dev.azure.com/hs0298/hs/_build/results?buildId=99&view=results
Heiko Schocher (12): powerpc/mpc85xx: fixes and updates for socrates board powerpc/mpc85xx: socrates: rework build process powerpc/mpc85xx: drop socrates specific image creation powerpc: dts: updates socrates board powerpc/mpc85xx: socrates: add MTD partitioning support powerpc/mpc85xx: socrates: add initrd_high default environment variable powerpc/mpc85xx: socrates: drop second flash bank powerpc/mpc85xx: socrates: Add boot retry feature powerpc/mpc85xx: socrates: add support for i2c eeprom at 0x51 powerpc/mpc85xx: socrates: add autoboot delay string powerpc/mpc85xx: socrates: enable protected Environment powerpc/mpc85xx: socrates: enable signed fitImages
Makefile | 11 +++-- arch/powerpc/dts/socrates-u-boot.dtsi | 23 ++++++----- arch/powerpc/dts/socrates.dts | 59 +++++++++++++++------------ arch/powerpc/dts/u-boot.dtsi | 2 +- board/socrates/socrates.c | 32 +++++++-------- configs/socrates_defconfig | 50 +++++++++++++++-------- include/configs/socrates.h | 25 ++++++++---- 7 files changed, 118 insertions(+), 84 deletions(-)

current mainline does not work on socrates board. To get it back up working, there are some updates needed in socrates_defconfig.
Signed-off-by: Heiko Schocher hs@denx.de Fixes: 94633c36f9eb ("net: Make DM_ETH be selected by NETDEVICE") Fixes: 2f8a6db5d83b ("Finish conversion of CONFIG_SYS_CLK_FREQ to Kconfig") ---
configs/socrates_defconfig | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/configs/socrates_defconfig b/configs/socrates_defconfig index 46be662037..ade1c79c03 100644 --- a/configs/socrates_defconfig +++ b/configs/socrates_defconfig @@ -1,10 +1,11 @@ CONFIG_PPC=y CONFIG_SYS_IMMR=0xE0000000 -CONFIG_TEXT_BASE=0xfff80000 +CONFIG_TEXT_BASE=0xfff60000 CONFIG_ENV_SIZE=0x4000 CONFIG_ENV_SECT_SIZE=0x20000 CONFIG_DEFAULT_DEVICE_TREE="socrates" -CONFIG_ENV_ADDR=0xFFF40000 +CONFIG_SYS_CLK_FREQ=66666666 +CONFIG_ENV_ADDR=0xFFF20000 # CONFIG_SYS_PCI_64BIT is not set CONFIG_MPC85xx=y CONFIG_SYS_INIT_RAM_LOCK=y @@ -12,11 +13,11 @@ CONFIG_SYS_INIT_RAM_LOCK=y CONFIG_TARGET_SOCRATES=y CONFIG_L2_CACHE=y CONFIG_ENABLE_36BIT_PHYS=y -CONFIG_SYS_MONITOR_LEN=393216 +CONFIG_SYS_MONITOR_LEN=786432 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y -CONFIG_SYS_MONITOR_BASE=0xFFF80000 +CONFIG_SYS_MONITOR_BASE=0xFFF60000 CONFIG_BOOTDELAY=1 CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="run boot_nor" @@ -53,11 +54,12 @@ CONFIG_CMD_SNTP=y CONFIG_CMD_EXT2=y # CONFIG_CMD_IRQ is not set CONFIG_OF_CONTROL=y +CONFIG_OF_BOARD=y CONFIG_ENV_IS_IN_FLASH=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y -CONFIG_ENV_ADDR_REDUND=0xFFF20000 +CONFIG_ENV_ADDR_REDUND=0xFFF00000 CONFIG_USE_ETHPRIME=y -CONFIG_ETHPRIME="TSEC0" +CONFIG_ETHPRIME="eTSEC0" CONFIG_SPD_EEPROM=y CONFIG_CHIP_SELECTS_PER_CTRL=2 CONFIG_SYS_BR0_PRELIM_BOOL=y @@ -84,15 +86,12 @@ CONFIG_SYS_FLASH_QUIET_TEST=y CONFIG_SYS_MAX_FLASH_SECT=256 CONFIG_SYS_MAX_FLASH_BANKS=2 CONFIG_MTD_RAW_NAND=y -CONFIG_PHY_ATHEROS=y -CONFIG_PHY_BROADCOM=y -CONFIG_PHY_DAVICOM=y CONFIG_PHY_LXT=y CONFIG_PHY_MARVELL=y CONFIG_PHY_NATSEMI=y -CONFIG_PHY_REALTEK=y -CONFIG_PHY_SMSC=y -CONFIG_PHY_VITESSE=y +CONFIG_DM_MDIO=y +CONFIG_PHY_GIGE=y +CONFIG_RGMII=y CONFIG_MII=y CONFIG_TSEC_ENET=y CONFIG_PCI_MPC85XX=y

On Tue, Jan 24, 2023 at 06:06:49PM +0100, Heiko Schocher wrote:
current mainline does not work on socrates board. To get it back up working, there are some updates needed in socrates_defconfig.
Signed-off-by: Heiko Schocher hs@denx.de Fixes: 94633c36f9eb ("net: Make DM_ETH be selected by NETDEVICE") Fixes: 2f8a6db5d83b ("Finish conversion of CONFIG_SYS_CLK_FREQ to Kconfig")
Applied to u-boot/master, thanks!

U-Boot build process for socrates board produces final U-Boot binary in file u-boot-socrates.bin (by binman) And as a bonus it produces two unusable broken binaries u-boot-dtb.bin and u-boot.bin (by Makefile).
Clean this up, so final U-Boot binary is in u-boot-dtb.bin
Signed-off-by: Pali Rohár pali@kernel.org Signed-off-by: Heiko Schocher hs@denx.de ---
Makefile | 11 +++++++---- arch/powerpc/dts/socrates-u-boot.dtsi | 4 ++-- arch/powerpc/dts/u-boot.dtsi | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile index eb354c045c..3472b59920 100644 --- a/Makefile +++ b/Makefile @@ -1190,19 +1190,22 @@ endif u-boot.bin: u-boot-fit-dtb.bin FORCE $(call if_changed,copy)
+ifneq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy) u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE $(call if_changed,cat) +endif
else ifeq ($(CONFIG_OF_SEPARATE).$(CONFIG_OF_OMIT_DTB),y.) + +ifneq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy) u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE $(call if_changed,cat) +endif
-ifneq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy) u-boot.bin: u-boot-dtb.bin FORCE $(call if_changed,copy) -endif
-else ifneq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy) +else u-boot.bin: u-boot-nodtb.bin FORCE $(call if_changed,copy) endif @@ -1580,7 +1583,7 @@ u-boot-with-nand-spl.sfp: u-boot-spl-padx4.sfp u-boot.img FORCE endif
ifeq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy) -u-boot.bin: u-boot-nodtb.bin u-boot.dtb u-boot-br.bin FORCE +u-boot-dtb.bin: u-boot-nodtb.bin u-boot.dtb u-boot-br.bin FORCE $(call if_changed,binman)
OBJCOPYFLAGS_u-boot-br.bin := -O binary -j .bootpg -j .resetvec diff --git a/arch/powerpc/dts/socrates-u-boot.dtsi b/arch/powerpc/dts/socrates-u-boot.dtsi index 14a7c245dc..f6af611b51 100644 --- a/arch/powerpc/dts/socrates-u-boot.dtsi +++ b/arch/powerpc/dts/socrates-u-boot.dtsi @@ -5,11 +5,11 @@ */ / { binman { - filename = "u-boot-socrates.bin"; + filename = "u-boot-dtb.bin"; pad-byte = <0xff>; // Place dtb one sector before u-boot-nodtb.bin blob { - filename = "dts/dt.dtb"; + filename = "u-boot.dtb"; }; u-boot-nodtb { filename = "u-boot-nodtb.bin"; diff --git a/arch/powerpc/dts/u-boot.dtsi b/arch/powerpc/dts/u-boot.dtsi index 6b7375cff2..c39ab6f0ca 100644 --- a/arch/powerpc/dts/u-boot.dtsi +++ b/arch/powerpc/dts/u-boot.dtsi @@ -9,7 +9,7 @@
/ { binman { - filename = "u-boot.bin"; + filename = "u-boot-dtb.bin"; skip-at-start = <CONFIG_TEXT_BASE>; sort-by-offset; pad-byte = <0xff>;

On Tue, Jan 24, 2023 at 06:06:50PM +0100, Heiko Schocher wrote:
U-Boot build process for socrates board produces final U-Boot binary in file u-boot-socrates.bin (by binman) And as a bonus it produces two unusable broken binaries u-boot-dtb.bin and u-boot.bin (by Makefile).
Clean this up, so final U-Boot binary is in u-boot-dtb.bin
Signed-off-by: Pali Rohár pali@kernel.org Signed-off-by: Heiko Schocher hs@denx.de
Applied to u-boot/master, thanks!

convert socrates board to use MPC85XX_HAVE_RESET_VECTOR and disable CONFIG_OF_BOARD and use common u-boot.dtsi for creating u-boot-dtb.bin.
Signed-off-by: Heiko Schocher hs@denx.de ---
arch/powerpc/dts/socrates-u-boot.dtsi | 17 ++++------------- board/socrates/socrates.c | 17 ----------------- configs/socrates_defconfig | 6 +++--- 3 files changed, 7 insertions(+), 33 deletions(-)
diff --git a/arch/powerpc/dts/socrates-u-boot.dtsi b/arch/powerpc/dts/socrates-u-boot.dtsi index f6af611b51..67c12f672c 100644 --- a/arch/powerpc/dts/socrates-u-boot.dtsi +++ b/arch/powerpc/dts/socrates-u-boot.dtsi @@ -3,20 +3,9 @@ * Copyright (C) 2019 * Heiko Schocher, DENX Software Engineering, hs@denx.de */ -/ { - binman { - filename = "u-boot-dtb.bin"; - pad-byte = <0xff>; - // Place dtb one sector before u-boot-nodtb.bin - blob { - filename = "u-boot.dtb"; - }; - u-boot-nodtb { - filename = "u-boot-nodtb.bin"; - offset = <0x20000>; - }; - }; +#include <config.h>
+/ { chosen { stdout-path = &serial0; }; @@ -38,3 +27,5 @@ u-boot,dm-pre-reloc; clock-frequency = <333333330>; }; + +#include "u-boot.dtsi" diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c index 9c4dd186fc..1d63c81a9c 100644 --- a/board/socrates/socrates.c +++ b/board/socrates/socrates.c @@ -217,23 +217,6 @@ int ft_board_setup(void *blob, struct bd_info *bd) } #endif /* CONFIG_OF_BOARD_SETUP */
-#if defined(CONFIG_OF_SEPARATE) -void *board_fdt_blob_setup(int *err) -{ - void *fw_dtb; - - *err = 0; - fw_dtb = (void *)(CONFIG_TEXT_BASE - CONFIG_ENV_SECT_SIZE); - if (fdt_magic(fw_dtb) != FDT_MAGIC) { - printf("DTB is not passed via %x\n", (u32)fw_dtb); - *err = -ENXIO; - return NULL; - } - - return fw_dtb; -} -#endif - int get_serial_clock(void) { return 333333330; diff --git a/configs/socrates_defconfig b/configs/socrates_defconfig index ade1c79c03..03e84c3e7e 100644 --- a/configs/socrates_defconfig +++ b/configs/socrates_defconfig @@ -1,6 +1,6 @@ CONFIG_PPC=y CONFIG_SYS_IMMR=0xE0000000 -CONFIG_TEXT_BASE=0xfff60000 +CONFIG_TEXT_BASE=0xFFF40000 CONFIG_ENV_SIZE=0x4000 CONFIG_ENV_SECT_SIZE=0x20000 CONFIG_DEFAULT_DEVICE_TREE="socrates" @@ -11,13 +11,14 @@ CONFIG_MPC85xx=y CONFIG_SYS_INIT_RAM_LOCK=y # CONFIG_CMD_ERRATA is not set CONFIG_TARGET_SOCRATES=y +CONFIG_MPC85XX_HAVE_RESET_VECTOR=y CONFIG_L2_CACHE=y CONFIG_ENABLE_36BIT_PHYS=y CONFIG_SYS_MONITOR_LEN=786432 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y -CONFIG_SYS_MONITOR_BASE=0xFFF60000 +CONFIG_SYS_MONITOR_BASE=0xFFF40000 CONFIG_BOOTDELAY=1 CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="run boot_nor" @@ -54,7 +55,6 @@ CONFIG_CMD_SNTP=y CONFIG_CMD_EXT2=y # CONFIG_CMD_IRQ is not set CONFIG_OF_CONTROL=y -CONFIG_OF_BOARD=y CONFIG_ENV_IS_IN_FLASH=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_ENV_ADDR_REDUND=0xFFF00000

On Tue, Jan 24, 2023 at 06:06:51PM +0100, Heiko Schocher wrote:
convert socrates board to use MPC85XX_HAVE_RESET_VECTOR and disable CONFIG_OF_BOARD and use common u-boot.dtsi for creating u-boot-dtb.bin.
Signed-off-by: Heiko Schocher hs@denx.de
Applied to u-boot/master, thanks!

include common e500v2_power_isa.dtsi and rearrange some nodes.
Signed-off-by: Heiko Schocher hs@denx.de ---
arch/powerpc/dts/socrates.dts | 59 +++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 27 deletions(-)
diff --git a/arch/powerpc/dts/socrates.dts b/arch/powerpc/dts/socrates.dts index 452cf58b5e..ea75eb6af3 100644 --- a/arch/powerpc/dts/socrates.dts +++ b/arch/powerpc/dts/socrates.dts @@ -9,6 +9,8 @@
/dts-v1/;
+/include/ "e500v2_power_isa.dtsi" + / { model = "abb,socrates"; compatible = "abb,socrates"; @@ -142,26 +144,29 @@ phy-handle = <&phy0>; tbi-handle = <&tbi0>; phy-connection-type = "rgmii-id"; + };
- mdio@520 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "fsl,gianfar-mdio"; - reg = <0x520 0x20>; - - phy0: ethernet-phy@0 { - interrupt-parent = <&mpic>; - interrupts = <0 1>; - reg = <0>; - }; - phy1: ethernet-phy@1 { - interrupt-parent = <&mpic>; - interrupts = <0 1>; - reg = <1>; - }; - tbi0: tbi-phy@11 { - reg = <0x11>; - }; + mdio@24520 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,gianfar-mdio"; + reg = <0x24520 0x20>; + + phy0: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + interrupt-parent = <&mpic>; + interrupts = <0 1>; + reg = <0>; + }; + + phy1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + interrupt-parent = <&mpic>; + interrupts = <0 1>; + reg = <1>; + }; + tbi0: tbi-phy@11 { + reg = <0x11>; }; };
@@ -180,16 +185,16 @@ phy-handle = <&phy1>; tbi-handle = <&tbi1>; phy-connection-type = "rgmii-id"; + };
- mdio@520 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "fsl,gianfar-tbi"; - reg = <0x520 0x20>; + mdio@26520 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,gianfar-tbi"; + reg = <0x26520 0x20>;
- tbi1: tbi-phy@11 { - reg = <0x11>; - }; + tbi1: tbi-phy@11 { + reg = <0x11>; }; };

On Tue, Jan 24, 2023 at 06:06:52PM +0100, Heiko Schocher wrote:
include common e500v2_power_isa.dtsi and rearrange some nodes.
Signed-off-by: Heiko Schocher hs@denx.de
Applied to u-boot/master, thanks!

setup MTD partitioning through mtdparts variable and set it to:
mtdparts=fe0000000.nor:13312k(system1),13312k(system2),5120k(data),128k(env),128k(env-red),768k(u-boot)
and pass this to linux per kernel commandline.
Signed-off-by: Heiko Schocher hs@denx.de ---
configs/socrates_defconfig | 5 +++++ include/configs/socrates.h | 17 +++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/configs/socrates_defconfig b/configs/socrates_defconfig index 03e84c3e7e..17c12aed7d 100644 --- a/configs/socrates_defconfig +++ b/configs/socrates_defconfig @@ -53,6 +53,9 @@ CONFIG_CMD_PING=y CONFIG_CMD_SNTP=y # CONFIG_CMD_HASH is not set CONFIG_CMD_EXT2=y +CONFIG_CMD_MTDPARTS=y +CONFIG_MTDIDS_DEFAULT="nor0=fe000000.nor_flash,nand0=socrates_nand" +CONFIG_MTDPARTS_DEFAULT="mtdparts=fe000000.nor_flash:13312k(system1),13312k(system2),5120k(data),128k(env),128k(env-red),768k(u-boot);socrates_nand:256M(ubi-data1),-(ubi-data2)" # CONFIG_CMD_IRQ is not set CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_FLASH=y @@ -78,9 +81,11 @@ CONFIG_DM_I2C=y CONFIG_SYS_I2C_FSL=y # CONFIG_MMC is not set CONFIG_MTD=y +CONFIG_DM_MTD=y CONFIG_MTD_NOR_FLASH=y CONFIG_FLASH_CFI_DRIVER=y CONFIG_FLASH_SHOW_PROGRESS=0 +CONFIG_FLASH_CFI_MTD=y CONFIG_SYS_FLASH_CFI=y CONFIG_SYS_FLASH_QUIET_TEST=y CONFIG_SYS_MAX_FLASH_SECT=256 diff --git a/include/configs/socrates.h b/include/configs/socrates.h index 2b35be83ec..67ff370e05 100644 --- a/include/configs/socrates.h +++ b/include/configs/socrates.h @@ -110,6 +110,10 @@ */ #define CFG_SYS_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */
+#define SOCRATES_ENV_MTD \ + "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \ + "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \ + "addmtd=setenv bootargs ${bootargs} ${mtdparts}\0"
#define CFG_EXTRA_ENV_SETTINGS \ "netdev=eth0\0" \ @@ -118,7 +122,7 @@ "bootfile=/home/tftp/syscon3/uImage\0" \ "fdt_file=/home/tftp/syscon3/socrates.dtb\0" \ "initrd_file=/home/tftp/syscon3/uinitrd.gz\0" \ - "uboot_addr=FFF60000\0" \ + "uboot_addr=FFF40000\0" \ "kernel_addr=FE000000\0" \ "fdt_addr=FE1E0000\0" \ "ramdisk_addr=FE200000\0" \ @@ -134,16 +138,16 @@ "addip=setenv bootargs $bootargs " \ "ip=$ipaddr:$serverip:$gatewayip:$netmask" \ ":$hostname:$netdev:off panic=1\0" \ - "boot_nor=run ramargs addcons;" \ + "boot_nor=run ramargs addcons addmtd;" \ "bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0" \ "net_nfs=tftp ${kernel_addr_r} ${bootfile}; " \ "tftp ${fdt_addr_r} ${fdt_file}; " \ - "run nfsargs addip addcons;" \ + "run nfsargs addip addcons addmtd;" \ "bootm ${kernel_addr_r} - ${fdt_addr_r}\0" \ "update_uboot=tftp 100000 ${uboot_file};" \ - "protect off fff60000 ffffffff;" \ - "era fff60000 ffffffff;" \ - "cp.b 100000 fff60000 ${filesize};" \ + "protect off ${uboot_addr} ffffffff;" \ + "era ${uboot_addr} ffffffff;" \ + "cp.b 100000 ${uboot_addr} ${filesize};" \ "setenv filesize;saveenv\0" \ "update_kernel=tftp 100000 ${bootfile};" \ "era fe000000 fe1dffff;" \ @@ -164,6 +168,7 @@ "boot_usb=run load_usb usbargs addcons;" \ "bootm ${kernel_addr_r} - ${fdt_addr};" \ "bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0" \ + SOCRATES_ENV_MTD \ ""
/* pass open firmware flat tree */

On Tue, Jan 24, 2023 at 06:06:53PM +0100, Heiko Schocher wrote:
setup MTD partitioning through mtdparts variable and set it to:
mtdparts=fe0000000.nor:13312k(system1),13312k(system2),5120k(data),128k(env),128k(env-red),768k(u-boot)
and pass this to linux per kernel commandline.
Signed-off-by: Heiko Schocher hs@denx.de
Applied to u-boot/master, thanks!

we need to set initrd_high to get fitimage booting.
Without, U-Boot drops when booting fitimage:
ERROR: Failed to allocate 0x59a0b6 bytes below 0x800000. ramdisk - allocation error bootm - boot application image from memory
Signed-off-by: Heiko Schocher hs@denx.de ---
include/configs/socrates.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/configs/socrates.h b/include/configs/socrates.h index 67ff370e05..ed1003158b 100644 --- a/include/configs/socrates.h +++ b/include/configs/socrates.h @@ -118,6 +118,7 @@ #define CFG_EXTRA_ENV_SETTINGS \ "netdev=eth0\0" \ "consdev=ttyS0\0" \ + "initrd_high=0x03000000\0" \ "uboot_file=/home/tftp/syscon3/u-boot.bin\0" \ "bootfile=/home/tftp/syscon3/uImage\0" \ "fdt_file=/home/tftp/syscon3/socrates.dtb\0" \

On Tue, Jan 24, 2023 at 06:06:54PM +0100, Heiko Schocher wrote:
we need to set initrd_high to get fitimage booting.
Without, U-Boot drops when booting fitimage:
ERROR: Failed to allocate 0x59a0b6 bytes below 0x800000. ramdisk - allocation error bootm - boot application image from memory
Signed-off-by: Heiko Schocher hs@denx.de
Applied to u-boot/master, thanks!

drop second flash bank, as not used anymore.
Signed-off-by: Heiko Schocher hs@denx.de ---
configs/socrates_defconfig | 4 ---- include/configs/socrates.h | 5 ++--- 2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/configs/socrates_defconfig b/configs/socrates_defconfig index 17c12aed7d..770f37a0be 100644 --- a/configs/socrates_defconfig +++ b/configs/socrates_defconfig @@ -68,9 +68,6 @@ CONFIG_CHIP_SELECTS_PER_CTRL=2 CONFIG_SYS_BR0_PRELIM_BOOL=y CONFIG_SYS_BR0_PRELIM=0xFE001001 CONFIG_SYS_OR0_PRELIM=0xFE000030 -CONFIG_SYS_BR1_PRELIM_BOOL=y -CONFIG_SYS_BR1_PRELIM=0xFC001001 -CONFIG_SYS_OR1_PRELIM=0xFE000030 CONFIG_SYS_BR2_PRELIM_BOOL=y CONFIG_SYS_BR2_PRELIM=0xC80018A1 CONFIG_SYS_OR2_PRELIM=0xFC000000 @@ -89,7 +86,6 @@ CONFIG_FLASH_CFI_MTD=y CONFIG_SYS_FLASH_CFI=y CONFIG_SYS_FLASH_QUIET_TEST=y CONFIG_SYS_MAX_FLASH_SECT=256 -CONFIG_SYS_MAX_FLASH_BANKS=2 CONFIG_MTD_RAW_NAND=y CONFIG_PHY_LXT=y CONFIG_PHY_MARVELL=y diff --git a/include/configs/socrates.h b/include/configs/socrates.h index ed1003158b..e2afba96cd 100644 --- a/include/configs/socrates.h +++ b/include/configs/socrates.h @@ -66,10 +66,9 @@ * Flash on the LocalBus */ #define CFG_SYS_FLASH0 0xFE000000 -#define CFG_SYS_FLASH1 0xFC000000 -#define CFG_SYS_FLASH_BANKS_LIST { CFG_SYS_FLASH1, CFG_SYS_FLASH0 } +#define CFG_SYS_FLASH_BANKS_LIST { CFG_SYS_FLASH0 }
-#define CFG_SYS_LBC_FLASH_BASE CFG_SYS_FLASH1 /* Localbus flash start */ +#define CFG_SYS_LBC_FLASH_BASE CFG_SYS_FLASH0 /* Localbus flash start */ #define CFG_SYS_FLASH_BASE CFG_SYS_LBC_FLASH_BASE /* start of FLASH */
#define CFG_SYS_LBC_LCRR 0x00030004 /* LB clock ratio reg */

On Tue, Jan 24, 2023 at 06:06:55PM +0100, Heiko Schocher wrote:
drop second flash bank, as not used anymore.
Signed-off-by: Heiko Schocher hs@denx.de
Applied to u-boot/master, thanks!

add boot retry feature and reboot after 120 seconds.
Signed-off-by: Heiko Schocher hs@denx.de ---
configs/socrates_defconfig | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/configs/socrates_defconfig b/configs/socrates_defconfig index 770f37a0be..c4a3fd30d8 100644 --- a/configs/socrates_defconfig +++ b/configs/socrates_defconfig @@ -20,6 +20,9 @@ CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_SYS_MONITOR_BASE=0xFFF40000 CONFIG_BOOTDELAY=1 +CONFIG_BOOT_RETRY=y +CONFIG_BOOT_RETRY_TIME=120 +CONFIG_RESET_TO_RETRY=y CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="run boot_nor" CONFIG_USE_PREBOOT=y

On Tue, Jan 24, 2023 at 06:06:56PM +0100, Heiko Schocher wrote:
add boot retry feature and reboot after 120 seconds.
Signed-off-by: Heiko Schocher hs@denx.de
Applied to u-boot/master, thanks!

add support for i2c eeprom on address 0x51.
Signed-off-by: Heiko Schocher hs@denx.de ---
arch/powerpc/dts/socrates-u-boot.dtsi | 10 ++++++++++ configs/socrates_defconfig | 4 ++++ 2 files changed, 14 insertions(+)
diff --git a/arch/powerpc/dts/socrates-u-boot.dtsi b/arch/powerpc/dts/socrates-u-boot.dtsi index 67c12f672c..88df031732 100644 --- a/arch/powerpc/dts/socrates-u-boot.dtsi +++ b/arch/powerpc/dts/socrates-u-boot.dtsi @@ -6,6 +6,10 @@ #include <config.h>
/ { + aliases { + eeprom0 = &i2c_eeprom0; + }; + chosen { stdout-path = &serial0; }; @@ -13,6 +17,12 @@ soc8544@e0000000 { i2c@3000 { u-boot,dm-pre-reloc; + + i2c_eeprom0: eeprom@51{ + compatible = "atmel,24c64"; + reg = <0x51>; + pagesize = <32>; + }; }; }; }; diff --git a/configs/socrates_defconfig b/configs/socrates_defconfig index c4a3fd30d8..816e59872e 100644 --- a/configs/socrates_defconfig +++ b/configs/socrates_defconfig @@ -39,6 +39,8 @@ CONFIG_CMD_REGINFO=y # CONFIG_BOOTM_VXWORKS is not set CONFIG_SYS_BOOTM_LEN=0x800000 CONFIG_CMD_IMLS=y +CONFIG_CMD_EEPROM=y +CONFIG_SYS_EEPROM_PAGE_WRITE_BITS=4 CONFIG_CMD_DM=y CONFIG_CMD_I2C=y CONFIG_LOADS_ECHO=y @@ -79,6 +81,8 @@ CONFIG_SYS_BR3_PRELIM=0xC0001881 CONFIG_SYS_OR3_PRELIM=0xFFF00000 CONFIG_DM_I2C=y CONFIG_SYS_I2C_FSL=y +CONFIG_MISC=y +CONFIG_I2C_EEPROM=y # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_DM_MTD=y

On Tue, Jan 24, 2023 at 06:06:57PM +0100, Heiko Schocher wrote:
add support for i2c eeprom on address 0x51.
Signed-off-by: Heiko Schocher hs@denx.de
Applied to u-boot/master, thanks!

add autoboot delay string for socrates board. use sha256 for abort autoboot, use "ao" to abort.
Signed-off-by: Heiko Schocher hs@denx.de ---
configs/socrates_defconfig | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/configs/socrates_defconfig b/configs/socrates_defconfig index 816e59872e..8640dc990a 100644 --- a/configs/socrates_defconfig +++ b/configs/socrates_defconfig @@ -20,6 +20,11 @@ CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_SYS_MONITOR_BASE=0xFFF40000 CONFIG_BOOTDELAY=1 +CONFIG_AUTOBOOT_KEYED=y +CONFIG_AUTOBOOT_PROMPT="Enter password to abort autoboot in %d seconds!\n" +CONFIG_AUTOBOOT_ENCRYPTION=y +CONFIG_AUTOBOOT_STOP_STR_ENABLE=y +CONFIG_AUTOBOOT_STOP_STR_SHA256="2dd411308b37266d33c9246821adc5aa4002f0091f5e2aece1953789930ad924" CONFIG_BOOT_RETRY=y CONFIG_BOOT_RETRY_TIME=120 CONFIG_RESET_TO_RETRY=y

On Tue, Jan 24, 2023 at 06:06:58PM +0100, Heiko Schocher wrote:
add autoboot delay string for socrates board. use sha256 for abort autoboot, use "ao" to abort.
Signed-off-by: Heiko Schocher hs@denx.de
Applied to u-boot/master, thanks!

enable protected Environment on socrates board.
Signed-off-by: Heiko Schocher hs@denx.de ---
board/socrates/socrates.c | 17 +++++++++++++++++ configs/socrates_defconfig | 4 ++++ include/configs/socrates.h | 2 ++ 3 files changed, 23 insertions(+)
diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c index 1d63c81a9c..02e6afb099 100644 --- a/board/socrates/socrates.c +++ b/board/socrates/socrates.c @@ -13,6 +13,7 @@ #include <common.h> #include <clock_legacy.h> #include <env.h> +#include <env_internal.h> #include <init.h> #include <pci.h> #include <uuid.h> @@ -221,3 +222,19 @@ int get_serial_clock(void) { return 333333330; } + +enum env_location env_get_location(enum env_operation op, int prio) +{ + if (op == ENVOP_SAVE || op == ENVOP_ERASE) + return ENVL_FLASH; + + switch (prio) { + case 0: + return ENVL_NOWHERE; + case 1: + return ENVL_FLASH; + default: + return ENVL_UNKNOWN; + } + return ENVL_UNKNOWN; +} diff --git a/configs/socrates_defconfig b/configs/socrates_defconfig index 8640dc990a..d4c08f1941 100644 --- a/configs/socrates_defconfig +++ b/configs/socrates_defconfig @@ -68,9 +68,13 @@ CONFIG_MTDIDS_DEFAULT="nor0=fe000000.nor_flash,nand0=socrates_nand" CONFIG_MTDPARTS_DEFAULT="mtdparts=fe000000.nor_flash:13312k(system1),13312k(system2),5120k(data),128k(env),128k(env-red),768k(u-boot);socrates_nand:256M(ubi-data1),-(ubi-data2)" # CONFIG_CMD_IRQ is not set CONFIG_OF_CONTROL=y +CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_FLASH=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_ENV_ADDR_REDUND=0xFFF00000 +CONFIG_ENV_APPEND=y +CONFIG_ENV_WRITEABLE_LIST=y +CONFIG_ENV_ACCESS_IGNORE_FORCE=y CONFIG_USE_ETHPRIME=y CONFIG_ETHPRIME="eTSEC0" CONFIG_SPD_EEPROM=y diff --git a/include/configs/socrates.h b/include/configs/socrates.h index e2afba96cd..305914de85 100644 --- a/include/configs/socrates.h +++ b/include/configs/socrates.h @@ -171,6 +171,8 @@ SOCRATES_ENV_MTD \ ""
+#define CFG_ENV_FLAGS_LIST_STATIC "ethaddr:mw,eth1addr:mw,system1_addr:xw,serial#:sw,ethact:sw,ethprime:sw" + /* pass open firmware flat tree */
#endif /* __CONFIG_H */

On Tue, Jan 24, 2023 at 06:06:59PM +0100, Heiko Schocher wrote:
enable protected Environment on socrates board.
Signed-off-by: Heiko Schocher hs@denx.de
Applied to u-boot/master, thanks!

allow only to boot signed fitimages (and signed u-boot scripts).
Signed-off-by: Heiko Schocher hs@denx.de ---
configs/socrates_defconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/configs/socrates_defconfig b/configs/socrates_defconfig index d4c08f1941..e03c971b5e 100644 --- a/configs/socrates_defconfig +++ b/configs/socrates_defconfig @@ -16,7 +16,9 @@ CONFIG_L2_CACHE=y CONFIG_ENABLE_36BIT_PHYS=y CONFIG_SYS_MONITOR_LEN=786432 CONFIG_FIT=y +CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y +CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_OF_BOARD_SETUP=y CONFIG_SYS_MONITOR_BASE=0xFFF40000 CONFIG_BOOTDELAY=1

On Tue, Jan 24, 2023 at 06:07:00PM +0100, Heiko Schocher wrote:
allow only to boot signed fitimages (and signed u-boot scripts).
Signed-off-by: Heiko Schocher hs@denx.de
Applied to u-boot/master, thanks!

On Tue, Jan 24, 2023 at 06:06:48PM +0100, Heiko Schocher wrote:
Patchseries is based on 53c47c59e6: ("Merge tag 'dm-pull-18jan23' of https://source.denx.de/u-boot/custodians/u-boot-dm")
It brings back socrates board working with current mainline, and adds also some small updates:
newer U-Boot needs more space in Flash, so set new textbase. adapt default environment
remove Flash on CS1 as not used anymore
support MTDPARTS
add boot retry feature
add support for i2c eeprom
add autbootdelay string
enable protected environement
enable signed fit images boot see thread: https://lists.denx.de/pipermail/u-boot/2023-January/504249.html
commit bcc85b96b5ff: ("cmd: source: Support specifying config name")
fixes this problem for me!
patch 0002-powerpc-mpc85xx-socrates-rework-socrates-build-proce.patch is a combination of patches from Pali http://patchwork.ozlabs.org/project/uboot/patch/20221228200437.30971-1-pali@... http://patchwork.ozlabs.org/project/uboot/patch/20221228200437.30971-2-pali@...
which is a base for patch 0003-powerpc-mpc85xx-drop-socrates-specific-image-creatio.patch which drops socrates board specific image creation and uses standard mpc85xx way by enabling MPC85XX_HAVE_RESET_VECTOR, drop CONFIG_OF_BOARD and use common u-boot.dtsi, so no specials anymore for this board.
azure build: https://dev.azure.com/hs0298/hs/_build/results?buildId=99&view=results
I'm glad you were able to get the board updated and working again. Can you please add moving this over to plain text based environments (such as the keymile family are using now, for example) as part of this?

Hello Tom,
On 24.01.23 19:12, Tom Rini wrote:
On Tue, Jan 24, 2023 at 06:06:48PM +0100, Heiko Schocher wrote:
Patchseries is based on 53c47c59e6: ("Merge tag 'dm-pull-18jan23' of https://source.denx.de/u-boot/custodians/u-boot-dm")
It brings back socrates board working with current mainline, and adds also some small updates:
newer U-Boot needs more space in Flash, so set new textbase. adapt default environment
remove Flash on CS1 as not used anymore
support MTDPARTS
add boot retry feature
add support for i2c eeprom
add autbootdelay string
enable protected environement
enable signed fit images boot see thread: https://lists.denx.de/pipermail/u-boot/2023-January/504249.html
commit bcc85b96b5ff: ("cmd: source: Support specifying config name")
fixes this problem for me!
patch 0002-powerpc-mpc85xx-socrates-rework-socrates-build-proce.patch is a combination of patches from Pali http://patchwork.ozlabs.org/project/uboot/patch/20221228200437.30971-1-pali@... http://patchwork.ozlabs.org/project/uboot/patch/20221228200437.30971-2-pali@...
which is a base for patch 0003-powerpc-mpc85xx-drop-socrates-specific-image-creatio.patch which drops socrates board specific image creation and uses standard mpc85xx way by enabling MPC85XX_HAVE_RESET_VECTOR, drop CONFIG_OF_BOARD and use common u-boot.dtsi, so no specials anymore for this board.
azure build: https://dev.azure.com/hs0298/hs/_build/results?buildId=99&view=results
I'm glad you were able to get the board updated and working again. Can
Me too!
you please add moving this over to plain text based environments (such as the keymile family are using now, for example) as part of this?
I can try ... if there are comments for a v2 I integrate it into v2, if v1 is fine, I send a follow up patch (if this is okay for you?).
Thanks!
bye, Heiko

On Wed, Jan 25, 2023 at 06:42:16AM +0100, Heiko Schocher wrote:
Hello Tom,
On 24.01.23 19:12, Tom Rini wrote:
On Tue, Jan 24, 2023 at 06:06:48PM +0100, Heiko Schocher wrote:
Patchseries is based on 53c47c59e6: ("Merge tag 'dm-pull-18jan23' of https://source.denx.de/u-boot/custodians/u-boot-dm")
It brings back socrates board working with current mainline, and adds also some small updates:
newer U-Boot needs more space in Flash, so set new textbase. adapt default environment
remove Flash on CS1 as not used anymore
support MTDPARTS
add boot retry feature
add support for i2c eeprom
add autbootdelay string
enable protected environement
enable signed fit images boot see thread: https://lists.denx.de/pipermail/u-boot/2023-January/504249.html
commit bcc85b96b5ff: ("cmd: source: Support specifying config name")
fixes this problem for me!
patch 0002-powerpc-mpc85xx-socrates-rework-socrates-build-proce.patch is a combination of patches from Pali http://patchwork.ozlabs.org/project/uboot/patch/20221228200437.30971-1-pali@... http://patchwork.ozlabs.org/project/uboot/patch/20221228200437.30971-2-pali@...
which is a base for patch 0003-powerpc-mpc85xx-drop-socrates-specific-image-creatio.patch which drops socrates board specific image creation and uses standard mpc85xx way by enabling MPC85XX_HAVE_RESET_VECTOR, drop CONFIG_OF_BOARD and use common u-boot.dtsi, so no specials anymore for this board.
azure build: https://dev.azure.com/hs0298/hs/_build/results?buildId=99&view=results
I'm glad you were able to get the board updated and working again. Can
Me too!
you please add moving this over to plain text based environments (such as the keymile family are using now, for example) as part of this?
I can try ... if there are comments for a v2 I integrate it into v2, if v1 is fine, I send a follow up patch (if this is okay for you?).
Follow-up is fine.
participants (2)
-
Heiko Schocher
-
Tom Rini