From 5988575a9006e4171a5a59721a537a51f12fabe6 Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Wed, 20 Jan 2021 14:42:01 +0100 Subject: mtd: spi-nor: Add WATCHDOG_RESET() in spi_nor_core callbacks In case of big area write/erase on spi nor, watchdog timeout may occurs. Issue reproduced on stm32mp157c-ev1 with following commands: sf write 0xC0000000 0 0x3000000 or sf erase 0 0x1000000 Signed-off-by: Patrice Chotard Reviewed-by: Patrick Delaunay --- drivers/mtd/spi/spi-nor-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index ef426dac02b..e0efebc3555 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -566,6 +567,7 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr) len = instr->len; while (len) { + WATCHDOG_RESET(); #ifdef CONFIG_SPI_FLASH_BAR ret = write_bar(nor, addr); if (ret < 0) @@ -1250,6 +1252,7 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, for (i = 0; i < len; ) { ssize_t written; loff_t addr = to + i; + WATCHDOG_RESET(); /* * If page_size is a power of two, the offset can be quickly -- cgit v1.3.1 From e48ec51b43ed0c9a4eb767addb829cef418041c7 Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Wed, 20 Jan 2021 14:42:02 +0100 Subject: spi: stm32_qspi: Add WATCHDOG_RESET in _stm32_qspi_read_fifo() In case of reading large area and memory-map mode is misconfigured (memory-map size declared lower than the real size of the memory chip) watchdog can be triggered. Add WATCHDOG_RESET() in _stm32_qspi_read_fifo to fix it. Issue reproduced with stm32mp157c-ev1 board and memory map size set to 1, with following command: sf read 0xC0000000 0 0x4000000 Signed-off-by: Patrice Chotard Reviewed-by: Patrick Delaunay --- drivers/spi/stm32_qspi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c index 75e5e840edb..4acc9047b9e 100644 --- a/drivers/spi/stm32_qspi.c +++ b/drivers/spi/stm32_qspi.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -171,6 +172,7 @@ static int _stm32_qspi_wait_cmd(struct stm32_qspi_priv *priv, static void _stm32_qspi_read_fifo(u8 *val, void __iomem *addr) { *val = readb(addr); + WATCHDOG_RESET(); } static void _stm32_qspi_write_fifo(u8 *val, void __iomem *addr) -- cgit v1.3.1 From 3f6cfdaa23763b691345d2d3709fe1668291f407 Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Wed, 20 Jan 2021 14:42:03 +0100 Subject: mtd: nand: Add WATCHDOG_RESET() in nanddev_mtd_erase() In case of big area erased on nand, watchdog timeout may occurs. To fix that, add WATCHDOG_RESET() in nanddev_mtd_erase() to ensure that watchdog is reset. Signed-off-by: Patrice Chotard Reviewed-by: Patrick Delaunay --- drivers/mtd/nand/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c index 219efdc8959..090834a495f 100644 --- a/drivers/mtd/nand/core.c +++ b/drivers/mtd/nand/core.c @@ -10,6 +10,7 @@ #define pr_fmt(fmt) "nand: " fmt #include +#include #ifndef __UBOOT__ #include #include @@ -172,6 +173,7 @@ int nanddev_mtd_erase(struct mtd_info *mtd, struct erase_info *einfo) nanddev_offs_to_pos(nand, einfo->addr, &pos); nanddev_offs_to_pos(nand, einfo->addr + einfo->len - 1, &last); while (nanddev_pos_cmp(&pos, &last) <= 0) { + WATCHDOG_RESET(); ret = nanddev_erase(nand, &pos); if (ret) { einfo->fail_addr = nanddev_pos_to_offs(nand, &pos); -- cgit v1.3.1 From de6f70a6329ebf3845fa9173dbd7962a15802c05 Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Wed, 20 Jan 2021 14:42:04 +0100 Subject: mtd: spinand: Add WATCHDOG_RESET() in spinand_mtd_read/write() In case of big area read/write on spi nand, watchdog timeout may occurs. To fix that, add WATCHDOG_RESET() in spinand_mtd_read() and spinand_mtd_write() to ensure that watchdog is reset. Signed-off-by: Patrice Chotard Reviewed-by: Patrick Delaunay --- drivers/mtd/nand/spi/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 68ef5d1af8d..e5330958c7e 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -22,6 +22,7 @@ #else #include #include +#include #include #include #include @@ -578,6 +579,7 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from, #endif nanddev_io_for_each_page(nand, from, ops, &iter) { + WATCHDOG_RESET(); ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) break; @@ -629,6 +631,7 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t to, #endif nanddev_io_for_each_page(nand, to, ops, &iter) { + WATCHDOG_RESET(); ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) break; -- cgit v1.3.1 From 3d15245502c4bc069c1a9d0268dbe5e833c529e2 Mon Sep 17 00:00:00 2001 From: Etienne Carriere Date: Wed, 24 Feb 2021 11:19:41 +0100 Subject: ARM: dts: stm32mp1: explicit clock reference needed by RCC clock driver Define in the RCC clock provider node which root clocks the driver depends on. These are root oscillators, which may be present or not, upon FDT content. This update binding is introduced in Linux kernel device tree by patch "ARM: dts: stm32: move clocks/resets to SCMI resources for stm32mp15" This patch is a preliminary step for SCMI support of stm32mp15 boards with trusted boot chain, based on TF-A or OP-TEE. Signed-off-by: Etienne Carriere Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- arch/arm/dts/stm32mp151.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/dts/stm32mp151.dtsi b/arch/arm/dts/stm32mp151.dtsi index eedea6f4b85..b564fc62693 100644 --- a/arch/arm/dts/stm32mp151.dtsi +++ b/arch/arm/dts/stm32mp151.dtsi @@ -1136,6 +1136,10 @@ reg = <0x50000000 0x1000>; #clock-cells = <1>; #reset-cells = <1>; + + clock-names = "hse", "hsi", "csi", "lse", "lsi"; + clocks = <&clk_hse>, <&clk_hsi>, <&clk_csi>, + <&clk_lse>, <&clk_lsi>; }; pwr_regulators: pwr@50001000 { -- cgit v1.3.1 From 08db5d5c7198d38ec51e12b8a65fc2b68dd92acc Mon Sep 17 00:00:00 2001 From: Etienne Carriere Date: Wed, 24 Feb 2021 11:19:42 +0100 Subject: clk: stm32mp1: gets root clocks from fdt This change makes stm32mp1 clock driver to get the root clocks reference from the device node in the FDT rather than fetching straight these clocks by their name. Driver now stores the clock reference and use it to know if a root clock is present, get its rate or gets its related udevice reference. Signed-off-by: Etienne Carriere Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- drivers/clk/clk_stm32mp1.c | 62 +++++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 39 deletions(-) diff --git a/drivers/clk/clk_stm32mp1.c b/drivers/clk/clk_stm32mp1.c index 848e33f4e82..0c0ef366a19 100644 --- a/drivers/clk/clk_stm32mp1.c +++ b/drivers/clk/clk_stm32mp1.c @@ -250,7 +250,7 @@ DECLARE_GLOBAL_DATA_PTR; enum stm32mp1_parent_id { /* * _HSI, _HSE, _CSI, _LSI, _LSE should not be moved - * they are used as index in osc[] as entry point + * they are used as index in osc_clk[] as clock reference */ _HSI, _HSE, @@ -430,8 +430,7 @@ struct stm32mp1_clk_data { struct stm32mp1_clk_priv { fdt_addr_t base; const struct stm32mp1_clk_data *data; - ulong osc[NB_OSC]; - struct udevice *osc_dev[NB_OSC]; + struct clk osc_clk[NB_OSC]; }; #define STM32MP1_CLK(off, b, idx, s) \ @@ -790,7 +789,7 @@ static ulong stm32mp1_clk_get_fixed(struct stm32mp1_clk_priv *priv, int idx) return 0; } - return priv->osc[idx]; + return clk_get_rate(&priv->osc_clk[idx]); } static int stm32mp1_clk_get_id(struct stm32mp1_clk_priv *priv, unsigned long id) @@ -1545,7 +1544,7 @@ static int stm32mp1_hsidiv(fdt_addr_t rcc, ulong hsifreq) break; if (hsidiv == 4) { - log_err("clk-hsi frequency invalid"); + log_err("hsi frequency invalid"); return -1; } @@ -1952,13 +1951,13 @@ static int stm32mp1_clktree(struct udevice *dev) * switch ON oscillator found in device-tree, * HSI already ON after bootrom */ - if (priv->osc[_LSI]) + if (clk_valid(&priv->osc_clk[_LSI])) stm32mp1_lsi_set(rcc, 1); - if (priv->osc[_LSE]) { + if (clk_valid(&priv->osc_clk[_LSE])) { int bypass, digbyp; u32 lsedrv; - struct udevice *dev = priv->osc_dev[_LSE]; + struct udevice *dev = priv->osc_clk[_LSE].dev; bypass = dev_read_bool(dev, "st,bypass"); digbyp = dev_read_bool(dev, "st,digbypass"); @@ -1969,9 +1968,9 @@ static int stm32mp1_clktree(struct udevice *dev) stm32mp1_lse_enable(rcc, bypass, digbyp, lsedrv); } - if (priv->osc[_HSE]) { + if (clk_valid(&priv->osc_clk[_HSE])) { int bypass, digbyp, css; - struct udevice *dev = priv->osc_dev[_HSE]; + struct udevice *dev = priv->osc_clk[_HSE].dev; bypass = dev_read_bool(dev, "st,bypass"); digbyp = dev_read_bool(dev, "st,digbypass"); @@ -1996,8 +1995,8 @@ static int stm32mp1_clktree(struct udevice *dev) /* configure HSIDIV */ dev_dbg(dev, "configure HSIDIV\n"); - if (priv->osc[_HSI]) { - stm32mp1_hsidiv(rcc, priv->osc[_HSI]); + if (clk_valid(&priv->osc_clk[_HSI])) { + stm32mp1_hsidiv(rcc, clk_get_rate(&priv->osc_clk[_HSI])); stgen_config(priv); } @@ -2043,7 +2042,7 @@ static int stm32mp1_clktree(struct udevice *dev) } /* wait LSE ready before to use it */ - if (priv->osc[_LSE]) + if (clk_valid(&priv->osc_clk[_LSE])) stm32mp1_lse_wait(rcc); /* configure with expected clock source */ @@ -2082,7 +2081,7 @@ static int stm32mp1_clktree(struct udevice *dev) dev_dbg(dev, "oscillator off\n"); /* switch OFF HSI if not found in device-tree */ - if (!priv->osc[_HSI]) + if (!clk_valid(&priv->osc_clk[_HSI])) stm32mp1_hsi_set(rcc, 0); /* Software Self-Refresh mode (SSR) during DDR initilialization */ @@ -2178,40 +2177,25 @@ static ulong stm32mp1_clk_set_rate(struct clk *clk, unsigned long clk_rate) return -EINVAL; } -static void stm32mp1_osc_clk_init(const char *name, - struct stm32mp1_clk_priv *priv, - int index) -{ - struct clk clk; - struct udevice *dev = NULL; - - priv->osc[index] = 0; - clk.id = 0; - if (!uclass_get_device_by_name(UCLASS_CLK, name, &dev)) { - if (clk_request(dev, &clk)) - log_err("%s request", name); - else - priv->osc[index] = clk_get_rate(&clk); - } - priv->osc_dev[index] = dev; -} - static void stm32mp1_osc_init(struct udevice *dev) { struct stm32mp1_clk_priv *priv = dev_get_priv(dev); int i; const char *name[NB_OSC] = { - [_LSI] = "clk-lsi", - [_LSE] = "clk-lse", - [_HSI] = "clk-hsi", - [_HSE] = "clk-hse", - [_CSI] = "clk-csi", + [_LSI] = "lsi", + [_LSE] = "lse", + [_HSI] = "hsi", + [_HSE] = "hse", + [_CSI] = "csi", [_I2S_CKIN] = "i2s_ckin", }; for (i = 0; i < NB_OSC; i++) { - stm32mp1_osc_clk_init(name[i], priv, i); - dev_dbg(dev, "%d: %s => %x\n", i, name[i], (u32)priv->osc[i]); + if (clk_get_by_name(dev, name[i], &priv->osc_clk[i])) + dev_dbg(dev, "No source clock \"%s\"", name[i]); + else + dev_dbg(dev, "%s clock rate: %luHz\n", + name[i], clk_get_rate(&priv->osc_clk[i])); } } -- cgit v1.3.1 From 1b9ad5198afa4d6c39ec605935dab468f7559b9e Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 24 Feb 2021 11:19:43 +0100 Subject: scmi: Include device_compat.h Include the file needed for log function prototype, this patch solves the compilation issue for undefined reference to `dev_err'. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard Reviewed-by: Patrice Chotard --- drivers/firmware/scmi/smccc_agent.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/firmware/scmi/smccc_agent.c b/drivers/firmware/scmi/smccc_agent.c index 64d0929f69c..81c2884bb7e 100644 --- a/drivers/firmware/scmi/smccc_agent.c +++ b/drivers/firmware/scmi/smccc_agent.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include -- cgit v1.3.1 From 9f5e4aa66e69df56f5e8c1be7c30bebe8ff13c90 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 24 Feb 2021 11:19:44 +0100 Subject: scmi: define LOG_CATEGORY Define LOG_CATEGORY to allow filtering with log command. Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass Reviewed-by: Patrice Chotard --- drivers/firmware/scmi/mailbox_agent.c | 2 ++ drivers/firmware/scmi/sandbox-scmi_agent.c | 2 ++ drivers/firmware/scmi/sandbox-scmi_devices.c | 2 ++ drivers/firmware/scmi/scmi_agent-uclass.c | 2 ++ drivers/firmware/scmi/smccc_agent.c | 2 ++ drivers/firmware/scmi/smt.c | 2 ++ 6 files changed, 12 insertions(+) diff --git a/drivers/firmware/scmi/mailbox_agent.c b/drivers/firmware/scmi/mailbox_agent.c index 3f4b04a4ae4..8043e2c2de6 100644 --- a/drivers/firmware/scmi/mailbox_agent.c +++ b/drivers/firmware/scmi/mailbox_agent.c @@ -3,6 +3,8 @@ * Copyright (C) 2020 Linaro Limited. */ +#define LOG_CATEGORY UCLASS_SCMI_AGENT + #include #include #include diff --git a/drivers/firmware/scmi/sandbox-scmi_agent.c b/drivers/firmware/scmi/sandbox-scmi_agent.c index 35de68c75d3..97a5dace15f 100644 --- a/drivers/firmware/scmi/sandbox-scmi_agent.c +++ b/drivers/firmware/scmi/sandbox-scmi_agent.c @@ -3,6 +3,8 @@ * Copyright (C) 2020, Linaro Limited */ +#define LOG_CATEGORY UCLASS_SCMI_AGENT + #include #include #include diff --git a/drivers/firmware/scmi/sandbox-scmi_devices.c b/drivers/firmware/scmi/sandbox-scmi_devices.c index 1a6fafbf531..69239a198f0 100644 --- a/drivers/firmware/scmi/sandbox-scmi_devices.c +++ b/drivers/firmware/scmi/sandbox-scmi_devices.c @@ -3,6 +3,8 @@ * Copyright (C) 2020, Linaro Limited */ +#define LOG_CATEGORY UCLASS_MISC + #include #include #include diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c index 516e690ac2d..2491e0a747b 100644 --- a/drivers/firmware/scmi/scmi_agent-uclass.c +++ b/drivers/firmware/scmi/scmi_agent-uclass.c @@ -3,6 +3,8 @@ * Copyright (C) 2020 Linaro Limited. */ +#define LOG_CATEGORY UCLASS_SCMI_AGENT + #include #include #include diff --git a/drivers/firmware/scmi/smccc_agent.c b/drivers/firmware/scmi/smccc_agent.c index 81c2884bb7e..f185891e8fd 100644 --- a/drivers/firmware/scmi/smccc_agent.c +++ b/drivers/firmware/scmi/smccc_agent.c @@ -3,6 +3,8 @@ * Copyright (C) 2020 Linaro Limited. */ +#define LOG_CATEGORY UCLASS_SCMI_AGENT + #include #include #include diff --git a/drivers/firmware/scmi/smt.c b/drivers/firmware/scmi/smt.c index d25478796aa..60b9d499b79 100644 --- a/drivers/firmware/scmi/smt.c +++ b/drivers/firmware/scmi/smt.c @@ -4,6 +4,8 @@ * Copyright (C) 2019-2020 Linaro Limited. */ +#define LOG_CATEGORY UCLASS_SCMI_AGENT + #include #include #include -- cgit v1.3.1 From 0689dc5323af695920576454e3a9168b0e69fde5 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 24 Feb 2021 11:19:45 +0100 Subject: scmi: cosmetic: reorder include files Reorder include files in expected order. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- drivers/firmware/scmi/mailbox_agent.c | 2 +- drivers/firmware/scmi/scmi_agent-uclass.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/scmi/mailbox_agent.c b/drivers/firmware/scmi/mailbox_agent.c index 8043e2c2de6..ea35e7e09ed 100644 --- a/drivers/firmware/scmi/mailbox_agent.c +++ b/drivers/firmware/scmi/mailbox_agent.c @@ -7,11 +7,11 @@ #include #include -#include #include #include #include #include +#include #include #include diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c index 2491e0a747b..527163b5ce3 100644 --- a/drivers/firmware/scmi/scmi_agent-uclass.c +++ b/drivers/firmware/scmi/scmi_agent-uclass.c @@ -7,11 +7,10 @@ #include #include -#include #include #include #include - +#include #include #include -- cgit v1.3.1 From 3f0038dee4e5e0c7c95640667260e6c8166d40f6 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 24 Feb 2021 11:19:46 +0100 Subject: configs: stm32mp1_trusted_defconfig rely on SCMI support Enable SCMI clock and reset domain support for stm32mp1 platform and ARM SMC mailbox driver used as communication channel for SCMI messages between non-secure world and secure SCMI server. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- configs/stm32mp15_trusted_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig index 107041119f1..13ee75e1860 100644 --- a/configs/stm32mp15_trusted_defconfig +++ b/configs/stm32mp15_trusted_defconfig @@ -53,6 +53,7 @@ CONFIG_ENV_UBI_VOLUME="uboot_config" CONFIG_ENV_UBI_VOLUME_REDUND="uboot_config_r" CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_STM32_ADC=y +CONFIG_CLK_SCMI=y CONFIG_SET_DFU_ALT_INFO=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_BUF_ADDR=0xC0000000 @@ -109,6 +110,7 @@ CONFIG_DM_REGULATOR_GPIO=y CONFIG_DM_REGULATOR_STM32_VREFBUF=y CONFIG_DM_REGULATOR_STPMIC1=y CONFIG_REMOTEPROC_STM32_COPRO=y +CONFIG_RESET_SCMI=y CONFIG_DM_RNG=y CONFIG_RNG_STM32MP1=y CONFIG_DM_RTC=y -- cgit v1.3.1 From 299ad5d6baa80374c1231f725a07cb1245f1f12a Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Thu, 25 Feb 2021 11:49:28 +0100 Subject: board: st: remove the nand MTD configuration for NOR boot in stm32mp1 board Since commit d5d726d3cc47 ("configs: stm32mp1: only support SD card after NOR in bootcmd_stm32mp"), the stm32mp1 boards only support SD card after NOR boot device, so the MTD partitions for nand0 or spi-nand0 are useless (no need of "UBI" partition in nand0 or spi-nand0). This patch removes these nand MTD update for nor boot and simplify nand0 and spi-nand0 support (remove the mtd_boot variable). Signed-off-by: Patrick Delaunay Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- board/st/common/stm32mp_mtdparts.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/board/st/common/stm32mp_mtdparts.c b/board/st/common/stm32mp_mtdparts.c index 69eb10844d4..f074fc189d4 100644 --- a/board/st/common/stm32mp_mtdparts.c +++ b/board/st/common/stm32mp_mtdparts.c @@ -122,28 +122,24 @@ void board_mtdparts_default(const char **mtdids, const char **mtdparts) log_debug("mtd device = %s\n", dev->name); } - if (nor || nand) { + if (nand) { mtd = get_mtd_device_nm("nand0"); if (!IS_ERR_OR_NULL(mtd)) { - const char *mtd_boot = CONFIG_MTDPARTS_NAND0_BOOT; const char *mtd_tee = CONFIG_MTDPARTS_NAND0_TEE; - board_set_mtdparts("nand0", ids, parts, - !nor ? mtd_boot : NULL, + CONFIG_MTDPARTS_NAND0_BOOT, !nor && tee ? mtd_tee : NULL, "-(UBI)"); put_mtd_device(mtd); } } - if (nor || spinand) { + if (spinand) { mtd = get_mtd_device_nm("spi-nand0"); if (!IS_ERR_OR_NULL(mtd)) { - const char *mtd_boot = CONFIG_MTDPARTS_SPINAND0_BOOT; const char *mtd_tee = CONFIG_MTDPARTS_SPINAND0_TEE; - board_set_mtdparts("spi-nand0", ids, parts, - !nor ? mtd_boot : NULL, + CONFIG_MTDPARTS_SPINAND0_BOOT, !nor && tee ? mtd_tee : NULL, "-(UBI)"); put_mtd_device(mtd); @@ -152,11 +148,9 @@ void board_mtdparts_default(const char **mtdids, const char **mtdparts) if (nor) { if (!uclass_get_device(UCLASS_SPI_FLASH, 0, &dev)) { - const char *mtd_boot = CONFIG_MTDPARTS_NOR0_BOOT; const char *mtd_tee = CONFIG_MTDPARTS_NOR0_TEE; - board_set_mtdparts("nor0", ids, parts, - mtd_boot, + CONFIG_MTDPARTS_NOR0_BOOT, tee ? mtd_tee : NULL, "-(nor_user)"); } -- cgit v1.3.1 From 2dc2216692f41f724dae137946e8c5d71f6ff038 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Thu, 25 Feb 2021 13:37:00 +0100 Subject: stm32mp: stm32prog: Add Kconfig file for stm32prog command Move CONFIG_CMD_STM32PROG in a specific Kconfig file for stm32prog command. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- arch/arm/mach-stm32mp/Kconfig | 18 +----------------- arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 17 deletions(-) create mode 100644 arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig index f538d7cb838..079d66a80c1 100644 --- a/arch/arm/mach-stm32mp/Kconfig +++ b/arch/arm/mach-stm32mp/Kconfig @@ -121,23 +121,6 @@ config STM32_ETZPC help Say y to enable STM32 Extended TrustZone Protection -config CMD_STM32PROG - bool "command stm32prog for STM32CudeProgrammer" - select DFU - select DFU_RAM - select DFU_VIRT - select PARTITION_TYPE_GUID - imply CMD_GPT if MMC - imply CMD_MTD if MTD - imply DFU_MMC if MMC - imply DFU_MTD if MTD - help - activate a specific command stm32prog for STM32MP soc family - witch update the device with the tools STM32CubeProgrammer, - using UART with STM32 protocol or USB with DFU protocol - NB: access to not volatile memory (NOR/NAND/SD/eMMC) is based - on U-Boot DFU framework - config CMD_STM32KEY bool "command stm32key to fuse public key hash" default y @@ -177,6 +160,7 @@ config DEBUG_UART_CLOCK default 64000000 endif +source "arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig" source "board/st/stm32mp1/Kconfig" source "board/dhelectronics/dh_stm32mp1/Kconfig" diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig b/arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig new file mode 100644 index 00000000000..609a678793d --- /dev/null +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig @@ -0,0 +1,18 @@ + +config CMD_STM32PROG + bool "command stm32prog for STM32CudeProgrammer" + select DFU + select DFU_RAM + select DFU_VIRT + select PARTITION_TYPE_GUID + imply CMD_GPT if MMC + imply CMD_MTD if MTD + imply DFU_MMC if MMC + imply DFU_MTD if MTD + help + activate a specific command stm32prog for STM32MP soc family + witch update the device with the tools STM32CubeProgrammer, + using UART with STM32 protocol or USB with DFU protocol + NB: access to not volatile memory (NOR/NAND/SD/eMMC) is based + on U-Boot DFU framework + -- cgit v1.3.1 From 5a05af87efcb8f46fd2fcbdde145a7107315446a Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Thu, 25 Feb 2021 13:37:01 +0100 Subject: stm32mp: stm32prog: Add CONFIG_CMD_STM32PROG_SERIAL and _USB Add CONFIG_CMD_STM32PROG_SERIAL and CONFIG_CMD_STM32PROG_USB to independently select the support of UART or USB communication for STM32CubeProgrammer. For serial boot over UART, user can deactivate CONFIG_CMD_STM32PROG_SERIAL to use U-Boot console of binary loaded by UART (for board bring-up for example). Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- arch/arm/mach-stm32mp/Makefile | 2 +- arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig | 20 +++++++++++++++++-- arch/arm/mach-stm32mp/cmd_stm32prog/Makefile | 8 ++++---- .../arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c | 4 ++-- arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h | 23 +++++++++++++++++++++- arch/arm/mach-stm32mp/cpu.c | 5 +++-- board/st/common/stm32mp_dfu.c | 9 +++++---- 7 files changed, 55 insertions(+), 16 deletions(-) diff --git a/arch/arm/mach-stm32mp/Makefile b/arch/arm/mach-stm32mp/Makefile index c8aa24d489e..aa39867080d 100644 --- a/arch/arm/mach-stm32mp/Makefile +++ b/arch/arm/mach-stm32mp/Makefile @@ -11,7 +11,7 @@ obj-y += bsec.o ifdef CONFIG_SPL_BUILD obj-y += spl.o else -obj-$(CONFIG_CMD_STM32PROG) += cmd_stm32prog/ +obj-y += cmd_stm32prog/ obj-$(CONFIG_CMD_STM32KEY) += cmd_stm32key.o obj-$(CONFIG_ARMV7_PSCI) += psci.o obj-$(CONFIG_TFABOOT) += boot_params.o diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig b/arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig index 609a678793d..f4c0d18d4d4 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig @@ -11,8 +11,24 @@ config CMD_STM32PROG imply DFU_MTD if MTD help activate a specific command stm32prog for STM32MP soc family - witch update the device with the tools STM32CubeProgrammer, - using UART with STM32 protocol or USB with DFU protocol + witch update the device with the tools STM32CubeProgrammer NB: access to not volatile memory (NOR/NAND/SD/eMMC) is based on U-Boot DFU framework +config CMD_STM32PROG_USB + bool "support stm32prog over USB" + depends on CMD_STM32PROG + default y + help + activate the command "stm32prog usb" for STM32MP soc family + witch update the device with the tools STM32CubeProgrammer, + using USB with DFU protocol + +config CMD_STM32PROG_SERIAL + bool "support stm32prog over UART" + depends on CMD_STM32PROG + default y + help + activate the command "stm32prog serial" for STM32MP soc family + with the tools STM32CubeProgrammer using U-Boot serial device + and UART protocol. \ No newline at end of file diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/Makefile b/arch/arm/mach-stm32mp/cmd_stm32prog/Makefile index 548a3789218..b57e1bf870b 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/Makefile +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/Makefile @@ -3,7 +3,7 @@ # Copyright (C) 2020, STMicroelectronics - All Rights Reserved # -obj-y += cmd_stm32prog.o -obj-y += stm32prog.o -obj-y += stm32prog_serial.o -obj-y += stm32prog_usb.o +obj-$(CONFIG_CMD_STM32PROG) += cmd_stm32prog.o +obj-$(CONFIG_CMD_STM32PROG) += stm32prog.o +obj-$(CONFIG_CMD_STM32PROG_SERIAL) += stm32prog_serial.o +obj-$(CONFIG_CMD_STM32PROG_USB) += stm32prog_usb.o diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c index 34a6be66c3d..a7e2861764c 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c @@ -50,9 +50,9 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < 3 || argc > 5) return CMD_RET_USAGE; - if (!strcmp(argv[1], "usb")) + if (IS_ENABLED(CONFIG_CMD_STM32PROG_USB) && !strcmp(argv[1], "usb")) link = LINK_USB; - else if (!strcmp(argv[1], "serial")) + else if (IS_ENABLED(CONFIG_CMD_STM32PROG_SERIAL) && !strcmp(argv[1], "serial")) link = LINK_SERIAL; if (link == LINK_UNDEFINED) { diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h index be482c34029..18af99c78bc 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h @@ -177,9 +177,30 @@ char *stm32prog_get_error(struct stm32prog_data *data); /* Main function */ int stm32prog_init(struct stm32prog_data *data, ulong addr, ulong size); +void stm32prog_clean(struct stm32prog_data *data); + +#ifdef CONFIG_CMD_STM32PROG_SERIAL int stm32prog_serial_init(struct stm32prog_data *data, int link_dev); bool stm32prog_serial_loop(struct stm32prog_data *data); +#else +static inline int stm32prog_serial_init(struct stm32prog_data *data, int link_dev) +{ + return -ENOSYS; +} + +static inline bool stm32prog_serial_loop(struct stm32prog_data *data) +{ + return false; +} +#endif + +#ifdef CONFIG_CMD_STM32PROG_USB bool stm32prog_usb_loop(struct stm32prog_data *data, int dev); -void stm32prog_clean(struct stm32prog_data *data); +#else +static inline bool stm32prog_usb_loop(struct stm32prog_data *data, int dev) +{ + return false; +} +#endif #endif diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c index 3faa4ec18a4..a453f89d021 100644 --- a/arch/arm/mach-stm32mp/cpu.c +++ b/arch/arm/mach-stm32mp/cpu.c @@ -265,7 +265,8 @@ int arch_cpu_init(void) boot_mode = get_bootmode(); - if ((boot_mode & TAMP_BOOT_DEVICE_MASK) == BOOT_SERIAL_UART) + if (IS_ENABLED(CONFIG_CMD_STM32PROG_SERIAL) && + (boot_mode & TAMP_BOOT_DEVICE_MASK) == BOOT_SERIAL_UART) gd->flags |= GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE; #if defined(CONFIG_DEBUG_UART) && \ !defined(CONFIG_TFABOOT) && \ @@ -485,7 +486,7 @@ static void setup_boot_mode(void) env_set("boot_instance", cmd); /* restore console on uart when not used */ - if (gd->cur_serial_dev != dev) { + if (IS_ENABLED(CONFIG_CMD_STM32PROG_SERIAL) && gd->cur_serial_dev != dev) { gd->flags &= ~(GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE); printf("serial boot with console enabled!\n"); diff --git a/board/st/common/stm32mp_dfu.c b/board/st/common/stm32mp_dfu.c index 5633a6cb95c..00d1fb8f598 100644 --- a/board/st/common/stm32mp_dfu.c +++ b/board/st/common/stm32mp_dfu.c @@ -143,7 +143,8 @@ void set_dfu_alt_info(char *interface, char *devstr) board_get_alt_info_mtd(mtd, buf); } - if (IS_ENABLED(CONFIG_DFU_VIRT)) { + if (IS_ENABLED(CONFIG_DFU_VIRT) && + IS_ENABLED(CMD_STM32PROG_USB)) { strncat(buf, "&virt 0=OTP", DFU_ALT_BUF_LEN); if (IS_ENABLED(CONFIG_PMIC_STPMIC1)) @@ -217,7 +218,7 @@ int dfu_read_medium_virt(struct dfu_entity *dfu, u64 offset, return dfu_pmic_read(offset, buf, len); } - if (CONFIG_IS_ENABLED(CMD_STM32PROG) && + if (IS_ENABLED(CONFIG_CMD_STM32PROG_USB) && dfu->data.virt.dev_num >= STM32PROG_VIRT_FIRST_DEV_NUM) return stm32prog_read_medium_virt(dfu, offset, buf, len); @@ -228,7 +229,7 @@ int dfu_read_medium_virt(struct dfu_entity *dfu, u64 offset, int dfu_write_medium_virt(struct dfu_entity *dfu, u64 offset, void *buf, long *len) { - if (CONFIG_IS_ENABLED(CMD_STM32PROG) && + if (IS_ENABLED(CONFIG_CMD_STM32PROG_USB) && dfu->data.virt.dev_num >= STM32PROG_VIRT_FIRST_DEV_NUM) return stm32prog_write_medium_virt(dfu, offset, buf, len); @@ -237,7 +238,7 @@ int dfu_write_medium_virt(struct dfu_entity *dfu, u64 offset, int __weak dfu_get_medium_size_virt(struct dfu_entity *dfu, u64 *size) { - if (CONFIG_IS_ENABLED(CMD_STM32PROG) && + if (IS_ENABLED(CONFIG_CMD_STM32PROG_USB) && dfu->data.virt.dev_num >= STM32PROG_VIRT_FIRST_DEV_NUM) return stm32prog_get_medium_size_virt(dfu, size); -- cgit v1.3.1 From b9d5e3aa8ff65e133e7fc5c808fa5ceb6a5d788d Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Thu, 25 Feb 2021 13:37:02 +0100 Subject: stm32mp: stm32prog: reactivate console and display serial error When serial instance is not found in device tree, the console should be enabled and the error should be indicated. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- arch/arm/mach-stm32mp/cpu.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c index a453f89d021..527b6290dec 100644 --- a/arch/arm/mach-stm32mp/cpu.c +++ b/arch/arm/mach-stm32mp/cpu.c @@ -476,11 +476,17 @@ static void setup_boot_mode(void) break; /* serial : search associated alias in devicetree */ sprintf(cmd, "serial@%x", serial_addr[instance]); - if (uclass_get_device_by_name(UCLASS_SERIAL, cmd, &dev)) - break; - if (fdtdec_get_alias_seq(gd->fdt_blob, "serial", - dev_of_offset(dev), &alias)) + if (uclass_get_device_by_name(UCLASS_SERIAL, cmd, &dev) || + fdtdec_get_alias_seq(gd->fdt_blob, "serial", + dev_of_offset(dev), &alias)) { + /* restore console on error */ + if (IS_ENABLED(CONFIG_CMD_STM32PROG_SERIAL)) + gd->flags &= ~(GD_FLG_SILENT | + GD_FLG_DISABLE_CONSOLE); + printf("serial%d = %s not found in device tree!\n", + instance, cmd); break; + } sprintf(cmd, "%d", alias); env_set("boot_device", "serial"); env_set("boot_instance", cmd); -- cgit v1.3.1 From f49eb16c17e2c45e5be712ded316ebcb17d29d17 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Thu, 25 Feb 2021 13:37:03 +0100 Subject: stm32mp: stm32prog: replace alias by serial device sequence number The command "stm32prog serial " can directly use the device sequence number of serial uclass as this sequence number is egual to alias when it exist; this assumption simplify the code and avoid access to gd->fdt_blob and the device tree parsing. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- .../mach-stm32mp/cmd_stm32prog/stm32prog_serial.c | 29 +++++----------------- arch/arm/mach-stm32mp/cpu.c | 11 +++----- 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c index 373ca208861..a51e5e3ec86 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c @@ -187,36 +187,19 @@ static int stm32prog_read(struct stm32prog_data *data, u8 phase, u32 offset, int stm32prog_serial_init(struct stm32prog_data *data, int link_dev) { struct udevice *dev = NULL; - int node; - char alias[10]; - const char *path; struct dm_serial_ops *ops; /* no parity, 8 bits, 1 stop */ u32 serial_config = SERIAL_DEFAULT_CONFIG; down_serial_dev = NULL; - sprintf(alias, "serial%d", link_dev); - path = fdt_get_alias(gd->fdt_blob, alias); - if (!path) { - log_err("%s alias not found", alias); - return -ENODEV; - } - node = fdt_path_offset(gd->fdt_blob, path); - if (!uclass_get_device_by_of_offset(UCLASS_SERIAL, node, - &dev)) { - down_serial_dev = dev; - } else if (node > 0 && - !lists_bind_fdt(gd->dm_root, offset_to_ofnode(node), - &dev, false)) { - if (!device_probe(dev)) - down_serial_dev = dev; - } - if (!down_serial_dev) { - log_err("%s = %s device not found", alias, path); + if (uclass_get_device_by_seq(UCLASS_SERIAL, link_dev, &dev)) { + log_err("serial %d device not found\n", link_dev); return -ENODEV; } + down_serial_dev = dev; + /* force silent console on uart only when used */ if (gd->cur_serial_dev == down_serial_dev) gd->flags |= GD_FLG_DISABLE_CONSOLE | GD_FLG_SILENT; @@ -226,11 +209,11 @@ int stm32prog_serial_init(struct stm32prog_data *data, int link_dev) ops = serial_get_ops(down_serial_dev); if (!ops) { - log_err("%s = %s missing ops", alias, path); + log_err("serial %d = %s missing ops\n", link_dev, dev->name); return -ENODEV; } if (!ops->setconfig) { - log_err("%s = %s missing setconfig", alias, path); + log_err("serial %d = %s missing setconfig\n", link_dev, dev->name); return -ENODEV; } diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c index 527b6290dec..9a76b5633bf 100644 --- a/arch/arm/mach-stm32mp/cpu.c +++ b/arch/arm/mach-stm32mp/cpu.c @@ -466,7 +466,6 @@ static void setup_boot_mode(void) unsigned int instance = (boot_mode & TAMP_BOOT_INSTANCE_MASK) - 1; u32 forced_mode = (boot_ctx & TAMP_BOOT_FORCED_MASK); struct udevice *dev; - int alias; log_debug("%s: boot_ctx=0x%x => boot_mode=%x, instance=%d forced=%x\n", __func__, boot_ctx, boot_mode, instance, forced_mode); @@ -474,20 +473,18 @@ static void setup_boot_mode(void) case BOOT_SERIAL_UART: if (instance > ARRAY_SIZE(serial_addr)) break; - /* serial : search associated alias in devicetree */ + /* serial : search associated node in devicetree */ sprintf(cmd, "serial@%x", serial_addr[instance]); - if (uclass_get_device_by_name(UCLASS_SERIAL, cmd, &dev) || - fdtdec_get_alias_seq(gd->fdt_blob, "serial", - dev_of_offset(dev), &alias)) { + if (uclass_get_device_by_name(UCLASS_SERIAL, cmd, &dev)) { /* restore console on error */ if (IS_ENABLED(CONFIG_CMD_STM32PROG_SERIAL)) gd->flags &= ~(GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE); - printf("serial%d = %s not found in device tree!\n", + printf("uart%d = %s not found in device tree!\n", instance, cmd); break; } - sprintf(cmd, "%d", alias); + sprintf(cmd, "%d", dev_seq(dev)); env_set("boot_device", "serial"); env_set("boot_instance", cmd); -- cgit v1.3.1 From 622c956cada0ce29b4464f8d488951454f3b3bef Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Thu, 25 Feb 2021 13:43:07 +0100 Subject: stm32mp: bsec: manage clock when present in device tree Enable the clocks during bsec probe when they are present in device tree. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- arch/arm/mach-stm32mp/bsec.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c index 88c7aec8b43..fe39bd80cfe 100644 --- a/arch/arm/mach-stm32mp/bsec.c +++ b/arch/arm/mach-stm32mp/bsec.c @@ -6,6 +6,7 @@ #define LOG_CATEGORY UCLASS_MISC #include +#include #include #include #include @@ -490,6 +491,15 @@ static int stm32mp_bsec_probe(struct udevice *dev) { int otp; struct stm32mp_bsec_plat *plat; + struct clk_bulk clk_bulk; + int ret; + + ret = clk_get_bulk(dev, &clk_bulk); + if (!ret) { + ret = clk_enable_bulk(&clk_bulk); + if (ret) + return ret; + } /* * update unlocked shadow for OTP cleared by the rom code -- cgit v1.3.1 From e9470fcd278dd85887f7671e5561351a860bb3d5 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Mon, 1 Mar 2021 19:40:56 +0100 Subject: configs: stm32mp15: move bootdelay configuration in defconfig The STM32MP15 boards have no reason to configure bootdelay in stm32mp1.h as it is already done with CONFIG_BOOTDELAY (default = 2) and in include/env_default.h. This patch allows configuration for customers which reuse stm32mp1.h and reduce the size of the default environment. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- configs/stm32mp15_basic_defconfig | 1 + configs/stm32mp15_dhcom_basic_defconfig | 1 + configs/stm32mp15_dhcor_basic_defconfig | 1 + configs/stm32mp15_trusted_defconfig | 1 + include/configs/stm32mp1.h | 1 - 5 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig index 1c680984b87..0864d4f252a 100644 --- a/configs/stm32mp15_basic_defconfig +++ b/configs/stm32mp15_basic_defconfig @@ -20,6 +20,7 @@ CONFIG_SPL_SPI_SUPPORT=y CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1" CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y +CONFIG_BOOTDELAY=1 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" CONFIG_SPL_LOG=y CONFIG_BOARD_EARLY_INIT_F=y diff --git a/configs/stm32mp15_dhcom_basic_defconfig b/configs/stm32mp15_dhcom_basic_defconfig index ed285e91617..e36d34d001e 100644 --- a/configs/stm32mp15_dhcom_basic_defconfig +++ b/configs/stm32mp15_dhcom_basic_defconfig @@ -19,6 +19,7 @@ CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_SOURCE="board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its" # CONFIG_USE_SPL_FIT_GENERATOR is not set +CONFIG_BOOTDELAY=1 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL_LEGACY_IMAGE_SUPPORT=y diff --git a/configs/stm32mp15_dhcor_basic_defconfig b/configs/stm32mp15_dhcor_basic_defconfig index a6620561aca..4794b1a14d5 100644 --- a/configs/stm32mp15_dhcor_basic_defconfig +++ b/configs/stm32mp15_dhcor_basic_defconfig @@ -17,6 +17,7 @@ CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_SOURCE="board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its" # CONFIG_USE_SPL_FIT_GENERATOR is not set +CONFIG_BOOTDELAY=1 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL_LEGACY_IMAGE_SUPPORT=y diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig index 13ee75e1860..7c32eb7e120 100644 --- a/configs/stm32mp15_trusted_defconfig +++ b/configs/stm32mp15_trusted_defconfig @@ -13,6 +13,7 @@ CONFIG_ENV_OFFSET_REDUND=0x2C0000 CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1" CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y +CONFIG_BOOTDELAY=1 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" CONFIG_SYS_PROMPT="STM32MP> " CONFIG_CMD_ADTIMG=y diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h index 36e400453ea..db2117a3d7c 100644 --- a/include/configs/stm32mp1.h +++ b/include/configs/stm32mp1.h @@ -160,7 +160,6 @@ * and the ramdisk at the end. */ #define CONFIG_EXTRA_ENV_SETTINGS \ - "bootdelay=1\0" \ "kernel_addr_r=0xc2000000\0" \ "fdt_addr_r=0xc4000000\0" \ "scriptaddr=0xc4100000\0" \ -- cgit v1.3.1 From a6d047c0a86b4d91f0964ad35b38577e221cdde2 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Thu, 4 Mar 2021 13:10:33 +0100 Subject: video: stm32: remove all child of DSI bridge when its probe failed Remove the child device of the STM32 DSI bridge when the driver probe failed to stop futher probe request on panels used with STMicroelectronics board (orisetech_otm8009a.c or raydium-rm68200.c driver). This patch avoid the trace "cannot get reset GPIO" when STM32MP157 device tree is used on stm32MP151 SOC without DSI support. In this hw_version value is 0, as DSI bridge is absent and the panel ofdata_to_platdata is called for each try of panel probe, the gpio reset pin is requested but after dsi father probe failed). For the next request, the PANEL ofdata_to_platdata failed as the gpio is already used. Signed-off-by: Patrick Delaunay Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- drivers/video/stm32/stm32_dsi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/stm32/stm32_dsi.c b/drivers/video/stm32/stm32_dsi.c index 8891ca4b784..4027e978c83 100644 --- a/drivers/video/stm32/stm32_dsi.c +++ b/drivers/video/stm32/stm32_dsi.c @@ -483,6 +483,9 @@ static int stm32_dsi_probe(struct udevice *dev) if (priv->hw_version != HWVER_130 && priv->hw_version != HWVER_131) { dev_err(dev, "DSI version 0x%x not supported\n", priv->hw_version); + dev_dbg(dev, "remove and unbind all DSI child\n"); + device_chld_remove(dev, NULL, DM_REMOVE_NORMAL); + device_chld_unbind(dev, NULL); ret = -ENODEV; goto err_clk; } -- cgit v1.3.1 From 612f76922756c6fab6992c637b4a5dec2a64beb0 Mon Sep 17 00:00:00 2001 From: Yannick Fertre Date: Thu, 4 Mar 2021 13:14:35 +0100 Subject: video: dw_mipi_dsi: missing device to log debug Missing udevice to struct dw_mipi_dsi to log trace. Signed-off-by: Yannick Fertre Signed-off-by: Patrick Delaunay Acked-by: Yannick Fertre Reviewed-by: Patrice Chotard --- drivers/video/dw_mipi_dsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/dw_mipi_dsi.c b/drivers/video/dw_mipi_dsi.c index 4dde6488144..a5beed3514e 100644 --- a/drivers/video/dw_mipi_dsi.c +++ b/drivers/video/dw_mipi_dsi.c @@ -797,6 +797,7 @@ static int dw_mipi_dsi_init(struct udevice *dev, dsi->phy_ops = phy_ops; dsi->max_data_lanes = max_data_lanes; dsi->device = device; + dsi->dsi_host.dev = (struct device *)dev; dsi->dsi_host.ops = &dw_mipi_dsi_host_ops; device->host = &dsi->dsi_host; -- cgit v1.3.1 From c45f82bb2ee9c923a84b13f3eff8e151fbafa66b Mon Sep 17 00:00:00 2001 From: Yannick Fertre Date: Thu, 4 Mar 2021 13:14:36 +0100 Subject: video: dw_mipi_dsi: update log of dphy_enable The DSI phy can be turned on from the DSI digital interface in the dphy_enable() function or from a dedicated DSI phy "wrapper" in phy_ops->init() function. If the STM32MP1 case, the wrapper is used then the dphy_enable() "warning" traces are not relevant. This patch moves these "warning" traces to "debug" traces so they are still available for DSI phy based on the digital interface in debug logging mode, but not there in normal mode for both cases. Note: The related Linux kernel driver uses a "debug" message too. Signed-off-by: Yannick Fertre Signed-off-by: Patrick Delaunay Acked-by: Yannick Fertre Reviewed-by: Patrice Chotard --- drivers/video/dw_mipi_dsi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/dw_mipi_dsi.c b/drivers/video/dw_mipi_dsi.c index a5beed3514e..9ae09eec12b 100644 --- a/drivers/video/dw_mipi_dsi.c +++ b/drivers/video/dw_mipi_dsi.c @@ -721,15 +721,15 @@ static void dw_mipi_dsi_dphy_enable(struct dw_mipi_dsi *dsi) ret = readl_poll_timeout(dsi->base + DSI_PHY_STATUS, val, val & PHY_LOCK, PHY_STATUS_TIMEOUT_US); if (ret) - dev_warn(dsi->dsi_host.dev, - "failed to wait phy lock state\n"); + dev_dbg(dsi->dsi_host.dev, + "failed to wait phy lock state\n"); ret = readl_poll_timeout(dsi->base + DSI_PHY_STATUS, val, val & PHY_STOP_STATE_CLK_LANE, PHY_STATUS_TIMEOUT_US); if (ret) - dev_warn(dsi->dsi_host.dev, - "failed to wait phy clk lane stop state\n"); + dev_dbg(dsi->dsi_host.dev, + "failed to wait phy clk lane stop state\n"); } static void dw_mipi_dsi_clear_err(struct dw_mipi_dsi *dsi) -- cgit v1.3.1 From 9f97193616f1fa2a9983ef3f846d5e5b42bc97a6 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Mon, 1 Mar 2021 13:17:56 +0100 Subject: board: stm32mp1: use CONFIG_SYS_MMC_ENV_DEV when available Check whether user has explicitly defined the mmc device to use in mmc_get_env_dev() with CONFIG_SYS_MMC_ENV_DEV. On STMicroelectronics boards the used mmc device for environment is the instance of boot device provided by the ROM code; the mmc instance is configured by alias in device tree. The used partition is defined in device tree with u-boot,mmc-env-partition = "ssbl". This patch allows to override this selection for the support of customer boards without alias; for example when SDMMC1 is not used and ENV in mmc0=SDMMC2, user can force the value: CONFIG_SYS_MMC_ENV_DEV = 0. On STMicroelectronics boards, the current behavior is kept with CONFIG_SYS_MMC_ENV_DEV = -1. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- board/st/stm32mp1/stm32mp1.c | 8 +++++++- configs/stm32mp15_basic_defconfig | 1 + configs/stm32mp15_trusted_defconfig | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index ab85d8ba683..759181fb5d1 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -862,8 +862,14 @@ const char *env_ext4_get_dev_part(void) int mmc_get_env_dev(void) { - u32 bootmode = get_bootmode(); + u32 bootmode; + + if (CONFIG_SYS_MMC_ENV_DEV >= 0) + return CONFIG_SYS_MMC_ENV_DEV; + + bootmode = get_bootmode(); + /* use boot instance to select the correct mmc device identifier */ return (bootmode & TAMP_BOOT_INSTANCE_MASK) - 1; } diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig index 0864d4f252a..fbca4828779 100644 --- a/configs/stm32mp15_basic_defconfig +++ b/configs/stm32mp15_basic_defconfig @@ -72,6 +72,7 @@ CONFIG_ENV_UBI_PART="UBI" CONFIG_ENV_UBI_VOLUME="uboot_config" CONFIG_ENV_UBI_VOLUME_REDUND="uboot_config_r" CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_SYS_MMC_ENV_DEV=-1 # CONFIG_SPL_ENV_IS_NOWHERE is not set # CONFIG_SPL_ENV_IS_IN_SPI_FLASH is not set CONFIG_STM32_ADC=y diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig index 7c32eb7e120..ba9a660abfe 100644 --- a/configs/stm32mp15_trusted_defconfig +++ b/configs/stm32mp15_trusted_defconfig @@ -53,6 +53,7 @@ CONFIG_ENV_UBI_PART="UBI" CONFIG_ENV_UBI_VOLUME="uboot_config" CONFIG_ENV_UBI_VOLUME_REDUND="uboot_config_r" CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_SYS_MMC_ENV_DEV=-1 CONFIG_STM32_ADC=y CONFIG_CLK_SCMI=y CONFIG_SET_DFU_ALT_INFO=y -- cgit v1.3.1 From 92baaada1a9b9a2876e383d4985f07fefa4d513d Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Wed, 24 Feb 2021 13:38:19 +0100 Subject: configs: stm32: Remove BOARD_EARLY_INIT_F and BOARD_LATE_INIT for stm32 boards These flags was defined and callbacks linked to these flags are empty and only returning 0. Remove BOARD_EARLY_INIT_F and BOARD_LATE_INIT flags for these stm32 boards. Signed-off-by: Patrice Chotard Reviewed-by: Patrick Delaunay --- configs/stm32f429-discovery_defconfig | 1 - configs/stm32f429-evaluation_defconfig | 1 - configs/stm32f469-discovery_defconfig | 1 - configs/stm32f746-disco_defconfig | 1 - configs/stm32f769-disco_defconfig | 2 -- configs/stm32h743-disco_defconfig | 2 -- configs/stm32h743-eval_defconfig | 2 -- 7 files changed, 10 deletions(-) diff --git a/configs/stm32f429-discovery_defconfig b/configs/stm32f429-discovery_defconfig index 99bf64ace5d..a1721fddfdc 100644 --- a/configs/stm32f429-discovery_defconfig +++ b/configs/stm32f429-discovery_defconfig @@ -14,7 +14,6 @@ CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk consoleblank=0 ignore_loglevel" # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set -CONFIG_BOARD_EARLY_INIT_F=y CONFIG_MISC_INIT_R=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot > " diff --git a/configs/stm32f429-evaluation_defconfig b/configs/stm32f429-evaluation_defconfig index 4511ac85cee..55505ea3784 100644 --- a/configs/stm32f429-evaluation_defconfig +++ b/configs/stm32f429-evaluation_defconfig @@ -11,7 +11,6 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTDELAY=3 # CONFIG_USE_BOOTCOMMAND is not set # CONFIG_DISPLAY_CPUINFO is not set -CONFIG_BOARD_EARLY_INIT_F=y CONFIG_MISC_INIT_R=y CONFIG_SYS_PROMPT="U-Boot > " CONFIG_CMD_IMLS=y diff --git a/configs/stm32f469-discovery_defconfig b/configs/stm32f469-discovery_defconfig index d13794e4207..37603970c2e 100644 --- a/configs/stm32f469-discovery_defconfig +++ b/configs/stm32f469-discovery_defconfig @@ -11,7 +11,6 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTDELAY=3 # CONFIG_USE_BOOTCOMMAND is not set # CONFIG_DISPLAY_CPUINFO is not set -CONFIG_BOARD_EARLY_INIT_F=y CONFIG_MISC_INIT_R=y CONFIG_SYS_PROMPT="U-Boot > " CONFIG_CMD_IMLS=y diff --git a/configs/stm32f746-disco_defconfig b/configs/stm32f746-disco_defconfig index 106ef28b831..e6585e5e9c2 100644 --- a/configs/stm32f746-disco_defconfig +++ b/configs/stm32f746-disco_defconfig @@ -18,7 +18,6 @@ CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk consoleblank=0 ignore_loglevel # CONFIG_USE_BOOTCOMMAND is not set # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set -CONFIG_BOARD_EARLY_INIT_F=y CONFIG_BOARD_LATE_INIT=y CONFIG_SYS_PROMPT="U-Boot > " CONFIG_CMD_GPT=y diff --git a/configs/stm32f769-disco_defconfig b/configs/stm32f769-disco_defconfig index cc3fad603b2..6dc96683263 100644 --- a/configs/stm32f769-disco_defconfig +++ b/configs/stm32f769-disco_defconfig @@ -18,8 +18,6 @@ CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk consoleblank=0 ignore_loglevel # CONFIG_USE_BOOTCOMMAND is not set # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set -CONFIG_BOARD_EARLY_INIT_F=y -CONFIG_BOARD_LATE_INIT=y CONFIG_SYS_PROMPT="U-Boot > " CONFIG_CMD_GPT=y # CONFIG_RANDOM_UUID is not set diff --git a/configs/stm32h743-disco_defconfig b/configs/stm32h743-disco_defconfig index 788da28f552..4f4144c9173 100644 --- a/configs/stm32h743-disco_defconfig +++ b/configs/stm32h743-disco_defconfig @@ -15,8 +15,6 @@ CONFIG_AUTOBOOT_STOP_STR=" " # CONFIG_USE_BOOTCOMMAND is not set CONFIG_DEFAULT_FDT_FILE="stm32h743i-disco" # CONFIG_DISPLAY_CPUINFO is not set -CONFIG_BOARD_EARLY_INIT_F=y -CONFIG_BOARD_LATE_INIT=y CONFIG_SYS_PROMPT="U-Boot > " CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y diff --git a/configs/stm32h743-eval_defconfig b/configs/stm32h743-eval_defconfig index d752f5e7928..18124859e65 100644 --- a/configs/stm32h743-eval_defconfig +++ b/configs/stm32h743-eval_defconfig @@ -15,8 +15,6 @@ CONFIG_AUTOBOOT_STOP_STR=" " # CONFIG_USE_BOOTCOMMAND is not set CONFIG_DEFAULT_FDT_FILE="stm32h743i-eval" # CONFIG_DISPLAY_CPUINFO is not set -CONFIG_BOARD_EARLY_INIT_F=y -CONFIG_BOARD_LATE_INIT=y CONFIG_SYS_PROMPT="U-Boot > " CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y -- cgit v1.3.1 From 729fa17f065ff0cb652bee55b08d8d83b594ff3e Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Wed, 24 Feb 2021 13:38:20 +0100 Subject: board: st: Remove board_early_init_f and board_late_init callbacks for stm32 boards Remove board_early_init_f() and board_late_init() callbacks for stm32 boards as the corresponding flags (CONFIG_BOARD_LATE_INIT and CONFIG_BOARD_EARLY_INIT_R) are now disabled. Signed-off-by: Patrice Chotard Reviewed-by: Patrick Delaunay --- board/st/stm32f429-discovery/stm32f429-discovery.c | 5 ----- board/st/stm32f429-evaluation/stm32f429-evaluation.c | 5 ----- board/st/stm32f469-discovery/stm32f469-discovery.c | 5 ----- board/st/stm32f746-disco/stm32f746-disco.c | 5 ----- board/st/stm32h743-disco/stm32h743-disco.c | 10 ---------- board/st/stm32h743-eval/stm32h743-eval.c | 10 ---------- 6 files changed, 40 deletions(-) diff --git a/board/st/stm32f429-discovery/stm32f429-discovery.c b/board/st/stm32f429-discovery/stm32f429-discovery.c index 9d8fc9f5a2e..46fcf907fc6 100644 --- a/board/st/stm32f429-discovery/stm32f429-discovery.c +++ b/board/st/stm32f429-discovery/stm32f429-discovery.c @@ -51,11 +51,6 @@ u32 get_board_rev(void) return 0; } -int board_early_init_f(void) -{ - return 0; -} - int board_init(void) { gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100; diff --git a/board/st/stm32f429-evaluation/stm32f429-evaluation.c b/board/st/stm32f429-evaluation/stm32f429-evaluation.c index 96b4c257263..3b6df1f3ab3 100644 --- a/board/st/stm32f429-evaluation/stm32f429-evaluation.c +++ b/board/st/stm32f429-evaluation/stm32f429-evaluation.c @@ -45,11 +45,6 @@ u32 get_board_rev(void) return 0; } -int board_early_init_f(void) -{ - return 0; -} - int board_init(void) { gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100; diff --git a/board/st/stm32f469-discovery/stm32f469-discovery.c b/board/st/stm32f469-discovery/stm32f469-discovery.c index 742fd67b98e..c5df9b0d9c0 100644 --- a/board/st/stm32f469-discovery/stm32f469-discovery.c +++ b/board/st/stm32f469-discovery/stm32f469-discovery.c @@ -45,11 +45,6 @@ u32 get_board_rev(void) return 0; } -int board_early_init_f(void) -{ - return 0; -} - int board_init(void) { gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100; diff --git a/board/st/stm32f746-disco/stm32f746-disco.c b/board/st/stm32f746-disco/stm32f746-disco.c index 40450ca914b..143cc6e1ea2 100644 --- a/board/st/stm32f746-disco/stm32f746-disco.c +++ b/board/st/stm32f746-disco/stm32f746-disco.c @@ -48,11 +48,6 @@ int dram_init_banksize(void) return fdtdec_setup_memory_banksize(); } -int board_early_init_f(void) -{ - return 0; -} - #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_SPL_OS_BOOT int spl_start_uboot(void) diff --git a/board/st/stm32h743-disco/stm32h743-disco.c b/board/st/stm32h743-disco/stm32h743-disco.c index 405836aba39..4091d5f9fde 100644 --- a/board/st/stm32h743-disco/stm32h743-disco.c +++ b/board/st/stm32h743-disco/stm32h743-disco.c @@ -36,21 +36,11 @@ int dram_init_banksize(void) return 0; } -int board_early_init_f(void) -{ - return 0; -} - u32 get_board_rev(void) { return 0; } -int board_late_init(void) -{ - return 0; -} - int board_init(void) { gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100; diff --git a/board/st/stm32h743-eval/stm32h743-eval.c b/board/st/stm32h743-eval/stm32h743-eval.c index 405836aba39..4091d5f9fde 100644 --- a/board/st/stm32h743-eval/stm32h743-eval.c +++ b/board/st/stm32h743-eval/stm32h743-eval.c @@ -36,21 +36,11 @@ int dram_init_banksize(void) return 0; } -int board_early_init_f(void) -{ - return 0; -} - u32 get_board_rev(void) { return 0; } -int board_late_init(void) -{ - return 0; -} - int board_init(void) { gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100; -- cgit v1.3.1 From 23e20b2fa61029d9767a84bb76b786775779da8b Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Wed, 24 Feb 2021 13:53:27 +0100 Subject: arm: stm32mp: Fix compilation issue when SYS_DCACHE_OFF and/or SYS_DCACHE_SYS are enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix following compilation issue when SYS_DCACHE_OFF and/or SYS_DCACHE_SYS are enabled : arch/arm/mach-stm32mp/cpu.c: In function ‘early_enable_caches’: arch/arm/mach-stm32mp/cpu.c:223:10: error: ‘volatile struct arch_global_data’ has no member named ‘tlb_size’ 223 | gd->arch.tlb_size = PGTABLE_SIZE; | ^ arch/arm/mach-stm32mp/cpu.c:224:10: error: ‘volatile struct arch_global_data’ has no member named ‘tlb_addr’ 224 | gd->arch.tlb_addr = (unsigned long)&early_tlb; | ^ Signed-off-by: Patrice Chotard Signed-off-by: Patrice Chotard Reviewed-by: Patrick Delaunay --- arch/arm/mach-stm32mp/cpu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c index 9a76b5633bf..bc2db535beb 100644 --- a/arch/arm/mach-stm32mp/cpu.c +++ b/arch/arm/mach-stm32mp/cpu.c @@ -223,8 +223,10 @@ static void early_enable_caches(void) if (CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) return; - gd->arch.tlb_size = PGTABLE_SIZE; - gd->arch.tlb_addr = (unsigned long)&early_tlb; + 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; + } dcache_enable(); -- cgit v1.3.1 From b076cbe8aa2b3c29a3acc89fbea9fb7676f15fa7 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 6 Mar 2021 21:44:17 +0100 Subject: doc: stm32mp1: Use u-boot.itb if CONFIG_SPL_LOAD_FIT=y For systems where SPL loads fitImage, i.e. CONFIG_SPL_LOAD_FIT=y, use u-boot.itb in the relevant documentation parts. Otherwise use u-boot.img. Signed-off-by: Marek Vasut Cc: Patrice Chotard Cc: Patrick Delaunay Reviewed-by: Patrice Chotard --- doc/board/st/stm32mp1.rst | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/board/st/stm32mp1.rst b/doc/board/st/stm32mp1.rst index 20f5c9e301e..f0c2b09b988 100644 --- a/doc/board/st/stm32mp1.rst +++ b/doc/board/st/stm32mp1.rst @@ -237,7 +237,8 @@ Build Procedure - For Basic boot - FSBL = spl/u-boot-spl.stm32 - - SSBL = u-boot.img + - SSBL = u-boot.img (without CONFIG_SPL_LOAD_FIT) or + u-boot.itb (with CONFIG_SPL_LOAD_FIT=y) Switch Setting for Boot Mode ---------------------------- @@ -347,7 +348,9 @@ c) copy the FSBL (2 times) and SSBL file on the correct partition. # dd if=u-boot-spl.stm32 of=/dev/mmcblk0p1 # dd if=u-boot-spl.stm32 of=/dev/mmcblk0p2 - # dd if=u-boot.img of=/dev/mmcblk0p3 + # dd if=u-boot.img of=/dev/mmcblk0p3 # Without CONFIG_SPL_LOAD_FIT + OR + dd if=u-boot.itb of=/dev/mmcblk0p3 # With CONFIG_SPL_LOAD_FIT=y for trusted boot mode: :: @@ -363,8 +366,9 @@ Prepare eMMC You can use U-Boot to copy binary in eMMC. In the next example, you need to boot from SD card and the images -(u-boot-spl.stm32, u-boot.img) are presents on SD card (mmc 0) -in ext4 partition 4 (bootfs). +(u-boot-spl.stm32, u-boot.img for systems without CONFIG_SPL_LOAD_FIT +or u-boot.itb for systems with CONFIG_SPL_LOAD_FIT=y) are presents on +SD card (mmc 0) in ext4 partition 4 (bootfs). To boot from SD card, select BootPinMode = 1 0 1 and reset. @@ -387,7 +391,9 @@ b) copy SPL on eMMC on firts boot partition c) copy U-Boot in first GPT partition of eMMC:: - # ext4load mmc 0:4 0xC0000000 u-boo t.img + # ext4load mmc 0:4 0xC0000000 u-boot.img # Without CONFIG_SPL_LOAD_FIT + OR + ext4load mmc 0:4 0xC0000000 u-boot.itb # With CONFIG_SPL_LOAD_FIT=y # mmc dev 1 # part start mmc 1 1 partstart # mmc write ${fileaddr} ${partstart} ${filesize} -- cgit v1.3.1