of: spmi: Support resource naming
reg-names and interrupt-names are standard bindings to map device
tree reg and interrupt indices to particular names. This way the
driver does not need to be concerned with hard coded assignments.
Therefore, add spmi support for these bindings.
Explicit support for reg-names is required since the
implementation does not make use of of_address_to_resource(),
which happens to already support this.
This is because of_address_to_resource() mandates address
translation, which is not relevant to spmi.
interrupt-names is already implicitly handled by
of_irq_to_resource(), which is used in the spmi implementation.
Add additional documentation to state clearly that this binding
is also supported.
Also add supporting routines to easily lookup a resource by name
for both registers and interrupts.
Change-Id: I94faf950da5106ecd4ff36f47e5b46102d9bd426
Signed-off-by: Michael Bohan <mbohan@codeaurora.org>
diff --git a/drivers/of/of_spmi.c b/drivers/of/of_spmi.c
index 61085c9..ea8f45c 100644
--- a/drivers/of/of_spmi.c
+++ b/drivers/of/of_spmi.c
@@ -130,6 +130,8 @@
res->start = be32_to_cpup(addrp);
res->end = res->start + size - 1;
res->flags = flags;
+ of_property_read_string_index(r_info->node, "reg-names",
+ i, &res->name);
}
WARN_ON(of_irq_to_resource_table(r_info->node, res, num_irq) !=
num_irq);