linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tty: serial: fsl_lpuart: minimum baud rate support
@ 2020-06-25  9:49 Vabhav Sharma
  2020-06-25 10:04 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Vabhav Sharma @ 2020-06-25  9:49 UTC (permalink / raw)
  To: gregkh, jslaby, linux-serial, linux-kernel; +Cc: v.sethi, Vabhav Sharma

From: Vabhav Sharma <vabhav.sharma@nxp.com>

The formula for the baud rate is
baud rate = "baud clock / ((OSR+1) × SBR)

Algorithm used in function lpuart32_serial_setbrg() only changes
the SBR. Even with maxmum value put in, OSR stays at 0x7 and the
lowest baud rate would be ~ 2600 bps

Update the algorithm to allow driver operation at 1200,2400 or
600 bps

Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
---
 drivers/tty/serial/fsl_lpuart.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 90298c4..0fd0fa5f 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1925,6 +1925,10 @@ static void __lpuart32_serial_setbrg(struct uart_port *port,
 			tmp_sbr++;
 		}
 
+		if (tmp_sbr > UARTBAUD_SBR_MASK) {
+			continue;
+		}
+
 		if (tmp_diff <= baud_diff) {
 			baud_diff = tmp_diff;
 			osr = tmp_osr;
-- 
2.7.4


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

* Re: [PATCH] tty: serial: fsl_lpuart: minimum baud rate support
  2020-06-25  9:49 [PATCH] tty: serial: fsl_lpuart: minimum baud rate support Vabhav Sharma
@ 2020-06-25 10:04 ` Greg KH
  2020-06-25 10:12   ` Vabhav Sharma (OSS)
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2020-06-25 10:04 UTC (permalink / raw)
  To: Vabhav Sharma; +Cc: jslaby, linux-serial, linux-kernel, v.sethi, Vabhav Sharma

On Thu, Jun 25, 2020 at 03:19:05PM +0530, Vabhav Sharma wrote:
> From: Vabhav Sharma <vabhav.sharma@nxp.com>
> 
> The formula for the baud rate is
> baud rate = "baud clock / ((OSR+1) × SBR)
> 
> Algorithm used in function lpuart32_serial_setbrg() only changes
> the SBR. Even with maxmum value put in, OSR stays at 0x7 and the
> lowest baud rate would be ~ 2600 bps
> 
> Update the algorithm to allow driver operation at 1200,2400 or
> 600 bps
> 
> Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
> ---
>  drivers/tty/serial/fsl_lpuart.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
> index 90298c4..0fd0fa5f 100644
> --- a/drivers/tty/serial/fsl_lpuart.c
> +++ b/drivers/tty/serial/fsl_lpuart.c
> @@ -1925,6 +1925,10 @@ static void __lpuart32_serial_setbrg(struct uart_port *port,
>  			tmp_sbr++;
>  		}
>  
> +		if (tmp_sbr > UARTBAUD_SBR_MASK) {
> +			continue;
> +		}

Always use scripts/checkpatch.pl on your patches so you do not get
grumpy emails from maintainers telling you to use scripts/checkpatch.pl
on your patches...


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

* RE: [PATCH] tty: serial: fsl_lpuart: minimum baud rate support
  2020-06-25 10:04 ` Greg KH
@ 2020-06-25 10:12   ` Vabhav Sharma (OSS)
  2020-06-25 10:52     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Vabhav Sharma (OSS) @ 2020-06-25 10:12 UTC (permalink / raw)
  To: Greg KH, Vabhav Sharma (OSS)
  Cc: jslaby, linux-serial, linux-kernel, Varun Sethi



> -----Original Message-----
> From: Greg KH <gregkh@linuxfoundation.org>
> Sent: Thursday, June 25, 2020 3:34 PM
> To: Vabhav Sharma (OSS) <vabhav.sharma@oss.nxp.com>
> Cc: jslaby@suse.com; linux-serial@vger.kernel.org; linux-
> kernel@vger.kernel.org; Varun Sethi <V.Sethi@nxp.com>; Vabhav Sharma
> <vabhav.sharma@nxp.com>
> Subject: Re: [PATCH] tty: serial: fsl_lpuart: minimum baud rate support
> 
> On Thu, Jun 25, 2020 at 03:19:05PM +0530, Vabhav Sharma wrote:
> > From: Vabhav Sharma <vabhav.sharma@nxp.com>
> >
> > The formula for the baud rate is
> > baud rate = "baud clock / ((OSR+1) × SBR)
> >
> > Algorithm used in function lpuart32_serial_setbrg() only changes the
> > SBR. Even with maxmum value put in, OSR stays at 0x7 and the lowest
> > baud rate would be ~ 2600 bps
> >
> > Update the algorithm to allow driver operation at 1200,2400 or
> > 600 bps
> >
> > Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
> > ---
> >  drivers/tty/serial/fsl_lpuart.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/tty/serial/fsl_lpuart.c
> > b/drivers/tty/serial/fsl_lpuart.c index 90298c4..0fd0fa5f 100644
> > --- a/drivers/tty/serial/fsl_lpuart.c
> > +++ b/drivers/tty/serial/fsl_lpuart.c
> > @@ -1925,6 +1925,10 @@ static void __lpuart32_serial_setbrg(struct
> uart_port *port,
> >  			tmp_sbr++;
> >  		}
> >
> > +		if (tmp_sbr > UARTBAUD_SBR_MASK) {
> > +			continue;
> > +		}
> 
> Always use scripts/checkpatch.pl on your patches so you do not get grumpy
> emails from maintainers telling you to use scripts/checkpatch.pl on your
> patches...
Indeed, I run the script before sending patch
./scripts/checkpatch.pl 0001-tty-serial-fsl_lpuart-minimum-baud-rate-support.patch
total: 0 errors, 0 warnings, 10 lines checked

0001-tty-serial-fsl_lpuart-minimum-baud-rate-support.patch has no obvious style problems and is ready for submission.

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

* Re: [PATCH] tty: serial: fsl_lpuart: minimum baud rate support
  2020-06-25 10:12   ` Vabhav Sharma (OSS)
@ 2020-06-25 10:52     ` Greg KH
  2020-06-26 11:18       ` Vabhav Sharma (OSS)
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2020-06-25 10:52 UTC (permalink / raw)
  To: Vabhav Sharma (OSS); +Cc: jslaby, linux-serial, linux-kernel, Varun Sethi

On Thu, Jun 25, 2020 at 10:12:54AM +0000, Vabhav Sharma (OSS) wrote:
> 
> 
> > -----Original Message-----
> > From: Greg KH <gregkh@linuxfoundation.org>
> > Sent: Thursday, June 25, 2020 3:34 PM
> > To: Vabhav Sharma (OSS) <vabhav.sharma@oss.nxp.com>
> > Cc: jslaby@suse.com; linux-serial@vger.kernel.org; linux-
> > kernel@vger.kernel.org; Varun Sethi <V.Sethi@nxp.com>; Vabhav Sharma
> > <vabhav.sharma@nxp.com>
> > Subject: Re: [PATCH] tty: serial: fsl_lpuart: minimum baud rate support
> > 
> > On Thu, Jun 25, 2020 at 03:19:05PM +0530, Vabhav Sharma wrote:
> > > From: Vabhav Sharma <vabhav.sharma@nxp.com>
> > >
> > > The formula for the baud rate is
> > > baud rate = "baud clock / ((OSR+1) × SBR)
> > >
> > > Algorithm used in function lpuart32_serial_setbrg() only changes the
> > > SBR. Even with maxmum value put in, OSR stays at 0x7 and the lowest
> > > baud rate would be ~ 2600 bps
> > >
> > > Update the algorithm to allow driver operation at 1200,2400 or
> > > 600 bps
> > >
> > > Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
> > > ---
> > >  drivers/tty/serial/fsl_lpuart.c | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/drivers/tty/serial/fsl_lpuart.c
> > > b/drivers/tty/serial/fsl_lpuart.c index 90298c4..0fd0fa5f 100644
> > > --- a/drivers/tty/serial/fsl_lpuart.c
> > > +++ b/drivers/tty/serial/fsl_lpuart.c
> > > @@ -1925,6 +1925,10 @@ static void __lpuart32_serial_setbrg(struct
> > uart_port *port,
> > >  			tmp_sbr++;
> > >  		}
> > >
> > > +		if (tmp_sbr > UARTBAUD_SBR_MASK) {
> > > +			continue;
> > > +		}
> > 
> > Always use scripts/checkpatch.pl on your patches so you do not get grumpy
> > emails from maintainers telling you to use scripts/checkpatch.pl on your
> > patches...
> Indeed, I run the script before sending patch
> ./scripts/checkpatch.pl 0001-tty-serial-fsl_lpuart-minimum-baud-rate-support.patch
> total: 0 errors, 0 warnings, 10 lines checked
> 
> 0001-tty-serial-fsl_lpuart-minimum-baud-rate-support.patch has no obvious style problems and is ready for submission.

Ok, then something is wrong as there is obviously a coding style issue
with your submission, as you can see with a manual review of it, right?

greg k-h

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

* RE: [PATCH] tty: serial: fsl_lpuart: minimum baud rate support
  2020-06-25 10:52     ` Greg KH
@ 2020-06-26 11:18       ` Vabhav Sharma (OSS)
  0 siblings, 0 replies; 5+ messages in thread
From: Vabhav Sharma (OSS) @ 2020-06-26 11:18 UTC (permalink / raw)
  To: Greg KH, Vabhav Sharma (OSS)
  Cc: jslaby, linux-serial, linux-kernel, Varun Sethi



> -----Original Message-----
> From: Greg KH <gregkh@linuxfoundation.org>
> Sent: Thursday, June 25, 2020 4:23 PM
> To: Vabhav Sharma (OSS) <vabhav.sharma@oss.nxp.com>
> Cc: jslaby@suse.com; linux-serial@vger.kernel.org; linux-
> kernel@vger.kernel.org; Varun Sethi <V.Sethi@nxp.com>
> Subject: Re: [PATCH] tty: serial: fsl_lpuart: minimum baud rate support
> 
> On Thu, Jun 25, 2020 at 10:12:54AM +0000, Vabhav Sharma (OSS) wrote:
> >
> >
> > > -----Original Message-----
> > > From: Greg KH <gregkh@linuxfoundation.org>
> > > Sent: Thursday, June 25, 2020 3:34 PM
> > > To: Vabhav Sharma (OSS) <vabhav.sharma@oss.nxp.com>
> > > Cc: jslaby@suse.com; linux-serial@vger.kernel.org; linux-
> > > kernel@vger.kernel.org; Varun Sethi <V.Sethi@nxp.com>; Vabhav
> Sharma
> > > <vabhav.sharma@nxp.com>
> > > Subject: Re: [PATCH] tty: serial: fsl_lpuart: minimum baud rate
> > > support
> > >
> > > On Thu, Jun 25, 2020 at 03:19:05PM +0530, Vabhav Sharma wrote:
> > > > From: Vabhav Sharma <vabhav.sharma@nxp.com>
> > > >
> > > > The formula for the baud rate is
> > > > baud rate = "baud clock / ((OSR+1) × SBR)
> > > >
> > > > Algorithm used in function lpuart32_serial_setbrg() only changes
> > > > the SBR. Even with maxmum value put in, OSR stays at 0x7 and the
> > > > lowest baud rate would be ~ 2600 bps
> > > >
> > > > Update the algorithm to allow driver operation at 1200,2400 or
> > > > 600 bps
> > > >
> > > > Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
> > > > ---
> > > >  drivers/tty/serial/fsl_lpuart.c | 4 ++++
> > > >  1 file changed, 4 insertions(+)
> > > >
> > > > diff --git a/drivers/tty/serial/fsl_lpuart.c
> > > > b/drivers/tty/serial/fsl_lpuart.c index 90298c4..0fd0fa5f 100644
> > > > --- a/drivers/tty/serial/fsl_lpuart.c
> > > > +++ b/drivers/tty/serial/fsl_lpuart.c
> > > > @@ -1925,6 +1925,10 @@ static void __lpuart32_serial_setbrg(struct
> > > uart_port *port,
> > > >  			tmp_sbr++;
> > > >  		}
> > > >
> > > > +		if (tmp_sbr > UARTBAUD_SBR_MASK) {
> > > > +			continue;
> > > > +		}
> > >
> > > Always use scripts/checkpatch.pl on your patches so you do not get
> > > grumpy emails from maintainers telling you to use
> > > scripts/checkpatch.pl on your patches...
> > Indeed, I run the script before sending patch ./scripts/checkpatch.pl
> > 0001-tty-serial-fsl_lpuart-minimum-baud-rate-support.patch
> > total: 0 errors, 0 warnings, 10 lines checked
> >
> > 0001-tty-serial-fsl_lpuart-minimum-baud-rate-support.patch has no
> obvious style problems and is ready for submission.
> 
> Ok, then something is wrong as there is obviously a coding style issue with
> your submission, as you can see with a manual review of it, right?
> 
> greg k-h
I see, Unnecessary usage of brace for single statement.
Thank you

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

end of thread, other threads:[~2020-06-26 11:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-25  9:49 [PATCH] tty: serial: fsl_lpuart: minimum baud rate support Vabhav Sharma
2020-06-25 10:04 ` Greg KH
2020-06-25 10:12   ` Vabhav Sharma (OSS)
2020-06-25 10:52     ` Greg KH
2020-06-26 11:18       ` Vabhav Sharma (OSS)

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