mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2 4/5] ARM: mach-imx: test PL310 write access
Date: Tue, 21 Jan 2020 08:37:39 +0100	[thread overview]
Message-ID: <20200121073739.wwyjp5n74vlpdt7q@pengutronix.de> (raw)
In-Reply-To: <20200120085647.19784-4-r.czerwinski@pengutronix.de>

On Mon, Jan 20, 2020 at 09:56:47AM +0100, Rouven Czerwinski wrote:
> If OP-TEE early loading is performed, OP-TEE will configure the PL210
> and lock write access to the controller from the normal world. Test this
> by trying to write the same value back and do not configure if we can
> not write to the PL310.
> 
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
>  arch/arm/mach-imx/imx6.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
> index 41e0066add..c6fd862379 100644
> --- a/arch/arm/mach-imx/imx6.c
> +++ b/arch/arm/mach-imx/imx6.c
> @@ -11,6 +11,7 @@
>   *
>   */
>  
> +#include <abort.h>
>  #include <init.h>
>  #include <common.h>
>  #include <io.h>
> @@ -273,6 +274,22 @@ int imx6_devices_init(void)
>  	return 0;
>  }
>  
> +static bool imx6_can_write_l2x0(void)
> +{
> +	void __iomem *l2x0_base = IOMEM(0x00a02000);
> +	u32 val;
> +	/*
> +	 * Mask data aborts and try to access the PL210. If OP-TEE is running we
> +	 * will receive a data-abort and assume barebox is running in the normal
> +	 * world.
> +	 */
> +	val = readl(l2x0_base + L2X0_PREFETCH_CTRL);
> +
> +	data_abort_mask();
> +	writel(val, l2x0_base + L2X0_PREFETCH_CTRL);
> +	return data_abort_unmask();
> +}
> +
>  static int imx6_mmu_init(void)
>  {
>  	void __iomem *l2x0_base = IOMEM(0x00a02000);
> @@ -281,6 +298,9 @@ static int imx6_mmu_init(void)
>  	if (!cpu_is_mx6())
>  		return 0;
>  
> +	if (imx6_can_write_l2x0())
> +		return 0;

Function name seems wrong, should be imx6_cannot_write_l2x0()

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-01-21  7:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-20  8:56 [PATCH v2 1/5] optee: move optee_verify_header() to common Rouven Czerwinski
2020-01-20  8:56 ` [PATCH v2 2/5] ARM: import setjmp implementation from U-Boot Rouven Czerwinski
2020-01-21  7:46   ` Sascha Hauer
2020-01-20  8:56 ` [PATCH v2 3/5] ARM: add optee early loading function Rouven Czerwinski
2020-01-20  8:56 ` [PATCH v2 4/5] ARM: mach-imx: test PL310 write access Rouven Czerwinski
2020-01-21  7:37   ` Sascha Hauer [this message]
2020-01-20  8:56 ` [PATCH v2 5/5] user: add documentation for OP-TEE loading Rouven Czerwinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200121073739.wwyjp5n74vlpdt7q@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=r.czerwinski@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox