diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2018-05-17 14:29:17 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-05-18 08:31:32 +0200 |
commit | 58243d98b3f8e000c674a78a9466bd2fce213cc6 (patch) | |
tree | 794cf2ab07dcf6f572323e8cad24e85458ddc034 /common | |
parent | 89677d11e714464d430f9dc09a21fb349d3fb931 (diff) | |
download | barebox-58243d98b3f8e000c674a78a9466bd2fce213cc6.tar.gz barebox-58243d98b3f8e000c674a78a9466bd2fce213cc6.tar.xz |
common: oftree: Pass reset source and reset source instance to kernel
Detecting reset reason is, in some cases, a destructive operation and
in such cases it is impossible to obtain that information in the
kernel without some help from barebox.
Pass reset source and reset source instance to kernel to Linux to make
it availible to Linux userspace. This info is placeed under
/chosen/bootsource and it can be read under Linux in
/sys/firmware/devicetree/base/chosen/reset-source.
and
/sys/firmware/devicetree/base/chosen/reset-source-instance.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/oftree.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/oftree.c b/common/oftree.c index a38dfff293..5bb5420a78 100644 --- a/common/oftree.c +++ b/common/oftree.c @@ -13,6 +13,7 @@ #include <boot.h> #include <bootsource.h> #include <i2c/i2c.h> +#include <reset_source.h> #define MAX_LEVEL 32 /* how deeply nested we will go */ @@ -158,6 +159,10 @@ static int of_fixup_bootargs(struct device_node *root, void *unused) if (err) return err; + of_property_write_string(node, "reset-source", reset_source_name()); + of_property_write_u32(node, "reset-source-instance", + reset_source_get_instance()); + return of_fixup_bootargs_bootsource(root, node); } |