* [PATCH v4 1/2] ARM: i.MX: allow disabling supervisor protect via DT
@ 2014-07-07 9:41 Steffen Trumtrar
2014-07-07 9:41 ` [PATCH v4 2/2] ARM: i.MX53: globally disable supervisor protect Steffen Trumtrar
0 siblings, 1 reply; 4+ messages in thread
From: Steffen Trumtrar @ 2014-07-07 9:41 UTC (permalink / raw)
To: linux-arm-kernel
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>
---
Changes since v3:
- use for_each_compatible_node
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..8c1a305 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 char *compat);
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..df42c14 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -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;
--
2.0.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v4 2/2] ARM: i.MX53: globally disable supervisor protect
2014-07-07 9:41 [PATCH v4 1/2] ARM: i.MX: allow disabling supervisor protect via DT Steffen Trumtrar
@ 2014-07-07 9:41 ` Steffen Trumtrar
2014-07-07 14:04 ` Shawn Guo
0 siblings, 1 reply; 4+ messages in thread
From: Steffen Trumtrar @ 2014-07-07 9:41 UTC (permalink / raw)
To: linux-arm-kernel
Most peripherals on the i.MX53 have an
Off-Platform Peripheral Access Control Register (OPACR)
in which the access rights (together with the MPROT registers) can be declared.
However, this does not seem to work for example for SSI1+SDMA, because the
supervisor bit is not set for the SDMA unit.
It does work for SSI2, the QSB for example uses SSI2 for its audio. But SSI2 only
works because it does NOT have an OPACR.
The right solution would be to fix the access rights for the SDMA, but the unit
responsible for this is the Central Security Unit (CSU), which of course is NOT
documented. So, until documentation for this is openly available, turn off the
supervisor protection because it cripples the hardware.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
arch/arm/mach-imx/mach-imx53.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c
index 2bad387..1fbd77d 100644
--- a/arch/arm/mach-imx/mach-imx53.c
+++ b/arch/arm/mach-imx/mach-imx53.c
@@ -26,9 +26,13 @@
static void __init imx53_dt_init(void)
{
+ const char *aips_compatible = "fsl,imx53-aipstz";
+
mxc_arch_reset_init_dt();
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+
+ imx_aips_allow_unprivileged_access(aips_compatible);
}
static const char *imx53_dt_board_compat[] __initconst = {
--
2.0.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v4 2/2] ARM: i.MX53: globally disable supervisor protect
2014-07-07 9:41 ` [PATCH v4 2/2] ARM: i.MX53: globally disable supervisor protect Steffen Trumtrar
@ 2014-07-07 14:04 ` Shawn Guo
2014-07-07 16:16 ` Steffen Trumtrar
0 siblings, 1 reply; 4+ messages in thread
From: Shawn Guo @ 2014-07-07 14:04 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jul 07, 2014 at 11:41:27AM +0200, Steffen Trumtrar wrote:
> Most peripherals on the i.MX53 have an
> Off-Platform Peripheral Access Control Register (OPACR)
> in which the access rights (together with the MPROT registers) can be declared.
> However, this does not seem to work for example for SSI1+SDMA, because the
> supervisor bit is not set for the SDMA unit.
> It does work for SSI2, the QSB for example uses SSI2 for its audio. But SSI2 only
> works because it does NOT have an OPACR.
>
> The right solution would be to fix the access rights for the SDMA, but the unit
> responsible for this is the Central Security Unit (CSU), which of course is NOT
> documented. So, until documentation for this is openly available, turn off the
> supervisor protection because it cripples the hardware.
>
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
> arch/arm/mach-imx/mach-imx53.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c
> index 2bad387..1fbd77d 100644
> --- a/arch/arm/mach-imx/mach-imx53.c
> +++ b/arch/arm/mach-imx/mach-imx53.c
> @@ -26,9 +26,13 @@
>
> static void __init imx53_dt_init(void)
> {
> + const char *aips_compatible = "fsl,imx53-aipstz";
> +
The variable is not really necessary, since we can just do:
imx_aips_allow_unprivileged_access("fsl,imx53-aipstz");
I'm going to fix it up and apply both patches. Let me know if you have
concern with that.
Shawn
> mxc_arch_reset_init_dt();
>
> of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> +
> + imx_aips_allow_unprivileged_access(aips_compatible);
> }
>
> static const char *imx53_dt_board_compat[] __initconst = {
> --
> 2.0.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v4 2/2] ARM: i.MX53: globally disable supervisor protect
2014-07-07 14:04 ` Shawn Guo
@ 2014-07-07 16:16 ` Steffen Trumtrar
0 siblings, 0 replies; 4+ messages in thread
From: Steffen Trumtrar @ 2014-07-07 16:16 UTC (permalink / raw)
To: linux-arm-kernel
Hi!
On Mon, Jul 07, 2014 at 10:04:18PM +0800, Shawn Guo wrote:
> On Mon, Jul 07, 2014 at 11:41:27AM +0200, Steffen Trumtrar wrote:
> > Most peripherals on the i.MX53 have an
> > Off-Platform Peripheral Access Control Register (OPACR)
> > in which the access rights (together with the MPROT registers) can be declared.
> > However, this does not seem to work for example for SSI1+SDMA, because the
> > supervisor bit is not set for the SDMA unit.
> > It does work for SSI2, the QSB for example uses SSI2 for its audio. But SSI2 only
> > works because it does NOT have an OPACR.
> >
> > The right solution would be to fix the access rights for the SDMA, but the unit
> > responsible for this is the Central Security Unit (CSU), which of course is NOT
> > documented. So, until documentation for this is openly available, turn off the
> > supervisor protection because it cripples the hardware.
> >
> > Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> > ---
> > arch/arm/mach-imx/mach-imx53.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c
> > index 2bad387..1fbd77d 100644
> > --- a/arch/arm/mach-imx/mach-imx53.c
> > +++ b/arch/arm/mach-imx/mach-imx53.c
> > @@ -26,9 +26,13 @@
> >
> > static void __init imx53_dt_init(void)
> > {
> > + const char *aips_compatible = "fsl,imx53-aipstz";
> > +
>
> The variable is not really necessary, since we can just do:
>
> imx_aips_allow_unprivileged_access("fsl,imx53-aipstz");
>
> I'm going to fix it up and apply both patches. Let me know if you have
> concern with that.
>
I'm okay with that. I don't really have any preference here, so
do as you like best.
Thanks,
Steffen
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-07-07 16:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-07 9:41 [PATCH v4 1/2] ARM: i.MX: allow disabling supervisor protect via DT Steffen Trumtrar
2014-07-07 9:41 ` [PATCH v4 2/2] ARM: i.MX53: globally disable supervisor protect Steffen Trumtrar
2014-07-07 14:04 ` Shawn Guo
2014-07-07 16:16 ` Steffen Trumtrar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).