summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-07-22 13:53:59 +0300
committerAnup Patel <anup@brainfault.org>2021-07-27 14:56:54 +0300
commite928472e67f86d73c00537dfa6d5cef5d646426d (patch)
tree455537f1107843cb1401ddc2d9b788248e0d5e50
parentce03c88ee142787cfe994d776491f43020de01de (diff)
downloadopensbi-e928472e67f86d73c00537dfa6d5cef5d646426d.tar.xz
lib: utils: support both of gpio-poweroff, gpio-reset
The generic GPIO reset driver has two entries in the match table: "gpio-poweroff", "gpio-reset". Only the first entry is considered by fdt_reset_init(). Define "gpio-poweroff" and "gpio-reset" as compatibility strings of two separate reset drivers. They still can share code. Fixes: e3d6919d10d7 ("lib: utils/reset: Add generic GPIO reset driver") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
-rw-r--r--lib/utils/reset/fdt_reset.c3
-rw-r--r--lib/utils/reset/fdt_reset_gpio.c11
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/utils/reset/fdt_reset.c b/lib/utils/reset/fdt_reset.c
index 87f925c..0d84dc2 100644
--- a/lib/utils/reset/fdt_reset.c
+++ b/lib/utils/reset/fdt_reset.c
@@ -12,12 +12,14 @@
#include <sbi_utils/fdt/fdt_helper.h>
#include <sbi_utils/reset/fdt_reset.h>
+extern struct fdt_reset fdt_poweroff_gpio;
extern struct fdt_reset fdt_reset_gpio;
extern struct fdt_reset fdt_reset_sifive_test;
extern struct fdt_reset fdt_reset_htif;
extern struct fdt_reset fdt_reset_thead;
static struct fdt_reset *reset_drivers[] = {
+ &fdt_poweroff_gpio,
&fdt_reset_gpio,
&fdt_reset_sifive_test,
&fdt_reset_htif,
@@ -45,7 +47,6 @@ int fdt_reset_init(void)
if (rc)
return rc;
}
- break;
}
return 0;
diff --git a/lib/utils/reset/fdt_reset_gpio.c b/lib/utils/reset/fdt_reset_gpio.c
index 7e0eb74..77e308a 100644
--- a/lib/utils/reset/fdt_reset_gpio.c
+++ b/lib/utils/reset/fdt_reset_gpio.c
@@ -129,8 +129,17 @@ static int gpio_reset_init(void *fdt, int nodeoff,
return 0;
}
-static const struct fdt_match gpio_reset_match[] = {
+static const struct fdt_match gpio_poweroff_match[] = {
{ .compatible = "gpio-poweroff", .data = (void *)FALSE },
+ { },
+};
+
+struct fdt_reset fdt_poweroff_gpio = {
+ .match_table = gpio_poweroff_match,
+ .init = gpio_reset_init,
+};
+
+static const struct fdt_match gpio_reset_match[] = {
{ .compatible = "gpio-restart", .data = (void *)TRUE },
{ },
};