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: 9050141 Return-Path: X-Original-To: patchwork-linux-omap@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 D5B68BF29F for ; Mon, 9 May 2016 21:43:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 082AA20123 for ; Mon, 9 May 2016 21:43:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1BEFE2011E for ; Mon, 9 May 2016 21:43:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752460AbcEIVmw (ORCPT ); Mon, 9 May 2016 17:42:52 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:50636 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751784AbcEIVmv (ORCPT ); Mon, 9 May 2016 17:42:51 -0400 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: , , CC: Russ Dill , Greg Kroah-Hartman , Arnd Bergmann , Shawn Guo , Tony Lindgren , Alexandre Belloni , Russell King , Nishanth Menon , Dave Gerlach , Russ Dill 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 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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))