diff mbox series

[09/10] arm: stm32mp: add function get_soc_name

Message ID 20200212183744.5309-10-patrick.delaunay@st.com
State Accepted
Commit ac5e4d8af8d3fd89068db1e50cafd646175c66d6
Headers show
Series stm32mp1: board and SOC identifications | expand

Commit Message

Patrick Delaunay Feb. 12, 2020, 6:37 p.m. UTC
Add a function get_soc_name to get a string with the full name
of the SOC "STM32MP15xxx Rev.x"

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

 arch/arm/mach-stm32mp/cpu.c                    | 14 +++++++++++---
 arch/arm/mach-stm32mp/include/mach/sys_proto.h |  4 ++++
 2 files changed, 15 insertions(+), 3 deletions(-)

Comments

Patrice CHOTARD March 18, 2020, 10:16 a.m. UTC | #1
On 2/12/20 7:37 PM, Patrick Delaunay wrote:
> Add a function get_soc_name to get a string with the full name
> of the SOC "STM32MP15xxx Rev.x"
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
> ---
>
>  arch/arm/mach-stm32mp/cpu.c                    | 14 +++++++++++---
>  arch/arm/mach-stm32mp/include/mach/sys_proto.h |  4 ++++
>  2 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
> index 5febed735c..9c5e0448ce 100644
> --- a/arch/arm/mach-stm32mp/cpu.c
> +++ b/arch/arm/mach-stm32mp/cpu.c
> @@ -279,8 +279,7 @@ u32 get_cpu_package(void)
>  	return get_otp(BSEC_OTP_PKG, PKG_SHIFT, PKG_MASK);
>  }
>  
> -#if defined(CONFIG_DISPLAY_CPUINFO)
> -int print_cpuinfo(void)
> +void get_soc_name(char name[SOC_NAME_SIZE])
>  {
>  	char *cpu_s, *cpu_r, *pkg;
>  
> @@ -344,7 +343,16 @@ int print_cpuinfo(void)
>  		break;
>  	}
>  
> -	printf("CPU: STM32MP%s%s Rev.%s\n", cpu_s, pkg, cpu_r);
> +	snprintf(name, SOC_NAME_SIZE, "STM32MP%s%s Rev.%s", cpu_s, pkg, cpu_r);
> +}
> +
> +#if defined(CONFIG_DISPLAY_CPUINFO)
> +int print_cpuinfo(void)
> +{
> +	char name[SOC_NAME_SIZE];
> +
> +	get_soc_name(name);
> +	printf("CPU: %s\n", name);
>  
>  	return 0;
>  }
> diff --git a/arch/arm/mach-stm32mp/include/mach/sys_proto.h b/arch/arm/mach-stm32mp/include/mach/sys_proto.h
> index da46c11573..065b7b2856 100644
> --- a/arch/arm/mach-stm32mp/include/mach/sys_proto.h
> +++ b/arch/arm/mach-stm32mp/include/mach/sys_proto.h
> @@ -29,6 +29,10 @@ u32 get_cpu_package(void);
>  #define PKG_AC_TFBGA361	2
>  #define PKG_AD_TFBGA257	1
>  
> +/* Get SOC name */
> +#define SOC_NAME_SIZE 20
> +void get_soc_name(char name[SOC_NAME_SIZE]);
> +
>  /* return boot mode */
>  u32 get_bootmode(void);
>  

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
> 
> Add a function get_soc_name to get a string with the full name of the SOC
> "STM32MP15xxx Rev.x"
> 
> 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/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
index 5febed735c..9c5e0448ce 100644
--- a/arch/arm/mach-stm32mp/cpu.c
+++ b/arch/arm/mach-stm32mp/cpu.c
@@ -279,8 +279,7 @@  u32 get_cpu_package(void)
 	return get_otp(BSEC_OTP_PKG, PKG_SHIFT, PKG_MASK);
 }
 
-#if defined(CONFIG_DISPLAY_CPUINFO)
-int print_cpuinfo(void)
+void get_soc_name(char name[SOC_NAME_SIZE])
 {
 	char *cpu_s, *cpu_r, *pkg;
 
@@ -344,7 +343,16 @@  int print_cpuinfo(void)
 		break;
 	}
 
-	printf("CPU: STM32MP%s%s Rev.%s\n", cpu_s, pkg, cpu_r);
+	snprintf(name, SOC_NAME_SIZE, "STM32MP%s%s Rev.%s", cpu_s, pkg, cpu_r);
+}
+
+#if defined(CONFIG_DISPLAY_CPUINFO)
+int print_cpuinfo(void)
+{
+	char name[SOC_NAME_SIZE];
+
+	get_soc_name(name);
+	printf("CPU: %s\n", name);
 
 	return 0;
 }
diff --git a/arch/arm/mach-stm32mp/include/mach/sys_proto.h b/arch/arm/mach-stm32mp/include/mach/sys_proto.h
index da46c11573..065b7b2856 100644
--- a/arch/arm/mach-stm32mp/include/mach/sys_proto.h
+++ b/arch/arm/mach-stm32mp/include/mach/sys_proto.h
@@ -29,6 +29,10 @@  u32 get_cpu_package(void);
 #define PKG_AC_TFBGA361	2
 #define PKG_AD_TFBGA257	1
 
+/* Get SOC name */
+#define SOC_NAME_SIZE 20
+void get_soc_name(char name[SOC_NAME_SIZE]);
+
 /* return boot mode */
 u32 get_bootmode(void);