summaryrefslogtreecommitdiff
path: root/plat/allwinner
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2019-02-17 22:10:11 +0000
committerDimitris Papastamos <dimitris.papastamos@arm.com>2019-03-08 15:35:30 +0000
commitc48d02bade88b07fa7f43aa44e5217f68e5d047f (patch)
tree53f3b5049097f563fb2d4092aef38869d1434778 /plat/allwinner
parentc6c10b02b8eec52c8da2f65164c6a0d3c100016b (diff)
allwinner: regulators: pick correct DT subnode
So far the DT node describing the AXP803 PMIC used in many Allwinner A64 boards had only one subnode, so our code just entering the first subnode to find all regulators worked fine. However recent DT updates in the Linux kernel add more subnodes *before* that, so we need to make sure to explicitly enter the "regulators" subnode to find the information we are after. Improve some DT node parsing error handling on the way. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'plat/allwinner')
-rw-r--r--plat/allwinner/sun50i_a64/sunxi_power.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/plat/allwinner/sun50i_a64/sunxi_power.c b/plat/allwinner/sun50i_a64/sunxi_power.c
index b4d16a06..07a37167 100644
--- a/plat/allwinner/sun50i_a64/sunxi_power.c
+++ b/plat/allwinner/sun50i_a64/sunxi_power.c
@@ -229,8 +229,8 @@ static void setup_axp803_rails(const void *fdt)
/* locate the PMIC DT node, bail out if not found */
node = fdt_node_offset_by_compatible(fdt, -1, "x-powers,axp803");
- if (node == -FDT_ERR_NOTFOUND) {
- WARN("BL31: PMIC: No AXP803 DT node, skipping initial setup.\n");
+ if (node < 0) {
+ WARN("BL31: PMIC: Cannot find AXP803 DT node, skipping initial setup.\n");
return;
}
@@ -241,11 +241,15 @@ static void setup_axp803_rails(const void *fdt)
}
/* descend into the "regulators" subnode */
- node = fdt_first_subnode(fdt, node);
+ node = fdt_subnode_offset(fdt, node, "regulators");
+ if (node < 0) {
+ WARN("BL31: PMIC: Cannot find regulators subnode, skipping initial setup.\n");
+ return;
+ }
/* iterate over all regulators to find used ones */
for (node = fdt_first_subnode(fdt, node);
- node != -FDT_ERR_NOTFOUND;
+ node >= 0;
node = fdt_next_subnode(fdt, node)) {
const struct axp_regulator *reg;
const char *name;