Allow barebox to overlay states

Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
This commit is contained in:
Pascal Vizeli 2018-06-02 22:40:30 +00:00
parent 9a16185a85
commit e866e0738f

View File

@ -0,0 +1,42 @@
From 19ab0b433893cc7d16e8f4a6052f0f784131c43a Mon Sep 17 00:00:00 2001
From: Pascal Vizeli <pvizeli@syshack.ch>
Date: Sat, 2 Jun 2018 22:08:31 +0000
Subject: [PATCH 1/1] common: state: allow to overlay state backend
This allow to use overlay for state backends. I.e. on raspberry you need
use barebox with SDHCI (slow) and after linux boot it will use SDHOST driver.
But the problem now is, that the state is on SDHCI and dt-utils need it on
SDHOST. Actual it is not possible to overwrite this.
Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
---
common/state/state.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/common/state/state.c b/common/state/state.c
index 25d950211..e6259043f 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -494,8 +494,17 @@ static int of_state_fixup(struct device_node *root, void *ctx)
}
/* backend phandle */
- backend_node = of_find_node_by_reproducible_name(root,
- state->backend_reproducible_name);
+ if (node) {
+ ret = of_property_read_u32(node, "backend", &phandle);
+ if (ret)
+ goto out;
+
+ backend_node = of_find_node_by_phandle_from(phandle, root);
+ } else {
+ backend_node = of_find_node_by_reproducible_name(root,
+ state->backend_reproducible_name);
+ }
+
if (!backend_node) {
ret = -ENODEV;
goto out;
--
2.17.0