aboutsummaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
authorBin Meng2021-04-30 21:16:58 +0800
committerSimon Glass2021-06-05 07:35:34 -0600
commit139eaa7a2b5f25e42307a672849eba0e5b4cddf0 (patch)
tree3eedf1e2ce3481018ef1325ea358747d3893eaf8 /drivers/core
parentc003d2cd6b415319c3e40db42b48c2815acda3d3 (diff)
of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
'dma-ranges' frequently exists without parent nodes having 'dma-ranges'. While this is an error for 'ranges', this is fine because DMA capable devices always have a translatable DMA address. Also, with no 'dma-ranges' at all, the assumption is that DMA addresses are 1:1 with no restrictions unless perhaps the device itself has implicit restrictions. This keeps in sync with Linux kernel commit: 81db12ee15cb: of/address: Translate 'dma-ranges' for parent nodes missing 'dma-ranges' Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/of_addr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/core/of_addr.c b/drivers/core/of_addr.c
index 9b77308182d..a3af48fd885 100644
--- a/drivers/core/of_addr.c
+++ b/drivers/core/of_addr.c
@@ -192,9 +192,13 @@ static int of_translate_one(const struct device_node *parent,
*
* As far as we know, this damage only exists on Apple machines, so
* This code is only enabled on powerpc. --gcl
+ *
+ * This quirk also applies for 'dma-ranges' which frequently exist in
+ * child nodes without 'dma-ranges' in the parent nodes. --RobH
*/
ranges = of_get_property(parent, rprop, &rlen);
- if (ranges == NULL && !of_empty_ranges_quirk(parent)) {
+ if (ranges == NULL && !of_empty_ranges_quirk(parent) &&
+ strcmp(rprop, "dma-ranges")) {
debug("no ranges; cannot translate\n");
return 1;
}