diff options
author | Thierry Reding <thierry.reding@avionic-design.de> | 2012-07-26 15:55:10 -0400 |
---|---|---|
committer | Rob Herring <rob.herring@calxeda.com> | 2012-09-07 12:31:23 -0400 |
commit | e38c0a1fbc5803cbacdaac0557c70ac8ca5152e7 (patch) | |
tree | 8173068856ea116c00c91ff04aac341a6da8b160 /drivers/of | |
parent | a4f8bf220e415318c739243aaeb2471cf5e8c911 (diff) |
of/address: Handle #address-cells > 2 specially
When a bus specifies #address-cells > 2, of_bus_default_map() now
assumes that the mapping isn't for a physical address but rather an
identifier that needs to match exactly.
This is required by bindings that use multiple cells to translate a
resource to the parent bus (device index, type, ...).
See here for the discussion:
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-June/016577.html
Originally-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/address.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/of/address.c b/drivers/of/address.c index 7a07751428d..72e496f1e9b 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c | |||
@@ -69,6 +69,14 @@ static u64 of_bus_default_map(u32 *addr, const __be32 *range, | |||
69 | (unsigned long long)cp, (unsigned long long)s, | 69 | (unsigned long long)cp, (unsigned long long)s, |
70 | (unsigned long long)da); | 70 | (unsigned long long)da); |
71 | 71 | ||
72 | /* | ||
73 | * If the number of address cells is larger than 2 we assume the | ||
74 | * mapping doesn't specify a physical address. Rather, the address | ||
75 | * specifies an identifier that must match exactly. | ||
76 | */ | ||
77 | if (na > 2 && memcmp(range, addr, na * 4) != 0) | ||
78 | return OF_BAD_ADDR; | ||
79 | |||
72 | if (da < cp || da >= (cp + s)) | 80 | if (da < cp || da >= (cp + s)) |
73 | return OF_BAD_ADDR; | 81 | return OF_BAD_ADDR; |
74 | return da - cp; | 82 | return da - cp; |