Re: [PATCH 2/2] serial: a37xx: Do not call get_ref_clk() in _debug_uart_init()

Stefan Roese
2021-07-31T07:47:24Z

On 26.07.21 14:58, Pali Rohár wrote:
> 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>

Apart from the comments from Marek (please in a separate patch):

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

Thanks,
Stefan

> ---
> 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);
>
>

Viele Grüße,
Stefan

--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de