linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "serial: 8250: Fix max baud limit in generic 8250 port"
@ 2020-06-30 23:42 Daniel Winkler
  2020-07-01  4:30 ` Lukas Wunner
  2020-07-01 13:26 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel Winkler @ 2020-06-30 23:42 UTC (permalink / raw)
  To: linux-serial, linux-mediatek
  Cc: chromeos-bluetooth-upstreaming, Daniel Winkler, Aaron Sierra,
	Andy Shevchenko, Greg Kroah-Hartman, Jiri Slaby, Lukas Wunner,
	Vignesh Raghavendra, linux-kernel

This reverts commit 0eeaf62981ecc79e8395ca8caa1570eaf3a12257.

The change regresses the QCA6174A-3 bluetooth chip, preventing
firmware from being properly loaded. We have verified that without
this patch, the chip works as intended.

Signed-off-by: Daniel Winkler <danielwinkler@google.com>
---

 drivers/tty/serial/8250/8250_port.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 1632f7d25acca..e057c65ac1580 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -2618,8 +2618,6 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
 					     struct ktermios *termios,
 					     struct ktermios *old)
 {
-	unsigned int tolerance = port->uartclk / 100;
-
 	/*
 	 * Ask the core to calculate the divisor for us.
 	 * Allow 1% tolerance at the upper limit so uart clks marginally
@@ -2628,7 +2626,7 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
 	 */
 	return uart_get_baud_rate(port, termios, old,
 				  port->uartclk / 16 / UART_DIV_MAX,
-				  (port->uartclk + tolerance) / 16);
+				  port->uartclk);
 }
 
 void
-- 
2.27.0.212.ge8ba1cc988-goog


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

* Re: [PATCH] Revert "serial: 8250: Fix max baud limit in generic 8250 port"
  2020-06-30 23:42 [PATCH] Revert "serial: 8250: Fix max baud limit in generic 8250 port" Daniel Winkler
@ 2020-07-01  4:30 ` Lukas Wunner
  2020-07-01 11:39   ` Serge Semin
  2020-07-01 13:26 ` Greg Kroah-Hartman
  1 sibling, 1 reply; 6+ messages in thread
From: Lukas Wunner @ 2020-07-01  4:30 UTC (permalink / raw)
  To: Daniel Winkler, Serge Semin, Alexey Malahov
  Cc: linux-serial, linux-mediatek, chromeos-bluetooth-upstreaming,
	Aaron Sierra, Andy Shevchenko, Greg Kroah-Hartman, Jiri Slaby,
	Vignesh Raghavendra, linux-kernel

On Tue, Jun 30, 2020 at 04:42:11PM -0700, Daniel Winkler wrote:
> This reverts commit 0eeaf62981ecc79e8395ca8caa1570eaf3a12257.

That is not an upstream commit.  You probably mean:

    commit 7b668c064ec33f3d687c3a413d05e355172e6c92
    Author: Serge Semin <Sergey.Semin@baikalelectronics.ru>
    Date:   Thu May 7 02:31:32 2020 +0300

    serial: 8250: Fix max baud limit in generic 8250 port

And you didn't cc the commit author (hereby fixed).

Thanks,

Lukas

> 
> The change regresses the QCA6174A-3 bluetooth chip, preventing
> firmware from being properly loaded. We have verified that without
> this patch, the chip works as intended.
> 
> Signed-off-by: Daniel Winkler <danielwinkler@google.com>
> ---
> 
>  drivers/tty/serial/8250/8250_port.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index 1632f7d25acca..e057c65ac1580 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -2618,8 +2618,6 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
>  					     struct ktermios *termios,
>  					     struct ktermios *old)
>  {
> -	unsigned int tolerance = port->uartclk / 100;
> -
>  	/*
>  	 * Ask the core to calculate the divisor for us.
>  	 * Allow 1% tolerance at the upper limit so uart clks marginally
> @@ -2628,7 +2626,7 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
>  	 */
>  	return uart_get_baud_rate(port, termios, old,
>  				  port->uartclk / 16 / UART_DIV_MAX,
> -				  (port->uartclk + tolerance) / 16);
> +				  port->uartclk);
>  }
>  
>  void
> -- 
> 2.27.0.212.ge8ba1cc988-goog

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

