public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Stefan Roese <sr@denx.de>
Cc: "Konstantin Porotchkin" <kostap@marvell.com>,
	"Marek Behún" <marek.behun@nic.cz>,
	u-boot@lists.denx.de
Subject: [PATCH 2/2] serial: a37xx: Do not call get_ref_clk() in _debug_uart_init()
Date: Mon, 26 Jul 2021 14:58:59 +0200	[thread overview]
Message-ID: <20210726125859.5588-2-pali@kernel.org> (raw)
In-Reply-To: <20210726125859.5588-1-pali@kernel.org>

Static inline function _debug_uart_init() should avoid calling external
(non-inline) functions. Therefore do not call get_ref_clk() in
_debug_uart_init() and reimplement its functionality without external
function calls.

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

diff --git a/drivers/serial/serial_mvebu_a3700.c b/drivers/serial/serial_mvebu_a3700.c
index 52dc3fdad7b4..6bca8e4b7e2d 100644
--- a/drivers/serial/serial_mvebu_a3700.c
+++ b/drivers/serial/serial_mvebu_a3700.c
@@ -305,6 +305,7 @@ U_BOOT_DRIVER(serial_mvebu) = {
 #ifdef CONFIG_DEBUG_MVEBU_A3700_UART
 
 #include <debug_uart.h>
+#include <mach/soc.h>
 
 static inline void _debug_uart_init(void)
 {
@@ -322,7 +323,8 @@ static inline void _debug_uart_init(void)
 	 * Calculate divider
 	 * baudrate = clock / 16 / divider
 	 */
-	parent_rate = get_ref_clk() * 1000000;
+	parent_rate = (readl(MVEBU_REGISTER(0x13808)) & BIT(9)) ?
+		      40000000 : 25000000;
 	divider = DIV_ROUND_CLOSEST(parent_rate, CONFIG_BAUDRATE * 16);
 	writel(divider, base + UART_BAUD_REG);
 
-- 
2.20.1


  reply	other threads:[~2021-07-26 12:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Pali Rohár [this message]
2021-07-26 14:55   ` [PATCH 2/2] serial: a37xx: Do not call get_ref_clk() in _debug_uart_init() 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

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=20210726125859.5588-2-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=kostap@marvell.com \
    --cc=marek.behun@nic.cz \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /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