diff mbox series

[08/10] board: stm32mp1: display reference only for STMicroelectronics board

Message ID 20200212183744.5309-9-patrick.delaunay@st.com
State New
Headers show
Series stm32mp1: board and SOC identifications | expand

Commit Message

Patrick Delaunay Feb. 12, 2020, 6:37 p.m. UTC
Display the reference MBxxxx found in OTP49
only for STMicroelectronics boards when CONFIG_CMD_STBOARD
is activated.

Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
---

 board/st/stm32mp1/stm32mp1.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

Comments

Patrice CHOTARD March 18, 2020, 10:15 a.m. UTC | #1
On 2/12/20 7:37 PM, Patrick Delaunay wrote:
> Display the reference MBxxxx found in OTP49
> only for STMicroelectronics boards when CONFIG_CMD_STBOARD
> is activated.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
> ---
>
>  board/st/stm32mp1/stm32mp1.c | 27 ++++++++++++++-------------
>  1 file changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
> index 76399e2d62..463248bcd7 100644
> --- a/board/st/stm32mp1/stm32mp1.c
> +++ b/board/st/stm32mp1/stm32mp1.c
> @@ -101,20 +101,21 @@ int checkboard(void)
>  		printf(" (%s)", fdt_compat);
>  	puts("\n");
>  
> -	ret = uclass_get_device_by_driver(UCLASS_MISC,
> -					  DM_GET_DRIVER(stm32mp_bsec),
> -					  &dev);
> +	if (CONFIG_IS_ENABLED(CMD_STBOARD)) {
> +		ret = uclass_get_device_by_driver(UCLASS_MISC,
> +						  DM_GET_DRIVER(stm32mp_bsec),
> +						  &dev);
>  
> -	if (!ret)
> -		ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
> -				&otp, sizeof(otp));
> -	if (ret > 0 && otp) {
> -		printf("Board: MB%04x Var%d.%d Rev.%c-%02d\n",
> -		       otp >> 16,
> -		       (otp >> 12) & 0xF,
> -		       (otp >> 4) & 0xF,
> -		       ((otp >> 8) & 0xF) - 1 + 'A',
> -		       otp & 0xF);
> +		if (!ret)
> +			ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
> +					&otp, sizeof(otp));
> +		if (ret > 0 && otp)
> +			printf("Board: MB%04x Var%d.%d Rev.%c-%02d\n",
> +			       otp >> 16,
> +			       (otp >> 12) & 0xF,
> +			       (otp >> 4) & 0xF,
> +			       ((otp >> 8) & 0xF) - 1 + 'A',
> +			       otp & 0xF);
>  	}
>  
>  	return 0;

Acked-by: Patrice Chotard <patrice.chotard at st.com>

Thanks

Patrice
Patrick Delaunay March 24, 2020, 8:37 a.m. UTC | #2
Hi,

> From: Patrick DELAUNAY <patrick.delaunay at st.com>
> Sent: mercredi 12 f?vrier 2020 19:38
> 
> Display the reference MBxxxx found in OTP49 only for STMicroelectronics boards
> when CONFIG_CMD_STBOARD is activated.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
> ---

Applied to u-boot-stm/next, thanks!

Regards

Patrick
diff mbox series

Patch

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 76399e2d62..463248bcd7 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -101,20 +101,21 @@  int checkboard(void)
 		printf(" (%s)", fdt_compat);
 	puts("\n");
 
-	ret = uclass_get_device_by_driver(UCLASS_MISC,
-					  DM_GET_DRIVER(stm32mp_bsec),
-					  &dev);
+	if (CONFIG_IS_ENABLED(CMD_STBOARD)) {
+		ret = uclass_get_device_by_driver(UCLASS_MISC,
+						  DM_GET_DRIVER(stm32mp_bsec),
+						  &dev);
 
-	if (!ret)
-		ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
-				&otp, sizeof(otp));
-	if (ret > 0 && otp) {
-		printf("Board: MB%04x Var%d.%d Rev.%c-%02d\n",
-		       otp >> 16,
-		       (otp >> 12) & 0xF,
-		       (otp >> 4) & 0xF,
-		       ((otp >> 8) & 0xF) - 1 + 'A',
-		       otp & 0xF);
+		if (!ret)
+			ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
+					&otp, sizeof(otp));
+		if (ret > 0 && otp)
+			printf("Board: MB%04x Var%d.%d Rev.%c-%02d\n",
+			       otp >> 16,
+			       (otp >> 12) & 0xF,
+			       (otp >> 4) & 0xF,
+			       ((otp >> 8) & 0xF) - 1 + 'A',
+			       otp & 0xF);
 	}
 
 	return 0;