From 508e0bf07c39c25f1bc5a4e82aa5d92c147bd3bc Mon Sep 17 00:00:00 2001 From: Ondrej Jirman Date: Sat, 15 May 2021 21:43:44 +0200 Subject: [PATCH 286/478] of: property: fw_devlink: Support allwinner,sram links allwinner,sram property points to a node representing section of SRAM, which is implemented by its ancestor (syscon), so we link to the parent of parent of the actual SRAM section node that the link points to. Signed-off-by: Ondrej Jirman --- drivers/of/property.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index a3483484a5a2..2e0d379af7ca 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1350,6 +1350,27 @@ static struct device_node *parse_interrupts(struct device_node *np, return of_irq_parse_one(np, index, &sup_args) ? NULL : sup_args.np; } +static struct device_node *parse_allwinner_sram(struct device_node *np, + const char *prop_name, int index) +{ + struct device_node *sram_node; + + if (!IS_ENABLED(CONFIG_SUNXI_SRAM)) + return NULL; + + if (strcmp(prop_name, "allwinner,sram")) + return NULL; + + if (index > 0) + return NULL; + + sram_node = of_parse_phandle(np, prop_name, 0); + sram_node = of_get_parent(sram_node); + sram_node = of_get_parent(sram_node); + + return sram_node; +} + static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_clocks, }, { .parse_prop = parse_interconnects, }, @@ -1384,6 +1405,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_regulators, }, { .parse_prop = parse_gpio, }, { .parse_prop = parse_gpios, }, + { .parse_prop = parse_allwinner_sram, }, {} }; -- 2.35.3