From 68ea9f0bf16e2be5dd705d5ad32c0979d0b6e5d8 Mon Sep 17 00:00:00 2001 From: Bhupesh Sharma Date: Tue, 22 Aug 2023 13:21:11 +0530 Subject: arm: stm32mp: Really fix compilation issue when SYS_DCACHE_OFF and/or SYS_DCACHE_SYS are enabled While 23e20b2fa6 ("arm: stm32mp: Fix compilation issue when SYS_DCACHE_OFF and/or SYS_DCACHE_SYS are enabled") tried fixing this issue, fix it really by adding #if checks for SYS_ICACHE_OFF and SYS_DCACHE_OFF. Cc: Patrice Chotard Cc: Patrick Delaunay Signed-off-by: Bhupesh Sharma Reviewed-by: Patrice Chotard Reviewed-by: Patrick Delaunay --- arch/arm/mach-stm32mp/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c index e07abbe21c1..bab318875cb 100644 --- a/arch/arm/mach-stm32mp/cpu.c +++ b/arch/arm/mach-stm32mp/cpu.c @@ -91,10 +91,10 @@ static void early_enable_caches(void) if (CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) return; - if (!(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))) { +#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) gd->arch.tlb_size = PGTABLE_SIZE; gd->arch.tlb_addr = (unsigned long)&early_tlb; - } +#endif /* enable MMU (default configuration) */ dcache_enable(); -- cgit v1.2.3 From 5846ef86f89b54f003c0e44cf3a9f2a7f044e041 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Tue, 10 Oct 2023 01:15:51 +0200 Subject: ARM: dts: stm32mp: Repair damage from alignment with v6.3 The patch fixed by this commit renders ST STM32MP15xx EV1 board and all DHSOM SoM based boards unbootable from SPI NOR. Fix the damage by updating -u-boot.dtsi to match the stm32mp15-pinctrl.dtsi update. Fixes: 08002ffd083d ("ARM: dts: stm32mp: alignment with v6.3") Signed-off-by: Marek Vasut Reviewed-by: Patrice Chotard --- arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi | 16 ++++++++++++---- arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi | 12 +++--------- arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi | 8 ++++++-- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi index 1f7fdbce530..eb283cacd27 100644 --- a/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi @@ -135,20 +135,28 @@ &qspi_bk1_pins_a { bootph-pre-ram; - pins1 { + pins { bootph-pre-ram; }; - pins2 { +}; + +&qspi_cs1_pins_a { + bootph-pre-ram; + pins { bootph-pre-ram; }; }; &qspi_bk2_pins_a { bootph-pre-ram; - pins1 { + pins { bootph-pre-ram; }; - pins2 { +}; + +&qspi_cs2_pins_a { + bootph-pre-ram; + pins { bootph-pre-ram; }; }; diff --git a/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi b/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi index f12941b05f6..2f70b0690d2 100644 --- a/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi +++ b/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi @@ -134,20 +134,14 @@ &qspi_bk1_pins_a { bootph-pre-ram; - pins1 { - bootph-pre-ram; - }; - pins2 { + pins { bootph-pre-ram; }; }; -&qspi_bk2_pins_a { +&qspi_cs1_pins_a { bootph-pre-ram; - pins1 { - bootph-pre-ram; - }; - pins2 { + pins { bootph-pre-ram; }; }; diff --git a/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi b/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi index eb905ad2820..552b35db3c7 100644 --- a/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi +++ b/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi @@ -98,10 +98,14 @@ &qspi_bk1_pins_a { bootph-pre-ram; - pins1 { + pins { bootph-pre-ram; }; - pins2 { +}; + +&qspi_cs1_pins_a { + bootph-pre-ram; + pins { bootph-pre-ram; }; }; -- cgit v1.2.3 From 55a3faada70a88f7a288ea1c0500e623dfe5d930 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 4 Nov 2023 17:31:56 +0100 Subject: arm: stm32: Enable TCP, IPv6, wget on DH STM32MP15 DHSOM Enable support for TCP protocol, wget, and IPv6 on this platform. The former two allow users download payload into the U-Boot from a web server, which may be more convenient or easier to set up than TFTP server. The later is enabled to future proof the IP stack on this platform. Signed-off-by: Marek Vasut Reviewed-by: Patrice Chotard --- configs/stm32mp15_dhcom_basic_defconfig | 5 +++++ configs/stm32mp15_dhcor_basic_defconfig | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/configs/stm32mp15_dhcom_basic_defconfig b/configs/stm32mp15_dhcom_basic_defconfig index b6cd0a47fa7..08aac878f8e 100644 --- a/configs/stm32mp15_dhcom_basic_defconfig +++ b/configs/stm32mp15_dhcom_basic_defconfig @@ -76,7 +76,10 @@ CONFIG_CMD_REMOTEPROC=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_DHCP6=y +CONFIG_CMD_TFTPPUT=y CONFIG_SYS_DISABLE_AUTOLOAD=y +CONFIG_CMD_WGET=y CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y @@ -101,6 +104,8 @@ CONFIG_IP_DEFRAG=y CONFIG_TFTP_TSIZE=y CONFIG_USE_SERVERIP=y CONFIG_SERVERIP="192.168.1.1" +CONFIG_PROT_TCP_SACK=y +CONFIG_IPV6=y CONFIG_STM32_ADC=y CONFIG_SPL_BLOCK_CACHE=y CONFIG_BOOTCOUNT_LIMIT=y diff --git a/configs/stm32mp15_dhcor_basic_defconfig b/configs/stm32mp15_dhcor_basic_defconfig index d1acf9c657e..8cd6924b580 100644 --- a/configs/stm32mp15_dhcor_basic_defconfig +++ b/configs/stm32mp15_dhcor_basic_defconfig @@ -74,7 +74,10 @@ CONFIG_CMD_REMOTEPROC=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_DHCP6=y +CONFIG_CMD_TFTPPUT=y CONFIG_SYS_DISABLE_AUTOLOAD=y +CONFIG_CMD_WGET=y CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y @@ -99,6 +102,8 @@ CONFIG_IP_DEFRAG=y CONFIG_TFTP_TSIZE=y CONFIG_USE_SERVERIP=y CONFIG_SERVERIP="192.168.1.1" +CONFIG_PROT_TCP_SACK=y +CONFIG_IPV6=y CONFIG_STM32_ADC=y CONFIG_SPL_BLOCK_CACHE=y CONFIG_BOOTCOUNT_LIMIT=y -- cgit v1.2.3 From 6d84f6bc75a30214534966efae022cfbb9e8097b Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 4 Nov 2023 17:31:57 +0100 Subject: arm: stm32: Limit u-boot.itb size to 0x160000 bytes on DH STM32MP15 DHSOM The maximum size of u-boot.itb in SPI NOR on DH STM32MP15 DHSOM is 0x160000 . Define this size in U-Boot config to prevent misconfigured builds from emitting larger u-boot.itb than the one which fits the SPI NOR area reserved for the blob. The SPI NOR layout is as follows: 0x00_0000..0x03_ffff ... SPL 1 0x04_0000..0x07_ffff ... SPL 2 0x08_0000..0x1d_ffff ... U-Boot 0x1e_0000..0x1e_ffff ... Environment 1 0x1f_0000..0x1f_ffff ... Environment 2 Signed-off-by: Marek Vasut Reviewed-by: Patrice Chotard --- configs/stm32mp15_dhcom_basic_defconfig | 2 ++ configs/stm32mp15_dhcor_basic_defconfig | 2 ++ 2 files changed, 4 insertions(+) diff --git a/configs/stm32mp15_dhcom_basic_defconfig b/configs/stm32mp15_dhcom_basic_defconfig index 08aac878f8e..1d241529be7 100644 --- a/configs/stm32mp15_dhcom_basic_defconfig +++ b/configs/stm32mp15_dhcom_basic_defconfig @@ -25,6 +25,8 @@ CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0xc2000000 CONFIG_SYS_MEMTEST_START=0xc0000000 CONFIG_SYS_MEMTEST_END=0xc4000000 +CONFIG_HAS_BOARD_SIZE_LIMIT=y +CONFIG_BOARD_SIZE_LIMIT=1441792 CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0xc1000000 diff --git a/configs/stm32mp15_dhcor_basic_defconfig b/configs/stm32mp15_dhcor_basic_defconfig index 8cd6924b580..6e0c4a8cf9f 100644 --- a/configs/stm32mp15_dhcor_basic_defconfig +++ b/configs/stm32mp15_dhcor_basic_defconfig @@ -23,6 +23,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI=y # CONFIG_ARMV7_VIRT is not set CONFIG_SYS_LOAD_ADDR=0xc2000000 +CONFIG_HAS_BOARD_SIZE_LIMIT=y +CONFIG_BOARD_SIZE_LIMIT=1441792 CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0xc1000000 -- cgit v1.2.3 From c205fe979ebc1961cf28555c00e24a9004761366 Mon Sep 17 00:00:00 2001 From: Igor Opaniuk Date: Mon, 6 Nov 2023 11:41:52 +0100 Subject: stm32mp1: read auth stats and boot_partition from tamp Obtain from TAMP backup register information about image authorization status and partition id used for booting. Store this info in environmental variables ("boot_auth" and "boot_part" correspondingly). Image authorization supported values: 0x0 - No authentication done 0x1 - Authentication done and failed 0x2 - Authentication done and succeeded These values are stored to TAMP backup register by Trusted Firmware-A [1]. Testing: STM32MP> print boot_part boot_part=1 STM32MP> print boot_auth boot_auth=2 [1] https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?h=refs/heads/integration&id=ab2b325c1ab895e626d4e11a9f26b9e7c968f8d8 Signed-off-by: Igor Opaniuk Co-developed-by: Oleksandr Suvorov Signed-off-by: Oleksandr Suvorov Reviewed-by: Patrice Chotard --- arch/arm/mach-stm32mp/cpu.c | 23 +++++++++++++++++++++++ arch/arm/mach-stm32mp/include/mach/stm32.h | 4 ++++ arch/arm/mach-stm32mp/include/mach/sys_proto.h | 3 +++ 3 files changed, 30 insertions(+) diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c index bab318875cb..55574fd4beb 100644 --- a/arch/arm/mach-stm32mp/cpu.c +++ b/arch/arm/mach-stm32mp/cpu.c @@ -40,6 +40,13 @@ u32 get_bootmode(void) TAMP_BOOT_MODE_SHIFT; } +u32 get_bootauth(void) +{ + /* read boot auth status and partition from TAMP backup register */ + return (readl(TAMP_BOOT_CONTEXT) & TAMP_BOOT_AUTH_MASK) >> + TAMP_BOOT_AUTH_SHIFT; +} + /* * weak function overidde: set the DDR/SYSRAM executable before to enable the * MMU and configure DACR, for early early_enable_caches (SPL or pre-reloc) @@ -371,8 +378,24 @@ __weak void stm32mp_misc_init(void) { } +static int setup_boot_auth_info(void) +{ + char buf[10]; + u32 bootauth = get_bootauth(); + + snprintf(buf, sizeof(buf), "%d", bootauth >> 4); + env_set("boot_auth", buf); + + snprintf(buf, sizeof(buf), "%d", bootauth & + (u32)TAMP_BOOT_PARTITION_MASK); + env_set("boot_part", buf); + + return 0; +} + int arch_misc_init(void) { + setup_boot_auth_info(); setup_boot_mode(); setup_mac_address(); setup_serial_number(); diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h b/arch/arm/mach-stm32mp/include/mach/stm32.h index 1cdc5e3b186..ac0deced67e 100644 --- a/arch/arm/mach-stm32mp/include/mach/stm32.h +++ b/arch/arm/mach-stm32mp/include/mach/stm32.h @@ -139,8 +139,12 @@ enum boot_device { #define TAMP_BOOT_MODE_MASK GENMASK(15, 8) #define TAMP_BOOT_MODE_SHIFT 8 +#define TAMP_BOOT_AUTH_MASK GENMASK(23, 16) +#define TAMP_BOOT_AUTH_SHIFT 16 #define TAMP_BOOT_DEVICE_MASK GENMASK(7, 4) #define TAMP_BOOT_INSTANCE_MASK GENMASK(3, 0) +#define TAMP_BOOT_AUTH_ST_MASK GENMASK(7, 4) +#define TAMP_BOOT_PARTITION_MASK GENMASK(3, 0) #define TAMP_BOOT_FORCED_MASK GENMASK(7, 0) enum forced_boot_mode { diff --git a/arch/arm/mach-stm32mp/include/mach/sys_proto.h b/arch/arm/mach-stm32mp/include/mach/sys_proto.h index 83fb32a45fc..52aca1e23e1 100644 --- a/arch/arm/mach-stm32mp/include/mach/sys_proto.h +++ b/arch/arm/mach-stm32mp/include/mach/sys_proto.h @@ -66,6 +66,9 @@ void get_soc_name(char name[SOC_NAME_SIZE]); /* return boot mode */ u32 get_bootmode(void); +/* return auth status and partition */ +u32 get_bootauth(void); + int get_eth_nb(void); int setup_mac_address(void); -- cgit v1.2.3