diff mbox series

[u-boot-marvell,4/5] tools: kwboot: Replace ARM mov + movt instruction pair by mov + orr

Message ID 20211027185702.8186-5-kabel@kernel.org
State Accepted
Commit 558176dcb14d589b5854bea0988301e27b60091d
Delegated to: Stefan Roese
Headers show
Series kwboot fix for AXP + some others | expand

Commit Message

Marek Behún Oct. 27, 2021, 6:57 p.m. UTC
From: Pali Rohár <pali@kernel.org>

Older Armada SoCs have custom ARMv5te compatible core which does not
support movt instruction. So replace mov + movt instruction pair used for
immediate move construction by mov + orr instructions which are supported
also by ARMv5te.

After this change kwboot ARM code should be compatible with any 32-bit ARM
core compatible by ARMv2 or new. At least GNU AS does not throw any error
or warning.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
---
 tools/kwboot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stefan Roese Nov. 3, 2021, 5:38 a.m. UTC | #1
On 27.10.21 20:57, Marek Behún wrote:
> From: Pali Rohár <pali@kernel.org>
> 
> Older Armada SoCs have custom ARMv5te compatible core which does not
> support movt instruction. So replace mov + movt instruction pair used for
> immediate move construction by mov + orr instructions which are supported
> also by ARMv5te.
> 
> After this change kwboot ARM code should be compatible with any 32-bit ARM
> core compatible by ARMv2 or new. At least GNU AS does not throw any error
> or warning.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Reviewed-by: Marek Behún <marek.behun@nic.cz>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   tools/kwboot.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/kwboot.c b/tools/kwboot.c
> index 84294cadfe..62c218ef64 100644
> --- a/tools/kwboot.c
> +++ b/tools/kwboot.c
> @@ -126,8 +126,8 @@ static unsigned char kwboot_baud_code[] = {
>   	0xfe, 0x5f, 0x2d, 0xe9, /* push  { r1 - r12, lr }                     */
>   
>   				/*  ; r0 = UART_BASE                          */
> -	0x02, 0x0a, 0xa0, 0xe3, /* mov   r0, #0x2000                          */
> -	0x01, 0x00, 0x4d, 0xe3, /* movt  r0, #0xd001                          */
> +	0x0d, 0x02, 0xa0, 0xe3, /* mov   r0, #0xd0000000                      */
> +	0x12, 0x0a, 0x80, 0xe3, /* orr   r0, r0, #0x12000                     */
>   
>   				/*  ; r2 = address of preamble string         */
>   	0xcc, 0x20, 0x8f, 0xe2, /* adr   r2, preamble                         */
> 


Viele Grüße,
Stefan
diff mbox series

Patch

diff --git a/tools/kwboot.c b/tools/kwboot.c
index 84294cadfe..62c218ef64 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -126,8 +126,8 @@  static unsigned char kwboot_baud_code[] = {
 	0xfe, 0x5f, 0x2d, 0xe9, /* push  { r1 - r12, lr }                     */
 
 				/*  ; r0 = UART_BASE                          */
-	0x02, 0x0a, 0xa0, 0xe3, /* mov   r0, #0x2000                          */
-	0x01, 0x00, 0x4d, 0xe3, /* movt  r0, #0xd001                          */
+	0x0d, 0x02, 0xa0, 0xe3, /* mov   r0, #0xd0000000                      */
+	0x12, 0x0a, 0x80, 0xe3, /* orr   r0, r0, #0x12000                     */
 
 				/*  ; r2 = address of preamble string         */
 	0xcc, 0x20, 0x8f, 0xe2, /* adr   r2, preamble                         */