From patchwork Tue Jul 1 08:27:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steffen Trumtrar X-Patchwork-Id: 365901 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0F99314008C for ; Tue, 1 Jul 2014 18:30:25 +1000 (EST) 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 1X1tQM-000232-Jc; Tue, 01 Jul 2014 08:28:22 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1tQJ-0001sm-HL for linux-arm-kernel@lists.infradead.org; Tue, 01 Jul 2014 08:28:20 +0000 Received: from dude.hi.pengutronix.de ([2001:6f8:1178:2:a236:9fff:fe00:814]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1X1tPu-0002hn-GQ; Tue, 01 Jul 2014 10:27:54 +0200 Received: from str by dude.hi.pengutronix.de with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1X1tPu-0007Wp-CI; Tue, 01 Jul 2014 10:27:54 +0200 From: Steffen Trumtrar To: Shawn Guo Subject: [PATCH v3 1/2] ARM: i.MX: allow disabling supervisor protect via DT Date: Tue, 1 Jul 2014 10:27:47 +0200 Message-Id: <1404203268-31404-1-git-send-email-s.trumtrar@pengutronix.de> X-Mailer: git-send-email 2.0.0 X-SA-Exim-Connect-IP: 2001:6f8:1178:2:a236:9fff:fe00:814 X-SA-Exim-Mail-From: str@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140701_012820_004162_8F847718 X-CRM114-Status: GOOD ( 12.49 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Steffen Trumtrar , linux-arm-kernel@lists.infradead.org, Sascha Hauer X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org The i.MX SoCs allow to setup fine grained access rights to peripherals on the AIPS bus. This is done via the Peripheral Access Register (PAR) in e.g. the i.MX21 or in later SoC versions the Off-Platform Peripheral Access Control Register (OPACR), e.g. i.MX53. Under certain circumstances this leads to problems in which bus masters are not granted their access rights to peripherals. To be able to disable these restrictions on DT platforms, add a helper function that looks for AIPS nodes in the DT and disables them for every match it finds. The match table has to be declared in the mach-specific entry file, where this helper function should then be called. Signed-off-by: Steffen Trumtrar --- arch/arm/mach-imx/common.h | 2 ++ arch/arm/mach-imx/cpu.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h index 9ab785c..9f6e778 100644 --- a/arch/arm/mach-imx/common.h +++ b/arch/arm/mach-imx/common.h @@ -19,6 +19,7 @@ struct pt_regs; struct clk; struct device_node; enum mxc_cpu_pwr_mode; +struct of_device_id; void mx1_map_io(void); void mx21_map_io(void); @@ -77,6 +78,7 @@ void mxc_arch_reset_init(void __iomem *); void mxc_arch_reset_init_dt(void); int mx53_revision(void); void imx_set_aips(void __iomem *); +void imx_aips_allow_unprivileged_access(const struct of_device_id *of_matches); int mxc_device_init(void); void imx_set_soc_revision(unsigned int rev); unsigned int imx_get_soc_revision(void); diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c index bbe8ff1..7f66d77 100644 --- a/arch/arm/mach-imx/cpu.c +++ b/arch/arm/mach-imx/cpu.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -60,6 +61,18 @@ void __init imx_set_aips(void __iomem *base) __raw_writel(reg, base + 0x50); } +void __init imx_aips_allow_unprivileged_access( + const struct of_device_id *of_matches) +{ + void __iomem *aips_base_addr; + struct device_node *np; + + for_each_matching_node(np, of_matches) { + aips_base_addr = of_iomap(np, 0); + imx_set_aips(aips_base_addr); + } +} + struct device * __init imx_soc_device_init(void) { struct soc_device_attribute *soc_dev_attr;