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>
This commit is contained in:
Michael Bohan
2012-05-21 17:47:11 -07:00
committed by Stephen Boyd
parent 902a511010
commit c3a607b5d6
4 changed files with 74 additions and 2 deletions

View File

@@ -433,6 +433,14 @@ extern struct resource *spmi_get_resource(struct spmi_device *dev,
struct spmi_resource *node,
unsigned int type, unsigned int res_num);
struct resource *spmi_get_resource_byname(struct spmi_device *dev,
struct spmi_resource *node,
unsigned int type,
const char *name);
extern int spmi_get_irq(struct spmi_device *dev, struct spmi_resource *node,
unsigned int res_num);
extern int spmi_get_irq_byname(struct spmi_device *dev,
struct spmi_resource *node, const char *name);
#endif