diff options
author | Christoph Muellner <christoph.muellner@theobroma-systems.com> | 2019-10-21 19:20:09 +0200 |
---|---|---|
committer | Christoph Muellner <christoph.muellner@theobroma-systems.com> | 2019-10-21 21:31:48 +0200 |
commit | 7d61a541e5ce8caf10dd8b7d847e12276368952a (patch) | |
tree | 7b6e0b3157b77b68fadf4945792be6784c72fc97 | |
parent | 1c71b33bd17d7357591cfb63869ef79d26944637 (diff) |
rockchip: rk3368-lion: add code to allow forcing a power-on resetv2019.04-som
Similar to the RK3399, the RK3368 only resets almost all logic when
a software reset is performed. To make our software maintenance
easier in the future, we want to have the option (controlled by a DTS
property) to force all reset causes other than a power-on reset to
trigger a power-on reset via a GPIO trigger.
This adds the necessary support to the rk3368-lion (i.e. RK3368-uQ7)
board-support.
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
-rw-r--r-- | arch/arm/dts/rk3368-lion-u-boot.dtsi | 5 | ||||
-rw-r--r-- | board/theobroma-systems/lion_rk3368/lion_rk3368.c | 28 | ||||
-rw-r--r-- | configs/lion-rk3368_defconfig | 1 |
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 |