All of lore.kernel.org
 help / color / mirror / Atom feed
From: Du Huanpeng <u74147@gmail.com>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] MIPS: DEBUG_LL_UART_DIVISOR is 0, use a0 instead
Date: Sat, 26 Sep 2020 00:42:59 +0800	[thread overview]
Message-ID: <20200925164259.GA21154@black> (raw)
In-Reply-To: <7101cee8-bdf4-4869-daf2-e9f2aac72e4e@pengutronix.de>

Hi, How about this, I send this for review, if it is ok,
I will send a patch later.

I add a argument to the macro, and set a default parameter.

+.macro	debug_ll_ns16550_init divisor=DEBUG_LL_UART_DIVISOR


+	/* three forms for ``call'' the macro */
pass a register name
+	debug_ll_ns16550_init v0

pass a immediate number
+	debug_ll_ns16550_init 888

use this macro as usual before
+	debug_ll_ns16550_init

----8<-----

diff --git a/arch/mips/boards/loongson-ls1b/lowlevel.S b/arch/mips/boards/loongson-ls1b/lowlevel.S
index af6ad54e1..7120d80ef 100644
--- a/arch/mips/boards/loongson-ls1b/lowlevel.S
+++ b/arch/mips/boards/loongson-ls1b/lowlevel.S
@@ -28,8 +28,14 @@ ENTRY_FUNCTION(BOARD_PBL_START)
 
 	pbl_loongson1_uart_enable
 	pbl_loongson1_calc_prescale 115200
-	move	a0, v0
+
+	/* three forms for ``call'' the macro */
+	debug_ll_ns16550_init v0
+	debug_ll_ns16550_init 888
+	debug_ll_ns16550_init
+
 	debug_ll_ns16550_init
+
 	debug_ll_ns16550_outnl
 	debug_ll_outc '.'
 	debug_ll_ns16550_outnl
diff --git a/arch/mips/include/asm/debug_ll_ns16550.h b/arch/mips/include/asm/debug_ll_ns16550.h
index a33587a15..44f3d5976 100644
--- a/arch/mips/include/asm/debug_ll_ns16550.h
+++ b/arch/mips/include/asm/debug_ll_ns16550.h
@@ -58,17 +58,14 @@ static inline void PUTC_LL(char ch)
  * Macros for use in assembly language code
  */
 
-.macro	debug_ll_ns16550_init
+.macro	debug_ll_ns16550_init divisor=DEBUG_LL_UART_DIVISOR
 #ifdef CONFIG_DEBUG_LL
 	la	t0, DEBUG_LL_UART_ADDR
 
 	li	t1, UART_LCR_DLAB		/* DLAB on */
 	sb	t1, UART_LCR(t0)		/* Write it out */
 
-	li	t1, DEBUG_LL_UART_DIVISOR
-#if DEBUG_LL_UART_DIVISOR == 0
-	move	t1, a0
-#endif
+	add	t1, zero, \divisor
 	sb	t1, UART_DLL(t0)		/* write low order byte */
 	srl	t1, t1, 8
 	sb	t1, UART_DLM(t0)		/* write high order byte */

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

  reply	other threads:[~2020-09-25 16:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11 12:33 [PATCH] MIPS: loongson1: enable to run from spi flash Du Huanpeng
2020-09-11 12:33 ` [PATCH] MIPS: DEBUG_LL_UART_DIVISOR is 0, use a0 instead Du Huanpeng
2020-09-11 14:07   ` Ahmad Fatoum
2020-09-17 13:56     ` Du Huanpeng
2020-09-17 17:42       ` Ahmad Fatoum
2020-09-25 16:42         ` Du Huanpeng [this message]
2020-09-25 17:54           ` Ahmad Fatoum

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=20200925164259.GA21154@black \
    --to=u74147@gmail.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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.