Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753535AbbKBLE5 (ORCPT ); Mon, 2 Nov 2015 06:04:57 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:34870 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752855AbbKBLEw (ORCPT ); Mon, 2 Nov 2015 06:04:52 -0500 From: Neil Armstrong Subject: [RFC PATCH v2 1/2] base: dma-coherent: Add DT property for non exclusive shared-dma-pool To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Grant Likely , Josh Cartwright , Marek Szyprowski Organization: Baylibre Message-ID: <56374349.1000306@baylibre.com> Date: Mon, 2 Nov 2015 12:04:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1436 Lines: 36 In order to have the ability to declare a non exclusive shared-dma-pool, i.e. without the DMA_MEMORY_EXCLUSIVE flag, add the 'no-exclusive' DT optional parameter to initialize the coherent memory without the flag. Signed-off-by: Neil Armstrong --- drivers/base/dma-coherent.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/base/dma-coherent.c b/drivers/base/dma-coherent.c index 55b8398..cda6364 100644 --- a/drivers/base/dma-coherent.c +++ b/drivers/base/dma-coherent.c @@ -279,10 +279,14 @@ EXPORT_SYMBOL(dma_mmap_from_coherent); static int rmem_dma_device_init(struct reserved_mem *rmem, struct device *dev) { struct dma_coherent_mem *mem = rmem->priv; + unsigned flags = 0; + + if (!of_property_read_bool(rmem->fdt_node, "no-exclusive")) + flags |= DMA_MEMORY_EXCLUSIVE; if (!mem && dma_init_coherent_memory(rmem->base, rmem->base, rmem->size, - DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE, + DMA_MEMORY_MAP | flags, &mem) != DMA_MEMORY_MAP) { pr_err("Reserved memory: failed to init DMA memory pool at %pa, size %ld MiB\n", &rmem->base, (unsigned long)rmem->size / SZ_1M); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/