[02/15] rockchip: Add cpu-info

Message ID 20190729074711.16988-3-jagan@amarulasolutions.com
State New
Headers show
Series
  • rk3399: Add redundant boot support
Related show

Commit Message

Jagan Teki July 29, 2019, 7:46 a.m. UTC
Add cpu information for rockchip soc.

This would help to print the SoC family number, with
associated temparature, clock and reason for reset etc.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 arch/arm/mach-rockchip/Makefile   |  1 +
 arch/arm/mach-rockchip/cpu-info.c | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+)
 create mode 100644 arch/arm/mach-rockchip/cpu-info.c

Comments

Kever Yang Aug. 5, 2019, 12:27 p.m. UTC | #1
Jagan,

On 2019/7/29 下午3:46, Jagan Teki wrote:
> Add cpu information for rockchip soc.
>
> This would help to print the SoC family number, with
> associated temparature, clock and reason for reset etc.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>   arch/arm/mach-rockchip/Makefile   |  1 +
>   arch/arm/mach-rockchip/cpu-info.c | 24 ++++++++++++++++++++++++
>   2 files changed, 25 insertions(+)
>   create mode 100644 arch/arm/mach-rockchip/cpu-info.c
>
> diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
> index a12b8d4434..655b3e3e1a 100644
> --- a/arch/arm/mach-rockchip/Makefile
> +++ b/arch/arm/mach-rockchip/Makefile
> @@ -25,6 +25,7 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
>   # we can have the preprocessor correctly recognise both 0x0 and 0
>   # meaning "turn it off".
>   obj-y += boot_mode.o
> +obj-$(CONFIG_DISPLAY_CPUINFO) += cpu-info.o
>   
>   obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o
>   obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128-board.o
> diff --git a/arch/arm/mach-rockchip/cpu-info.c b/arch/arm/mach-rockchip/cpu-info.c
> new file mode 100644
> index 0000000000..088fc806a6
> --- /dev/null
> +++ b/arch/arm/mach-rockchip/cpu-info.c
> @@ -0,0 +1,24 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * (C) Copyright 2019 Amarula Solutions.
> + * Author: Jagan Teki <jagan@amarulasolutions.com>
> + */
> +
> +#include <common.h>
> +
> +int print_cpuinfo(void)
> +{
> +	puts("SoC:   Rockchip ");
> +
> +	/* TODO print operating temparature and clock */
> +# ifdef CONFIG_ROCKCHIP_RK3288
> +	puts("RK3288\n");
> +# elif CONFIG_ROCKCHIP_RK3399
> +	puts("RK3399\n");
> +# else
> +# warning Please update cpu.c with correct CPU information
> +	puts("Family\n");
> +# endif

     Can we use CONFIG_SYS_SOC and not one macro for each SoC?


Thanks,

- Kever

> +
> +	return 0;
> +}

Patch

diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index a12b8d4434..655b3e3e1a 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -25,6 +25,7 @@  ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
 # we can have the preprocessor correctly recognise both 0x0 and 0
 # meaning "turn it off".
 obj-y += boot_mode.o
+obj-$(CONFIG_DISPLAY_CPUINFO) += cpu-info.o
 
 obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o
 obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128-board.o
diff --git a/arch/arm/mach-rockchip/cpu-info.c b/arch/arm/mach-rockchip/cpu-info.c
new file mode 100644
index 0000000000..088fc806a6
--- /dev/null
+++ b/arch/arm/mach-rockchip/cpu-info.c
@@ -0,0 +1,24 @@ 
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * (C) Copyright 2019 Amarula Solutions.
+ * Author: Jagan Teki <jagan@amarulasolutions.com>
+ */
+
+#include <common.h>
+
+int print_cpuinfo(void)
+{
+	puts("SoC:   Rockchip ");
+
+	/* TODO print operating temparature and clock */
+# ifdef CONFIG_ROCKCHIP_RK3288
+	puts("RK3288\n");
+# elif CONFIG_ROCKCHIP_RK3399
+	puts("RK3399\n");
+# else
+# warning Please update cpu.c with correct CPU information
+	puts("Family\n");
+# endif
+
+	return 0;
+}