* Re: [PATCH] Revert "serial: 8250: Fix max baud limit in generic 8250 port"
  2020-07-01  4:30 ` Lukas Wunner
@ 2020-07-01 11:39   ` Serge Semin
  2020-07-01 12:46     ` Alain Michaud
  0 siblings, 1 reply; 6+ messages in thread
From: Serge Semin @ 2020-07-01 11:39 UTC (permalink / raw)
  To: Lukas Wunner
  Cc: Daniel Winkler, Alexey Malahov, linux-serial, linux-mediatek,
	chromeos-bluetooth-upstreaming, Aaron Sierra, Andy Shevchenko,
	Greg Kroah-Hartman, Jiri Slaby, Vignesh Raghavendra,
	linux-kernel

Hello Lukas,

On Wed, Jul 01, 2020 at 06:30:01AM +0200, Lukas Wunner wrote:
> On Tue, Jun 30, 2020 at 04:42:11PM -0700, Daniel Winkler wrote:
> > This reverts commit 0eeaf62981ecc79e8395ca8caa1570eaf3a12257.
> 
> That is not an upstream commit.  You probably mean:
> 
>     commit 7b668c064ec33f3d687c3a413d05e355172e6c92
>     Author: Serge Semin <Sergey.Semin@baikalelectronics.ru>
>     Date:   Thu May 7 02:31:32 2020 +0300
> 
>     serial: 8250: Fix max baud limit in generic 8250 port
> 
> And you didn't cc the commit author (hereby fixed).
> 
> Thanks,
> 
> Lukas

Thanks for Cc'ing me.

> 
> > 
> > The change regresses the QCA6174A-3 bluetooth chip, preventing
> > firmware from being properly loaded. We have verified that without
> > this patch, the chip works as intended.

That text doesn't say what is really wrong and why the firmware couldn't be loaded.
The original commit gets back the 8250 port baud rate limitation so if the baud
gets out of the range [uartclk / 16 / UART_DIV_MAX; (port->uartclk + tolerance) /
16], then it will be clamped to be within it. That range is what the standard
8250 port supports. Acceptance of out of that range values will cause a
problem further in calling serial8250_get_divisor() and uart_get_divisor()
methods (see the original patch log message) for standard 8250 ports. Any different
behavior must be taken into account by a custom set_termios() callbacks or at
least must be workarounded so the standard 8250 ports wouldn't be affected. So in
order to investigate the root cause of the problem it would be good to at least
know what your platform was and what UART port has been used in the attempt to
load the QCA6174A-3 chip firmware.

-Sergey

> > 
> > Signed-off-by: Daniel Winkler <danielwinkler@google.com>
> > ---
> > 
> >  drivers/tty/serial/8250/8250_port.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> > index 1632f7d25acca..e057c65ac1580 100644
> > --- a/drivers/tty/serial/8250/8250_port.c
> > +++ b/drivers/tty/serial/8250/8250_port.c
> > @@ -2618,8 +2618,6 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
> >  					     struct ktermios *termios,
> >  					     struct ktermios *old)
> >  {
> > -	unsigned int tolerance = port->uartclk / 100;
> > -
> >  	/*
> >  	 * Ask the core to calculate the divisor for us.
> >  	 * Allow 1% tolerance at the upper limit so uart clks marginally
> > @@ -2628,7 +2626,7 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
> >  	 */
> >  	return uart_get_baud_rate(port, termios, old,
> >  				  port->uartclk / 16 / UART_DIV_MAX,
> > -				  (port->uartclk + tolerance) / 16);
> > +				  port->uartclk);
> >  }
> >  
> >  void
> > -- 
> > 2.27.0.212.ge8ba1cc988-goog

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

* Re: [PATCH] Revert "serial: 8250: Fix max baud limit in generic 8250 port"
  2020-07-01 11:39   ` Serge Semin
