summaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-01-10 17:01:05 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-01-11 15:11:02 +0100
commit62753977d4231a160e4fb3bd3fe585e151792eb4 (patch)
tree791c05654d0b6f8bb5c7d389a8cb544f7536826a /drivers/of
parenta16e16575ae797e33f1a499b5f6e28f6cf6c3527 (diff)
downloadbarebox-62753977d4231a160e4fb3bd3fe585e151792eb4.tar.gz
barebox-62753977d4231a160e4fb3bd3fe585e151792eb4.tar.xz
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 <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240110160112.4134162-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/platform.c14
1 files changed, 8 insertions, 6 deletions
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);