All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: Marek Vasut <marex@denx.de>
Cc: u-boot@lists.denx.de, "NXP i.MX U-Boot Team" <uboot-imx@nxp.com>,
	Fabio Estevam <festevam@gmail.com>,
	Stefano Babic <sbabic@denx.de>
Subject: Re: [PATCH] arm: mxs: Clear CPSR V bit to activate low vectors
Date: Mon, 31 Jul 2023 10:06:15 +0200	[thread overview]
Message-ID: <20230731100615.22850307@wsk> (raw)
In-Reply-To: <20230729133010.8660-1-marex@denx.de>

[-- Attachment #1: Type: text/plain, Size: 2468 bytes --]

On Sat, 29 Jul 2023 15:30:10 +0200
Marek Vasut <marex@denx.de> wrote:

> The MXS starts with CPSR V bit set, which makes the CPU jump to high
> vectors in case of an exception. Those high vectors are located at
> 0xffff0000, which is where the BootROM exception table is located as
> well. U-Boot should handle exceptions on its own using its own
> exception handling code, which is located at 0x0, i.e. at low
> vectors. Clear the CPSR V bit, so that the CPU would jump to low
> vectors on exception instead, and therefore run the U-Boot exception
> handling code.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: "NXP i.MX U-Boot Team" <uboot-imx@nxp.com>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Lukasz Majewski <lukma@denx.de>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
>  arch/arm/cpu/arm926ejs/mxs/mxs.c      | 3 +++
>  arch/arm/cpu/arm926ejs/mxs/spl_boot.c | 4 ++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c
> b/arch/arm/cpu/arm926ejs/mxs/mxs.c index 4d21e3df76e..d64a8328b04
> 100644 --- a/arch/arm/cpu/arm926ejs/mxs/mxs.c
> +++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c
> @@ -85,6 +85,9 @@ void mx28_fixup_vt(uint32_t start_addr)
>  		/* cppcheck-suppress nullPointer */
>  		vt[i + 8] = start_addr + (4 * i);
>  	}
> +
> +	/* Make sure ARM core points to low vectors */
> +	set_cr(get_cr() & ~CR_V);
>  }
>  
>  #ifdef	CONFIG_ARCH_MISC_INIT
> diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
> b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c index
> 5598c552ab9..4a7dfc6a2ae 100644 ---
> a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c +++
> b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c @@ -17,6 +17,7 @@
>  #include <asm/arch/sys_proto.h>
>  #include <asm/gpio.h>
>  #include <asm/sections.h>
> +#include <asm/system.h>
>  #include <linux/compiler.h>
>  
>  #include "mxs_init.h"
> @@ -104,6 +105,9 @@ static void mxs_spl_fixup_vectors(void)
>  
>  	/* cppcheck-suppress nullPointer */
>  	memcpy(0x0, &_start, 0x60);
> +
> +	/* Make sure ARM core points to low vectors */
> +	set_cr(get_cr() & ~CR_V);
>  }
>  
>  static void mxs_spl_console_init(void)

Reviewed-by: Lukasz Majewski <lukma@denx.de>


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2023-07-31  8:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-29 13:30 [PATCH] arm: mxs: Clear CPSR V bit to activate low vectors Marek Vasut
2023-07-31  8:06 ` Lukasz Majewski [this message]
2023-10-18  8:02   ` Stefano Babic

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=20230731100615.22850307@wsk \
    --to=lukma@denx.de \
    --cc=festevam@gmail.com \
    --cc=marex@denx.de \
    --cc=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.