Re: [PATCH 06/12] stm32mp: add soc.c file

2024-01-15 Thread Patrice CHOTARD



On 1/15/24 13:46, Patrick Delaunay wrote:
> Add a new file soc.c for common functions between stm32mp1 and stm32mp2
> family and move print_cpuinfo() in this new file.
> 
> Signed-off-by: Patrick Delaunay 
> ---
> 
>  arch/arm/mach-stm32mp/Makefile   |  1 +
>  arch/arm/mach-stm32mp/soc.c  | 17 +
>  arch/arm/mach-stm32mp/stm32mp1/cpu.c | 11 ---
>  arch/arm/mach-stm32mp/stm32mp2/cpu.c | 11 ---
>  4 files changed, 18 insertions(+), 22 deletions(-)
>  create mode 100644 arch/arm/mach-stm32mp/soc.c
> 
> diff --git a/arch/arm/mach-stm32mp/Makefile b/arch/arm/mach-stm32mp/Makefile
> index 00dc25bb275c..fdcbbf91dfd5 100644
> --- a/arch/arm/mach-stm32mp/Makefile
> +++ b/arch/arm/mach-stm32mp/Makefile
> @@ -6,6 +6,7 @@
>  obj-y += dram_init.o
>  obj-y += syscon.o
>  obj-y += bsec.o
> +obj-y += soc.o
>  
>  obj-$(CONFIG_STM32MP15x) += stm32mp1/
>  obj-$(CONFIG_STM32MP13x) += stm32mp1/
> diff --git a/arch/arm/mach-stm32mp/soc.c b/arch/arm/mach-stm32mp/soc.c
> new file mode 100644
> index ..8d5fa474ccaf
> --- /dev/null
> +++ b/arch/arm/mach-stm32mp/soc.c
> @@ -0,0 +1,17 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause
> +/*
> + * Copyright (C) 2024, STMicroelectronics - All Rights Reserved
> + */
> +
> +#include 
> +
> +/* used when CONFIG_DISPLAY_CPUINFO is activated */
> +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/stm32mp1/cpu.c 
> b/arch/arm/mach-stm32mp/stm32mp1/cpu.c
> index 55574fd4bebf..00fea7929b2f 100644
> --- a/arch/arm/mach-stm32mp/stm32mp1/cpu.c
> +++ b/arch/arm/mach-stm32mp/stm32mp1/cpu.c
> @@ -158,17 +158,6 @@ void enable_caches(void)
>   dcache_enable();
>  }
>  
> -/* used when CONFIG_DISPLAY_CPUINFO is activated */
> -int print_cpuinfo(void)
> -{
> - char name[SOC_NAME_SIZE];
> -
> - get_soc_name(name);
> - printf("CPU: %s\n", name);
> -
> - return 0;
> -}
> -
>  static void setup_boot_mode(void)
>  {
>   const u32 serial_addr[] = {
> diff --git a/arch/arm/mach-stm32mp/stm32mp2/cpu.c 
> b/arch/arm/mach-stm32mp/stm32mp2/cpu.c
> index f43d1aaf72cc..c0f6519e8d7c 100644
> --- a/arch/arm/mach-stm32mp/stm32mp2/cpu.c
> +++ b/arch/arm/mach-stm32mp/stm32mp2/cpu.c
> @@ -67,17 +67,6 @@ void enable_caches(void)
>   dcache_enable();
>  }
>  
> -/* used when CONFIG_DISPLAY_CPUINFO is activated */
> -int print_cpuinfo(void)
> -{
> - char name[SOC_NAME_SIZE];
> -
> - get_soc_name(name);
> - printf("CPU: %s\n", name);
> -
> - return 0;
> -}
> -
>  int arch_misc_init(void)
>  {
>   return 0;
Reviewed-by: Patrice Chotard 

Thanks
Patrice


[PATCH 06/12] stm32mp: add soc.c file

2024-01-15 Thread Patrick Delaunay
Add a new file soc.c for common functions between stm32mp1 and stm32mp2
family and move print_cpuinfo() in this new file.

Signed-off-by: Patrick Delaunay 
---

 arch/arm/mach-stm32mp/Makefile   |  1 +
 arch/arm/mach-stm32mp/soc.c  | 17 +
 arch/arm/mach-stm32mp/stm32mp1/cpu.c | 11 ---
 arch/arm/mach-stm32mp/stm32mp2/cpu.c | 11 ---
 4 files changed, 18 insertions(+), 22 deletions(-)
 create mode 100644 arch/arm/mach-stm32mp/soc.c

diff --git a/arch/arm/mach-stm32mp/Makefile b/arch/arm/mach-stm32mp/Makefile
index 00dc25bb275c..fdcbbf91dfd5 100644
--- a/arch/arm/mach-stm32mp/Makefile
+++ b/arch/arm/mach-stm32mp/Makefile
@@ -6,6 +6,7 @@
 obj-y += dram_init.o
 obj-y += syscon.o
 obj-y += bsec.o
+obj-y += soc.o
 
 obj-$(CONFIG_STM32MP15x) += stm32mp1/
 obj-$(CONFIG_STM32MP13x) += stm32mp1/
diff --git a/arch/arm/mach-stm32mp/soc.c b/arch/arm/mach-stm32mp/soc.c
new file mode 100644
index ..8d5fa474ccaf
--- /dev/null
+++ b/arch/arm/mach-stm32mp/soc.c
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause
+/*
+ * Copyright (C) 2024, STMicroelectronics - All Rights Reserved
+ */
+
+#include 
+
+/* used when CONFIG_DISPLAY_CPUINFO is activated */
+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/stm32mp1/cpu.c 
b/arch/arm/mach-stm32mp/stm32mp1/cpu.c
index 55574fd4bebf..00fea7929b2f 100644
--- a/arch/arm/mach-stm32mp/stm32mp1/cpu.c
+++ b/arch/arm/mach-stm32mp/stm32mp1/cpu.c
@@ -158,17 +158,6 @@ void enable_caches(void)
dcache_enable();
 }
 
-/* used when CONFIG_DISPLAY_CPUINFO is activated */
-int print_cpuinfo(void)
-{
-   char name[SOC_NAME_SIZE];
-
-   get_soc_name(name);
-   printf("CPU: %s\n", name);
-
-   return 0;
-}
-
 static void setup_boot_mode(void)
 {
const u32 serial_addr[] = {
diff --git a/arch/arm/mach-stm32mp/stm32mp2/cpu.c 
b/arch/arm/mach-stm32mp/stm32mp2/cpu.c
index f43d1aaf72cc..c0f6519e8d7c 100644
--- a/arch/arm/mach-stm32mp/stm32mp2/cpu.c
+++ b/arch/arm/mach-stm32mp/stm32mp2/cpu.c
@@ -67,17 +67,6 @@ void enable_caches(void)
dcache_enable();
 }
 
-/* used when CONFIG_DISPLAY_CPUINFO is activated */
-int print_cpuinfo(void)
-{
-   char name[SOC_NAME_SIZE];
-
-   get_soc_name(name);
-   printf("CPU: %s\n", name);
-
-   return 0;
-}
-
 int arch_misc_init(void)
 {
return 0;
-- 
2.25.1