* [RFC PATCH 0/4] Add 32bit-mode for mt7622
@ 2020-08-10 14:26 Frank Wunderlich
2020-08-10 14:26 ` [RFC PATCH 1/4] mt7622: Support to build 32 bits version Frank Wunderlich
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Frank Wunderlich @ 2020-08-10 14:26 UTC (permalink / raw)
To: u-boot
From: Frank Wunderlich <frank-w@public-files.de>
official images for bananapi-r64 based on 32bit-uboot and
linux-kernels packed into an armhf image
i post this series for compatibility reasons
it adds ability to build 32bit uboot which can switch to 64bit mode by
calling jumparch64-target from mt7622 ATF
Frank Wunderlich (3):
mt7622: add lowlevel_init from 2014-04
jumparch64: insert into bootm
jumparch64: add go64
Oleksandr Rybalko (1):
mt7622: Support to build 32 bits version.
arch/arm/lib/bootm.c | 10 ++++++
arch/arm/mach-mediatek/Kconfig | 7 +++-
arch/arm/mach-mediatek/mt7622/Makefile | 4 +++
arch/arm/mach-mediatek/mt7622/init.c | 6 +++-
arch/arm/mach-mediatek/mt7622/lowlevel_init.S | 33 +++++++++++++++++++
cmd/boot.c | 26 +++++++++++++++
6 files changed, 84 insertions(+), 2 deletions(-)
create mode 100755 arch/arm/mach-mediatek/mt7622/lowlevel_init.S
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [RFC PATCH 1/4] mt7622: Support to build 32 bits version.
2020-08-10 14:26 [RFC PATCH 0/4] Add 32bit-mode for mt7622 Frank Wunderlich
@ 2020-08-10 14:26 ` Frank Wunderlich
2020-08-11 2:11 ` Sam Shih
2020-08-10 14:26 ` [RFC PATCH 2/4] mt7622: add lowlevel_init from 2014-04 Frank Wunderlich
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Frank Wunderlich @ 2020-08-10 14:26 UTC (permalink / raw)
To: u-boot
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
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC PATCH 2/4] mt7622: add lowlevel_init from 2014-04
2020-08-10 14:26 [RFC PATCH 0/4] Add 32bit-mode for mt7622 Frank Wunderlich
2020-08-10 14:26 ` [RFC PATCH 1/4] mt7622: Support to build 32 bits version Frank Wunderlich
@ 2020-08-10 14:26 ` Frank Wunderlich
2020-08-10 14:26 ` [RFC PATCH 3/4] jumparch64: insert into bootm Frank Wunderlich
2020-08-10 14:26 ` [RFC PATCH 4/4] jumparch64: add go64 Frank Wunderlich
3 siblings, 0 replies; 7+ messages in thread
From: Frank Wunderlich @ 2020-08-10 14:26 UTC (permalink / raw)
To: u-boot
From: Frank Wunderlich <frank-w@public-files.de>
add low level initialisation to gain access to jumparch64 target in
mt7622 ATF from 32bit uboot.
jumparch64 allows switching from 32bit to 64bit to
load 64bit kernel from 32bit uboot
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
arch/arm/mach-mediatek/mt7622/Makefile | 4 +++
arch/arm/mach-mediatek/mt7622/lowlevel_init.S | 33 +++++++++++++++++++
2 files changed, 37 insertions(+)
create mode 100755 arch/arm/mach-mediatek/mt7622/lowlevel_init.S
diff --git a/arch/arm/mach-mediatek/mt7622/Makefile b/arch/arm/mach-mediatek/mt7622/Makefile
index 886ab7e4eb..5fe4505ddf 100644
--- a/arch/arm/mach-mediatek/mt7622/Makefile
+++ b/arch/arm/mach-mediatek/mt7622/Makefile
@@ -1,3 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
obj-y += init.o
+
+ifeq ($(CONFIG_ARCH_MEDIATEK_32),y)
+ obj-y += lowlevel_init.o
+endif
diff --git a/arch/arm/mach-mediatek/mt7622/lowlevel_init.S b/arch/arm/mach-mediatek/mt7622/lowlevel_init.S
new file mode 100755
index 0000000000..bf20cbd1e7
--- /dev/null
+++ b/arch/arm/mach-mediatek/mt7622/lowlevel_init.S
@@ -0,0 +1,33 @@
+/*
+ * (C) Copyright 2012 Stephen Warren
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+.globl lowlevel_init
+lowlevel_init:
+ /*Enable SMP bit*/
+ mrc p15, 0, r0, c1, c0, 1
+ orr r0, r0, #0x40
+ mcr p15, 0, r0, c1, c0, 1
+ mov pc, lr
+
+.global jumparch64_smc
+jumparch64_smc:
+ mov r3, r2
+ mov r2, r1
+ mov r1, r0
+ ldr r0, =0x82000200 /*please check MTK_SIP_KERNEL_TMP_AARCH32 in vendor/arm/atf/include/bl31/services/sip_svc.h*/
+# smc #0
+ .word 0xe1600070 @ SMC #0 to enter monitor - hand assembled
+ b .
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC PATCH 3/4] jumparch64: insert into bootm
2020-08-10 14:26 [RFC PATCH 0/4] Add 32bit-mode for mt7622 Frank Wunderlich
2020-08-10 14:26 ` [RFC PATCH 1/4] mt7622: Support to build 32 bits version Frank Wunderlich
2020-08-10 14:26 ` [RFC PATCH 2/4] mt7622: add lowlevel_init from 2014-04 Frank Wunderlich
@ 2020-08-10 14:26 ` Frank Wunderlich
2020-08-10 14:26 ` [RFC PATCH 4/4] jumparch64: add go64 Frank Wunderlich
3 siblings, 0 replies; 7+ messages in thread
From: Frank Wunderlich @ 2020-08-10 14:26 UTC (permalink / raw)
To: u-boot
From: Frank Wunderlich <frank-w@public-files.de>
if uboot is 32bit and linux-kernel is 64bit packed into armhf mkimage
(like official kernels for bpi-r64) call jumparch64 to switch to 64bit
mode after unpacking the kernel-image
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
arch/arm/lib/bootm.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 1206e306db..015a5f7f86 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -374,6 +374,16 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
ES_TO_AARCH64);
#endif
}
+#elif defined(CONFIG_ARCH_MEDIATEK_32) && defined(CONFIG_TARGET_MT7622)
+ extern void jumparch64_smc(ulong addr, ulong arg1, ulong arg2);
+
+ /*
+ * Iverson 20150528 - show message for boot.
+ */
+ debug("images->ep = %lx, images->ft_addr = %lx\n", images->ep, (unsigned long)images->ft_addr);
+
+ announce_and_cleanup(0);
+ jumparch64_smc(images->ep, (unsigned long)images->ft_addr, 0);
#else
unsigned long machid = gd->bd->bi_arch_number;
char *s;
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC PATCH 4/4] jumparch64: add go64
2020-08-10 14:26 [RFC PATCH 0/4] Add 32bit-mode for mt7622 Frank Wunderlich
` (2 preceding siblings ...)
2020-08-10 14:26 ` [RFC PATCH 3/4] jumparch64: insert into bootm Frank Wunderlich
@ 2020-08-10 14:26 ` Frank Wunderlich
3 siblings, 0 replies; 7+ messages in thread
From: Frank Wunderlich @ 2020-08-10 14:26 UTC (permalink / raw)
To: u-boot
From: Frank Wunderlich <frank-w@public-files.de>
adding a new uboot command go64 which allows booting 64bit
kernel-image from 32bit uboot using the jumparch64 target in mt7622 ATF
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
cmd/boot.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/cmd/boot.c b/cmd/boot.c
index 36aba22b30..1448eb3854 100644
--- a/cmd/boot.c
+++ b/cmd/boot.c
@@ -53,6 +53,32 @@ U_BOOT_CMD(
" passing 'arg' as arguments"
);
+#if defined(CONFIG_ARCH_MEDIATEK_32) && defined(CONFIG_TARGET_MT7622)
+static int do_go64(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
+{
+ ulong addr;
+
+ if (argc < 2)
+ return CMD_RET_USAGE;
+
+ addr = simple_strtoul(argv[1], NULL, 16);
+
+ printf ("## Starting application at 0x%08lX ...\n", addr);
+
+ extern void jumparch64_smc(ulong addr, ulong arg1, ulong arg2);
+ jumparch64_smc(addr, 0, 0);
+
+ return 0;
+}
+
+U_BOOT_CMD(
+ go64, CONFIG_SYS_MAXARGS, 1, do_go64,
+ "start 64bit application at address 'addr'",
+ "addr [arg ...]\n - start 64bit application@address 'addr'\n"
+ " passing 'arg' as arguments"
+);
+#endif
+
#endif
U_BOOT_CMD(
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC PATCH 1/4] mt7622: Support to build 32 bits version.
2020-08-10 14:26 ` [RFC PATCH 1/4] mt7622: Support to build 32 bits version Frank Wunderlich
@ 2020-08-11 2:11 ` Sam Shih
2020-08-11 10:01 ` Frank Wunderlich
0 siblings, 1 reply; 7+ messages in thread
From: Sam Shih @ 2020-08-11 2:11 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [RFC PATCH 1/4] mt7622: Support to build 32 bits version.
2020-08-11 2:11 ` Sam Shih
@ 2020-08-11 10:01 ` Frank Wunderlich
0 siblings, 0 replies; 7+ messages in thread
From: Frank Wunderlich @ 2020-08-11 10:01 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-08-11 10:01 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 14:26 [RFC PATCH 0/4] Add 32bit-mode for mt7622 Frank Wunderlich
2020-08-10 14:26 ` [RFC PATCH 1/4] mt7622: Support to build 32 bits version Frank Wunderlich
2020-08-11 2:11 ` Sam Shih
2020-08-11 10:01 ` Frank Wunderlich
2020-08-10 14:26 ` [RFC PATCH 2/4] mt7622: add lowlevel_init from 2014-04 Frank Wunderlich
2020-08-10 14:26 ` [RFC PATCH 3/4] jumparch64: insert into bootm Frank Wunderlich
2020-08-10 14:26 ` [RFC PATCH 4/4] jumparch64: add go64 Frank Wunderlich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.