SBC_builder/patch/kernel/sunxi-6.14/patches.megous/of-property-fw_devlink-Support-allwinner-sram-links.patch
2025-06-01 01:05:27 +02:00

59 lines
1.7 KiB
Diff

From ffba28a2260e995a9170bea3a008d84a130fa583 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Sat, 15 May 2021 21:43:44 +0200
Subject: 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 <megi@xff.cz>
---
drivers/of/property.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/of/property.c b/drivers/of/property.c
index 208d922cc24c..8c9f3ea663a6 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1455,6 +1455,27 @@ static struct device_node *parse_remote_endpoint(struct device_node *np,
return of_graph_get_remote_port_parent(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, },
@@ -1502,6 +1523,7 @@ static const struct supplier_bindings of_supplier_bindings[] = {
.parse_prop = parse_post_init_providers,
.fwlink_flags = FWLINK_FLAG_IGNORE,
},
+ { .parse_prop = parse_allwinner_sram, },
{}
};
--
2.35.3