@@ -29,6 +29,8 @@ Optional properties in the sram node:
- no-memory-wc : the flag indicating, that SRAM memory region has not to
be remapped as write combining. WC is used by default.
+- memory-exec : map range to allow code execution
+- memory-exec-nocache : map range to allow code execution and also non-cached
Required properties in the area nodes:
@@ -362,6 +362,13 @@ static int sram_probe(struct platform_device *pdev)
if (of_property_read_bool(pdev->dev.of_node, "no-memory-wc"))
sram->virt_base = devm_ioremap(sram->dev, res->start, size);
+ else if (of_property_read_bool(pdev->dev.of_node, "memory-exec"))
+ sram->virt_base = devm_memremap(sram->dev, res->start, size,
+ MEMREMAP_EXEC);
+ else if (of_property_read_bool(pdev->dev.of_node,
+ "memory-exec-nocache"))
+ sram->virt_base = devm_memremap(sram->dev, res->start, size,
+ MEMREMAP_EXEC_NOCACHE);
else
sram->virt_base = devm_ioremap_wc(sram->dev, res->start, size);
if (!sram->virt_base)
Allow option for mapping SRAM as executable. DT node can specify "memory-exec" and "memory-exec-nocache" to also map it as non-cached. This is useful for platforms using the sram driver that need to run PM code from sram like several ARM platforms. Signed-off-by: Dave Gerlach <d-gerlach@ti.com> --- Documentation/devicetree/bindings/sram/sram.txt | 2 ++ drivers/misc/sram.c | 7 +++++++ 2 files changed, 9 insertions(+)