From patchwork Mon May 9 21:41:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Gerlach X-Patchwork-Id: 9050151 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CBFACBF29F for ; Mon, 9 May 2016 21:44:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F405C20114 for ; Mon, 9 May 2016 21:44:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 21B492010E for ; Mon, 9 May 2016 21:44:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1azsx2-0000BJ-Py; Mon, 09 May 2016 21:42:52 +0000 Received: from arroyo.ext.ti.com ([192.94.94.40]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1azswz-0008UR-Nc for linux-arm-kernel@lists.infradead.org; Mon, 09 May 2016 21:42:50 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id u49Lg6Xt016558; Mon, 9 May 2016 16:42:06 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id u49Lg6bC013354; Mon, 9 May 2016 16:42:06 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.224.2; Mon, 9 May 2016 16:42:04 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id u49Lg43W022135; Mon, 9 May 2016 16:42:04 -0500 Received: from localhost (uda0274052.am.dhcp.ti.com [128.247.83.19]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id u49Lg4304610; Mon, 9 May 2016 16:42:04 -0500 (CDT) From: Dave Gerlach To: , , Subject: [RFC PATCH 3/3] misc: SRAM: Add option to map SRAM to allow code execution Date: Mon, 9 May 2016 16:41:51 -0500 Message-ID: <1462830111-28172-4-git-send-email-d-gerlach@ti.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1462830111-28172-1-git-send-email-d-gerlach@ti.com> References: <1462830111-28172-1-git-send-email-d-gerlach@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160509_144249_880755_4B772C9B X-CRM114-Status: GOOD ( 11.24 ) X-Spam-Score: -9.0 (---------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nishanth Menon , Russell King , Arnd Bergmann , Dave Gerlach , Tony Lindgren , Greg Kroah-Hartman , Alexandre Belloni , Russ Dill , Shawn Guo Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 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: Russ Dill Signed-off-by: Dave Gerlach --- Documentation/devicetree/bindings/sram/sram.txt | 2 ++ drivers/misc/sram.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/sram/sram.txt b/Documentation/devicetree/bindings/sram/sram.txt index 227e3a341af1..1f1d0aa52703 100644 --- a/Documentation/devicetree/bindings/sram/sram.txt +++ b/Documentation/devicetree/bindings/sram/sram.txt @@ -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: diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c index 69cdabea9c03..7f00ba574a83 100644 --- a/drivers/misc/sram.c +++ b/drivers/misc/sram.c @@ -362,6 +362,14 @@ 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_ioremap_exec(sram->dev, res->start, + size); + else if (of_property_read_bool(pdev->dev.of_node, + "memory-exec-nocache")) + sram->virt_base = devm_ioremap_exec_nocache(sram->dev, + res->start, + size); else sram->virt_base = devm_ioremap_wc(sram->dev, res->start, size); if (IS_ERR(sram->virt_base))