diff mbox series

[RFC,1/4] mt7622: Support to build 32 bits version.

Message ID 20200810142652.40669-2-linux@fw-web.de
State RFC
Delegated to: Tom Rini
Headers show
Series Add 32bit-mode for mt7622 | expand

Commit Message

Frank Wunderlich Aug. 10, 2020, 2:26 p.m. UTC
From: Oleksandr Rybalko <ray@ddteam.net>

allow building uboot in 32bit-mode for mt7622 to
be compatible with bpi-r64 images

Signed-off-by: Oleksandr Rybalko <ray@ddteam.net>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
 arch/arm/mach-mediatek/Kconfig       | 7 ++++++-
 arch/arm/mach-mediatek/mt7622/init.c | 6 +++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

Comments

Sam Shih Aug. 11, 2020, 2:11 a.m. UTC | #1
On Mon, 2020-08-10 at 16:26 +0200, Frank Wunderlich wrote:
> From: Oleksandr Rybalko <ray@ddteam.net>
> 
> allow building uboot in 32bit-mode for mt7622 to
> be compatible with bpi-r64 images
> 
> Signed-off-by: Oleksandr Rybalko <ray@ddteam.net>
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> ---
>  arch/arm/mach-mediatek/Kconfig       | 7 ++++++-
>  arch/arm/mach-mediatek/mt7622/init.c | 6 +++++-
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig
> index 0042e57017..46e10025e4 100644
> --- a/arch/arm/mach-mediatek/Kconfig
> +++ b/arch/arm/mach-mediatek/Kconfig
> @@ -10,12 +10,17 @@ config MT8512
>  	bool "MediaTek MT8512 SoC"
>  	default n
>  
> +config ARCH_MEDIATEK_32
> +	bool "Build 32 bits version"
> +	default n
> +
>  choice
>  	prompt "MediaTek board select"
>  
>  config TARGET_MT7622
>  	bool "MediaTek MT7622 SoC"
> -	select ARM64
> +	select CPU_V7A if ARCH_MEDIATEK_32
> +	select ARM64 if !ARCH_MEDIATEK_32
>  	help
>  	  The MediaTek MT7622 is a ARM64-based SoC with a dual-core Cortex-A53.
>  	  including UART, SPI, USB3.0, SD and MMC cards, NAND, SNFI, PWM, PCIe,
> diff --git a/arch/arm/mach-mediatek/mt7622/init.c b/arch/arm/mach-mediatek/mt7622/init.c
> index 7f6ce80f37..884c45e183 100644
> --- a/arch/arm/mach-mediatek/mt7622/init.c
> +++ b/arch/arm/mach-mediatek/mt7622/init.c
> @@ -7,8 +7,10 @@
>  #include <common.h>
>  #include <fdtdec.h>
>  #include <init.h>
> -#include <asm/armv8/mmu.h>
>  #include <asm/cache.h>
> +#ifdef CONFIG_ARM64
> +#include <asm/armv8/mmu.h>
> +#endif
>  
>  int print_cpuinfo(void)
>  {
> @@ -27,6 +29,7 @@ int dram_init(void)
>  
>  }
>  
> +#ifdef CONFIG_ARM64
>  void reset_cpu(ulong addr)
>  {
>  	psci_system_reset();
> @@ -51,3 +54,4 @@ static struct mm_region mt7622_mem_map[] = {
>  	}
>  };
>  struct mm_region *mem_map = mt7622_mem_map;
> +#endif


Dear Frank and Ray:

Thank you for your continued support to mt7622 (bpir64)

Because we recently completed an ATF based on the mainline ATF 2.1 which
is a standard ATF containing BL2 (equal to the preloader in the old
bpir64 image, but implemented in aarch64),
and BL31 security monitor (equivalent to ATF in the old bpir64 image,
implemented in aarch64)

Using this new ATF 2.1, MT7622 mainline U-boot can detect the FIT
description in the liunx image and jump to aarch32/aarch64 mode and boot
to Shell.

