Re: [U-Boot] [PATCH u-boot 2/2] ARM: meson: Add cpu info display for GX SoCs
Hi Neil, On 10 April 2018 at 09:51, Neil Armstrong wrote: > On 08/04/2018 15:50, Simon Glass wrote: >> Hi, >> >> On 28 March 2018 at 05:54, Neil Armstrong wrote: >>> The Amlogic SoCs have a registers containing the die revision >>> and packaging type to determine the SoC family and package marketing >>> name like S905X for the GXL SoC Family. >>> This code is taken for the Linux meson-gx-socinfo driver and adapted >>> to U-Boot printing. >>> >>> Signed-off-by: Neil Armstrong >>> --- >>> arch/arm/include/asm/arch-meson/gx.h | 1 + >>> arch/arm/mach-meson/Makefile | 2 +- >>> arch/arm/mach-meson/cpu_info.c | 105 >>> +++ >>> configs/khadas-vim_defconfig | 2 +- >>> configs/libretech-cc_defconfig | 2 +- >>> configs/odroid-c2_defconfig | 2 +- >>> configs/odroid_defconfig | 1 + >>> configs/p212_defconfig | 2 +- >>> 8 files changed, 112 insertions(+), 5 deletions(-) >>> create mode 100644 arch/arm/mach-meson/cpu_info.c >> >> Please can you use driver model's CPU interface for this? >> >> Regards, >> Simon >> > > Hi Simon, > > The CPU uclass is designed for the /cpu/* nodes, here we fetch the SoC > information > in some /soc/ subnodes which cannot be used with the current CPU uclass and > won't be probed before relocation. > > Either I push is as a MISC driver (with the pre-reloc issue) or we leave this > in mach-meson. > > What do you think ? Do you think it could search both /cpu and /soc ? They seem to be fairly equivalent. Is that the only problem? > > Thanks, > Neil Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH u-boot 2/2] ARM: meson: Add cpu info display for GX SoCs
On 08/04/2018 15:50, Simon Glass wrote: > Hi, > > On 28 March 2018 at 05:54, Neil Armstrong wrote: >> The Amlogic SoCs have a registers containing the die revision >> and packaging type to determine the SoC family and package marketing >> name like S905X for the GXL SoC Family. >> This code is taken for the Linux meson-gx-socinfo driver and adapted >> to U-Boot printing. >> >> Signed-off-by: Neil Armstrong >> --- >> arch/arm/include/asm/arch-meson/gx.h | 1 + >> arch/arm/mach-meson/Makefile | 2 +- >> arch/arm/mach-meson/cpu_info.c | 105 >> +++ >> configs/khadas-vim_defconfig | 2 +- >> configs/libretech-cc_defconfig | 2 +- >> configs/odroid-c2_defconfig | 2 +- >> configs/odroid_defconfig | 1 + >> configs/p212_defconfig | 2 +- >> 8 files changed, 112 insertions(+), 5 deletions(-) >> create mode 100644 arch/arm/mach-meson/cpu_info.c > > Please can you use driver model's CPU interface for this? > > Regards, > Simon > Hi Simon, The CPU uclass is designed for the /cpu/* nodes, here we fetch the SoC information in some /soc/ subnodes which cannot be used with the current CPU uclass and won't be probed before relocation. Either I push is as a MISC driver (with the pre-reloc issue) or we leave this in mach-meson. What do you think ? Thanks, Neil ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH u-boot 2/2] ARM: meson: Add cpu info display for GX SoCs
On 08/04/2018 15:50, Simon Glass wrote: > Hi, > > On 28 March 2018 at 05:54, Neil Armstrong wrote: >> The Amlogic SoCs have a registers containing the die revision >> and packaging type to determine the SoC family and package marketing >> name like S905X for the GXL SoC Family. >> This code is taken for the Linux meson-gx-socinfo driver and adapted >> to U-Boot printing. >> >> Signed-off-by: Neil Armstrong >> --- >> arch/arm/include/asm/arch-meson/gx.h | 1 + >> arch/arm/mach-meson/Makefile | 2 +- >> arch/arm/mach-meson/cpu_info.c | 105 >> +++ >> configs/khadas-vim_defconfig | 2 +- >> configs/libretech-cc_defconfig | 2 +- >> configs/odroid-c2_defconfig | 2 +- >> configs/odroid_defconfig | 1 + >> configs/p212_defconfig | 2 +- >> 8 files changed, 112 insertions(+), 5 deletions(-) >> create mode 100644 arch/arm/mach-meson/cpu_info.c > > Please can you use driver model's CPU interface for this? > > Regards, > Simon > You are right, I totally missed this one. Neil ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH u-boot 2/2] ARM: meson: Add cpu info display for GX SoCs
On 04/04/2018 22:49, Beniamino Galvani wrote: > On Wed, Mar 28, 2018 at 11:54:37AM +0200, Neil Armstrong wrote: >> The Amlogic SoCs have a registers containing the die revision >> and packaging type to determine the SoC family and package marketing >> name like S905X for the GXL SoC Family. >> This code is taken for the Linux meson-gx-socinfo driver and adapted >> to U-Boot printing. >> >> Signed-off-by: Neil Armstrong >> --- >> arch/arm/include/asm/arch-meson/gx.h | 1 + >> arch/arm/mach-meson/Makefile | 2 +- >> arch/arm/mach-meson/cpu_info.c | 105 >> +++ >> configs/khadas-vim_defconfig | 2 +- >> configs/libretech-cc_defconfig | 2 +- >> configs/odroid-c2_defconfig | 2 +- >> configs/odroid_defconfig | 1 + >> configs/p212_defconfig | 2 +- >> 8 files changed, 112 insertions(+), 5 deletions(-) >> create mode 100644 arch/arm/mach-meson/cpu_info.c >> >> diff --git a/arch/arm/include/asm/arch-meson/gx.h >> b/arch/arm/include/asm/arch-meson/gx.h >> index 7930efd..6d5b4ea 100644 >> --- a/arch/arm/include/asm/arch-meson/gx.h >> +++ b/arch/arm/include/asm/arch-meson/gx.h >> @@ -17,6 +17,7 @@ >> /* Always-On Peripherals registers */ >> #define GX_AO_ADDR(off) (GX_AOBUS_BASE + ((off) << 2)) >> >> +#define GX_AO_SEC_SD_CFG8 GX_AO_ADDR(0x88) >> #define GX_AO_SEC_GP_CFG0 GX_AO_ADDR(0x90) >> #define GX_AO_SEC_GP_CFG3 GX_AO_ADDR(0x93) >> #define GX_AO_SEC_GP_CFG4 GX_AO_ADDR(0x94) >> diff --git a/arch/arm/mach-meson/Makefile b/arch/arm/mach-meson/Makefile >> index b4e8dde..5a01ff0 100644 >> --- a/arch/arm/mach-meson/Makefile >> +++ b/arch/arm/mach-meson/Makefile >> @@ -4,4 +4,4 @@ >> # SPDX-License-Identifier: GPL-2.0+ >> # >> >> -obj-y += board.o sm.o eth.o >> +obj-y += board.o sm.o eth.o cpu_info.o >> diff --git a/arch/arm/mach-meson/cpu_info.c b/arch/arm/mach-meson/cpu_info.c >> new file mode 100644 >> index 000..657768f >> --- /dev/null >> +++ b/arch/arm/mach-meson/cpu_info.c >> @@ -0,0 +1,105 @@ >> +/* >> + * Copyright (C) 2018 BayLibre, SAS >> + * Author: Neil Armstrong >> + * >> + * SPDX-License-Identifier: GPL-2.0+ >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> + >> +#ifdef CONFIG_DISPLAY_CPUINFO >> + >> +#define SOCINFO_MAJOR GENMASK(31, 24) >> +#define SOCINFO_PACKGENMASK(23, 16) >> +#define SOCINFO_MINOR GENMASK(15, 8) >> +#define SOCINFO_MISCGENMASK(7, 0) >> + >> +static const struct meson_gx_soc_id { >> +const char *name; >> +unsigned int id; >> +} soc_ids[] = { >> +{ "GXBB", 0x1f }, >> +{ "GXTVBB", 0x20 }, >> +{ "GXL", 0x21 }, >> +{ "GXM", 0x22 }, >> +{ "TXL", 0x23 }, >> +}; >> + >> +static const struct meson_gx_package_id { >> +const char *name; >> +unsigned int major_id; >> +unsigned int pack_id; >> +} soc_packages[] = { >> +{ "S905", 0x1f, 0 }, >> +{ "S905M", 0x1f, 0x20 }, >> +{ "S905D", 0x21, 0 }, >> +{ "S905X", 0x21, 0x80 }, >> +{ "S905L", 0x21, 0xc0 }, >> +{ "S905M2", 0x21, 0xe0 }, >> +{ "S912", 0x22, 0 }, >> +}; >> + >> +static inline unsigned int socinfo_to_major(u32 socinfo) >> +{ >> +return FIELD_GET(SOCINFO_MAJOR, socinfo); >> +} >> + >> +static inline unsigned int socinfo_to_minor(u32 socinfo) >> +{ >> +return FIELD_GET(SOCINFO_MINOR, socinfo); >> +} >> + >> +static inline unsigned int socinfo_to_pack(u32 socinfo) >> +{ >> +return FIELD_GET(SOCINFO_PACK, socinfo); >> +} >> + >> +static inline unsigned int socinfo_to_misc(u32 socinfo) >> +{ >> +return FIELD_GET(SOCINFO_MISC, socinfo); >> +} >> + >> +static const char *socinfo_to_package_id(u32 socinfo) >> +{ >> +unsigned int pack = socinfo_to_pack(socinfo) & 0xf0; >> +unsigned int major = socinfo_to_major(socinfo); >> +int i; >> + >> +for (i = 0 ; i < ARRAY_SIZE(soc_packages) ; ++i) { >> +if (soc_packages[i].major_id == major && >> +soc_packages[i].pack_id == pack) >> +return soc_packages[i].name; >> +} >> + >> +return "Unknown"; >> +} >> + >> +static const char *socinfo_to_soc_id(u32 socinfo) >> +{ >> +unsigned int id = socinfo_to_major(socinfo); >> +int i; >> + >> +for (i = 0 ; i < ARRAY_SIZE(soc_ids) ; ++i) { >> +if (soc_ids[i].id == id) >> +return soc_ids[i].name; >> +} >> + >> +return "Unknown"; >> +} >> + >> +int print_cpuinfo(void) >> +{ >> +u32 socinfo = readl(GX_AO_SEC_SD_CFG8); > > Perhaps, add a blank line between declarations and code? checkpatch > issues a warning about this. Ok > >> +printf("CPU: Amlogic Meson %s (%s) rev %x:%x (%x:%x)\n", >> +socinfo_to_soc_id(socinfo), >> +socinfo_to_package_id(socinfo), >> +socinfo_to_major(socinfo), >> +socinfo_to_minor(socinfo), >> +socinfo_to_pack(socinfo), >> +socinfo_to_misc(socinfo)); >> +return 0; >> +}
Re: [U-Boot] [PATCH u-boot 2/2] ARM: meson: Add cpu info display for GX SoCs
Hi, On 28 March 2018 at 05:54, Neil Armstrong wrote: > The Amlogic SoCs have a registers containing the die revision > and packaging type to determine the SoC family and package marketing > name like S905X for the GXL SoC Family. > This code is taken for the Linux meson-gx-socinfo driver and adapted > to U-Boot printing. > > Signed-off-by: Neil Armstrong > --- > arch/arm/include/asm/arch-meson/gx.h | 1 + > arch/arm/mach-meson/Makefile | 2 +- > arch/arm/mach-meson/cpu_info.c | 105 > +++ > configs/khadas-vim_defconfig | 2 +- > configs/libretech-cc_defconfig | 2 +- > configs/odroid-c2_defconfig | 2 +- > configs/odroid_defconfig | 1 + > configs/p212_defconfig | 2 +- > 8 files changed, 112 insertions(+), 5 deletions(-) > create mode 100644 arch/arm/mach-meson/cpu_info.c Please can you use driver model's CPU interface for this? Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH u-boot 2/2] ARM: meson: Add cpu info display for GX SoCs
On Wed, Mar 28, 2018 at 11:54:37AM +0200, Neil Armstrong wrote: > The Amlogic SoCs have a registers containing the die revision > and packaging type to determine the SoC family and package marketing > name like S905X for the GXL SoC Family. > This code is taken for the Linux meson-gx-socinfo driver and adapted > to U-Boot printing. > > Signed-off-by: Neil Armstrong > --- > arch/arm/include/asm/arch-meson/gx.h | 1 + > arch/arm/mach-meson/Makefile | 2 +- > arch/arm/mach-meson/cpu_info.c | 105 > +++ > configs/khadas-vim_defconfig | 2 +- > configs/libretech-cc_defconfig | 2 +- > configs/odroid-c2_defconfig | 2 +- > configs/odroid_defconfig | 1 + > configs/p212_defconfig | 2 +- > 8 files changed, 112 insertions(+), 5 deletions(-) > create mode 100644 arch/arm/mach-meson/cpu_info.c > > diff --git a/arch/arm/include/asm/arch-meson/gx.h > b/arch/arm/include/asm/arch-meson/gx.h > index 7930efd..6d5b4ea 100644 > --- a/arch/arm/include/asm/arch-meson/gx.h > +++ b/arch/arm/include/asm/arch-meson/gx.h > @@ -17,6 +17,7 @@ > /* Always-On Peripherals registers */ > #define GX_AO_ADDR(off) (GX_AOBUS_BASE + ((off) << 2)) > > +#define GX_AO_SEC_SD_CFG8GX_AO_ADDR(0x88) > #define GX_AO_SEC_GP_CFG0GX_AO_ADDR(0x90) > #define GX_AO_SEC_GP_CFG3GX_AO_ADDR(0x93) > #define GX_AO_SEC_GP_CFG4GX_AO_ADDR(0x94) > diff --git a/arch/arm/mach-meson/Makefile b/arch/arm/mach-meson/Makefile > index b4e8dde..5a01ff0 100644 > --- a/arch/arm/mach-meson/Makefile > +++ b/arch/arm/mach-meson/Makefile > @@ -4,4 +4,4 @@ > # SPDX-License-Identifier: GPL-2.0+ > # > > -obj-y += board.o sm.o eth.o > +obj-y += board.o sm.o eth.o cpu_info.o > diff --git a/arch/arm/mach-meson/cpu_info.c b/arch/arm/mach-meson/cpu_info.c > new file mode 100644 > index 000..657768f > --- /dev/null > +++ b/arch/arm/mach-meson/cpu_info.c > @@ -0,0 +1,105 @@ > +/* > + * Copyright (C) 2018 BayLibre, SAS > + * Author: Neil Armstrong > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#include > +#include > +#include > +#include > + > +#ifdef CONFIG_DISPLAY_CPUINFO > + > +#define SOCINFO_MAJORGENMASK(31, 24) > +#define SOCINFO_PACK GENMASK(23, 16) > +#define SOCINFO_MINORGENMASK(15, 8) > +#define SOCINFO_MISC GENMASK(7, 0) > + > +static const struct meson_gx_soc_id { > + const char *name; > + unsigned int id; > +} soc_ids[] = { > + { "GXBB", 0x1f }, > + { "GXTVBB", 0x20 }, > + { "GXL", 0x21 }, > + { "GXM", 0x22 }, > + { "TXL", 0x23 }, > +}; > + > +static const struct meson_gx_package_id { > + const char *name; > + unsigned int major_id; > + unsigned int pack_id; > +} soc_packages[] = { > + { "S905", 0x1f, 0 }, > + { "S905M", 0x1f, 0x20 }, > + { "S905D", 0x21, 0 }, > + { "S905X", 0x21, 0x80 }, > + { "S905L", 0x21, 0xc0 }, > + { "S905M2", 0x21, 0xe0 }, > + { "S912", 0x22, 0 }, > +}; > + > +static inline unsigned int socinfo_to_major(u32 socinfo) > +{ > + return FIELD_GET(SOCINFO_MAJOR, socinfo); > +} > + > +static inline unsigned int socinfo_to_minor(u32 socinfo) > +{ > + return FIELD_GET(SOCINFO_MINOR, socinfo); > +} > + > +static inline unsigned int socinfo_to_pack(u32 socinfo) > +{ > + return FIELD_GET(SOCINFO_PACK, socinfo); > +} > + > +static inline unsigned int socinfo_to_misc(u32 socinfo) > +{ > + return FIELD_GET(SOCINFO_MISC, socinfo); > +} > + > +static const char *socinfo_to_package_id(u32 socinfo) > +{ > + unsigned int pack = socinfo_to_pack(socinfo) & 0xf0; > + unsigned int major = socinfo_to_major(socinfo); > + int i; > + > + for (i = 0 ; i < ARRAY_SIZE(soc_packages) ; ++i) { > + if (soc_packages[i].major_id == major && > + soc_packages[i].pack_id == pack) > + return soc_packages[i].name; > + } > + > + return "Unknown"; > +} > + > +static const char *socinfo_to_soc_id(u32 socinfo) > +{ > + unsigned int id = socinfo_to_major(socinfo); > + int i; > + > + for (i = 0 ; i < ARRAY_SIZE(soc_ids) ; ++i) { > + if (soc_ids[i].id == id) > + return soc_ids[i].name; > + } > + > + return "Unknown"; > +} > + > +int print_cpuinfo(void) > +{ > + u32 socinfo = readl(GX_AO_SEC_SD_CFG8); Perhaps, add a blank line between declarations and code? checkpatch issues a warning about this. > + printf("CPU: Amlogic Meson %s (%s) rev %x:%x (%x:%x)\n", > + socinfo_to_soc_id(socinfo), > + socinfo_to_package_id(socinfo), > + socinfo_to_major(socinfo), > + socinfo_to_minor(socinfo), > + socinfo_to_pack(socinfo), > + socinfo_to_misc(socinfo)); > + return 0; > +} > +#endif /* CONFIG_DISPLAY_CPUINFO */ > diff --git a/configs/khadas-vim_defconfig b/configs/khadas-vim_defconfig > index a0b3f8d..970d373 100644 > --- a/configs/khadas-v