@ 2020-07-01 12:46     ` Alain Michaud
  0 siblings, 0 replies; 6+ messages in thread
From: Alain Michaud @ 2020-07-01 12:46 UTC (permalink / raw)
  To: Serge Semin, BlueZ
  Cc: Lukas Wunner, Daniel Winkler, Alexey Malahov, linux-serial,
	linux-mediatek, chromeos-bluetooth-upstreaming, Aaron Sierra,
	Andy Shevchenko, Greg Kroah-Hartman, Jiri Slaby,
	Vignesh Raghavendra, LKML

Adding the bluetooth list as well per the Bluetooth impact.


On Wed, Jul 1, 2020 at 7:39 AM Serge Semin
<Sergey.Semin@baikalelectronics.ru> wrote:
>
> Hello Lukas,
>
> On Wed, Jul 01, 2020 at 06:30:01AM +0200, Lukas Wunner wrote:
> > On Tue, Jun 30, 2020 at 04:42:11PM -0700, Daniel Winkler wrote:
> > > This reverts commit 0eeaf62981ecc79e8395ca8caa1570eaf3a12257.
> >
> > That is not an upstream commit.  You probably mean:
> >
> >     commit 7b668c064ec33f3d687c3a413d05e355172e6c92
> >     Author: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> >     Date:   Thu May 7 02:31:32 2020 +0300
> >
> >     serial: 8250: Fix max baud limit in generic 8250 port
> >
> > And you didn't cc the commit author (hereby fixed).
> >
> > Thanks,
> >
> > Lukas
>
> Thanks for Cc'ing me.
>
> >
> > >
> > > The change regresses the QCA6174A-3 bluetooth chip, preventing
> > > firmware from being properly loaded. We have verified that without
> > > this patch, the chip works as intended.
>
> That text doesn't say what is really wrong and why the firmware couldn't be loaded.
> The original commit gets back the 8250 port baud rate limitation so if the baud
> gets out of the range [uartclk / 16 / UART_DIV_MAX; (port->uartclk + tolerance) /
> 16], then it will be clamped to be within it. That range is what the standard
> 8250 port supports. Acceptance of out of that range values will cause a
> problem further in calling serial8250_get_divisor() and uart_get_divisor()
> methods (see the original patch log message) for standard 8250 ports. Any different
> behavior must be taken into account by a custom set_termios() callbacks or at
> least must be workarounded so the standard 8250 ports wouldn't be affected. So in
> order to investigate the root cause of the problem it would be good to at least
> know what your platform was and what UART port has been used in the attempt to
> load the QCA6174A-3 chip firmware.
>
> -Sergey
>
> > >
> > > Signed-off-by: Daniel Winkler <danielwinkler@google.com>
> > > ---
> > >
> > >  drivers/tty/serial/8250/8250_port.c | 4 +---
> > >  1 file changed, 1 insertion(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> > > index 1632f7d25acca..e057c65ac1580 100644
> > > --- a/drivers/tty/serial/8250/8250_port.c
> > > +++ b/drivers/tty/serial/8250/8250_port.c
> > > @@ -2618,8 +2618,6 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
> > >                                          struct ktermios *termios,
> > >                                          struct ktermios *old)
> > >  {
> > > -   unsigned int tolerance = port->uartclk / 100;
> > > -
> > >     /*
> > >      * Ask the core to calculate the divisor for us.
> > >      * Allow 1% tolerance at the upper limit so uart clks marginally
> > > @@ -2628,7 +2626,7 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
> > >      */
> > >     return uart_get_baud_rate(port, termios, old,
> > >                               port->uartclk / 16 / UART_DIV_MAX,
> > > -                             (port->uartclk + tolerance) / 16);
> > > +                             port->uartclk);
> > >  }
> > >
> > >  void
> > > --
> > > 2.27.0.212.ge8ba1cc988-goog
>
> --
> You received this message because you are subscribed to the Google Groups "ChromeOS Bluetooth Upstreaming" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to chromeos-bluetooth-upstreaming+unsubscribe@chromium.org.
> To post to this group, send email to chromeos-bluetooth-upstreaming@chromium.org.
> To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromeos-bluetooth-upstreaming/20200701113904.7zh534vmlvjvojia%40mobilestation.

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

* Re: [PATCH] Revert "serial: 8250: Fix max baud limit in generic 8250 port"
  2020-06-30 23:42 [PATCH] Revert "serial: 8250: Fix max baud limit in generic 8250 port" Daniel Winkler
  2020-07-01  4:30 ` Lukas Wunner
@ 2020-07-01 13:26 ` Greg Kroah-Hartman
  2020-07-01 18:26   ` Daniel Winkler
  1 sibling, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2020-07-01 13:26 UTC (permalink / raw)
  To: Daniel Winkler
  Cc: linux-serial, linux-mediatek, chromeos-bluetooth-upstreaming,
	Aaron Sierra, Andy Shevchenko, Jiri Slaby, Lukas Wunner,
	Vignesh Raghavendra, linux-kernel

On Tue, Jun 30, 2020 at 04:42:11PM -0700, Daniel Winkler wrote:
> This reverts commit 0eeaf62981ecc79e8395ca8caa1570eaf3a12257.
> 
> The change regresses the QCA6174A-3 bluetooth chip, preventing
> firmware from being properly loaded. We have verified that without
> this patch, the chip works as intended.
> 
> Signed-off-by: Daniel Winkler <danielwinkler@google.com>

No cc: stable?  No Fixes: tag?

{sigh}


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

* Re: [PATCH] Revert "serial: 8250: Fix max baud limit in generic 8250 port"
  2020-07-01 13:26 ` Greg Kroah-Hartman
@ 2020-07-01 18:26   ` Daniel Winkler
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Winkler @ 2020-07-01 18:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-serial, linux-mediatek, chromeos-bluetooth-upstreaming,
	Aaron Sierra, Andy Shevchenko, Jiri Slaby, Lukas Wunner,
	Vignesh Raghavendra, linux-kernel

Hello all,

Please forgive any omitted information, as this is my first
upstreaming experience. I am preparing a second patch that will
clarify the requested points. Thanks in advance!

Best regards,
Daniel Winkler


On Wed, Jul 1, 2020 at 6:26 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Tue, Jun 30, 2020 at 04:42:11PM -0700, Daniel Winkler wrote:
> > This reverts commit 0eeaf62981ecc79e8395ca8caa1570eaf3a12257.
> >
> > The change regresses the QCA6174A-3 bluetooth chip, preventing
> > firmware from being properly loaded. We have verified that without
> > this patch, the chip works as intended.
> >
> > Signed-off-by: Daniel Winkler <danielwinkler@google.com>
>
> No cc: stable?  No Fixes: tag?
>
> {sigh}
>

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

end of thread, other threads:[~2020-07-01 18:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-30 23:42 [PATCH] Revert "serial: 8250: Fix max baud limit in generic 8250 port" Daniel Winkler
2020-07-01  4:30 ` Lukas Wunner
2020-07-01 11:39   ` Serge Semin
2020-07-01 12:46     ` Alain Michaud
2020-07-01 13:26 ` Greg Kroah-Hartman
2020-07-01 18:26   ` Daniel Winkler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).