All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@st.com>
To: u-boot@lists.denx.de
Subject: [PATCH 03/33] arm: stm32mp: bsec: migrate trace to log macro
Date: Wed, 21 Oct 2020 12:01:58 +0000	[thread overview]
Message-ID: <f72a1baf-a8be-8520-65d6-794e56e2e3c7@st.com> (raw)
In-Reply-To: <20201014091646.4233-4-patrick.delaunay@st.com>


On 10/14/20 11:16 AM, Patrick Delaunay wrote:
> Define LOG_CATEGORY, change pr_debug to dev_dbg and remove "bsec:"
> header as it is managed by log macro (dev->name is displayed)
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
>  arch/arm/mach-stm32mp/bsec.c | 38 ++++++++++++++++++++----------------
>  1 file changed, 21 insertions(+), 17 deletions(-)
>
> diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c
> index a9b9bd0902..70650cfbf7 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>
> @@ -11,6 +13,7 @@
>  #include <asm/arch/bsec.h>
>  #include <asm/arch/stm32mp1_smc.h>
>  #include <linux/arm-smccc.h>
> +#include <linux/compat.h>
>  #include <linux/iopoll.h>
>  
>  #define BSEC_OTP_MAX_VALUE		95
> @@ -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_platdata(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_platdata(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_platdata(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_platdata(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_GET_DRIVER(stm32mp_bsec), &dev);
>  	if (ret || !dev) {
> -		pr_debug("bsec driver not available\n");
> +		log_debug("bsec driver not available\n");
>  		return false;
>  	}
>  

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>

Thanks

  reply	other threads:[~2020-10-21 12:01 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14  9:16 [PATCH 00/33] stm32: enable logging features Patrick Delaunay
2020-10-14  9:16 ` [PATCH 01/33] arm: stm32mp: migrate trace to log macro Patrick Delaunay
2020-10-21 12:01   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 02/33] arm: stm32mp: migrate cmd_stm32prog " Patrick Delaunay
2020-10-21 12:01   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 03/33] arm: stm32mp: bsec: migrate trace " Patrick Delaunay
2020-10-21 12:01   ` Patrice CHOTARD [this message]
2020-10-14  9:16 ` [PATCH 04/33] pinctrl: stm32: " Patrick Delaunay
2020-10-21 12:38   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 05/33] gpio: stm32-gpio: migrate trace to dev and " Patrick Delaunay
2020-10-21 12:24   ` Patrice CHOTARD
2020-10-21 12:29   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 06/33] remoproc: stm32: migrate trace to " Patrick Delaunay
2020-10-21 12:25   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 07/33] ram: " Patrick Delaunay
2020-10-21 12:25   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 08/33] ram: stm32mp1: migrate trace to dev or " Patrick Delaunay
2020-10-21 12:25   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 09/33] mmc: stm32_sdmmc2: migrate trace to dev and " Patrick Delaunay
2020-10-15 10:25   ` Peng Fan
2020-10-21 12:26   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 10/33] timer: stm32: migrate trace to " Patrick Delaunay
2020-10-21 12:26   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 11/33] hwspinlock: " Patrick Delaunay
2020-10-21 12:26   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 12/33] rtc: " Patrick Delaunay
2020-10-21 12:26   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 13/33] watchdog: stm32mp: migrate trace to dev macro Patrick Delaunay
2020-10-21 12:27   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 14/33] power: regulator: stm32-verfbuf: define LOG_CATEGORY Patrick Delaunay
2020-10-21 12:27   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 15/33] misc: rcc: migrate trace to dev macro Patrick Delaunay
2020-10-21 12:27   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 16/33] misc: rcc: keep the rcc device name for subnode Patrick Delaunay
2020-10-21 12:28   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 17/33] clk: stm32mp1: migrate trace to dev and log macro Patrick Delaunay
2020-10-21 12:28   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 18/33] clk: clk_stm32f: " Patrick Delaunay
2020-10-21 12:32   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 19/33] clk: clk_stm32h7: " Patrick Delaunay
2020-10-21 12:32   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 20/33] reset: stm32-reset: " Patrick Delaunay
2020-10-21 12:32   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 21/33] mailbox: stm32-ipcc: " Patrick Delaunay
2020-10-21 12:33   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 22/33] i2c: stm32f7_i2c: " Patrick Delaunay
2020-10-21 12:33   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 23/33] phy: stm32-usbphyc: " Patrick Delaunay
2020-10-21 12:33   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 24/33] spi: stm32_spi: " Patrick Delaunay
2020-10-21 12:34   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 25/33] spi: stm32_qspi: " Patrick Delaunay
2020-10-21 12:34   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 26/33] mtd: stm32_fmc2: " Patrick Delaunay
2020-10-21 12:34   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 27/33] memory: stm32-fmc2: " Patrick Delaunay
2020-10-21 12:34   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 28/33] serial: stm32: define LOG_CATEGORY Patrick Delaunay
2020-10-21 12:34   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 29/33] video: stm32_ltdc: migrate trace to dev and log macro Patrick Delaunay
2020-10-21 12:35   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 30/33] video: stm32_dsi: " Patrick Delaunay
2020-10-15  8:50   ` Philippe CORNU
2020-10-14  9:16 ` [PATCH 31/33] board: st: stm32mp1: " Patrick Delaunay
2020-10-21 12:35   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 32/33] board: st: common: " Patrick Delaunay
2020-10-21 12:36   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 33/33] configs: stm32mp15: enable LOG features Patrick Delaunay
2020-10-21 12:37   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-15 15:05 ` [PATCH 00/33] stm32: enable logging features Simon Glass
2020-10-15 15:59   ` Patrick DELAUNAY
2020-10-26 19:22     ` Simon Glass
2020-10-28 11:52       ` Patrick DELAUNAY
2020-10-30 18:15         ` Simon Glass
2020-11-06 17:45           ` Patrick DELAUNAY
2020-11-06 18:50             ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f72a1baf-a8be-8520-65d6-794e56e2e3c7@st.com \
    --to=patrice.chotard@st.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.