
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:
Add a CPU driver for the MPC83xx architecture.
Signed-off-by: Mario Six mario.six@gdsys.cc
v2 -> v3:
- Added driver files to MAINTAINERS
v1 -> v2:
- Removed cpu_print_info
- Fixed CPU info printing
- Removed usage of uclass_{first,next}_device_compat
- Removed printing of reset status
MAINTAINERS | 2 + arch/powerpc/cpu/mpc83xx/cpu.c | 2 + arch/powerpc/cpu/mpc83xx/cpu_init.c | 2 + arch/powerpc/include/asm/processor.h | 2 + drivers/cpu/Kconfig | 7 + drivers/cpu/Makefile | 1 + drivers/cpu/mpc83xx_cpu.c | 265 +++++++++++++++++++++++++++++++++++ drivers/cpu/mpc83xx_cpu.h | 172 +++++++++++++++++++++++ include/cpu.h | 1 + 9 files changed, 454 insertions(+) create mode 100644 drivers/cpu/mpc83xx_cpu.c create mode 100644 drivers/cpu/mpc83xx_cpu.h
diff --git a/MAINTAINERS b/MAINTAINERS index f03cfcc73b0..11965be1402 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -475,6 +475,8 @@ F: drivers/clk/mpc83xx_clk.c F: drivers/clk/mpc83xx_clk.h F: include/dt-bindings/clk/mpc83xx-clk.h F: drivers/timer/mpc83xx_timer.c +F: drivers/cpu/mpc83xx_cpu.c +F: drivers/cpu/mpc83xx_cpu.h F: arch/powerpc/cpu/mpc83xx/ F: arch/powerpc/include/asm/arch-mpc83xx/
diff --git a/arch/powerpc/cpu/mpc83xx/cpu.c b/arch/powerpc/cpu/mpc83xx/cpu.c index ffb42415feb..b29f271e9bc 100644 --- a/arch/powerpc/cpu/mpc83xx/cpu.c +++ b/arch/powerpc/cpu/mpc83xx/cpu.c @@ -25,6 +25,7 @@
DECLARE_GLOBAL_DATA_PTR;
+#ifndef CONFIG_CPU_MPC83XX int checkcpu(void) { volatile immap_t *immr; @@ -114,6 +115,7 @@ int checkcpu(void)
return 0;
} +#endif
#ifndef CONFIG_SYSRESET int diff --git a/arch/powerpc/cpu/mpc83xx/cpu_init.c b/arch/powerpc/cpu/mpc83xx/cpu_init.c index fcac9f63a81..1555205e069 100644 --- a/arch/powerpc/cpu/mpc83xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc83xx/cpu_init.c @@ -464,6 +464,7 @@ static int print_83xx_arb_event(int force) } #endif /* CONFIG_DISPLAY_AER_xxxx */
+#ifndef CONFIG_CPU_MPC83XX /*
- Figure out the cause of the reset
*/ @@ -505,3 +506,4 @@ int prt_83xx_rsr(void)
return 0;
} +#endif diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index 6fbe8c46b31..f97ce48cc27 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h @@ -1325,7 +1325,9 @@ void ll_puts(const char *); /* In misc.c */ void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
+#ifndef CONFIG_CPU_MPC83XX int prt_83xx_rsr(void); +#endif
#endif /* ndef ASSEMBLY*/
diff --git a/drivers/cpu/Kconfig b/drivers/cpu/Kconfig index 0d1424d38e9..d4052005e24 100644 --- a/drivers/cpu/Kconfig +++ b/drivers/cpu/Kconfig @@ -6,3 +6,10 @@ config CPU multiple CPUs, then normally have to be set up in U-Boot so that they can work correctly in the OS. This provides a framework for finding out information about available CPUs and making changes.
+config CPU_MPC83XX
bool "Enable MPC83xx CPU driver"
depends on CPU
select CLK_MPC83XX
help
Support CPU cores for SoCs of the MPC83xx series.
diff --git a/drivers/cpu/Makefile b/drivers/cpu/Makefile index db515f6f177..29d7da42fad 100644 --- a/drivers/cpu/Makefile +++ b/drivers/cpu/Makefile @@ -7,3 +7,4 @@ obj-$(CONFIG_CPU) += cpu-uclass.o
obj-$(CONFIG_ARCH_BMIPS) += bmips_cpu.o +obj-$(CONFIG_CPU_MPC83XX) += mpc83xx_cpu.o diff --git a/drivers/cpu/mpc83xx_cpu.c b/drivers/cpu/mpc83xx_cpu.c new file mode 100644 index 00000000000..550a7ad89f1 --- /dev/null +++ b/drivers/cpu/mpc83xx_cpu.c @@ -0,0 +1,265 @@ +// SPDX-License-Identifier: GPL-2.0+ +/*
- (C) Copyright 2018
- Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
- */
+#include <common.h> +#include <dm.h> +#include <cpu.h> +#include <clk.h> +#include <asm/immap_83xx.h>
+#include "mpc83xx_cpu.h"
+struct mpc83xx_cpu_priv {
struct mpc83xx_cpu_info info;
+};
+int checkcpu(void) +{
struct udevice *cpu;
for (uclass_first_device(UCLASS_CPU, &cpu);
cpu;
uclass_next_device(&cpu)) {
}
Can you please create a function in the CPU uclass to do this in a separate patch? (probe all CPUs). It should return an error if something goes wrong, but not print anything.
Then you can call it here.
OK, will add a function like that in v4.
[...]
diff --git a/include/cpu.h b/include/cpu.h index 5cc7c5abd72..e1de356b543 100644 --- a/include/cpu.h +++ b/include/cpu.h @@ -43,6 +43,7 @@ enum { struct cpu_info { ulong cpu_freq; ulong features;
void *specific_info;
Did you mean to add that?
No, that was a development artifact; thanks for noticing!
Regards, Simon
Best regards, Mario