ARM: i.MX: allow disabling supervisor protect via DT
authorSteffen Trumtrar <s.trumtrar@pengutronix.de>
Mon, 7 Jul 2014 09:41:26 +0000 (11:41 +0200)
committerShawn Guo <shawn.guo@freescale.com>
Fri, 18 Jul 2014 08:11:39 +0000 (16:11 +0800)
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 compatible node
it finds.
The compatible has to be declared in the mach-specific entry file, where this
helper function should then be called.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
arch/arm/mach-imx/common.h
arch/arm/mach-imx/cpu.c

index e0632d1890ac2a89dcc90fdf90bfc885ff962d2b..f7189bc461adf2454c1932aa00c1ea55df383725 100644 (file)
@@ -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);
@@ -65,6 +66,7 @@ void mxc_arch_reset_init_dt(void);
 int mx51_revision(void);
 int mx53_revision(void);
 void imx_set_aips(void __iomem *);
+void imx_aips_allow_unprivileged_access(const char *compat);
 int mxc_device_init(void);
 void imx_set_soc_revision(unsigned int rev);
 unsigned int imx_get_soc_revision(void);
index bbe8ff1f0412ed2609c82408ef67fc8b16604a81..df42c14ff7497fb0c1dbd89153c88b46a86748cd 100644 (file)
@@ -2,6 +2,7 @@
 #include <linux/module.h>
 #include <linux/io.h>
 #include <linux/of.h>
+#include <linux/of_address.h>
 #include <linux/slab.h>
 #include <linux/sys_soc.h>
 
@@ -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 char *compat)
+{
+       void __iomem *aips_base_addr;
+       struct device_node *np;
+
+       for_each_compatible_node(np, NULL, compat) {
+               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;
This page took 0.030868 seconds and 5 git commands to generate.