Add set_arch_dma_coherent_ops() for architectures to setup coherent dma_ops. Update dt_dma_configure() to look for a "dma-coherent" property in the device's node, and its ancestors If this property is found, we call set_arch_dma_coherent_ops() per device to apply coherent DMA configuartion.
The set_arch_dma_coherent_ops() is declared as __weak and it's expected that the arch's needing it will imlepment it. Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> Cc: Russell King <li...@arm.linux.org.uk> Cc: Arnd Bergmann <a...@arndb.de> Cc: Olof Johansson <o...@lixom.net> Cc: Grant Likely <grant.lik...@linaro.org> Cc: Rob Herring <robh...@kernel.org> Cc: Catalin Marinas <catalin.mari...@arm.com> Cc: Linus Walleij <linus.wall...@linaro.org> Signed-off-by: Grygorii Strashko <grygorii.stras...@ti.com> Signed-off-by: Santosh Shilimkar <santosh.shilim...@ti.com> --- drivers/of/platform.c | 5 +++++ include/linux/dma-mapping.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 53bb12f..272e390 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -255,6 +255,11 @@ static void dt_dma_configure(struct device *dev) dev_err(dev, "failed to set coherent DMA mask %pad\n", &dma_mask); } + + if (of_dma_is_coherent(dev->of_node)) { + set_arch_dma_coherent_ops(dev); + dev_dbg(dev, "device is dma coherent\n"); + } } /** diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index fd4aee2..c7d9b1b 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -123,6 +123,13 @@ static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask) extern u64 dma_get_required_mask(struct device *dev); +#ifndef set_arch_dma_coherent_ops +static inline int set_arch_dma_coherent_ops(struct device *dev) +{ + return 0; +} +#endif + static inline unsigned int dma_get_max_seg_size(struct device *dev) { return dev->dma_parms ? dev->dma_parms->max_segment_size : 65536; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/