summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/dts/rk3368-lion-u-boot.dtsi5
-rw-r--r--board/theobroma-systems/lion_rk3368/lion_rk3368.c28
-rw-r--r--configs/lion-rk3368_defconfig1
3 files changed, 33 insertions, 1 deletions
diff --git a/arch/arm/dts/rk3368-lion-u-boot.dtsi b/arch/arm/dts/rk3368-lion-u-boot.dtsi
index fb4a4fb59c..077005c1e5 100644
--- a/arch/arm/dts/rk3368-lion-u-boot.dtsi
+++ b/arch/arm/dts/rk3368-lion-u-boot.dtsi
@@ -7,6 +7,8 @@
config {
u-boot,spl-payload-offset = <0x40000>; /* @ 256KB */
u-boot,mmc-env-offset = <0x4000>; /* @ 16KB */
+ #gpio-cells = <0x2>;
+ sysreset-gpio = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>;
};
chosen {
@@ -91,4 +93,7 @@
status = "okay";
};
+&gpio0 {
+ u-boot,dm-pre-reloc;
+};
diff --git a/board/theobroma-systems/lion_rk3368/lion_rk3368.c b/board/theobroma-systems/lion_rk3368/lion_rk3368.c
index 31e09c87b1..2c5ce7154d 100644
--- a/board/theobroma-systems/lion_rk3368/lion_rk3368.c
+++ b/board/theobroma-systems/lion_rk3368/lion_rk3368.c
@@ -9,7 +9,9 @@
#include <spl.h>
#include <syscon.h>
#include <asm/io.h>
+#include <asm/gpio.h>
#include <asm/arch/clock.h>
+#include <asm/arch/cru_rk3368.h>
#include <asm/arch/grf_rk3368.h>
#include <asm/arch/timer.h>
#include <power/regulator.h>
@@ -34,11 +36,35 @@ int board_init(void)
return 0;
}
+static void rk3368_force_power_on_reset(void)
+{
+ ofnode node;
+ struct gpio_desc sysreset_gpio;
+
+ debug("%s: trying to force a power-on reset\n", __func__);
+
+ node = ofnode_path("/config");
+ if (!ofnode_valid(node)) {
+ debug("%s: no /config node?\n", __func__);
+ return;
+ }
+
+ if (gpio_request_by_name_nodev(node, "sysreset-gpio", 0,
+ &sysreset_gpio, GPIOD_IS_OUT)) {
+ debug("%s: could not find a /config/sysreset-gpio\n", __func__);
+ return;
+ }
+
+ dm_gpio_set_value(&sysreset_gpio, 1);
+}
+
void spl_board_init(void)
{
int ret;
+ struct rk3368_cru *cru = rockchip_get_cru();
- debug("%s: calling regulators_enable_boot_on\n", __func__);
+ if (cru->glb_rst_st != 0)
+ rk3368_force_power_on_reset();
ret = regulators_enable_boot_on(false);
if (ret)
diff --git a/configs/lion-rk3368_defconfig b/configs/lion-rk3368_defconfig
index 7b0da59fbf..6a0476251c 100644
--- a/configs/lion-rk3368_defconfig
+++ b/configs/lion-rk3368_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARM=y
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
+CONFIG_SPL_GPIO_SUPPORT=y
CONFIG_SPL_LIBCOMMON_SUPPORT=y
CONFIG_SPL_LIBGENERIC_SUPPORT=y
CONFIG_SYS_MALLOC_F_LEN=0x2000