Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6eba55b authored by Rob Herring's avatar Rob Herring Committed by John Stultz
Browse files

UPSTREAM: of/address: 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.

Cc: Robin Murphy <robin.murphy@arm.com>
Tested-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
(cherry picked from commit 81db12ee15cb83926e290a8a3654a2dfebc80935)
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
Change-Id: I1c80cd1757ddf143f06e7795fd1ac06da93c0ce9
parent 5eadbde1
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -519,9 +519,13 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
	 *
	 * 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")) {
		pr_debug("no ranges; cannot translate\n");
		return 1;
	}