summaryrefslogtreecommitdiff
path: root/drivers/of/of_private.h
diff options
context:
space:
mode:
authorRobin Murphy <robin.murphy@arm.com>2022-09-29 13:48:38 +0100
committerRob Herring <robh@kernel.org>2022-09-30 14:35:43 -0500
commitf1ad5338a4d57fe1fe6475003acb8c70bf9d1bdf (patch)
tree4e0c03ad6c6334de5bf36988639db0772fb0e018 /drivers/of/of_private.h
parent17005609548f1f0204cbfc988b325533470e585c (diff)
of: Fix "dma-ranges" handling for bus controllers
Commit 951d48855d86 ("of: Make of_dma_get_range() work on bus nodes") relaxed the handling of "dma-ranges" for any leaf node on the assumption that it would still represent a usage error for the property to be present on a non-bus leaf node. However there turns out to be a fiddly case where a bus also represents a DMA-capable device in its own right, such as a PCIe root complex with an integrated DMA engine on its platform side. In such cases, "dma-ranges" translation is entirely valid for devices discovered behind the bus, but should not be erroneously applied to the bus controller device itself which operates in its parent's address space. Fix this by restoring the previous behaviour for the specific case where a device is configured via its own OF node, since it is logical to assume that a device should never represent its own parent bus. Reported-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> Signed-off-by: Robin Murphy <robin.murphy@arm.com> Link: https://lore.kernel.org/r/112e8f3d3e7c054ecf5e12b5ac0aa5596ec00681.1664455433.git.robin.murphy@arm.com Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of/of_private.h')
-rw-r--r--drivers/of/of_private.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index 9324483397f6..fb6792d381a6 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -155,12 +155,17 @@ struct bus_dma_region;
#if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_HAS_DMA)
int of_dma_get_range(struct device_node *np,
const struct bus_dma_region **map);
+struct device_node *__of_get_dma_parent(const struct device_node *np);
#else
static inline int of_dma_get_range(struct device_node *np,
const struct bus_dma_region **map)
{
return -ENODEV;
}
+static inline struct device_node *__of_get_dma_parent(const struct device_node *np)
+{
+ return of_get_parent(np);
+}
#endif
void fdt_init_reserved_mem(void);