diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2019-08-25 17:58:44 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-09-09 10:44:30 +0200 |
commit | e208e049f98de40157eb3d8f8f7cbb61147a5040 (patch) | |
tree | 55c919d8ec72d82cb0433e3e9715452dcecefc86 | |
parent | 33f699d2eeef7735a40398ec8e0a7f457d6f2f54 (diff) | |
download | barebox-e208e049f98de40157eb3d8f8f7cbb61147a5040.tar.gz barebox-e208e049f98de40157eb3d8f8f7cbb61147a5040.tar.xz |
oftree: expose reset_source device in device tree
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | common/oftree.c | 14 | ||||
-rw-r--r-- | include/reset_source.h | 5 |
2 files changed, 19 insertions, 0 deletions
diff --git a/common/oftree.c b/common/oftree.c index 28a3b965ff..09cb660212 100644 --- a/common/oftree.c +++ b/common/oftree.c @@ -145,6 +145,7 @@ static int of_fixup_bootargs(struct device_node *root, void *unused) const char *str; int err; int instance = reset_source_get_instance(); + struct device_d *dev; str = linux_bootargs_get(); if (!str) @@ -164,6 +165,19 @@ static int of_fixup_bootargs(struct device_node *root, void *unused) if (instance >= 0) of_property_write_u32(node, "reset-source-instance", instance); + + dev = reset_source_get_device(); + if (dev && dev->device_node) { + phandle phandle; + + phandle = of_node_create_phandle(dev->device_node); + + err = of_property_write_u32(node, + "reset-source-device", phandle); + if (err) + return err; + } + return of_fixup_bootargs_bootsource(root, node); } diff --git a/include/reset_source.h b/include/reset_source.h index 27ee077cc6..3ccd529fdd 100644 --- a/include/reset_source.h +++ b/include/reset_source.h @@ -55,6 +55,11 @@ static inline int reset_source_get_instance(void) return -1; } +static inline struct device_d *reset_source_get_device(void) +{ + return NULL; +} + static inline void reset_source_set_prinst(enum reset_src_type type, unsigned int priority, int instance) { |