public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Russ Dill <Russ.Dill@ti.com>
To: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	mans@mansr.com, Shawn Guo <shawn.guo@linaro.org>,
	Dave Martin <Dave.Martin@arm.com>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>
Subject: [RFC PATCH 03/11] misc: SRAM: Add option to map SRAM to allow code execution
Date: Tue, 17 Sep 2013 05:43:29 -0700	[thread overview]
Message-ID: <1379421817-15759-4-git-send-email-Russ.Dill@ti.com> (raw)
In-Reply-To: <1379421817-15759-1-git-send-email-Russ.Dill@ti.com>

This is necessary for platforms that use SRAM to execute suspend/resume stubs.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
---
 Documentation/devicetree/bindings/misc/sram.txt |  4 ++++
 drivers/misc/sram.c                             | 13 ++++++++++++-
 include/linux/platform_data/sram.h              |  8 ++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 include/linux/platform_data/sram.h

diff --git a/Documentation/devicetree/bindings/misc/sram.txt b/Documentation/devicetree/bindings/misc/sram.txt
index 4d0a00e..4fa9af3 100644
--- a/Documentation/devicetree/bindings/misc/sram.txt
+++ b/Documentation/devicetree/bindings/misc/sram.txt
@@ -8,6 +8,10 @@ Required properties:
 
 - reg : SRAM iomem address range
 
+Optional properties:
+
+- map-exec: Map range to allow code execution
+
 Example:
 
 sram: sram@5c000000 {
diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
index d87cc91..baa5008 100644
--- a/drivers/misc/sram.c
+++ b/drivers/misc/sram.c
@@ -28,6 +28,7 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/genalloc.h>
+#include <linux/platform_data/sram.h>
 
 #define SRAM_GRANULARITY	32
 
@@ -38,14 +39,24 @@ struct sram_dev {
 
 static int sram_probe(struct platform_device *pdev)
 {
+	struct sram_platform_data *pdata = pdev->dev.platform_data;
 	void __iomem *virt_base;
 	struct sram_dev *sram;
 	struct resource *res;
 	unsigned long size;
+	bool map_exec = false;
 	int ret;
 
+	if (of_get_property(pdev->dev.of_node, "map-exec", NULL))
+		map_exec = true;
+	if (pdata && pdata->map_exec)
+		map_exec |= true;
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	virt_base = devm_ioremap_resource(&pdev->dev, res);
+	if (map_exec)
+		virt_base = devm_ioremap_exec_resource(&pdev->dev, res);
+	else
+		virt_base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(virt_base))
 		return PTR_ERR(virt_base);
 
diff --git a/include/linux/platform_data/sram.h b/include/linux/platform_data/sram.h
new file mode 100644
index 0000000..8f5c4ba
--- /dev/null
+++ b/include/linux/platform_data/sram.h
@@ -0,0 +1,8 @@
+#ifndef _LINUX_SRAM_H
+#define _LINUX_SRAM_H
+
+struct sram_platform_data {
+	bool map_exec;
+};
+
+#endif
-- 
1.8.3.2


  parent reply	other threads:[~2013-09-17 12:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-17 12:43 [RFC PATCH 00/11] Embeddable Position Independent Executable Russ Dill
2013-09-17 12:43 ` [RFC PATCH 01/11] asm-generic: io: Add exec versions of ioremap Russ Dill
2013-09-17 12:43 ` [RFC PATCH 02/11] lib: devres: Add exec versions of devm_ioremap_resource and friends Russ Dill
2013-09-17 12:43 ` Russ Dill [this message]
2013-09-17 12:43 ` [RFC PATCH 04/11] asm-generic: fncpy: Add function copying macros Russ Dill
2013-09-17 14:23   ` Geert Uytterhoeven
2013-09-17 12:43 ` [RFC PATCH 05/11] PIE: Support embedding position independent executables Russ Dill
2013-09-17 12:43 ` [RFC PATCH 06/11] ARM: PIE: Add position independent executable embedding to ARM Russ Dill
2013-09-17 12:43 ` [RFC PATCH 07/11] ARM: PIE: Add support for updating PIE relocations Russ Dill
2013-09-17 12:43 ` [RFC PATCH 08/11] ARM: PIE: Add macro for generating PIE resume trampoline Russ Dill
2013-09-17 12:43 ` [RFC PATCH 09/11] ARM: dts: AM33XX: Associate SRAM with MPU and mark it exec Russ Dill
2013-09-17 12:43 ` [RFC PATCH 10/11] ARM: OMAP2+: AM33XX: Add PIE support for AM33XX Russ Dill
2013-09-17 12:43 ` [RFC PATCH 11/11] ARM: OMAP2+: AM33XX: Basic suspend resume support Russ Dill
2013-10-23 14:11 ` [RFC PATCH 00/11] Embeddable Position Independent Executable Linus Walleij
2013-10-24  8:09 ` Heiko Stübner
2014-04-22  8:15   ` Heiko Stübner
2014-06-04 13:36     ` Pascal Hürst
2013-11-07 23:29 ` Kevin Hilman
2013-11-08 18:09 ` Dave Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1379421817-15759-4-git-send-email-Russ.Dill@ti.com \
    --to=russ.dill@ti.com \
    --cc=Dave.Martin@arm.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mans@mansr.com \
    --cc=shawn.guo@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox