All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC. PATCH] earlycon: Remove hardcoded port->uartclk initialization in of_setup_earlycon
@ 2018-04-23  9:27 Michal Simek
  2018-04-23 13:16   ` Matt Redfearn
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Simek @ 2018-04-23  9:27 UTC (permalink / raw)
  To: linux-kernel, monstr, devicetree, Rob Herring, matt.redfearn
  Cc: Greg Kroah-Hartman, linux-serial, Jiri Slaby

There is no reason to initialize uartclk to BASE_BAUD * 16 for DT based
systems.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

It looks like from history that portclk = BASE_BAUD * 16 was setup to
get on calculation on x86 (divisor = 1) but it shouldn't be needed on DT based
system. That's why I think that there is no DT based system which really
requires this line.
---
 drivers/tty/serial/earlycon.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index a24278380fec..c12b1edcdd8e 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -244,7 +244,6 @@ int __init of_setup_earlycon(const struct earlycon_id *match,
 		return -ENXIO;
 	}
 	port->mapbase = addr;
-	port->uartclk = BASE_BAUD * 16;
 
 	val = of_get_flat_dt_prop(node, "reg-offset", NULL);
 	if (val)
-- 
2.17.0


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

* Re: [RFC. PATCH] earlycon: Remove hardcoded port->uartclk initialization in of_setup_earlycon
  2018-04-23  9:27 [RFC. PATCH] earlycon: Remove hardcoded port->uartclk initialization in of_setup_earlycon Michal Simek
@ 2018-04-23 13:16   ` Matt Redfearn
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Redfearn @ 2018-04-23 13:16 UTC (permalink / raw)
  To: Michal Simek, linux-kernel, monstr, devicetree, Rob Herring
  Cc: Greg Kroah-Hartman, linux-serial, Jiri Slaby



On 23/04/18 10:27, Michal Simek wrote:
> There is no reason to initialize uartclk to BASE_BAUD * 16 for DT based
> systems.
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
> 
> It looks like from history that portclk = BASE_BAUD * 16 was setup to
> get on calculation on x86 (divisor = 1) but it shouldn't be needed on DT based
> system. That's why I think that there is no DT based system which really
> requires this line.

Hi Michal,

This is fine for the MIPS generic platform (tested on Boston board) 
which was broken by some earlycon changes a few versions ago. Also 
tested on a MIPS pistachio board. As long as the bootloader has 
configured the uart divisor, earlycon should work as long as my patch 
"serial: 8250_early: Only set divisor if valid clk & baud" is applied to 
avoid a bad divisor getting calculated.

Tested-by: Matt Redfearn <matt.redfearn@mips.com>

Thanks,
Matt

> ---
>   drivers/tty/serial/earlycon.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
> index a24278380fec..c12b1edcdd8e 100644
> --- a/drivers/tty/serial/earlycon.c
> +++ b/drivers/tty/serial/earlycon.c
> @@ -244,7 +244,6 @@ int __init of_setup_earlycon(const struct earlycon_id *match,
>   		return -ENXIO;
>   	}
>   	port->mapbase = addr;
> -	port->uartclk = BASE_BAUD * 16;
>   
>   	val = of_get_flat_dt_prop(node, "reg-offset", NULL);
>   	if (val)
> 

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

* Re: [RFC. PATCH] earlycon: Remove hardcoded port->uartclk initialization in of_setup_earlycon
@ 2018-04-23 13:16   ` Matt Redfearn
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Redfearn @ 2018-04-23 13:16 UTC (permalink / raw)
  To: Michal Simek, linux-kernel, monstr, devicetree, Rob Herring
  Cc: Greg Kroah-Hartman, linux-serial, Jiri Slaby



On 23/04/18 10:27, Michal Simek wrote:
> There is no reason to initialize uartclk to BASE_BAUD * 16 for DT based
> systems.
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
> 
> It looks like from history that portclk = BASE_BAUD * 16 was setup to
> get on calculation on x86 (divisor = 1) but it shouldn't be needed on DT based
> system. That's why I think that there is no DT based system which really
> requires this line.

Hi Michal,

This is fine for the MIPS generic platform (tested on Boston board) 
which was broken by some earlycon changes a few versions ago. Also 
tested on a MIPS pistachio board. As long as the bootloader has 
configured the uart divisor, earlycon should work as long as my patch 
"serial: 8250_early: Only set divisor if valid clk & baud" is applied to 
avoid a bad divisor getting calculated.

Tested-by: Matt Redfearn <matt.redfearn@mips.com>

Thanks,
Matt

> ---
>   drivers/tty/serial/earlycon.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
> index a24278380fec..c12b1edcdd8e 100644
> --- a/drivers/tty/serial/earlycon.c
> +++ b/drivers/tty/serial/earlycon.c
> @@ -244,7 +244,6 @@ int __init of_setup_earlycon(const struct earlycon_id *match,
>   		return -ENXIO;
>   	}
>   	port->mapbase = addr;
> -	port->uartclk = BASE_BAUD * 16;
>   
>   	val = of_get_flat_dt_prop(node, "reg-offset", NULL);
>   	if (val)
> 

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

* Re: [RFC. PATCH] earlycon: Remove hardcoded port->uartclk initialization in of_setup_earlycon
  2018-04-23 13:16   ` Matt Redfearn
@ 2018-04-23 13:22     ` Michal Simek
  -1 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2018-04-23 13:22 UTC (permalink / raw)
  To: Matt Redfearn, Michal Simek, linux-kernel, monstr, devicetree,
	Rob Herring
  Cc: Greg Kroah-Hartman, linux-serial, Jiri Slaby

Hi,

On 23.4.2018 15:16, Matt Redfearn wrote:
> 
> 
> On 23/04/18 10:27, Michal Simek wrote:
>> There is no reason to initialize uartclk to BASE_BAUD * 16 for DT based
>> systems.
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>> It looks like from history that portclk = BASE_BAUD * 16 was setup to
>> get on calculation on x86 (divisor = 1) but it shouldn't be needed on
>> DT based
>> system. That's why I think that there is no DT based system which really
>> requires this line.
> 
> Hi Michal,
> 
> This is fine for the MIPS generic platform (tested on Boston board)
> which was broken by some earlycon changes a few versions ago. Also
> tested on a MIPS pistachio board. As long as the bootloader has
> configured the uart divisor, earlycon should work as long as my patch
> "serial: 8250_early: Only set divisor if valid clk & baud" is applied to
> avoid a bad divisor getting calculated.

I have sent one patch to fix your patch because you don't need to check
device->baud twice.
[PATCH] serial: 8250_early: Setup divider when uartclk is passed
 > Tested-by: Matt Redfearn <matt.redfearn@mips.com>

Thanks,
Michal


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

* Re: [RFC. PATCH] earlycon: Remove hardcoded port->uartclk initialization in of_setup_earlycon
@ 2018-04-23 13:22     ` Michal Simek
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2018-04-23 13:22 UTC (permalink / raw)
  To: Matt Redfearn, Michal Simek, linux-kernel, monstr, devicetree,
	Rob Herring
  Cc: Greg Kroah-Hartman, linux-serial, Jiri Slaby

Hi,

On 23.4.2018 15:16, Matt Redfearn wrote:
> 
> 
> On 23/04/18 10:27, Michal Simek wrote:
>> There is no reason to initialize uartclk to BASE_BAUD * 16 for DT based
>> systems.
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>> It looks like from history that portclk = BASE_BAUD * 16 was setup to
>> get on calculation on x86 (divisor = 1) but it shouldn't be needed on
>> DT based
>> system. That's why I think that there is no DT based system which really
>> requires this line.
> 
> Hi Michal,
> 
> This is fine for the MIPS generic platform (tested on Boston board)
> which was broken by some earlycon changes a few versions ago. Also
> tested on a MIPS pistachio board. As long as the bootloader has
> configured the uart divisor, earlycon should work as long as my patch
> "serial: 8250_early: Only set divisor if valid clk & baud" is applied to
> avoid a bad divisor getting calculated.

I have sent one patch to fix your patch because you don't need to check
device->baud twice.
[PATCH] serial: 8250_early: Setup divider when uartclk is passed
 > Tested-by: Matt Redfearn <matt.redfearn@mips.com>

Thanks,
Michal

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

end of thread, other threads:[~2018-04-23 13:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-23  9:27 [RFC. PATCH] earlycon: Remove hardcoded port->uartclk initialization in of_setup_earlycon Michal Simek
2018-04-23 13:16 ` Matt Redfearn
2018-04-23 13:16   ` Matt Redfearn
2018-04-23 13:22   ` Michal Simek
2018-04-23 13:22     ` Michal Simek

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.