summaryrefslogtreecommitdiffstats
path: root/include/reset_source.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-08-26 10:13:22 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-08-28 07:18:14 +0200
commit4a7534bf07ee0fb56cf48501d988234382567481 (patch)
tree0b5c616c5508979b42f925182084029e0af70cb7 /include/reset_source.h
parentff2a4a0a138d6cb6addb5a855ea57a0332626d3c (diff)
downloadbarebox-4a7534bf07ee0fb56cf48501d988234382567481.tar.gz
barebox-4a7534bf07ee0fb56cf48501d988234382567481.tar.xz
reset-source: Allow different priorities
Different devices may report the reset source with different levels of certainty. For example a SoC may see a power-on reset, but this may only be because an external PMIC has power cycled the SoC. This means the PMIC knows the real reason better and thus the reset reason from the PMIC should be preferred. This patch introduces priorities for the reset_source to handle the above scenario. Also add a of_get_reset_source_priority() function to retrieve the desired priority from the device tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/reset_source.h')
-rw-r--r--include/reset_source.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/reset_source.h b/include/reset_source.h
index 367f93b2ad..d484836dff 100644
--- a/include/reset_source.h
+++ b/include/reset_source.h
@@ -25,10 +25,11 @@ enum reset_src_type {
};
#ifdef CONFIG_RESET_SOURCE
-void reset_source_set(enum reset_src_type);
+void reset_source_set_priority(enum reset_src_type, unsigned int priority);
enum reset_src_type reset_source_get(void);
#else
-static inline void reset_source_set(enum reset_src_type unused)
+static inline void reset_source_set_priority(enum reset_src_type type,
+ unsigned int priority)
{
}
@@ -38,4 +39,13 @@ static inline enum reset_src_type reset_source_get(void)
}
#endif
+#define RESET_SOURCE_DEFAULT_PRIORITY 100
+
+static inline void reset_source_set(enum reset_src_type type)
+{
+ reset_source_set_priority(type, RESET_SOURCE_DEFAULT_PRIORITY);
+}
+
+unsigned int of_get_reset_source_priority(struct device_node *node);
+
#endif /* __INCLUDE_RESET_SOURCE_H */