[PATCH 02/31] arm: mediatek: add support for MediaTek MT7981 SoC

Weijie Gao weijie.gao at mediatek.com
Mon Aug 8 04:17:13 CEST 2022


On Thu, 2022-08-04 at 07:57 -0600, Simon Glass wrote:
> Hi Weijie,
> 
> On Wed, 3 Aug 2022 at 21:35, Weijie Gao <weijie.gao at mediatek.com>
> wrote:
> > 
> > This patch adds basic support for MediaTek MT7981 SoC.
> > This include the file that will initialize the SoC after boot and
> > its
> > device tree.
> > 
> > Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
> > ---
> >  arch/arm/dts/mt7981.dtsi                      | 288
> > ++++++++++++++++++
> >  arch/arm/mach-mediatek/Kconfig                |  12 +-
> >  arch/arm/mach-mediatek/Makefile               |   1 +
> >  arch/arm/mach-mediatek/mt7981/Makefile        |   4 +
> >  arch/arm/mach-mediatek/mt7981/init.c          |  52 ++++
> >  arch/arm/mach-mediatek/mt7981/lowlevel_init.S |  30 ++
> >  6 files changed, 386 insertions(+), 1 deletion(-)
> >  create mode 100644 arch/arm/dts/mt7981.dtsi
> >  create mode 100644 arch/arm/mach-mediatek/mt7981/Makefile
> >  create mode 100644 arch/arm/mach-mediatek/mt7981/init.c
> >  create mode 100644 arch/arm/mach-mediatek/mt7981/lowlevel_init.S
> > 
> 
> 
> [..]
> 
> > diff --git a/arch/arm/mach-mediatek/mt7981/init.c
> >  b/arch/arm/mach-mediatek/mt7981/init.c
> > new file mode 100644
> > index 0000000000..f503bb804b
> > --- /dev/null
> > +++ b/arch/arm/mach-mediatek/mt7981/init.c
> > @@ -0,0 +1,52 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (C) 2022 MediaTek Inc.
> > + * Author: Sam Shih <sam.shih at mediatek.com>
> > + */
> > +
> > +#include <fdtdec.h>
> 
> Do you need that?

This was used during testing, and should be remove now.

> 
> > +#include <asm/armv8/mmu.h>
> > +#include <init.h>
> 
> Move up one

ok.

> 
> > +#include <asm/system.h>
> > +#include <asm/global_data.h>
> > +
> > +DECLARE_GLOBAL_DATA_PTR;
> > +
> > +int print_cpuinfo(void)
> 
> Can you use the CPU uclass and DISPLAY_CPUINFO instead/

Basically there's nothing to do for print_cpuinfo other than printing a
fixed CPU model string. Not sure if it's worth using a CPU uclass.

Besides, Using a cpu uclass involves modifying other chips, and some
of them cann't be tested by me.

> 
> > +{
> > +       printf("CPU:   MediaTek MT7981\n");
> > +       return 0;
> > +}
> > +
> 
> [..]
> 
> > diff --git a/arch/arm/mach-mediatek/mt7981/lowlevel_init.S
> >  b/arch/arm/mach-mediatek/mt7981/lowlevel_init.S
> > new file mode 100644
> > index 0000000000..244d2c1385
> > --- /dev/null
> > +++ b/arch/arm/mach-mediatek/mt7981/lowlevel_init.S
> > @@ -0,0 +1,30 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +/*
> > + * Copyright (C) 2022 MediaTek Inc.
> > + * Author: Sam Shih <sam.shih at mediatek.com>
> > + */
> > +
> > +/*
> > + * Switch from AArch64 EL2 to AArch32 EL2
> > + * @param inputs:
> > + * x0: argument, zero
> > + * x1: machine nr
> > + * x2: fdt address
> > + * x3: input argument
> > + * x4: kernel entry point
> > + * @param outputs for secure firmware:
> > + * x0: function id
> > + * x1: kernel entry point
> > + * x2: machine nr
> > + * x3: fdt address
> > +*/
> > +
> > +.global armv8_el2_to_aarch32
> > +armv8_el2_to_aarch32:
> > +       mov     x3, x2
> > +       mov     x2, x1
> > +       mov     x1, x4
> > +       mov     x4, #0
> > +       ldr x0, =0x82000200
> 
> Please comment or add a symbol for this

I can add the following link as a comment:
https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tree/plat/m
ediatek/common/mtk_sip_svc.c#n73

> 
> > +       SMC #0
> > +       ret
> > --
> > 2.17.1
> > 
> 
> Regards,
> Simon


More information about the U-Boot mailing list