drivers: of: of_reserved_mem: fixup the CMA alignment not to affect dma-coherent
authorJaewon <jaewon31.kim@samsung.com>
Wed, 25 May 2016 04:29:50 +0000 (13:29 +0900)
committerRob Herring <robh@kernel.org>
Fri, 3 Jun 2016 12:24:10 +0000 (07:24 -0500)
There was an alignment mismatch issue for CMA and it was fixed by
commit 1cc8e3458b51 ("drivers: of: of_reserved_mem: fixup the alignment with CMA setup").
However the way of the commit considers not only dma-contiguous(CMA) but also
dma-coherent which has no that requirement.

This patch checks more to distinguish dma-contiguous(CMA) from dma-coherent.

Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
Acked-by: Jason Liu <r64343@freescale.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
[robh: remove erroneous opening bracket]
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/of/of_reserved_mem.c

index ed01c0172e4a5f8b45e0a382b789f0cd20d60987..ed7e681efcf00ed123592ed2043233d169c87837 100644 (file)
@@ -127,7 +127,10 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
        }
 
        /* Need adjust the alignment to satisfy the CMA requirement */
-       if (IS_ENABLED(CONFIG_CMA) && of_flat_dt_is_compatible(node, "shared-dma-pool"))
+       if (IS_ENABLED(CONFIG_CMA)
+           && of_flat_dt_is_compatible(node, "shared-dma-pool")
+           && of_get_flat_dt_prop(node, "reusable", NULL)
+           && !of_get_flat_dt_prop(node, "no-map", NULL))
                align = max(align, (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));
 
        prop = of_get_flat_dt_prop(node, "alloc-ranges", &len);