All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] serial: a37xx: Use CONFIG_BAUDRATE for initializing early debug UART
@ 2021-07-26 12:58 Pali Rohár
  2021-07-26 12:58 ` [PATCH 2/2] serial: a37xx: Do not call get_ref_clk() in _debug_uart_init() Pali Rohár
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Pali Rohár @ 2021-07-26 12:58 UTC (permalink / raw)
  To: Stefan Roese; +Cc: Konstantin Porotchkin, Marek Behún, u-boot

CONFIG_BAUDRATE should be used for setting the baudrate for the early debug
UART. This replaces current hardcoded 115200 value.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/serial/serial_mvebu_a3700.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/serial_mvebu_a3700.c b/drivers/serial/serial_mvebu_a3700.c
index c7e66fef8768..52dc3fdad7b4 100644
--- a/drivers/serial/serial_mvebu_a3700.c
+++ b/drivers/serial/serial_mvebu_a3700.c
@@ -309,7 +309,7 @@ U_BOOT_DRIVER(serial_mvebu) = {
 static inline void _debug_uart_init(void)
 {
 	void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
-	u32 baudrate, parent_rate, divider;
+	u32 parent_rate, divider;
 
 	/* reset FIFOs */
 	writel(UART_CTRL_RXFIFO_RESET | UART_CTRL_TXFIFO_RESET,
@@ -322,9 +322,8 @@ static inline void _debug_uart_init(void)
 	 * Calculate divider
 	 * baudrate = clock / 16 / divider
 	 */
-	baudrate = 115200;
 	parent_rate = get_ref_clk() * 1000000;
-	divider = DIV_ROUND_CLOSEST(parent_rate, baudrate * 16);
+	divider = DIV_ROUND_CLOSEST(parent_rate, CONFIG_BAUDRATE * 16);
 	writel(divider, base + UART_BAUD_REG);
 
 	/*
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-08-16  9:08 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 12:58 [PATCH 1/2] serial: a37xx: Use CONFIG_BAUDRATE for initializing early debug UART Pali Rohár
2021-07-26 12:58 ` [PATCH 2/2] serial: a37xx: Do not call get_ref_clk() in _debug_uart_init() Pali Rohár
2021-07-26 14:55   ` Marek Behun
2021-07-26 14:58     ` Pali Rohár
2021-07-26 15:24       ` Marek Behun
2021-08-11 18:57         ` Pali Rohár
2021-08-16  8:04           ` Stefan Roese
2021-08-16  8:33             ` Pali Rohár
2021-08-16  9:07               ` Stefan Roese
2021-07-31  7:47   ` Stefan Roese
2021-07-31 10:01   ` Stefan Roese
2021-07-26 15:21 ` [PATCH 1/2] serial: a37xx: Use CONFIG_BAUDRATE for initializing early debug UART Marek Behun
2021-07-31  7:45 ` Stefan Roese
2021-07-31 10:01 ` Stefan Roese

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.