mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
Fix rockchip uboot on 6.1
This commit is contained in:
parent
d05bd9be17
commit
1fd3a0d155
35 changed files with 4 additions and 2 deletions
|
@ -0,0 +1,144 @@
|
|||
From 79cb33b9da0c9475486ca0759341057854b25e38 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Sun, 20 Feb 2022 07:57:50 -0500
|
||||
Subject: [PATCH] rockchip: handle bootrom mode in spl
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
---
|
||||
arch/arm/mach-rockchip/Makefile | 6 +--
|
||||
arch/arm/mach-rockchip/boot_mode.c | 4 +-
|
||||
arch/arm/mach-rockchip/rk3568/rk3568.c | 54 +++++++++++++++++++++++++-
|
||||
3 files changed, 59 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/arch/arm/mach-rockchip/Makefile
|
||||
+++ b/arch/arm/mach-rockchip/Makefile
|
||||
@@ -15,13 +15,13 @@ obj-tpl-$(CONFIG_ROCKCHIP_PX30) += px30-board-tpl.o
|
||||
|
||||
obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o
|
||||
|
||||
-ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
|
||||
-
|
||||
# Always include boot_mode.o, as we bypass it (i.e. turn it off)
|
||||
# inside of boot_mode.c when CONFIG_ROCKCHIP_BOOT_MODE_REG is 0. This way,
|
||||
# we can have the preprocessor correctly recognise both 0x0 and 0
|
||||
# meaning "turn it off".
|
||||
-obj-y += boot_mode.o
|
||||
+obj-$(CONFIG_ARCH_ROCKCHIP) += boot_mode.o
|
||||
+
|
||||
+ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
|
||||
obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o
|
||||
obj-$(CONFIG_MISC_INIT_R) += misc.o
|
||||
endif
|
||||
--- a/arch/arm/mach-rockchip/boot_mode.c
|
||||
+++ b/arch/arm/mach-rockchip/boot_mode.c
|
||||
@@ -51,7 +51,7 @@ __weak int rockchip_dnl_key_pressed(void)
|
||||
ret = -ENODEV;
|
||||
uclass_foreach_dev(dev, uc) {
|
||||
if (!strncmp(dev->name, "saradc", 6)) {
|
||||
- ret = adc_channel_single_shot(dev->name, 1, &val);
|
||||
+ ret = adc_channel_single_shot(dev->name, 0, &val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -89,6 +89,7 @@ int setup_boot_mode(void)
|
||||
boot_mode = readl(reg);
|
||||
debug("%s: boot mode 0x%08x\n", __func__, boot_mode);
|
||||
|
||||
+#if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD)
|
||||
/* Clear boot mode */
|
||||
writel(BOOT_NORMAL, reg);
|
||||
|
||||
@@ -102,6 +103,7 @@ int setup_boot_mode(void)
|
||||
env_set("preboot", "setenv preboot; ums mmc 0");
|
||||
break;
|
||||
}
|
||||
+#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
--- a/arch/arm/mach-rockchip/rk3568/rk3568.c
|
||||
+++ b/arch/arm/mach-rockchip/rk3568/rk3568.c
|
||||
@@ -9,19 +9,30 @@
|
||||
#include <asm/armv8/mmu.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/arch-rockchip/bootrom.h>
|
||||
+#include <asm/arch-rockchip/boot_mode.h>
|
||||
#include <asm/arch-rockchip/grf_rk3568.h>
|
||||
#include <asm/arch-rockchip/hardware.h>
|
||||
#include <dt-bindings/clock/rk3568-cru.h>
|
||||
|
||||
#define PMUGRF_BASE 0xfdc20000
|
||||
#define GRF_BASE 0xfdc60000
|
||||
+#define GRF_GPIO1B_IOMUX_H 0x0c
|
||||
+#define GRF_GPIO1C_IOMUX_L 0x10
|
||||
+#define GRF_GPIO1C_IOMUX_H 0x14
|
||||
+#define GRF_GPIO1D_IOMUX_L 0x18
|
||||
+#define GRF_GPIO1D_IOMUX_H 0x1c
|
||||
+#define GRF_GPIO2A_IOMUX_L 0x20
|
||||
#define GRF_GPIO1B_DS_2 0x218
|
||||
#define GRF_GPIO1B_DS_3 0x21c
|
||||
#define GRF_GPIO1C_DS_0 0x220
|
||||
#define GRF_GPIO1C_DS_1 0x224
|
||||
#define GRF_GPIO1C_DS_2 0x228
|
||||
#define GRF_GPIO1C_DS_3 0x22c
|
||||
-#define SGRF_BASE 0xFDD18000
|
||||
+#define GRF_GPIO1D_DS_0 0x230
|
||||
+#define GRF_GPIO1D_DS_1 0x234
|
||||
+#define GRF_GPIO1D_DS_2 0x238
|
||||
+#define SGRF_BASE 0xfdd18000
|
||||
+#define SGRF_SOC_CON3 0x0c
|
||||
#define SGRF_SOC_CON4 0x10
|
||||
#define EMMC_HPROT_SECURE_CTRL 0x03
|
||||
#define SDMMC0_HPROT_SECURE_CTRL 0x01
|
||||
@@ -133,6 +144,24 @@ int arch_cpu_init(void)
|
||||
writel(0x3f3f0707, GRF_BASE + GRF_GPIO1C_DS_1);
|
||||
writel(0x3f3f0707, GRF_BASE + GRF_GPIO1C_DS_2);
|
||||
writel(0x3f3f0707, GRF_BASE + GRF_GPIO1C_DS_3);
|
||||
+
|
||||
+ /* emmc, sfc, and sdmmc iomux */
|
||||
+ writel((0x7777UL << 16) | (0x1111), GRF_BASE + GRF_GPIO1B_IOMUX_H);
|
||||
+ writel((0x7777UL << 16) | (0x1111), GRF_BASE + GRF_GPIO1C_IOMUX_L);
|
||||
+ writel((0x7777UL << 16) | (0x2111), GRF_BASE + GRF_GPIO1C_IOMUX_H);
|
||||
+ writel((0x7777UL << 16) | (0x1111), GRF_BASE + GRF_GPIO1D_IOMUX_L);
|
||||
+ writel((0x7777UL << 16) | (0x1111), GRF_BASE + GRF_GPIO1D_IOMUX_H);
|
||||
+ writel((0x7777UL << 16) | (0x1111), GRF_BASE + GRF_GPIO2A_IOMUX_L);
|
||||
+
|
||||
+ /* set the fspi d0~3 cs0 to level 2 */
|
||||
+ writel(0x3f000700, GRF_BASE + GRF_GPIO1C_DS_3);
|
||||
+ writel(0x3f000700, GRF_BASE + GRF_GPIO1D_DS_0);
|
||||
+ writel(0x3f3f0707, GRF_BASE + GRF_GPIO1D_DS_1);
|
||||
+ writel(0x003f0007, GRF_BASE + GRF_GPIO1D_DS_2);
|
||||
+
|
||||
+ /* Set the fspi to secure */
|
||||
+ writel(((0x1 << 14) << 16) | (0x0 << 14), SGRF_BASE + SGRF_SOC_CON3);
|
||||
+
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@@ -164,3 +193,26 @@ int ft_system_setup(void *blob, struct bd_info *bd)
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+#ifdef CONFIG_SPL_BUILD
|
||||
+
|
||||
+void __weak led_setup(void)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+void spl_board_init(void)
|
||||
+{
|
||||
+ led_setup();
|
||||
+
|
||||
+#if defined(SPL_DM_REGULATOR)
|
||||
+ /*
|
||||
+ * Turning the eMMC and SPI back on (if disabled via the Qseven
|
||||
+ * BIOS_ENABLE) signal is done through a always-on regulator).
|
||||
+ */
|
||||
+ if (regulators_enable_boot_on(false))
|
||||
+ debug("%s: Cannot enable boot on regulator\n", __func__);
|
||||
+#endif
|
||||
+
|
||||
+ setup_boot_mode();
|
||||
+}
|
||||
+#endif
|
Loading…
Add table
Add a link
Reference in a new issue