Message ID | 20180524084209.21172-9-mario.six@gdsys.cc |
---|---|
State | Changes Requested |
Delegated to: | Mario Six |
Headers | show |
Series | [U-Boot,v3,01/11] ram: Add driver for MPC83xx | expand |
Hi Mario, On 24 May 2018 at 02:42, Mario Six <mario.six@gdsys.cc> wrote: > When the DM CPU drivers are active, printing information about a CPU > should be delegated to a matching driver. > > Hence, add a static print_cpuinfo that implements this delegation when > DM CPU drivers are active. > > Signed-off-by: Mario Six <mario.six@gdsys.cc> > > --- > > v2 -> v3: > No changes > > v1 -> v2: > New in v2 > > --- > common/board_f.c | 16 ++++++++++++++++ > include/init.h | 2 ++ > 2 files changed, 18 insertions(+) Reviewed-by: Simon Glass <sjg@chromium.org> See below > > diff --git a/common/board_f.c b/common/board_f.c > index a716eeb8990..327c7d83e2c 100644 > --- a/common/board_f.c > +++ b/common/board_f.c > @@ -11,6 +11,7 @@ > > #include <common.h> > #include <console.h> > +#include <cpu.h> > #include <dm.h> > #include <environment.h> > #include <fdtdec.h> > @@ -165,6 +166,21 @@ static int print_resetinfo(void) > } > #endif > > +#if defined(CONFIG_DISPLAY_CPUINFO) && defined(CONFIG_CPU) > +static int print_cpuinfo(void) > +{ > + struct udevice *dev; > + char desc[512]; > + > + uclass_first_device_err(UCLASS_CPU, &dev); > + > + cpu_get_desc(dev, desc, sizeof(desc)); If this returns an error, I think you should print the error instead > + printf("%s", desc); > + > + return 0; > +} > +#endif > + > static int announce_dram_init(void) > { > puts("DRAM: "); > diff --git a/include/init.h b/include/init.h > index f114a889631..38c9680c7a7 100644 > --- a/include/init.h > +++ b/include/init.h > @@ -107,7 +107,9 @@ int arch_reserve_stacks(void); > */ > int init_cache_f_r(void); > > +#ifndef CONFIG_CPU > int print_cpuinfo(void); > +#endif > int timer_init(void); > int reserve_mmu(void); > int misc_init_f(void); > -- > 2.11.0 > Regards, SImon
Hi Simon, On Fri, May 25, 2018 at 4:42 AM, Simon Glass <sjg@chromium.org> wrote: > Hi Mario, > > On 24 May 2018 at 02:42, Mario Six <mario.six@gdsys.cc> wrote: >> When the DM CPU drivers are active, printing information about a CPU >> should be delegated to a matching driver. >> >> Hence, add a static print_cpuinfo that implements this delegation when >> DM CPU drivers are active. >> >> Signed-off-by: Mario Six <mario.six@gdsys.cc> >> >> --- >> >> v2 -> v3: >> No changes >> >> v1 -> v2: >> New in v2 >> >> --- >> common/board_f.c | 16 ++++++++++++++++ >> include/init.h | 2 ++ >> 2 files changed, 18 insertions(+) > > Reviewed-by: Simon Glass <sjg@chromium.org> > > See below > >> >> diff --git a/common/board_f.c b/common/board_f.c >> index a716eeb8990..327c7d83e2c 100644 >> --- a/common/board_f.c >> +++ b/common/board_f.c >> @@ -11,6 +11,7 @@ >> >> #include <common.h> >> #include <console.h> >> +#include <cpu.h> >> #include <dm.h> >> #include <environment.h> >> #include <fdtdec.h> >> @@ -165,6 +166,21 @@ static int print_resetinfo(void) >> } >> #endif >> >> +#if defined(CONFIG_DISPLAY_CPUINFO) && defined(CONFIG_CPU) >> +static int print_cpuinfo(void) >> +{ >> + struct udevice *dev; >> + char desc[512]; >> + >> + uclass_first_device_err(UCLASS_CPU, &dev); >> + >> + cpu_get_desc(dev, desc, sizeof(desc)); > > If this returns an error, I think you should print the error instead > OK, will be fixed in v4. >> + printf("%s", desc); >> + >> + return 0; >> +} >> +#endif >> + >> static int announce_dram_init(void) >> { >> puts("DRAM: "); >> diff --git a/include/init.h b/include/init.h >> index f114a889631..38c9680c7a7 100644 >> --- a/include/init.h >> +++ b/include/init.h >> @@ -107,7 +107,9 @@ int arch_reserve_stacks(void); >> */ >> int init_cache_f_r(void); >> >> +#ifndef CONFIG_CPU >> int print_cpuinfo(void); >> +#endif >> int timer_init(void); >> int reserve_mmu(void); >> int misc_init_f(void); >> -- >> 2.11.0 >> > > Regards, > SImon Best regards, Mario
diff --git a/common/board_f.c b/common/board_f.c index a716eeb8990..327c7d83e2c 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -11,6 +11,7 @@ #include <common.h> #include <console.h> +#include <cpu.h> #include <dm.h> #include <environment.h> #include <fdtdec.h> @@ -165,6 +166,21 @@ static int print_resetinfo(void) } #endif +#if defined(CONFIG_DISPLAY_CPUINFO) && defined(CONFIG_CPU) +static int print_cpuinfo(void) +{ + struct udevice *dev; + char desc[512]; + + uclass_first_device_err(UCLASS_CPU, &dev); + + cpu_get_desc(dev, desc, sizeof(desc)); + printf("%s", desc); + + return 0; +} +#endif + static int announce_dram_init(void) { puts("DRAM: "); diff --git a/include/init.h b/include/init.h index f114a889631..38c9680c7a7 100644 --- a/include/init.h +++ b/include/init.h @@ -107,7 +107,9 @@ int arch_reserve_stacks(void); */ int init_cache_f_r(void); +#ifndef CONFIG_CPU int print_cpuinfo(void); +#endif int timer_init(void); int reserve_mmu(void); int misc_init_f(void);
When the DM CPU drivers are active, printing information about a CPU should be delegated to a matching driver. Hence, add a static print_cpuinfo that implements this delegation when DM CPU drivers are active. Signed-off-by: Mario Six <mario.six@gdsys.cc> --- v2 -> v3: No changes v1 -> v2: New in v2 --- common/board_f.c | 16 ++++++++++++++++ include/init.h | 2 ++ 2 files changed, 18 insertions(+) -- 2.11.0