misc: SRAM: Add option to map SRAM as cacheable
author黄涛 <huangtao@rock-chips.com>
Mon, 25 Aug 2014 10:21:55 +0000 (18:21 +0800)
committer黄涛 <huangtao@rock-chips.com>
Mon, 25 Aug 2014 10:23:05 +0000 (18:23 +0800)
Documentation/devicetree/bindings/misc/sram.txt
drivers/misc/sram.c

index 4fa9af31a06176f5c5f450c7027f0b67850c6033..db6ee8e7910079c68f427769d9d8d211dba14d3d 100644 (file)
@@ -11,6 +11,7 @@ Required properties:
 Optional properties:
 
 - map-exec: Map range to allow code execution
+- map-cacheable: Map range as cacheable
 
 Example:
 
index baa50080ac460a288fa1696cea04a6074bdefe3b..31f268c86885aa63b9695384d424a4ac91c2cd30 100644 (file)
@@ -53,6 +53,8 @@ static int sram_probe(struct platform_device *pdev)
                map_exec |= true;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (res && of_get_property(pdev->dev.of_node, "map-cacheable", NULL))
+               res->flags |= IORESOURCE_CACHEABLE;
        if (map_exec)
                virt_base = devm_ioremap_exec_resource(&pdev->dev, res);
        else