Therefore, I think we should keep the mt7622 upstream uboot code clear
and keep no proprietary code to support the old ATF.

The new architecture of mt7622 (bpir64) will be:
aarch64 prelaoder (BL2), aarch64 bl31 and aarch64 u-boot and optional
arch32/aarch64 of the Linux kernel

Thanks,
Regards,
Sam Shih
Frank Wunderlich Aug. 11, 2020, 10:01 a.m. UTC | #2
Am 11. August 2020 04:11:46 MESZ schrieb Sam Shih <sam.shih@mediatek.com>:

>Thank you for your continued support to mt7622 (bpir64)
>
>Because we recently completed an ATF based on the mainline ATF 2.1
>which
>is a standard ATF containing BL2 (equal to the preloader in the old
>bpir64 image, but implemented in aarch64),
>and BL31 security monitor (equivalent to ATF in the old bpir64 image,
>implemented in aarch64)

Can you point us to source and maybe binary to this ATF and install instructions as this may need other preloader? Does it work for sd and emmc (maybe nand/nor)?

>Using this new ATF 2.1, MT7622 mainline U-boot can detect the FIT
>description in the liunx image and jump to aarch32/aarch64 mode and
>boot
>to Shell.
Please give us Instructions for FIT-creation/booting too as we only use legacy boot atm based on bananpi's sources.
I know this page, but here much things are changing now (preloader,atf,uboot,kernelpackage) so if you have it already working it will save us much time on try&error https://gitlab.denx.de/u-boot/u-boot/raw/HEAD/doc/uImage.FIT/beaglebone_vboot.txt
>Therefore, I think we should keep the mt7622 upstream uboot code clear
>and keep no proprietary code to support the old ATF.

Then we need to know exact information about new bootup

>The new architecture of mt7622 (bpir64) will be:
>aarch64 prelaoder (BL2), aarch64 bl31 and aarch64 u-boot and optional
>arch32/aarch64 of the Linux kernel

Same as above
regards Frank
diff mbox series

Patch

diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig
index 0042e57017..46e10025e4 100644
--- a/arch/arm/mach-mediatek/Kconfig
+++ b/arch/arm/mach-mediatek/Kconfig
@@ -10,12 +10,17 @@  config MT8512
 	bool "MediaTek MT8512 SoC"
 	default n
 
+config ARCH_MEDIATEK_32
+	bool "Build 32 bits version"
+	default n
+
 choice
 	prompt "MediaTek board select"
 
 config TARGET_MT7622
 	bool "MediaTek MT7622 SoC"
-	select ARM64
+	select CPU_V7A if ARCH_MEDIATEK_32
+	select ARM64 if !ARCH_MEDIATEK_32
 	help
 	  The MediaTek MT7622 is a ARM64-based SoC with a dual-core Cortex-A53.
 	  including UART, SPI, USB3.0, SD and MMC cards, NAND, SNFI, PWM, PCIe,
diff --git a/arch/arm/mach-mediatek/mt7622/init.c b/arch/arm/mach-mediatek/mt7622/init.c
index 7f6ce80f37..884c45e183 100644
--- a/arch/arm/mach-mediatek/mt7622/init.c
+++ b/arch/arm/mach-mediatek/mt7622/init.c
@@ -7,8 +7,10 @@ 
 #include <common.h>
 #include <fdtdec.h>
 #include <init.h>
-#include <asm/armv8/mmu.h>
 #include <asm/cache.h>
+#ifdef CONFIG_ARM64
+#include <asm/armv8/mmu.h>
+#endif
 
 int print_cpuinfo(void)
 {
@@ -27,6 +29,7 @@  int dram_init(void)
 
 }
 
+#ifdef CONFIG_ARM64
 void reset_cpu(ulong addr)
 {
 	psci_system_reset();
@@ -51,3 +54,4 @@  static struct mm_region mt7622_mem_map[] = {
 	}
 };
 struct mm_region *mem_map = mt7622_mem_map;
+#endif