[PATCH v2 11/16] LoongArch: Generic CPU type
Simon Glass
sjg at chromium.org
Thu Jul 2 12:26:35 CEST 2026
Hi Yao,
On 2026-07-01T11:17:53, Yao Zi <me at ziyao.cc> wrote:
> LoongArch: Generic CPU type
>
> Provide a generic CPU type with some common routines
> that expected to be implemented at CPU level.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang at flygoat.com>
> Signed-off-by: Yao Zi <me at ziyao.cc>
>
> arch/loongarch/Kconfig | 1 +
> arch/loongarch/cpu/generic/Kconfig | 13 +++++++++++++
> arch/loongarch/cpu/generic/Makefile | 7 +++++++
> arch/loongarch/cpu/generic/cpu.c | 22 ++++++++++++++++++++++
> arch/loongarch/cpu/generic/dram.c | 21 +++++++++++++++++++++
> 5 files changed, 64 insertions(+)
> LoongArch: Generic CPU type
'generic CPU type' isn't quite right - this adds the 'generic'
platform (common cleanup/DRAM code) rather than a CPU type. Please
reword and fix the grammar of the second sentence ('some common
routines that are expected to be implemented at the CPU level'). A
short note on what falls under this bucket vs. the actual CPU driver
(patch 12) would help.
> diff --git a/arch/loongarch/cpu/generic/cpu.c b/arch/loongarch/cpu/generic/cpu.c
> @@ -0,0 +1,22 @@
> +/*
> + * cleanup_before_linux() is called just before we call linux
> + * it prepares the processor for linux
> + *
> + * we disable interrupt and caches.
> + */
> +int cleanup_before_linux(void)
> +{
> + disable_interrupts();
> +
> + cache_flush();
> +
> + return 0;
> +}
The comment says 'we disable interrupt and caches' but the code
only disables interrupts and flushes the caches. Please fix the
comment to match (or, if disabling the caches was intended, add
that). Also, 'Linux' should be capitalised.
> diff --git a/arch/loongarch/cpu/generic/dram.c b/arch/loongarch/cpu/generic/dram.c
> @@ -0,0 +1,21 @@
> +#include <fdtdec.h>
> +#include <init.h>
> +#include <asm/global_data.h>
> +#include <linux/sizes.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;
Neither gd nor anything from linux/sizes.h or asm/global_data.h is
used here. Please drop the unused includes and DECLARE_GLOBAL_DATA_PTR.
Compare arch/riscv/cpu/generic/dram.c which keeps this to just
fdtdec.h and init.h.
Regards,
Simon
More information about the U-Boot
mailing list