From 62753977d4231a160e4fb3bd3fe585e151792eb4 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Wed, 10 Jan 2024 17:01:05 +0100 Subject: dma: introduce CONFIG_OF_DMA_COHERENCY Some architectures are either exclusively cache-coherent or not, but some others can have only some devices that snoop the bus, while the rest doesn't. This information can be encoded in the device tree, but we don't want to look this up in the device tree for the vast majority of platforms that are either completely coherent or aren't. Therefore provide a new CONFIG_OF_DMA_COHERENCY symbol for selections by platforms that require this functionality. Signed-off-by: Ahmad Fatoum Link: https://lore.barebox.org/20240110160112.4134162-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- drivers/of/platform.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers/of') diff --git a/drivers/of/platform.c b/drivers/of/platform.c index dc6c53b716..edfeb192d4 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -101,12 +101,14 @@ static struct device_node *of_get_next_dma_parent(const struct device_node *np) */ bool of_dma_is_coherent(struct device_node *node) { - while (node) { - if (of_property_read_bool(node, "dma-coherent")) - return true; - if (of_property_read_bool(node, "dma-noncoherent")) - return false; - node = of_get_next_dma_parent(node); + if (IS_ENABLED(CONFIG_OF_DMA_COHERENCY)) { + while (node) { + if (of_property_read_bool(node, "dma-coherent")) + return true; + if (of_property_read_bool(node, "dma-noncoherent")) + return false; + node = of_get_next_dma_parent(node); + } } return IS_ENABLED(CONFIG_ARCH_DMA_DEFAULT_COHERENT); -- cgit v1.2.3