mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Du Huanpeng <u74147@gmail.com>
To: barebox@lists.infradead.org
Cc: a.fatoum@pengutronix.de, duhuanpeng <u74147@gmail.com>
Subject: [PATCH v2] asm/debug_ll_ns16550.h: add parament divisor
Date: Sun, 27 Sep 2020 17:32:57 +0800	[thread overview]
Message-ID: <1601199177-11599-1-git-send-email-u74147@gmail.com> (raw)

From: duhuanpeng <u74147@gmail.com>

add a parameters for the assembly version for passing divisor,
and set the default value to DEBUG_LL_UART_ADDR when no parameter
is given.
now it is possiable to recalculate divisor in runtime to keep
the baudrate unchanged. when pll settings changed outside of barebox.
e.g. jtag.

Signed-off-by: duhuanpeng <u74147@gmail.com>
---
 arch/mips/include/asm/debug_ll_ns16550.h  | 4 ++--
 arch/riscv/include/asm/debug_ll_ns16550.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/mips/include/asm/debug_ll_ns16550.h b/arch/mips/include/asm/debug_ll_ns16550.h
index df58c4c..703bfae 100644
--- a/arch/mips/include/asm/debug_ll_ns16550.h
+++ b/arch/mips/include/asm/debug_ll_ns16550.h
@@ -58,14 +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
+	li	t1, \divisor
 	sb	t1, UART_DLL(t0)		/* write low order byte */
 	srl	t1, t1, 8
 	sb	t1, UART_DLM(t0)		/* write high order byte */
diff --git a/arch/riscv/include/asm/debug_ll_ns16550.h b/arch/riscv/include/asm/debug_ll_ns16550.h
index e891cbd..f1c2ccb 100644
--- a/arch/riscv/include/asm/debug_ll_ns16550.h
+++ b/arch/riscv/include/asm/debug_ll_ns16550.h
@@ -88,14 +88,14 @@ static inline void debug_ll_ns16550_init(void)
  * 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
 	li	t0, DEBUG_LL_UART_ADDR
 
 	li	t1, UART_LCR_DLAB		/* DLAB on */
 	UART_REG_S	t1, UART_LCR(t0)		/* Write it out */
 
-	li	t1, DEBUG_LL_UART_DIVISOR
+	li	t1, \divisor
 	UART_REG_S	t1, UART_DLL(t0)		/* write low order byte */
 	srl	t1, t1, 8
 	UART_REG_S	t1, UART_DLM(t0)		/* write high order byte */
-- 
2.7.4


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

             reply	other threads:[~2020-09-27  9:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-27  9:32 Du Huanpeng [this message]
2020-09-29  6:57 ` Sascha Hauer

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=1601199177-11599-1-git-send-email-u74147@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox