All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@foss.st.com>
To: Patrick Delaunay <patrick.delaunay@foss.st.com>, <u-boot@lists.denx.de>
Cc: Tom Rini <trini@konsulko.com>,
	U-Boot STM32 <uboot-stm32@st-md-mailman.stormreply.com>
Subject: Re: [PATCH 03/16] arm: stm32mp: move the get_otp helper function in bsec
Date: Fri, 20 May 2022 08:32:30 +0200	[thread overview]
Message-ID: <65971db1-ecd2-314e-5280-97ed39c52556@foss.st.com> (raw)
In-Reply-To: <20220506160540.3.I64f8491d095549bcba2adf2bfa962c50ecca7874@changeid>

HI Patrick

On 5/6/22 16:06, Patrick Delaunay wrote:
> As the get_otp() helper function in bsec are common for all STM32MP family,
> move this function in bsec driver
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  arch/arm/mach-stm32mp/bsec.c                   | 17 +++++++++++++++++
>  arch/arm/mach-stm32mp/cpu.c                    | 17 -----------------
>  arch/arm/mach-stm32mp/include/mach/sys_proto.h |  3 +++
>  3 files changed, 20 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c
> index 506caa0a31..c00130b08b 100644
> --- a/arch/arm/mach-stm32mp/bsec.c
> +++ b/arch/arm/mach-stm32mp/bsec.c
> @@ -632,3 +632,20 @@ bool bsec_dbgswenable(void)
>  
>  	return false;
>  }
> +
> +u32 get_otp(int index, int shift, int mask)
> +{
> +	int ret;
> +	struct udevice *dev;
> +	u32 otp = 0;
> +
> +	ret = uclass_get_device_by_driver(UCLASS_MISC,
> +					  DM_DRIVER_GET(stm32mp_bsec),
> +					  &dev);
> +
> +	if (!ret)
> +		ret = misc_read(dev, STM32_BSEC_SHADOW(index),
> +				&otp, sizeof(otp));
> +
> +	return (otp >> shift) & mask;
> +}
> diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
> index 0ad5f307db..6f44c75515 100644
> --- a/arch/arm/mach-stm32mp/cpu.c
> +++ b/arch/arm/mach-stm32mp/cpu.c
> @@ -349,23 +349,6 @@ u32 get_cpu_rev(void)
>  	return (read_idc() & DBGMCU_IDC_REV_ID_MASK) >> DBGMCU_IDC_REV_ID_SHIFT;
>  }
>  
> -static u32 get_otp(int index, int shift, int mask)
> -{
> -	int ret;
> -	struct udevice *dev;
> -	u32 otp = 0;
> -
> -	ret = uclass_get_device_by_driver(UCLASS_MISC,
> -					  DM_DRIVER_GET(stm32mp_bsec),
> -					  &dev);
> -
> -	if (!ret)
> -		ret = misc_read(dev, STM32_BSEC_SHADOW(index),
> -				&otp, sizeof(otp));
> -
> -	return (otp >> shift) & mask;
> -}
> -
>  /* Get Device Part Number (RPN) from OTP */
>  static u32 get_cpu_rpn(void)
>  {
> diff --git a/arch/arm/mach-stm32mp/include/mach/sys_proto.h b/arch/arm/mach-stm32mp/include/mach/sys_proto.h
> index b91f98eb45..dc98f0c5a4 100644
> --- a/arch/arm/mach-stm32mp/include/mach/sys_proto.h
> +++ b/arch/arm/mach-stm32mp/include/mach/sys_proto.h
> @@ -52,3 +52,6 @@ int setup_mac_address(void);
>  
>  /* board power management : configure vddcore according OPP */
>  void board_vddcore_init(u32 voltage_mv);
> +
> +/* helper function: read data from OTP */
> +u32 get_otp(int index, int shift, int mask);
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

  reply	other threads:[~2022-05-20  6:32 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06 14:06 [PATCH 00/16] stm32mp: add STM32MP13x support Patrick Delaunay
2022-05-06 14:06 ` [PATCH 01/16] ARM: dts: stm32: add STM32MP13 SoCs support Patrick Delaunay
2022-05-20  6:31   ` Patrice CHOTARD
2022-06-17  8:47   ` Patrick DELAUNAY
2022-05-06 14:06 ` [PATCH 02/16] configs: stm32mp1: move SUPPORT_SPL in STM32MP15x Patrick Delaunay
2022-05-20  6:32   ` Patrice CHOTARD
2022-06-17  8:47   ` Patrick DELAUNAY
2022-05-06 14:06 ` [PATCH 03/16] arm: stm32mp: move the get_otp helper function in bsec Patrick Delaunay
2022-05-20  6:32   ` Patrice CHOTARD [this message]
2022-06-17  8:47   ` Patrick DELAUNAY
2022-05-06 14:06 ` [PATCH 04/16] arm: stm32mp: move code for STM32MP15x Patrick Delaunay
2022-05-20  6:32   ` Patrice CHOTARD
2022-06-17  8:48   ` Patrick DELAUNAY
2022-05-06 14:06 ` [PATCH 05/16] arm: stm32mp: add choice for STM32MP SOC family Patrick Delaunay
2022-05-20  6:37   ` Patrice CHOTARD
2022-06-17  8:48   ` Patrick DELAUNAY
2022-05-06 14:06 ` [PATCH 06/16] arm: stm32mp: add sub config Kconfig.15x Patrick Delaunay
2022-05-20  6:39   ` Patrice CHOTARD
2022-06-17  8:49   ` Patrick DELAUNAY
2022-05-06 14:06 ` [PATCH 07/16] arm: stm32mp: add CONFIG_STM32MP15_PWR Patrick Delaunay
2022-05-20  6:41   ` Patrice CHOTARD
2022-06-17  8:49   ` Patrick DELAUNAY
2022-05-06 14:06 ` [PATCH 08/16] arm: stm32mp: add support of STM32MP13x Patrick Delaunay
2022-05-20  6:49   ` Patrice CHOTARD
2022-05-20  7:24     ` [Uboot-stm32] " Patrice CHOTARD
2022-05-20  7:44       ` Marek Vasut
2022-06-17  8:57   ` Patrick DELAUNAY
2022-05-06 14:06 ` [PATCH 09/16] arm: stm32mp: support 2 MAC address for STM32MP13 Patrick Delaunay
2022-05-20  6:55   ` Patrice CHOTARD
2022-06-17  8:57   ` Patrick DELAUNAY
2022-05-06 14:06 ` [PATCH 10/16] pinctrl: stm32: add support of STM32MP135 Patrick Delaunay
2022-05-20  6:55   ` Patrice CHOTARD
2022-05-20  6:57   ` Patrice CHOTARD
2022-06-17  8:57   ` Patrick DELAUNAY
2022-05-06 14:06 ` [PATCH 11/16] board: stm32pm1: add stm32mp13 board support Patrick Delaunay
2022-05-20  7:02   ` Patrice CHOTARD
2022-05-20 15:33     ` Patrick DELAUNAY
2022-06-17  9:00   ` Patrick DELAUNAY
2022-05-06 14:06 ` [PATCH 12/16] ram: stm32mp1: add support of STM32MP13x Patrick Delaunay
2022-05-20  7:09   ` Patrice CHOTARD
2022-06-17  9:01   ` Patrick DELAUNAY
2022-05-06 14:06 ` [PATCH 13/16] mmc: stm32_sdmmc2: make reset property optional Patrick Delaunay
2022-05-16 23:34   ` Jaehoon Chung
2022-05-20  7:10   ` Patrice CHOTARD
2022-06-17  9:01   ` Patrick DELAUNAY
2022-05-06 14:06 ` [PATCH 14/16] arm: dts: stm32mp: add stm32mp13 device tree for U-Boot Patrick Delaunay
2022-05-20  7:10   ` Patrice CHOTARD
2022-06-17  9:01   ` Patrick DELAUNAY
2022-05-06 14:06 ` [PATCH 15/16] configs: add stm32mp13 defconfig Patrick Delaunay
2022-05-20  7:10   ` Patrice CHOTARD
2022-06-17  9:04   ` Patrick DELAUNAY
2022-05-06 14:06 ` [PATCH 16/16] doc: st: stm32mp1: add STM32MP13x support Patrick Delaunay
2022-05-20  7:21   ` Patrice CHOTARD
2022-05-20 16:13     ` Patrick DELAUNAY
2022-06-17  9:05   ` Patrick DELAUNAY

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=65971db1-ecd2-314e-5280-97ed39c52556@foss.st.com \
    --to=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-stm32@st-md-mailman.stormreply.com \
    /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.