Skip to content

Commit e57e4ab

Browse files
strumtrarShawn Guo
authored andcommitted
ARM: i.MX: allow disabling supervisor protect via DT
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 <[email protected]> Signed-off-by: Shawn Guo <[email protected]>
1 parent b4de531 commit e57e4ab

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

arch/arm/mach-imx/common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct pt_regs;
1919
struct clk;
2020
struct device_node;
2121
enum mxc_cpu_pwr_mode;
22+
struct of_device_id;
2223

2324
void mx1_map_io(void);
2425
void mx21_map_io(void);
@@ -65,6 +66,7 @@ void mxc_arch_reset_init_dt(void);
6566
int mx51_revision(void);
6667
int mx53_revision(void);
6768
void imx_set_aips(void __iomem *);
69+
void imx_aips_allow_unprivileged_access(const char *compat);
6870
int mxc_device_init(void);
6971
void imx_set_soc_revision(unsigned int rev);
7072
unsigned int imx_get_soc_revision(void);

arch/arm/mach-imx/cpu.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <linux/module.h>
33
#include <linux/io.h>
44
#include <linux/of.h>
5+
#include <linux/of_address.h>
56
#include <linux/slab.h>
67
#include <linux/sys_soc.h>
78

@@ -60,6 +61,18 @@ void __init imx_set_aips(void __iomem *base)
6061
__raw_writel(reg, base + 0x50);
6162
}
6263

64+
void __init imx_aips_allow_unprivileged_access(
65+
const char *compat)
66+
{
67+
void __iomem *aips_base_addr;
68+
struct device_node *np;
69+
70+
for_each_compatible_node(np, NULL, compat) {
71+
aips_base_addr = of_iomap(np, 0);
72+
imx_set_aips(aips_base_addr);
73+
}
74+
}
75+
6376
struct device * __init imx_soc_device_init(void)
6477
{
6578
struct soc_device_attribute *soc_dev_attr;

0 commit comments

Comments
 (0)