All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: Boston: Fix earlycon baud rate selection
@ 2017-10-17 13:27 ` Matt Redfearn
  0 siblings, 0 replies; 7+ messages in thread
From: Matt Redfearn @ 2017-10-17 13:27 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: linux-mips, Matt Redfearn, devicetree, linux-kernel, Rob Herring,
	Mark Rutland, Paul Burton

During set up of the early console, the earlycon driver will attempt to
configure a baud rate, if one is set in the earlycon structure.
Previously, of_setup_earlycon left this field as 0, ignoring any baud
rate selected by the DT. Commit 31cb9a8575ca ("earlycon: initialise baud
field of earlycon device structure") changed this behaviour such that
any selected baud rate is now set. The earlycon driver must deduce the
divisor from the configured uartclk, which of_setup_earlycon sets to
BASE_BAUD. MIPS generic kernels do not set BASE_BAUD (there is no
practical way to set this generically for all supported platforms), so
when the early console is configured an incorrect divisor is calculated
for the selected baud rate, and garbage is printed to the console during
boot.

Fix this by removing the configured baud rate from the device tree.
This causes the early console to inherit the baud rate settings from the
bootloader. By the time the real console is probed, the clock drivers
necessary to calculate the divisor are enabled and the kernel can
correctly configure the baud rate.

Fixes: 31cb9a8575ca ("earlycon: initialise baud field of earlycon device structure")
Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>

---

 arch/mips/boot/dts/img/boston.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/boot/dts/img/boston.dts b/arch/mips/boot/dts/img/boston.dts
index 53bfa29a7093..179691aae7d7 100644
--- a/arch/mips/boot/dts/img/boston.dts
+++ b/arch/mips/boot/dts/img/boston.dts
@@ -11,7 +11,7 @@
 	compatible = "img,boston";
 
 	chosen {
-		stdout-path = "uart0:115200";
+		stdout-path = "uart0";
 	};
 
 	aliases {
-- 
2.7.4

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

* [PATCH] MIPS: Boston: Fix earlycon baud rate selection
@ 2017-10-17 13:27 ` Matt Redfearn
  0 siblings, 0 replies; 7+ messages in thread
From: Matt Redfearn @ 2017-10-17 13:27 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: linux-mips, Matt Redfearn, devicetree, linux-kernel, Rob Herring,
	Mark Rutland, Paul Burton

During set up of the early console, the earlycon driver will attempt to
configure a baud rate, if one is set in the earlycon structure.
Previously, of_setup_earlycon left this field as 0, ignoring any baud
rate selected by the DT. Commit 31cb9a8575ca ("earlycon: initialise baud
field of earlycon device structure") changed this behaviour such that
any selected baud rate is now set. The earlycon driver must deduce the
divisor from the configured uartclk, which of_setup_earlycon sets to
BASE_BAUD. MIPS generic kernels do not set BASE_BAUD (there is no
practical way to set this generically for all supported platforms), so
when the early console is configured an incorrect divisor is calculated
for the selected baud rate, and garbage is printed to the console during
boot.

Fix this by removing the configured baud rate from the device tree.
This causes the early console to inherit the baud rate settings from the
bootloader. By the time the real console is probed, the clock drivers
necessary to calculate the divisor are enabled and the kernel can
correctly configure the baud rate.

Fixes: 31cb9a8575ca ("earlycon: initialise baud field of earlycon device structure")
Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>

---

 arch/mips/boot/dts/img/boston.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/boot/dts/img/boston.dts b/arch/mips/boot/dts/img/boston.dts
index 53bfa29a7093..179691aae7d7 100644
--- a/arch/mips/boot/dts/img/boston.dts
+++ b/arch/mips/boot/dts/img/boston.dts
@@ -11,7 +11,7 @@
 	compatible = "img,boston";
 
 	chosen {
-		stdout-path = "uart0:115200";
+		stdout-path = "uart0";
 	};
 
 	aliases {
-- 
2.7.4

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

* RE: [PATCH] MIPS: Boston: Fix earlycon baud rate selection
  2017-10-17 13:27 ` Matt Redfearn
  (?)
@ 2017-10-25 22:09   ` Paul Burton
  -1 siblings, 0 replies; 7+ messages in thread
From: Paul Burton @ 2017-10-25 22:09 UTC (permalink / raw)
  To: Matt Redfearn, Ralf Baechle
  Cc: linux-mips, Matt Redfearn, devicetree, linux-kernel, Rob Herring,
	Mark Rutland, Paul Burton

Hi Matt,

On Tuesday, October 17, 2017 at 6:28 AM Matt Redfearn wrote:
> During set up of the early console, the earlycon driver will attempt to
> configure a baud rate, if one is set in the earlycon structure.
> Previously, of_setup_earlycon left this field as 0, ignoring any baud
> rate selected by the DT. Commit 31cb9a8575ca ("earlycon: initialise baud
> field of earlycon device structure") changed this behaviour such that
> any selected baud rate is now set. The earlycon driver must deduce the
> divisor from the configured uartclk, which of_setup_earlycon sets to
> BASE_BAUD. MIPS generic kernels do not set BASE_BAUD (there is no
> practical way to set this generically for all supported platforms), so
> when the early console is configured an incorrect divisor is calculated
> for the selected baud rate, and garbage is printed to the console during
> boot.
> 
> Fix this by removing the configured baud rate from the device tree.
> This causes the early console to inherit the baud rate settings from the
> bootloader. By the time the real console is probed, the clock drivers
> necessary to calculate the divisor are enabled and the kernel can
> correctly configure the baud rate.

Sadly I think this breaks the proper console - my current understanding
is that we end up with it set to 9600 baud due to the defaults in
serial8250_console_setup(). So with your patch I see correct output from
the early console, then nothing when the proper console registers until
my userland starts a getty on ttyS0 which reconfigures it to 115200 baud.

Thanks,
    Paul

> Fixes: 31cb9a8575ca ("earlycon: initialise baud field of earlycon device
> structure")
> Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
> 
> ---
> 
>  arch/mips/boot/dts/img/boston.dts | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/boot/dts/img/boston.dts
> b/arch/mips/boot/dts/img/boston.dts
> index 53bfa29a7093..179691aae7d7 100644
> --- a/arch/mips/boot/dts/img/boston.dts
> +++ b/arch/mips/boot/dts/img/boston.dts
> @@ -11,7 +11,7 @@
>  	compatible = "img,boston";
> 
>  	chosen {
> -		stdout-path = "uart0:115200";
> +		stdout-path = "uart0";
>  	};
> 
>  	aliases {
> --
> 2.7.4

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

* RE: [PATCH] MIPS: Boston: Fix earlycon baud rate selection
@ 2017-10-25 22:09   ` Paul Burton
  0 siblings, 0 replies; 7+ messages in thread
From: Paul Burton @ 2017-10-25 22:09 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: linux-mips, Matt Redfearn, devicetree, linux-kernel, Rob Herring,
	Mark Rutland, Paul Burton

Hi Matt,

On Tuesday, October 17, 2017 at 6:28 AM Matt Redfearn wrote:
> During set up of the early console, the earlycon driver will attempt to
> configure a baud rate, if one is set in the earlycon structure.
> Previously, of_setup_earlycon left this field as 0, ignoring any baud
> rate selected by the DT. Commit 31cb9a8575ca ("earlycon: initialise baud
> field of earlycon device structure") changed this behaviour such that
> any selected baud rate is now set. The earlycon driver must deduce the
> divisor from the configured uartclk, which of_setup_earlycon sets to
> BASE_BAUD. MIPS generic kernels do not set BASE_BAUD (there is no
> practical way to set this generically for all supported platforms), so
> when the early console is configured an incorrect divisor is calculated
> for the selected baud rate, and garbage is printed to the console during
> boot.
> 
> Fix this by removing the configured baud rate from the device tree.
> This causes the early console to inherit the baud rate settings from the
> bootloader. By the time the real console is probed, the clock drivers
> necessary to calculate the divisor are enabled and the kernel can
> correctly configure the baud rate.

Sadly I think this breaks the proper console - my current understanding
is that we end up with it set to 9600 baud due to the defaults in
serial8250_console_setup(). So with your patch I see correct output from
the early console, then nothing when the proper console registers until
my userland starts a getty on ttyS0 which reconfigures it to 115200 baud.

Thanks,
    Paul

> Fixes: 31cb9a8575ca ("earlycon: initialise baud field of earlycon device
> structure")
> Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
> 
> ---
> 
>  arch/mips/boot/dts/img/boston.dts | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/boot/dts/img/boston.dts
> b/arch/mips/boot/dts/img/boston.dts
> index 53bfa29a7093..179691aae7d7 100644
> --- a/arch/mips/boot/dts/img/boston.dts
> +++ b/arch/mips/boot/dts/img/boston.dts
> @@ -11,7 +11,7 @@
>  	compatible = "img,boston";
> 
>  	chosen {
> -		stdout-path = "uart0:115200";
> +		stdout-path = "uart0";
>  	};
> 
>  	aliases {
> --
> 2.7.4

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

* RE: [PATCH] MIPS: Boston: Fix earlycon baud rate selection
@ 2017-10-25 22:09   ` Paul Burton
  0 siblings, 0 replies; 7+ messages in thread
From: Paul Burton @ 2017-10-25 22:09 UTC (permalink / raw)
  To: Matt Redfearn, Ralf Baechle
  Cc: linux-mips, devicetree, linux-kernel, Rob Herring, Mark Rutland,
	Paul Burton

Hi Matt,

On Tuesday, October 17, 2017 at 6:28 AM Matt Redfearn wrote:
> During set up of the early console, the earlycon driver will attempt to
> configure a baud rate, if one is set in the earlycon structure.
> Previously, of_setup_earlycon left this field as 0, ignoring any baud
> rate selected by the DT. Commit 31cb9a8575ca ("earlycon: initialise baud
> field of earlycon device structure") changed this behaviour such that
> any selected baud rate is now set. The earlycon driver must deduce the
> divisor from the configured uartclk, which of_setup_earlycon sets to
> BASE_BAUD. MIPS generic kernels do not set BASE_BAUD (there is no
> practical way to set this generically for all supported platforms), so
> when the early console is configured an incorrect divisor is calculated
> for the selected baud rate, and garbage is printed to the console during
> boot.
> 
> Fix this by removing the configured baud rate from the device tree.
> This causes the early console to inherit the baud rate settings from the
> bootloader. By the time the real console is probed, the clock drivers
> necessary to calculate the divisor are enabled and the kernel can
> correctly configure the baud rate.

Sadly I think this breaks the proper console - my current understanding
is that we end up with it set to 9600 baud due to the defaults in
serial8250_console_setup(). So with your patch I see correct output from
the early console, then nothing when the proper console registers until
my userland starts a getty on ttyS0 which reconfigures it to 115200 baud.

Thanks,
    Paul

> Fixes: 31cb9a8575ca ("earlycon: initialise baud field of earlycon device
> structure")
> Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
> 
> ---
> 
>  arch/mips/boot/dts/img/boston.dts | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/boot/dts/img/boston.dts
> b/arch/mips/boot/dts/img/boston.dts
> index 53bfa29a7093..179691aae7d7 100644
> --- a/arch/mips/boot/dts/img/boston.dts
> +++ b/arch/mips/boot/dts/img/boston.dts
> @@ -11,7 +11,7 @@
>  	compatible = "img,boston";
> 
>  	chosen {
> -		stdout-path = "uart0:115200";
> +		stdout-path = "uart0";
>  	};
> 
>  	aliases {
> --
> 2.7.4

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

* Re: [PATCH] MIPS: Boston: Fix earlycon baud rate selection
@ 2017-10-26 12:07     ` Matt Redfearn
  0 siblings, 0 replies; 7+ messages in thread
From: Matt Redfearn @ 2017-10-26 12:07 UTC (permalink / raw)
  To: Paul Burton, Ralf Baechle
  Cc: linux-mips, devicetree, linux-kernel, Rob Herring, Mark Rutland,
	Paul Burton, Eugeniy Paltsev, Greg Kroah-Hartman

Hi Paul,


On 25/10/17 23:09, Paul Burton wrote:
> Hi Matt,
>
> On Tuesday, October 17, 2017 at 6:28 AM Matt Redfearn wrote:
>> During set up of the early console, the earlycon driver will attempt to
>> configure a baud rate, if one is set in the earlycon structure.
>> Previously, of_setup_earlycon left this field as 0, ignoring any baud
>> rate selected by the DT. Commit 31cb9a8575ca ("earlycon: initialise baud
>> field of earlycon device structure") changed this behaviour such that
>> any selected baud rate is now set. The earlycon driver must deduce the
>> divisor from the configured uartclk, which of_setup_earlycon sets to
>> BASE_BAUD. MIPS generic kernels do not set BASE_BAUD (there is no
>> practical way to set this generically for all supported platforms), so
>> when the early console is configured an incorrect divisor is calculated
>> for the selected baud rate, and garbage is printed to the console during
>> boot.
>>
>> Fix this by removing the configured baud rate from the device tree.
>> This causes the early console to inherit the baud rate settings from the
>> bootloader. By the time the real console is probed, the clock drivers
>> necessary to calculate the divisor are enabled and the kernel can
>> correctly configure the baud rate.
> Sadly I think this breaks the proper console - my current understanding
> is that we end up with it set to 9600 baud due to the defaults in
> serial8250_console_setup(). So with your patch I see correct output from
> the early console, then nothing when the proper console registers until
> my userland starts a getty on ttyS0 which reconfigures it to 115200 baud.

As long as you specify "console=ttyS0,115200" on the command line, then 
the correct baud rate gets applied. I know that's not ideal...

(CC'ing Eugene & Greg KH for other ideas to fix this)

Thanks,
Matt

>
> Thanks,
>      Paul
>
>> Fixes: 31cb9a8575ca ("earlycon: initialise baud field of earlycon device
>> structure")
>> Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
>>
>> ---
>>
>>   arch/mips/boot/dts/img/boston.dts | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/mips/boot/dts/img/boston.dts
>> b/arch/mips/boot/dts/img/boston.dts
>> index 53bfa29a7093..179691aae7d7 100644
>> --- a/arch/mips/boot/dts/img/boston.dts
>> +++ b/arch/mips/boot/dts/img/boston.dts
>> @@ -11,7 +11,7 @@
>>   	compatible = "img,boston";
>>
>>   	chosen {
>> -		stdout-path = "uart0:115200";
>> +		stdout-path = "uart0";
>>   	};
>>
>>   	aliases {
>> --
>> 2.7.4

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

* Re: [PATCH] MIPS: Boston: Fix earlycon baud rate selection
@ 2017-10-26 12:07     ` Matt Redfearn
  0 siblings, 0 replies; 7+ messages in thread
From: Matt Redfearn @ 2017-10-26 12:07 UTC (permalink / raw)
  To: Paul Burton, Ralf Baechle
  Cc: linux-mips-6z/3iImG2C8G8FEW9MqTrA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Mark Rutland,
	Paul Burton, Eugeniy Paltsev, Greg Kroah-Hartman

Hi Paul,


On 25/10/17 23:09, Paul Burton wrote:
> Hi Matt,
>
> On Tuesday, October 17, 2017 at 6:28 AM Matt Redfearn wrote:
>> During set up of the early console, the earlycon driver will attempt to
>> configure a baud rate, if one is set in the earlycon structure.
>> Previously, of_setup_earlycon left this field as 0, ignoring any baud
>> rate selected by the DT. Commit 31cb9a8575ca ("earlycon: initialise baud
>> field of earlycon device structure") changed this behaviour such that
>> any selected baud rate is now set. The earlycon driver must deduce the
>> divisor from the configured uartclk, which of_setup_earlycon sets to
>> BASE_BAUD. MIPS generic kernels do not set BASE_BAUD (there is no
>> practical way to set this generically for all supported platforms), so
>> when the early console is configured an incorrect divisor is calculated
>> for the selected baud rate, and garbage is printed to the console during
>> boot.
>>
>> Fix this by removing the configured baud rate from the device tree.
>> This causes the early console to inherit the baud rate settings from the
>> bootloader. By the time the real console is probed, the clock drivers
>> necessary to calculate the divisor are enabled and the kernel can
>> correctly configure the baud rate.
> Sadly I think this breaks the proper console - my current understanding
> is that we end up with it set to 9600 baud due to the defaults in
> serial8250_console_setup(). So with your patch I see correct output from
> the early console, then nothing when the proper console registers until
> my userland starts a getty on ttyS0 which reconfigures it to 115200 baud.

As long as you specify "console=ttyS0,115200" on the command line, then 
the correct baud rate gets applied. I know that's not ideal...

(CC'ing Eugene & Greg KH for other ideas to fix this)

Thanks,
Matt

>
> Thanks,
>      Paul
>
>> Fixes: 31cb9a8575ca ("earlycon: initialise baud field of earlycon device
>> structure")
>> Signed-off-by: Matt Redfearn <matt.redfearn-8NJIiSa5LzA@public.gmane.org>
>>
>> ---
>>
>>   arch/mips/boot/dts/img/boston.dts | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/mips/boot/dts/img/boston.dts
>> b/arch/mips/boot/dts/img/boston.dts
>> index 53bfa29a7093..179691aae7d7 100644
>> --- a/arch/mips/boot/dts/img/boston.dts
>> +++ b/arch/mips/boot/dts/img/boston.dts
>> @@ -11,7 +11,7 @@
>>   	compatible = "img,boston";
>>
>>   	chosen {
>> -		stdout-path = "uart0:115200";
>> +		stdout-path = "uart0";
>>   	};
>>
>>   	aliases {
>> --
>> 2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2017-10-26 12:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-17 13:27 [PATCH] MIPS: Boston: Fix earlycon baud rate selection Matt Redfearn
2017-10-17 13:27 ` Matt Redfearn
2017-10-25 22:09 ` Paul Burton
2017-10-25 22:09   ` Paul Burton
2017-10-25 22:09   ` Paul Burton
2017-10-26 12:07   ` Matt Redfearn
2017-10-26 12:07     ` Matt Redfearn

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.