From patchwork Tue Sep 17 12:43:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russ Dill X-Patchwork-Id: 2902201 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 09C0E9F1BF for ; Tue, 17 Sep 2013 12:45:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EC05F2038B for ; Tue, 17 Sep 2013 12:45:38 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8CB912037E for ; Tue, 17 Sep 2013 12:45:34 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VLueL-0000V7-K0; Tue, 17 Sep 2013 12:45:02 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VLueC-0004CK-DX; Tue, 17 Sep 2013 12:44:52 +0000 Received: from mail-pd0-x229.google.com ([2607:f8b0:400e:c02::229]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VLudf-00045Z-B6 for linux-arm-kernel@lists.infradead.org; Tue, 17 Sep 2013 12:44:25 +0000 Received: by mail-pd0-f169.google.com with SMTP id r10so5569811pdi.0 for ; Tue, 17 Sep 2013 05:43:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=NHqyZPFyKhYMn6RNk+6SLdJgSVF5JfmosavAOtsnigg=; b=m87RVmE3+nURYEReGgktgXwlNYoKqyh0e4NjJfpiPa5RWC/vKcIorfp7Dy/Cm04TML cvzOdW+h7UAU3jTuaVN722v+d+Au/+cEOqxLrwrnaDlQy45afVBDa0Faza3XSs4ejONj l5kOWIGGpGl5Keooyp3dDRTVAYVCcCkk5fbT+fM+r0yrA6NEA6CiDoQYLXWo8jd2SUkh XM4j/Khx64A9KSDVl4/DWUr9oLnRg5ozuxAUOU7lZrET1YPyGYwrqmWHa01TbEoJShiU RsFFVQ/0SxWnfZpvSMF3IrNtlwrNH5A1v2C77SugZkbZJta0tXykWlo++OqQS/IaM8Fi aITw== X-Received: by 10.68.189.5 with SMTP id ge5mr34981404pbc.42.1379421837909; Tue, 17 Sep 2013 05:43:57 -0700 (PDT) Received: from localhost (pool-71-189-49-9.lsanca.fios.verizon.net. [71.189.49.9]) by mx.google.com with ESMTPSA id go4sm38044640pbb.15.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 17 Sep 2013 05:43:57 -0700 (PDT) From: Russ Dill To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org 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 Message-Id: <1379421817-15759-4-git-send-email-Russ.Dill@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1379421817-15759-1-git-send-email-Russ.Dill@ti.com> References: <1379421817-15759-1-git-send-email-Russ.Dill@ti.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130917_084419_488524_B319224B X-CRM114-Status: GOOD ( 12.82 ) X-Spam-Score: -1.9 (-) Cc: mans@mansr.com, Russell King - ARM Linux , Ard Biesheuvel , linux-kbuild@vger.kernel.org, Shawn Guo , Dave Martin X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is necessary for platforms that use SRAM to execute suspend/resume stubs. Signed-off-by: Russ Dill --- 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 #include #include +#include #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