summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorChristoph Muellner <christoph.muellner@theobroma-systems.com>2019-10-21 19:20:09 +0200
committerChristoph Muellner <christoph.muellner@theobroma-systems.com>2019-10-21 21:31:48 +0200
commit7d61a541e5ce8caf10dd8b7d847e12276368952a (patch)
tree7b6e0b3157b77b68fadf4945792be6784c72fc97 /board
parent1c71b33bd17d7357591cfb63869ef79d26944637 (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>
Diffstat (limited to 'board')
-rw-r--r--board/theobroma-systems/lion_rk3368/lion_rk3368.c28
1 files changed, 27 insertions, 1 deletions
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)