summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-01-24 15:17:32 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-01-29 12:12:23 +0100
commit706cef7e5bd9faafeb1ec599bf5270ea07063d56 (patch)
tree87474836bd259a5f8b0fb57763db438b1fb973c9
parent0099a887c03b7dfe76e06496906dbb1e5c7f5df6 (diff)
downloadbarebox-706cef7e5bd9faafeb1ec599bf5270ea07063d56.tar.gz
reset_source: add reset_source_get
To get reset_source from C code, not only from shell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/reset_source.c10
-rw-r--r--include/reset_source.h6
2 files changed, 16 insertions, 0 deletions
diff --git a/common/reset_source.c b/common/reset_source.c
index 3a11d26..6026af1 100644
--- a/common/reset_source.c
+++ b/common/reset_source.c
@@ -27,8 +27,18 @@ static const char * const reset_src_names[] = {
[RESET_JTAG] = "JTAG",
};
+static enum reset_src_type reset_source;
+
+enum reset_src_type reset_source_get(void)
+{
+ return reset_source;
+}
+EXPORT_SYMBOL(reset_source_get);
+
void reset_source_set(enum reset_src_type st)
{
+ reset_source = st;
+
setenv("global.system.reset", reset_src_names[st]);
}
EXPORT_SYMBOL(reset_source_set);
diff --git a/include/reset_source.h b/include/reset_source.h
index f3a203a..bff7f97 100644
--- a/include/reset_source.h
+++ b/include/reset_source.h
@@ -24,10 +24,16 @@ enum reset_src_type {
#ifdef CONFIG_RESET_SOURCE
void reset_source_set(enum reset_src_type);
+enum reset_src_type reset_source_get(void);
#else
static inline void reset_source_set(enum reset_src_type unused)
{
}
+
+static inline enum reset_src_type reset_source_get(void)
+{
+ return RESET_UKWN;
+}
#endif
#endif /* __INCLUDE_RESET_SOURCE_H */