From 731fd50e27fb3e9e55eb508cebebc7a111616a30 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 22 Apr 2020 13:18:11 +0200 Subject: ARM: stm32: Implement board coding on AV96 The AV96 board does exist in multiple variants. To cater for all of them, implement board code handling. There are two GPIOs which code the type of the board, read them out and use the value to pick the correct device tree from an fitImage. Reviewed-by: Patrick Delaunay Signed-off-by: Marek Vasut Cc: Manivannan Sadhasivam Cc: Patrick Delaunay Cc: Patrice Chotard Change-Id: Iddb330b9a66500495885457cbe17edc0eacaaf43 --- include/configs/dh_stm32mp1.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 include/configs/dh_stm32mp1.h (limited to 'include') diff --git a/include/configs/dh_stm32mp1.h b/include/configs/dh_stm32mp1.h new file mode 100644 index 0000000000..89d317ba2b --- /dev/null +++ b/include/configs/dh_stm32mp1.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ +/* + * Copyright (C) 2020 Marek Vasut + * + * Configuration settings for the DH STM32MP15x SoMs + */ + +#ifndef __CONFIG_DH_STM32MP1_H__ +#define __CONFIG_DH_STM32MP1_H__ + +#include + +#define CONFIG_SPL_TARGET "u-boot.itb" + +#endif -- cgit From 31325e1b8b9ce06b34add643f4a9d0b58235434a Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 18 Mar 2020 09:22:46 +0100 Subject: stm32mp1: dynamically build DFU_ALT_INFO This patch reduces the stm32mp1 environment size and builds dynamically the DFU board configuration with gpt and mtd partitions and information from defconfig (CONFIG_DFU_ALT_RAM0). Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- include/configs/stm32mp1.h | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'include') diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h index be5afe9c6f..0319ebf4d8 100644 --- a/include/configs/stm32mp1.h +++ b/include/configs/stm32mp1.h @@ -165,37 +165,6 @@ #define STM32MP_MTDPARTS #endif -#define STM32MP_DFU_ALT_RAM \ - "dfu_alt_info_ram=ram 0=" \ - "uImage ram ${kernel_addr_r} 0x2000000;" \ - "devicetree.dtb ram ${fdt_addr_r} 0x100000;" \ - "uramdisk.image.gz ram ${ramdisk_addr_r} 0x10000000\0" - -#ifdef CONFIG_SET_DFU_ALT_INFO -#define STM32MP_DFU_ALT_INFO \ - "dfu_alt_info_nor0=mtd nor0=" \ - "nor_fsbl1 part 1;nor_fsbl2 part 2;" \ - "nor_ssbl part 3;nor_env part 4\0" \ - "dfu_alt_info_nand0=mtd nand0="\ - "nand_fsbl part 1;nand_ssbl1 part 2;" \ - "nand_ssbl2 part 3;nand_UBI partubi 4\0" \ - "dfu_alt_info_spi-nand0=mtd spi-nand0="\ - "spi-nand_fsbl part 1;spi-nand_ssbl1 part 2;" \ - "spi-nand_ssbl2 part 3;spi-nand_UBI partubi 4\0" \ - "dfu_alt_info_mmc0=mmc 0=" \ - "sdcard_fsbl1 part 0 1;sdcard_fsbl2 part 0 2;" \ - "sdcard_ssbl part 0 3;sdcard_bootfs part 0 4;" \ - "sdcard_vendorfs part 0 5;sdcard_rootfs part 0 6;" \ - "sdcard_userfs part 0 7\0" \ - "dfu_alt_info_mmc1=mmc 1=" \ - "emmc_fsbl1 raw 0x0 0x200 mmcpart 1;" \ - "emmc_fsbl2 raw 0x0 0x200 mmcpart 2;emmc_ssbl part 1 1;" \ - "emmc_bootfs part 1 2;emmc_vendorfs part 1 3;" \ - "emmc_rootfs part 1 4;emmc_userfs part 1 5\0" -#else -#define STM32MP_DFU_ALT_INFO -#endif - /* * memory layout for 32M uncompressed/compressed kernel, * 1M fdt, 1M script, 1M pxe and 1M for splashimage @@ -215,8 +184,6 @@ " then env set env_default 0;env save;fi\0" \ STM32MP_BOOTCMD \ STM32MP_MTDPARTS \ - STM32MP_DFU_ALT_RAM \ - STM32MP_DFU_ALT_INFO \ BOOTENV \ "boot_net_usb_start=true\0" -- cgit From 28a28ba9764d02b1e52938b5f7d322ffd13b01f1 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 18 Mar 2020 09:22:47 +0100 Subject: stm32mp1: move MTDPART configuration in Kconfig This patch reduces the stm32mp1 environment size and builds dynamically the MTD partitions with information from defconfig (CONFIG_MTDPARTS_...). Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- include/configs/stm32mp1.h | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'include') diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h index 0319ebf4d8..19e2b3b31e 100644 --- a/include/configs/stm32mp1.h +++ b/include/configs/stm32mp1.h @@ -144,27 +144,6 @@ #include -#ifdef CONFIG_STM32MP1_OPTEE -/* with OPTEE: define specific MTD partitions = teeh, teed, teex */ -#define STM32MP_MTDPARTS \ - "mtdparts_nor0=256k(fsbl1),256k(fsbl2),2m(ssbl),256k(u-boot-env),256k(teeh),256k(teed),256k(teex),-(nor_user)\0" \ - "mtdparts_nand0=2m(fsbl),2m(ssbl1),2m(ssbl2),512k(teeh),512k(teed),512k(teex),-(UBI)\0" \ - "mtdparts_spi-nand0=2m(fsbl),2m(ssbl1),2m(ssbl2),"\ - "512k(teeh),512k(teed),512k(teex),-(UBI)\0" - -#else /* CONFIG_STM32MP1_OPTEE */ -#define STM32MP_MTDPARTS \ - "mtdparts_nor0=256k(fsbl1),256k(fsbl2),2m(ssbl),256k(u-boot-env),-(nor_user)\0" \ - "mtdparts_nand0=2m(fsbl),2m(ssbl1),2m(ssbl2),-(UBI)\0" \ - "mtdparts_spi-nand0=2m(fsbl),2m(ssbl1),2m(ssbl2),-(UBI)\0" - -#endif /* CONFIG_STM32MP1_OPTEE */ - -#ifndef CONFIG_SYS_MTDPARTS_RUNTIME -#undef STM32MP_MTDPARTS -#define STM32MP_MTDPARTS -#endif - /* * memory layout for 32M uncompressed/compressed kernel, * 1M fdt, 1M script, 1M pxe and 1M for splashimage @@ -183,7 +162,6 @@ "env_check=if test $env_default -eq 1;"\ " then env set env_default 0;env save;fi\0" \ STM32MP_BOOTCMD \ - STM32MP_MTDPARTS \ BOOTENV \ "boot_net_usb_start=true\0" -- cgit From 4a1b975dac0270f553f5a58b0e7d809c8c8ef61f Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 18 Mar 2020 09:22:48 +0100 Subject: board: stm32mp1: reserve memory for OP-TEE in device tree Add reserve memory for OP-TEE in U-Boot and in kernel device tree: - no more reduce the DDR size in "memory" node: CONFIG_SYS_MEM_TOP_HIDE is no more used - U-Boot device-tree defines the needed "reserved-memory" for OP-TEE and U-Boot should not use this reserved memory: board_get_usable_ram_top use lmb lib to found the first free region, the not reserved memory, enough to relocate U-Boot: the needed size of U-Boot is estimated with gd->mon_len + CONFIG_SYS_MALLOC_LEN. - the optee node ("optee@...": firmware with compatible "linaro,optee-tz") and the associated "reserved-memory" are deactivated in kernel device tree when OP-TEE is not detected by U-Boot to prevent kernel issue (memory is reserved but not used, optee driver probe failed). Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- include/configs/stm32mp1.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include') diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h index 19e2b3b31e..feb4cc21a9 100644 --- a/include/configs/stm32mp1.h +++ b/include/configs/stm32mp1.h @@ -23,10 +23,6 @@ #define CONFIG_SYS_SDRAM_BASE STM32_DDR_BASE #define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_TEXT_BASE -#ifdef CONFIG_STM32MP1_OPTEE -#define CONFIG_SYS_MEM_TOP_HIDE SZ_32M -#endif /* CONFIG_STM32MP1_OPTEE */ - /* * Console I/O buffer size */ -- cgit From b664a74537c9a9a4a50940e4a2ced2428760235b Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 18 Mar 2020 09:22:52 +0100 Subject: board: stm32mp1: support boot from spi-nand Manage BOOT_FLASH_SPINAND, with boot_device="spi-nand" and treat this value in bootcmd_stm32mp. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- include/configs/stm32mp1.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h index feb4cc21a9..f271b84a59 100644 --- a/include/configs/stm32mp1.h +++ b/include/configs/stm32mp1.h @@ -122,7 +122,7 @@ * bootcmd for stm32mp1: * for serial/usb: execute the stm32prog command * for mmc boot (eMMC, SD card), boot only on the same device - * for nand boot, boot with on ubifs partition on nand + * for nand or spi-nand boot, boot with on ubifs partition on UBI partition * for nor boot, use the default order */ #define STM32MP_BOOTCMD "bootcmd_stm32mp=" \ @@ -133,7 +133,8 @@ "run env_check;" \ "if test ${boot_device} = mmc;" \ "then env set boot_targets \"mmc${boot_instance}\"; fi;" \ - "if test ${boot_device} = nand;" \ + "if test ${boot_device} = nand ||" \ + " test ${boot_device} = spi-nand ;" \ "then env set boot_targets ubifs0; fi;" \ "run distro_bootcmd;" \ "fi;\0" -- cgit From bcd677f246e872c2c945d667ac1044cb735c8e14 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 18 Mar 2020 09:24:46 +0100 Subject: usb: gadget: g_dnl: add function g_dnl_set_product Add a function g_dnl_set_product to change the Product string used in USB enumeration in any command based on download gadget. If the function is called with NULL pointer, the product string is set to the default value (product[] = "USB download gadget"). Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- include/g_dnl.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/g_dnl.h b/include/g_dnl.h index 6d461c73d3..836ee602c8 100644 --- a/include/g_dnl.h +++ b/include/g_dnl.h @@ -38,6 +38,7 @@ int g_dnl_board_usb_cable_connected(void); int g_dnl_register(const char *s); void g_dnl_unregister(void); void g_dnl_set_serialnumber(char *); +void g_dnl_set_product(const char *s); bool g_dnl_detach(void); void g_dnl_trigger_detach(void); -- cgit From 5cf39720af39872bef541371cf7c35b96c7f0063 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 18 Mar 2020 09:24:47 +0100 Subject: dfu: add prototype for dfu_transaction_initiate/cleanup Add prototype for function dfu_transaction_initiate and dfu_transaction_cleanup to avoid warning with W=1. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- include/dfu.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/dfu.h b/include/dfu.h index fb5260d903..2f0e335ec0 100644 --- a/include/dfu.h +++ b/include/dfu.h @@ -209,6 +209,9 @@ void dfu_initiated_callback(struct dfu_entity *dfu); */ void dfu_flush_callback(struct dfu_entity *dfu); +int dfu_transaction_initiate(struct dfu_entity *dfu, bool read); +void dfu_transaction_cleanup(struct dfu_entity *dfu); + /* * dfu_defer_flush - pointer to store dfu_entity for deferred flashing. * It should be NULL when not used. -- cgit