diff options
author | Tom Rini | 2021-01-13 15:00:53 -0500 |
---|---|---|
committer | Tom Rini | 2021-01-13 15:00:53 -0500 |
commit | ab1a425524a79eeca61e7b67fdf382c7a499346f (patch) | |
tree | 08f3925c3cb439f674ebf41cc5003c95ea5c4a57 /arch | |
parent | 795f8fd0b591eef7cf3f8c6fcf9788280029cc4a (diff) | |
parent | 7ccaa31380a4abb2b23718008a54fe2917db8edf (diff) |
Merge tag 'u-boot-stm32-20210113' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
- Enable logging features for stm32mp15 boards
- Update MAINTAINERS emails for STI and STM32
- Activate OF_LIVE for ST stm32mp15 boards
- Switch to MCO2 for PHY 50 MHz clock for DHCOM boards
- Correction in stm32prog command on uart: always flush DFU on start command
- Update USB-C power detection algorithm on DK boards
Diffstat (limited to 'arch')
21 files changed, 175 insertions, 144 deletions
diff --git a/arch/arm/dts/stih410-b2260-u-boot.dtsi b/arch/arm/dts/stih410-b2260-u-boot.dtsi index 897c42146aa..3b080ac7a1b 100644 --- a/arch/arm/dts/stih410-b2260-u-boot.dtsi +++ b/arch/arm/dts/stih410-b2260-u-boot.dtsi @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2018, STMicroelectronics - All Rights Reserved - * Author(s): Patrice Chotard, <patrice.chotard@st.com> for STMicroelectronics. + * Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics. * */ diff --git a/arch/arm/dts/stih410-b2260.dts b/arch/arm/dts/stih410-b2260.dts index 4fbd8e9eb5b..8c4155b6227 100644 --- a/arch/arm/dts/stih410-b2260.dts +++ b/arch/arm/dts/stih410-b2260.dts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2016 STMicroelectronics (R&D) Limited. - * Author: Patrice Chotard <patrice.chotard@st.com> + * Author: Patrice Chotard <patrice.chotard@foss.st.com> */ /dts-v1/; #include "stih410.dtsi" diff --git a/arch/arm/dts/stm32429i-eval-u-boot.dtsi b/arch/arm/dts/stm32429i-eval-u-boot.dtsi index e75cf99f8fa..09d9d9ab9b6 100644 --- a/arch/arm/dts/stm32429i-eval-u-boot.dtsi +++ b/arch/arm/dts/stm32429i-eval-u-boot.dtsi @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2018, STMicroelectronics - All Rights Reserved - * Author(s): Patrice Chotard, <patrice.chotard@st.com> for STMicroelectronics. + * Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics. */ #include <dt-bindings/memory/stm32-sdram.h> diff --git a/arch/arm/dts/stm32f429-disco-u-boot.dtsi b/arch/arm/dts/stm32f429-disco-u-boot.dtsi index df99e01393a..297cc561445 100644 --- a/arch/arm/dts/stm32f429-disco-u-boot.dtsi +++ b/arch/arm/dts/stm32f429-disco-u-boot.dtsi @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2017, STMicroelectronics - All Rights Reserved - * Author(s): Patrice Chotard, <patrice.chotard@st.com> for STMicroelectronics. + * Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics. */ #include <dt-bindings/memory/stm32-sdram.h> diff --git a/arch/arm/dts/stm32f469-disco-u-boot.dtsi b/arch/arm/dts/stm32f469-disco-u-boot.dtsi index 7223ba4a60d..9eda8f535b7 100644 --- a/arch/arm/dts/stm32f469-disco-u-boot.dtsi +++ b/arch/arm/dts/stm32f469-disco-u-boot.dtsi @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2017, STMicroelectronics - All Rights Reserved - * Author(s): Patrice Chotard, <patrice.chotard@st.com> for STMicroelectronics. + * Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics. */ #include <dt-bindings/memory/stm32-sdram.h> diff --git a/arch/arm/dts/stm32h743i-disco.dts b/arch/arm/dts/stm32h743i-disco.dts index 81007161e74..7927310d8e2 100644 --- a/arch/arm/dts/stm32h743i-disco.dts +++ b/arch/arm/dts/stm32h743i-disco.dts @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ OR X11 /* - * Copyright 2017 - Patrice Chotard <patrice.chotard@st.com> + * Copyright 2017 - Patrice Chotard <patrice.chotard@foss.st.com> * */ diff --git a/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi b/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi index 92345b7ba36..6868769c6e8 100644 --- a/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi +++ b/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi @@ -72,8 +72,8 @@ &pinctrl { /* These should bound to FMC2 bus driver, but we do not have one */ - pinctrl-0 = <&fmc_pins_b>; - pinctrl-1 = <&fmc_sleep_pins_b>; + pinctrl-0 = <&fmc_pins_b &mco2_pins_a>; + pinctrl-1 = <&fmc_sleep_pins_b &mco2_sleep_pins_a>; pinctrl-names = "default", "sleep"; fmc_pins_b: fmc-0 { @@ -130,6 +130,21 @@ <STM32_PINMUX('G', 12, ANALOG)>; /* FMC_NE4 */ }; }; + + mco2_pins_a: mco2-0 { + pins { + pinmux = <STM32_PINMUX('G', 2, AF1)>; /* MCO2 */ + bias-disable; + drive-push-pull; + slew-rate = <2>; + }; + }; + + mco2_sleep_pins_a: mco2-sleep-0 { + pins { + pinmux = <STM32_PINMUX('G', 2, ANALOG)>; /* MCO2 */ + }; + }; }; &pmic { @@ -181,7 +196,7 @@ CLK_PLL4_HSE CLK_RTC_LSE CLK_MCO1_DISABLED - CLK_MCO2_DISABLED + CLK_MCO2_PLL4P >; st,clkdiv = < @@ -195,7 +210,7 @@ 2 /*APB5*/ 23 /*RTC*/ 0 /*MCO1*/ - 0 /*MCO2*/ + 1 /*MCO2*/ >; st,pkcs = < @@ -258,7 +273,7 @@ pll4: st,pll@3 { compatible = "st,stm32mp1-pll"; reg = <3>; - cfg = < 1 49 11 11 11 PQR(1,1,1) >; + cfg = < 1 49 5 11 11 PQR(1,1,1) >; u-boot,dm-pre-reloc; }; }; diff --git a/arch/arm/dts/stm32mp15xx-dhcom.dtsi b/arch/arm/dts/stm32mp15xx-dhcom.dtsi index dafcce43239..a1d1b8dec76 100644 --- a/arch/arm/dts/stm32mp15xx-dhcom.dtsi +++ b/arch/arm/dts/stm32mp15xx-dhcom.dtsi @@ -58,7 +58,6 @@ phy-mode = "rmii"; max-speed = <100>; phy-handle = <&phy0>; - st,eth_ref_clk_sel; phy-reset-gpios = <&gpioh 15 GPIO_ACTIVE_LOW>; mdio0 { @@ -267,7 +266,7 @@ pinmux = <STM32_PINMUX('G', 13, AF11)>, /* ETH1_RMII_TXD0 */ <STM32_PINMUX('G', 14, AF11)>, /* ETH1_RMII_TXD1 */ <STM32_PINMUX('B', 11, AF11)>, /* ETH1_RMII_TX_EN */ - <STM32_PINMUX('A', 1, AF0)>, /* ETH1_RMII_REF_CLK */ + <STM32_PINMUX('A', 1, AF11)>, /* ETH1_RMII_REF_CLK */ <STM32_PINMUX('A', 2, AF11)>, /* ETH1_MDIO */ <STM32_PINMUX('C', 1, AF11)>; /* ETH1_MDC */ bias-disable; diff --git a/arch/arm/mach-stm32mp/boot_params.c b/arch/arm/mach-stm32mp/boot_params.c index 37ee9e1612c..13322e34d60 100644 --- a/arch/arm/mach-stm32mp/boot_params.c +++ b/arch/arm/mach-stm32mp/boot_params.c @@ -3,6 +3,8 @@ * Copyright (C) 2019, STMicroelectronics - All Rights Reserved */ +#define LOG_CATEGORY LOGC_ARCH + #include <common.h> #include <log.h> #include <asm/sections.h> @@ -32,15 +34,15 @@ void save_boot_params(unsigned long r0, unsigned long r1, unsigned long r2, */ void *board_fdt_blob_setup(void) { - debug("%s: nt_fw_dtb=%lx\n", __func__, nt_fw_dtb); + log_debug("%s: nt_fw_dtb=%lx\n", __func__, nt_fw_dtb); /* use external device tree only if address is valid */ if (nt_fw_dtb >= STM32_DDR_BASE) { if (fdt_magic(nt_fw_dtb) == FDT_MAGIC) return (void *)nt_fw_dtb; - debug("%s: DTB not found.\n", __func__); + log_debug("%s: DTB not found.\n", __func__); } - debug("%s: fall back to builtin DTB, %p\n", __func__, &_end); + log_debug("%s: fall back to builtin DTB, %p\n", __func__, &_end); return (void *)&_end; } diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c index 84e0bddcd44..88c7aec8b43 100644 --- a/arch/arm/mach-stm32mp/bsec.c +++ b/arch/arm/mach-stm32mp/bsec.c @@ -3,6 +3,8 @@ * Copyright (C) 2018, STMicroelectronics - All Rights Reserved */ +#define LOG_CATEGORY UCLASS_MISC + #include <common.h> #include <dm.h> #include <log.h> @@ -10,6 +12,7 @@ #include <asm/io.h> #include <asm/arch/bsec.h> #include <asm/arch/stm32mp1_smc.h> +#include <dm/device_compat.h> #include <linux/arm-smccc.h> #include <linux/iopoll.h> @@ -160,7 +163,7 @@ static int bsec_power_safmem(u32 base, bool power) * @otp: otp number (0 - BSEC_OTP_MAX_VALUE) * Return: 0 if no error */ -static int bsec_shadow_register(u32 base, u32 otp) +static int bsec_shadow_register(struct udevice *dev, u32 base, u32 otp) { u32 val; int ret; @@ -168,7 +171,8 @@ static int bsec_shadow_register(u32 base, u32 otp) /* check if shadowing of otp is locked */ if (bsec_read_SR_lock(base, otp)) - pr_debug("bsec : OTP %d is locked and refreshed with 0\n", otp); + dev_dbg(dev, "OTP %d is locked and refreshed with 0\n", + otp); /* check if safemem is power up */ val = readl(base + BSEC_OTP_STATUS_OFF); @@ -203,7 +207,7 @@ static int bsec_shadow_register(u32 base, u32 otp) * @otp: otp number (0 - BSEC_OTP_MAX_VALUE) * Return: 0 if no error */ -static int bsec_read_shadow(u32 base, u32 *val, u32 otp) +static int bsec_read_shadow(struct udevice *dev, u32 base, u32 *val, u32 otp) { *val = readl(base + BSEC_OTP_DATA_OFF + otp * sizeof(u32)); @@ -217,11 +221,11 @@ static int bsec_read_shadow(u32 base, u32 *val, u32 otp) * @otp: otp number (0 - BSEC_OTP_MAX_VALUE) * Return: 0 if no error */ -static int bsec_write_shadow(u32 base, u32 val, u32 otp) +static int bsec_write_shadow(struct udevice *dev, u32 base, u32 val, u32 otp) { /* check if programming of otp is locked */ if (bsec_read_SW_lock(base, otp)) - pr_debug("bsec : OTP %d is lock, write will be ignore\n", otp); + dev_dbg(dev, "OTP %d is lock, write will be ignore\n", otp); writel(val, base + BSEC_OTP_DATA_OFF + otp * sizeof(u32)); @@ -236,16 +240,16 @@ static int bsec_write_shadow(u32 base, u32 val, u32 otp) * after the function the otp data is not refreshed in shadow * Return: 0 if no error */ -static int bsec_program_otp(long base, u32 val, u32 otp) +static int bsec_program_otp(struct udevice *dev, long base, u32 val, u32 otp) { u32 ret; bool power_up = false; if (bsec_read_SP_lock(base, otp)) - pr_debug("bsec : OTP %d locked, prog will be ignore\n", otp); + dev_dbg(dev, "OTP %d locked, prog will be ignore\n", otp); if (readl(base + BSEC_OTP_LOCK_OFF) & (1 << BSEC_LOCK_PROGRAM)) - pr_debug("bsec : Global lock, prog will be ignore\n"); + dev_dbg(dev, "Global lock, prog will be ignore\n"); /* check if safemem is power up */ if (!(readl(base + BSEC_OTP_STATUS_OFF) & BSEC_MODE_PWR_MASK)) { @@ -298,21 +302,21 @@ static int stm32mp_bsec_read_otp(struct udevice *dev, u32 *val, u32 otp) plat = dev_get_plat(dev); /* read current shadow value */ - ret = bsec_read_shadow(plat->base, &tmp_data, otp); + ret = bsec_read_shadow(dev, plat->base, &tmp_data, otp); if (ret) return ret; /* copy otp in shadow */ - ret = bsec_shadow_register(plat->base, otp); + ret = bsec_shadow_register(dev, plat->base, otp); if (ret) return ret; - ret = bsec_read_shadow(plat->base, val, otp); + ret = bsec_read_shadow(dev, plat->base, val, otp); if (ret) return ret; /* restore shadow value */ - ret = bsec_write_shadow(plat->base, tmp_data, otp); + ret = bsec_write_shadow(dev, plat->base, tmp_data, otp); return ret; } @@ -328,7 +332,7 @@ static int stm32mp_bsec_read_shadow(struct udevice *dev, u32 *val, u32 otp) plat = dev_get_plat(dev); - return bsec_read_shadow(plat->base, val, otp); + return bsec_read_shadow(dev, plat->base, val, otp); } static int stm32mp_bsec_read_lock(struct udevice *dev, u32 *val, u32 otp) @@ -352,7 +356,7 @@ static int stm32mp_bsec_write_otp(struct udevice *dev, u32 val, u32 otp) plat = dev_get_plat(dev); - return bsec_program_otp(plat->base, val, otp); + return bsec_program_otp(dev, plat->base, val, otp); } @@ -367,7 +371,7 @@ static int stm32mp_bsec_write_shadow(struct udevice *dev, u32 val, u32 otp) plat = dev_get_plat(dev); - return bsec_write_shadow(plat->base, val, otp); + return bsec_write_shadow(dev, plat->base, val, otp); } static int stm32mp_bsec_write_lock(struct udevice *dev, u32 val, u32 otp) @@ -497,7 +501,7 @@ static int stm32mp_bsec_probe(struct udevice *dev) for (otp = 57; otp <= BSEC_OTP_MAX_VALUE; otp++) if (!bsec_read_SR_lock(plat->base, otp)) - bsec_shadow_register(plat->base, otp); + bsec_shadow_register(dev, plat->base, otp); } return 0; @@ -527,7 +531,7 @@ bool bsec_dbgswenable(void) ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(stm32mp_bsec), &dev); if (ret || !dev) { - pr_debug("bsec driver not available\n"); + log_debug("bsec driver not available\n"); return false; } diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c index 544bab38480..42fdc112388 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32key.c +++ b/arch/arm/mach-stm32mp/cmd_stm32key.c @@ -6,6 +6,7 @@ #include <common.h> #include <command.h> #include <console.h> +#include <log.h> #include <misc.h> #include <dm/device.h> #include <dm/uclass.h> @@ -34,7 +35,7 @@ static void fuse_hash_value(u32 addr, bool print) DM_DRIVER_GET(stm32mp_bsec), &dev); if (ret) { - pr_err("Can't find stm32mp_bsec driver\n"); + log_err("Can't find stm32mp_bsec driver\n"); return; } diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c index 49dd25b28f4..34a6be66c3d 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c @@ -56,7 +56,7 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc, link = LINK_SERIAL; if (link == LINK_UNDEFINED) { - pr_err("not supported link=%s\n", argv[1]); + log_err("not supported link=%s\n", argv[1]); return CMD_RET_USAGE; } @@ -90,7 +90,7 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc, data = (struct stm32prog_data *)malloc(sizeof(*data)); if (!data) { - pr_err("Alloc failed."); + log_err("Alloc failed."); return CMD_RET_FAILURE; } stm32prog_data = data; diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c index fc9a2af5459..a8e7158c1f4 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c @@ -97,28 +97,28 @@ u8 stm32prog_header_check(struct raw_header_s *raw_header, header->image_length = 0x0; if (!raw_header || !header) { - pr_debug("%s:no header data\n", __func__); + log_debug("%s:no header data\n", __func__); return -1; } if (raw_header->magic_number != (('S' << 0) | ('T' << 8) | ('M' << 16) | (0x32 << 24))) { - pr_debug("%s:invalid magic number : 0x%x\n", - __func__, raw_header->magic_number); + log_debug("%s:invalid magic number : 0x%x\n", + __func__, raw_header->magic_number); return -2; } /* only header v1.0 supported */ if (raw_header->header_version != 0x00010000) { - pr_debug("%s:invalid header version : 0x%x\n", - __func__, raw_header->header_version); + log_debug("%s:invalid header version : 0x%x\n", + __func__, raw_header->header_version); return -3; } if (raw_header->reserved1 != 0x0 || raw_header->reserved2) { - pr_debug("%s:invalid reserved field\n", __func__); + log_debug("%s:invalid reserved field\n", __func__); return -4; } for (i = 0; i < (sizeof(raw_header->padding) / 4); i++) { if (raw_header->padding[i] != 0) { - pr_debug("%s:invalid padding field\n", __func__); + log_debug("%s:invalid padding field\n", __func__); return -5; } } @@ -376,7 +376,7 @@ static int parse_flash_layout(struct stm32prog_data *data, last = start + size; *last = 0x0; /* force null terminated string */ - pr_debug("flash layout =\n%s\n", start); + log_debug("flash layout =\n%s\n", start); /* calculate expected number of partitions */ part_list_size = 1; @@ -584,11 +584,11 @@ static int init_device(struct stm32prog_data *data, last_addr = (u64)(block_dev->lba - GPT_HEADER_SZ - 1) * block_dev->blksz; } - pr_debug("MMC %d: lba=%ld blksz=%ld\n", dev->dev_id, - block_dev->lba, block_dev->blksz); - pr_debug(" available address = 0x%llx..0x%llx\n", - first_addr, last_addr); - pr_debug(" full_update = %d\n", dev->full_update); + log_debug("MMC %d: lba=%ld blksz=%ld\n", dev->dev_id, + block_dev->lba, block_dev->blksz); + log_debug(" available address = 0x%llx..0x%llx\n", + first_addr, last_addr); + log_debug(" full_update = %d\n", dev->full_update); break; case STM32PROG_NOR: case STM32PROG_NAND: @@ -598,7 +598,7 @@ static int init_device(struct stm32prog_data *data, return -ENODEV; } get_mtd_by_target(mtd_id, dev->target, dev->dev_id); - pr_debug("%s\n", mtd_id); + log_debug("%s\n", mtd_id); mtdparts_init(); mtd = get_mtd_device_nm(mtd_id); @@ -609,10 +609,10 @@ static int init_device(struct stm32prog_data *data, first_addr = 0; last_addr = mtd->size; dev->erase_size = mtd->erasesize; - pr_debug("MTD device %s: size=%lld erasesize=%d\n", - mtd_id, mtd->size, mtd->erasesize); - pr_debug(" available address = 0x%llx..0x%llx\n", - first_addr, last_addr); + log_debug("MTD device %s: size=%lld erasesize=%d\n", + mtd_id, mtd->size, mtd->erasesize); + log_debug(" available address = 0x%llx..0x%llx\n", + first_addr, last_addr); dev->mtd = mtd; break; case STM32PROG_RAM: @@ -624,13 +624,13 @@ static int init_device(struct stm32prog_data *data, stm32prog_err("unknown device type = %d", dev->target); return -ENODEV; } - pr_debug(" erase size = 0x%x\n", dev->erase_size); - pr_debug(" full_update = %d\n", dev->full_update); + log_debug(" erase size = 0x%x\n", dev->erase_size); + log_debug(" full_update = %d\n", dev->full_update); /* order partition list in offset order */ list_sort(NULL, &dev->part_list, &part_cmp); part_id = 1; - pr_debug("id : Opt Phase Name target.n dev.n addr size part_off part_size\n"); + log_debug("id : Opt Phase Name target.n dev.n addr size part_off part_size\n"); list_for_each_entry(part, &dev->part_list, list) { if (part->bin_nb > 1) { if ((dev->target != STM32PROG_NAND && @@ -650,10 +650,10 @@ static int init_device(struct stm32prog_data *data, part->size = block_dev->lba * block_dev->blksz; else part->size = last_addr; - pr_debug("-- : %1d %02x %14s %02d.%d %02d.%02d %08llx %08llx\n", - part->option, part->id, part->name, - part->part_type, part->bin_nb, part->target, - part->dev_id, part->addr, part->size); + log_debug("-- : %1d %02x %14s %02d.%d %02d.%02d %08llx %08llx\n", + part->option, part->id, part->name, + part->part_type, part->bin_nb, part->target, + part->dev_id, part->addr, part->size); continue; } if (part->part_id < 0) { /* boot hw partition for eMMC */ @@ -709,10 +709,10 @@ static int init_device(struct stm32prog_data *data, part->dev->erase_size); return -EINVAL; } - pr_debug("%02d : %1d %02x %14s %02d.%d %02d.%02d %08llx %08llx", - part->part_id, part->option, part->id, part->name, - part->part_type, part->bin_nb, part->target, - part->dev_id, part->addr, part->size); + log_debug("%02d : %1d %02x %14s %02d.%d %02d.%02d %08llx %08llx", + part->part_id, part->option, part->id, part->name, + part->part_type, part->bin_nb, part->target, + part->dev_id, part->addr, part->size); part_addr = 0; part_size = 0; @@ -726,7 +726,7 @@ static int init_device(struct stm32prog_data *data, * created for full update */ if (dev->full_update || part->part_id < 0) { - pr_debug("\n"); + log_debug("\n"); continue; } struct disk_partition partinfo; @@ -770,11 +770,11 @@ static int init_device(struct stm32prog_data *data, /* no partition for this device */ if (!part_found) { - pr_debug("\n"); + log_debug("\n"); continue; } - pr_debug(" %08llx %08llx\n", part_addr, part_size); + log_debug(" %08llx %08llx\n", part_addr, part_size); if (part->addr != part_addr) { stm32prog_err("%s (0x%x): Bad address for partition %d (%s) = 0x%llx <> 0x%llx expected", @@ -910,8 +910,8 @@ static int create_gpt_partitions(struct stm32prog_data *data) continue; if (offset + 100 > buflen) { - pr_debug("\n%s: buffer too small, %s skippped", - __func__, part->name); + log_debug("\n%s: buffer too small, %s skippped", + __func__, part->name); continue; } @@ -959,7 +959,7 @@ static int create_gpt_partitions(struct stm32prog_data *data) if (offset) { offset += snprintf(buf + offset, buflen - offset, "\""); - pr_debug("\ncmd: %s\n", buf); + log_debug("\ncmd: %s\n", buf); if (run_command(buf, 0)) { stm32prog_err("GPT partitionning fail: %s", buf); @@ -974,7 +974,7 @@ static int create_gpt_partitions(struct stm32prog_data *data) #ifdef DEBUG sprintf(buf, "gpt verify mmc %d", data->dev[i].dev_id); - pr_debug("\ncmd: %s", buf); + log_debug("\ncmd: %s", buf); if (run_command(buf, 0)) printf("fail !\n"); else @@ -1098,10 +1098,10 @@ static int stm32prog_alt_add(struct stm32prog_data *data, stm32prog_err("invalid target: %d", part->target); return ret; } - pr_debug("dfu_alt_add(%s,%s,%s)\n", dfustr, devstr, buf); + log_debug("dfu_alt_add(%s,%s,%s)\n", dfustr, devstr, buf); ret = dfu_alt_add(dfu, dfustr, devstr, buf); - pr_debug("dfu_alt_add(%s,%s,%s) result %d\n", - dfustr, devstr, buf, ret); + log_debug("dfu_alt_add(%s,%s,%s) result %d\n", + dfustr, devstr, buf, ret); return ret; } @@ -1116,7 +1116,7 @@ static int stm32prog_alt_add_virt(struct dfu_entity *dfu, sprintf(devstr, "%d", phase); sprintf(buf, "@%s/0x%02x/1*%dBe", name, phase, size); ret = dfu_alt_add(dfu, "virt", devstr, buf); - pr_debug("dfu_alt_add(virt,%s,%s) result %d\n", devstr, buf, ret); + log_debug("dfu_alt_add(virt,%s,%s) result %d\n", devstr, buf, ret); return ret; } @@ -1171,7 +1171,7 @@ static int dfu_init_entities(struct stm32prog_data *data) sprintf(buf, "@FlashLayout/0x%02x/1*256Ke ram %x 40000", PHASE_FLASHLAYOUT, STM32_DDR_BASE); ret = dfu_alt_add(dfu, "ram", NULL, buf); - pr_debug("dfu_alt_add(ram, NULL,%s) result %d\n", buf, ret); + log_debug("dfu_alt_add(ram, NULL,%s) result %d\n", buf, ret); } if (!ret) @@ -1196,7 +1196,7 @@ static int dfu_init_entities(struct stm32prog_data *data) int stm32prog_otp_write(struct stm32prog_data *data, u32 offset, u8 *buffer, long *size) { - pr_debug("%s: %x %lx\n", __func__, offset, *size); + log_debug("%s: %x %lx\n", __func__, offset, *size); if (!data->otp_part) { data->otp_part = memalign(CONFIG_SYS_CACHELINE_SIZE, OTP_SIZE); @@ -1226,7 +1226,7 @@ int stm32prog_otp_read(struct stm32prog_data *data, u32 offset, u8 *buffer, return -1; } - pr_debug("%s: %x %lx\n", __func__, offset, *size); + log_debug("%s: %x %lx\n", __func__, offset, *size); /* alway read for first packet */ if (!offset) { if (!data->otp_part) @@ -1258,7 +1258,7 @@ int stm32prog_otp_read(struct stm32prog_data *data, u32 offset, u8 *buffer, memcpy(buffer, (void *)((u32)data->otp_part + offset), *size); end_otp_read: - pr_debug("%s: result %i\n", __func__, result); + log_debug("%s: result %i\n", __func__, result); return result; } @@ -1292,20 +1292,20 @@ int stm32prog_otp_start(struct stm32prog_data *data) result = 0; break; default: - pr_err("%s: OTP incorrect value (err = %ld)\n", - __func__, res.a1); + log_err("%s: OTP incorrect value (err = %ld)\n", + __func__, res.a1); result = -EINVAL; break; } } else { - pr_err("%s: Failed to exec svc=%x op=%x in secure mode (err = %ld)\n", - __func__, STM32_SMC_BSEC, STM32_SMC_WRITE_ALL, res.a0); + log_err("%s: Failed to exec svc=%x op=%x in secure mode (err = %ld)\n", + __func__, STM32_SMC_BSEC, STM32_SMC_WRITE_ALL, res.a0); result = -EINVAL; } free(data->otp_part); data->otp_part = NULL; - pr_debug("%s: result %i\n", __func__, result); + log_debug("%s: result %i\n", __func__, result); return result; } @@ -1313,7 +1313,7 @@ int stm32prog_otp_start(struct stm32prog_data *data) int stm32prog_pmic_write(struct stm32prog_data *data, u32 offset, u8 *buffer, long *size) { - pr_debug("%s: %x %lx\n", __func__, offset, *size); + log_debug("%s: %x %lx\n", __func__, offset, *size); if (!offset) memset(data->pmic_part, 0, PMIC_SIZE); @@ -1338,7 +1338,7 @@ int stm32prog_pmic_read(struct stm32prog_data *data, u32 offset, u8 *buffer, return -EOPNOTSUPP; } - pr_debug("%s: %x %lx\n", __func__, offset, *size); + log_debug("%s: %x %lx\n", __func__, offset, *size); ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(stpmic1_nvm), &dev); @@ -1373,7 +1373,7 @@ int stm32prog_pmic_read(struct stm32prog_data *data, u32 offset, u8 *buffer, memcpy(buffer, &data->pmic_part[offset], *size); end_pmic_read: - pr_debug("%s: result %i\n", __func__, result); + log_debug("%s: result %i\n", __func__, result); return result; } @@ -1429,7 +1429,7 @@ static int stm32prog_copy_fsbl(struct stm32prog_part_t *part) if (!fsbl) return -ENOMEM; ret = dfu->read_medium(dfu, 0, fsbl, &size); - pr_debug("%s read size=%lx ret=%d\n", __func__, size, ret); + log_debug("%s read size=%lx ret=%d\n", __func__, size, ret); if (ret) goto error; @@ -1439,8 +1439,8 @@ static int stm32prog_copy_fsbl(struct stm32prog_part_t *part) offset += size; /* write to the next erase block */ ret = dfu->write_medium(dfu, offset, fsbl, &size); - pr_debug("%s copy at ofset=%lx size=%lx ret=%d", - __func__, offset, size, ret); + log_debug("%s copy at ofset=%lx size=%lx ret=%d", + __func__, offset, size, ret); if (ret) goto error; } @@ -1751,6 +1751,6 @@ void dfu_initiated_callback(struct dfu_entity *dfu) if (dfu->alt == stm32prog_data->cur_part->alt_id) { dfu->offset = stm32prog_data->offset; stm32prog_data->dfu_seq = 0; - pr_debug("dfu offset = 0x%llx\n", dfu->offset); + log_debug("dfu offset = 0x%llx\n", dfu->offset); } } diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h index bae4e91c01d..be482c34029 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h @@ -172,7 +172,7 @@ char *stm32prog_get_error(struct stm32prog_data *data); if (data->phase != PHASE_RESET) { \ sprintf(data->error, args); \ data->phase = PHASE_RESET; \ - pr_err("Error: %s\n", data->error); } \ + log_err("Error: %s\n", data->error); } \ } /* Main function */ diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c index 8aad4be467e..68d841bd9d1 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c @@ -159,8 +159,8 @@ static int stm32prog_read(struct stm32prog_data *data, u8 phase, u32 offset, dfu_entity->offset = offset; data->offset = offset; data->read_phase = phase; - pr_debug("\nSTM32 download read %s offset=0x%x\n", - dfu_entity->name, offset); + log_debug("\nSTM32 download read %s offset=0x%x\n", + dfu_entity->name, offset); ret = dfu_read(dfu_entity, buffer, buffer_size, dfu_entity->i_blk_seq_num); if (ret < 0) { @@ -198,7 +198,7 @@ int stm32prog_serial_init(struct stm32prog_data *data, int link_dev) sprintf(alias, "serial%d", link_dev); path = fdt_get_alias(gd->fdt_blob, alias); if (!path) { - pr_err("%s alias not found", alias); + log_err("%s alias not found", alias); return -ENODEV; } node = fdt_path_offset(gd->fdt_blob, path); @@ -212,7 +212,7 @@ int stm32prog_serial_init(struct stm32prog_data *data, int link_dev) down_serial_dev = dev; } if (!down_serial_dev) { - pr_err("%s = %s device not found", alias, path); + log_err("%s = %s device not found", alias, path); return -ENODEV; } @@ -225,11 +225,11 @@ int stm32prog_serial_init(struct stm32prog_data *data, int link_dev) ops = serial_get_ops(down_serial_dev); if (!ops) { - pr_err("%s = %s missing ops", alias, path); + log_err("%s = %s missing ops", alias, path); return -ENODEV; } if (!ops->setconfig) { - pr_err("%s = %s missing setconfig", alias, path); + log_err("%s = %s missing setconfig", alias, path); return -ENODEV; } @@ -397,14 +397,13 @@ static u8 stm32prog_start(struct stm32prog_data *data, u32 address) if (!dfu_entity) return -ENODEV; - if (data->dfu_seq) { - ret = dfu_flush(dfu_entity, NULL, 0, data->dfu_seq); - data->dfu_seq = 0; - if (ret) { - stm32prog_err("DFU flush failed [%d]", ret); - return ret; - } + ret = dfu_flush(dfu_entity, NULL, 0, data->dfu_seq); + if (ret) { + stm32prog_err("DFU flush failed [%d]", ret); + return ret; } + data->dfu_seq = 0; + printf("\n received length = 0x%x\n", data->cursor); if (data->header.present) { if (data->cursor != @@ -815,7 +814,7 @@ static void download_command(struct stm32prog_data *data) if (data->cursor > image_header->image_length + BL_HEADER_SIZE) { - pr_err("expected size exceeded\n"); + log_err("expected size exceeded\n"); result = ABORT_BYTE; goto end; } @@ -859,8 +858,8 @@ static void read_partition_command(struct stm32prog_data *data) rcv_data = stm32prog_serial_getc(); if (rcv_data != tmp_xor) { - pr_debug("1st checksum received = %x, computed %x\n", - rcv_data, tmp_xor); + log_debug("1st checksum received = %x, computed %x\n", + rcv_data, tmp_xor); goto error; } stm32prog_serial_putc(ACK_BYTE); @@ -872,12 +871,12 @@ static void read_partition_command(struct stm32prog_data *data) rcv_data = stm32prog_serial_getc(); if ((rcv_data ^ tmp_xor) != 0xFF) { - pr_debug("2nd checksum received = %x, computed %x\n", - rcv_data, tmp_xor); + log_debug("2nd checksum received = %x, computed %x\n", + rcv_data, tmp_xor); goto error; } - pr_debug("%s : %x\n", __func__, part_id); + log_debug("%s : %x\n", __func__, part_id); rcv_data = 0; switch (part_id) { case PHASE_OTP: diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c index 30547f94c94..bc44d9fc8f9 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c @@ -47,11 +47,11 @@ static int stm32prog_cmd_write(u64 offset, void *buf, long *len) int ret; if (*len < 5) { - pr_err("size not allowed\n"); + log_err("size not allowed\n"); return -EINVAL; } if (offset) { - pr_err("invalid offset\n"); + log_err("invalid offset\n"); return -EINVAL; } phase = pt[0]; @@ -66,7 +66,7 @@ static int stm32prog_cmd_write(u64 offset, void *buf, long *len) /* set phase and offset */ ret = stm32prog_set_phase(stm32prog_data, phase, address); if (ret) - pr_err("failed: %d\n", ret); + log_err("failed: %d\n", ret); return ret; } @@ -81,7 +81,7 @@ static int stm32prog_cmd_read(u64 offset, void *buf, long *len) int length; if (*len < PHASE_MIN_SIZE) { - pr_err("request exceeds allowed area\n"); + log_err("request exceeds allowed area\n"); return -EINVAL; } if (offset) { @@ -171,8 +171,8 @@ int stm32prog_get_medium_size_virt(struct dfu_entity *dfu, u64 *size) { if (dfu->dev_type != DFU_DEV_VIRT) { *size = 0; - pr_debug("%s, invalid dev_type = %d\n", - __func__, dfu->dev_type); + log_debug("%s, invalid dev_type = %d\n", + __func__, dfu->dev_type); return -EINVAL; } @@ -227,6 +227,6 @@ bool stm32prog_usb_loop(struct stm32prog_data *data, int dev) int g_dnl_get_board_bcd_device_number(int gcnum) { - pr_debug("%s\n", __func__); + log_debug("%s\n", __func__); return 0x200; } diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c index 29c0d92195c..717f80e9ff3 100644 --- a/arch/arm/mach-stm32mp/cpu.c +++ b/arch/arm/mach-stm32mp/cpu.c @@ -2,6 +2,9 @@ /* * Copyright (C) 2018, STMicroelectronics - All Rights Reserved */ + +#define LOG_CATEGORY LOGC_ARCH + #include <common.h> #include <clk.h> #include <cpu_func.h> @@ -463,8 +466,8 @@ static void setup_boot_mode(void) struct udevice *dev; int alias; - pr_debug("%s: boot_ctx=0x%x => boot_mode=%x, instance=%d forced=%x\n", - __func__, boot_ctx, boot_mode, instance, forced_mode); + log_debug("%s: boot_ctx=0x%x => boot_mode=%x, instance=%d forced=%x\n", + __func__, boot_ctx, boot_mode, instance, forced_mode); switch (boot_mode & TAMP_BOOT_DEVICE_MASK) { case BOOT_SERIAL_UART: if (instance > ARRAY_SIZE(serial_addr)) @@ -510,7 +513,7 @@ static void setup_boot_mode(void) env_set("boot_instance", "0"); break; default: - pr_debug("unexpected boot mode = %x\n", boot_mode); + log_debug("unexpected boot mode = %x\n", boot_mode); break; } @@ -537,7 +540,7 @@ static void setup_boot_mode(void) case BOOT_NORMAL: break; default: - pr_debug("unexpected forced boot mode = %x\n", forced_mode); + log_debug("unexpected forced boot mode = %x\n", forced_mode); break; } @@ -577,14 +580,13 @@ __weak int setup_mac_address(void) enetaddr[i] = ((uint8_t *)&otp)[i]; if (!is_valid_ethaddr(enetaddr)) { - pr_err("invalid MAC address in OTP %pM\n", enetaddr); + log_err("invalid MAC address in OTP %pM\n", enetaddr); return -EINVAL; } - pr_debug("OTP MAC address = %pM\n", enetaddr); + log_debug("OTP MAC address = %pM\n", enetaddr); ret = eth_env_set_enetaddr("ethaddr", enetaddr); if (ret) - pr_err("Failed to set mac address %pM from OTP: %d\n", - enetaddr, ret); + log_err("Failed to set mac address %pM from OTP: %d\n", enetaddr, ret); #endif return 0; diff --git a/arch/arm/mach-stm32mp/dram_init.c b/arch/arm/mach-stm32mp/dram_init.c index 0e8ce63f4a2..32b177bb798 100644 --- a/arch/arm/mach-stm32mp/dram_init.c +++ b/arch/arm/mach-stm32mp/dram_init.c @@ -3,6 +3,8 @@ * Copyright (C) 2018, STMicroelectronics - All Rights Reserved */ +#define LOG_CATEGORY LOGC_ARCH + #include <common.h> #include <dm.h> #include <image.h> @@ -21,15 +23,15 @@ int dram_init(void) ret = uclass_get_device(UCLASS_RAM, 0, &dev); if (ret) { - debug("RAM init failed: %d\n", ret); + log_debug("RAM init failed: %d\n", ret); return ret; } ret = ram_get_info(dev, &ram); if (ret) { - debug("Cannot get RAM size: %d\n", ret); + log_debug("Cannot get RAM size: %d\n", ret); return ret; } - debug("RAM init base=%lx, size=%x\n", ram.base, ram.size); + log_debug("RAM init base=%lx, size=%x\n", ram.base, ram.size); gd->ram_size = ram.size; diff --git a/arch/arm/mach-stm32mp/fdt.c b/arch/arm/mach-stm32mp/fdt.c index 0de1d822912..aaedeac8d5b 100644 --- a/arch/arm/mach-stm32mp/fdt.c +++ b/arch/arm/mach-stm32mp/fdt.c @@ -3,6 +3,8 @@ * Copyright (C) 2019-2020, STMicroelectronics - All Rights Reserved */ +#define LOG_CATEGORY LOGC_ARCH + #include <common.h> #include <fdt_support.h> #include <log.h> @@ -172,15 +174,15 @@ static int stm32_fdt_fixup_etzpc(void *fdt, int soc_node) status = (decprot[offset] >> shift) & DECPROT_MASK; addr = array[i]; - debug("ETZPC: 0x%08x decprot %d=%d\n", addr, i, status); + log_debug("ETZPC: 0x%08x decprot %d=%d\n", addr, i, status); if (addr == ETZPC_RESERVED || status == DECPROT_NON_SECURED) continue; if (fdt_disable_subnode_by_address(fdt, soc_node, addr)) - printf("ETZPC: 0x%08x node disabled, decprot %d=%d\n", - addr, i, status); + log_notice("ETZPC: 0x%08x node disabled, decprot %d=%d\n", + addr, i, status); } return 0; @@ -194,7 +196,7 @@ static void stm32_fdt_fixup_cpu(void *blob, char *name) off = fdt_path_offset(blob, "/cpus"); if (off < 0) { - printf("%s: couldn't find /cpus node\n", __func__); + log_warning("%s: couldn't find /cpus node\n", __func__); return; } @@ -203,7 +205,8 @@ static void stm32_fdt_fixup_cpu(void *blob, char *name) reg = fdtdec_get_addr(blob, off, "reg"); if (reg != 0) { fdt_del_node(blob, off); - printf("FDT: cpu %d node remove for %s\n", reg, name); + log_notice("FDT: cpu %d node remove for %s\n", + reg, name); /* after delete we can't trust the offsets anymore */ off = -1; } @@ -216,8 +219,8 @@ static void stm32_fdt_disable(void *fdt, int offset, u32 addr, const char *string, const char *name) { if (fdt_disable_subnode_by_address(fdt, offset, addr)) - printf("FDT: %s@%08x node disabled for %s\n", - string, addr, name); + log_notice("FDT: %s@%08x node disabled for %s\n", + string, addr, name); } static void stm32_fdt_disable_optee(void *blob) diff --git a/arch/arm/mach-stm32mp/pwr_regulator.c b/arch/arm/mach-stm32mp/pwr_regulator.c index 766ed95f1a6..846637ab162 100644 --- a/arch/arm/mach-stm32mp/pwr_regulator.c +++ b/arch/arm/mach-stm32mp/pwr_regulator.c @@ -3,6 +3,8 @@ * Copyright (C) 2018, STMicroelectronics - All Rights Reserved */ +#define LOG_CATEGORY UCLASS_REGULATOR + #include <common.h> #include <dm.h> #include <errno.h> diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c index 66a634654ee..0c50ad54df6 100644 --- a/arch/arm/mach-stm32mp/spl.c +++ b/arch/arm/mach-stm32mp/spl.c @@ -3,6 +3,8 @@ * Copyright (C) 2018, STMicroelectronics - All Rights Reserved */ +#define LOG_CATEGORY LOGC_ARCH + #include <common.h> #include <cpu_func.h> #include <dm.h> @@ -80,7 +82,7 @@ void spl_display_print(void) */ model = fdt_getprop(gd->fdt_blob, 0, "model", NULL); if (model) - printf("Model: %s\n", model); + log_info("Model: %s\n", model); } #endif @@ -98,25 +100,25 @@ void board_init_f(ulong dummy) ret = spl_early_init(); if (ret) { - debug("spl_early_init() failed: %d\n", ret); + log_debug("spl_early_init() failed: %d\n", ret); hang(); } ret = uclass_get_device(UCLASS_CLK, 0, &dev); if (ret) { - debug("Clock init failed: %d\n", ret); + log_debug("Clock init failed: %d\n", ret); hang(); } ret = uclass_get_device(UCLASS_RESET, 0, &dev); if (ret) { - debug("Reset init failed: %d\n", ret); + log_debug("Reset init failed: %d\n", ret); hang(); } ret = uclass_get_device(UCLASS_PINCTRL, 0, &dev); if (ret) { - debug("%s: Cannot find pinctrl device\n", __func__); + log_debug("%s: Cannot find pinctrl device\n", __func__); hang(); } @@ -125,13 +127,13 @@ void board_init_f(ulong dummy) ret = board_early_init_f(); if (ret) { - debug("board_early_init_f() failed: %d\n", ret); + log_debug("board_early_init_f() failed: %d\n", ret); hang(); } ret = uclass_get_device(UCLASS_RAM, 0, &dev); if (ret) { - printf("DRAM init failed: %d\n", ret); + log_err("DRAM init failed: %d\n", ret); hang(); } |