From: Vabhav Sharma <[email protected]>
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 <[email protected]>
---
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
On Thu, Jun 25, 2020 at 03:19:05PM +0530, Vabhav Sharma wrote:
> From: Vabhav Sharma <[email protected]>
>
> 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 <[email protected]>
> ---
> 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...
> -----Original Message-----
> From: Greg KH <[email protected]>
> Sent: Thursday, June 25, 2020 3:34 PM
> To: Vabhav Sharma (OSS) <[email protected]>
> Cc: [email protected]; [email protected]; linux-
> [email protected]; Varun Sethi <[email protected]>; Vabhav Sharma
> <[email protected]>
> 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 <[email protected]>
> >
> > 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 <[email protected]>
> > ---
> > 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.
On Thu, Jun 25, 2020 at 10:12:54AM +0000, Vabhav Sharma (OSS) wrote:
>
>
> > -----Original Message-----
> > From: Greg KH <[email protected]>
> > Sent: Thursday, June 25, 2020 3:34 PM
> > To: Vabhav Sharma (OSS) <[email protected]>
> > Cc: [email protected]; [email protected]; linux-
> > [email protected]; Varun Sethi <[email protected]>; Vabhav Sharma
> > <[email protected]>
> > 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 <[email protected]>
> > >
> > > 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 <[email protected]>
> > > ---
> > > 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
> -----Original Message-----
> From: Greg KH <[email protected]>
> Sent: Thursday, June 25, 2020 4:23 PM
> To: Vabhav Sharma (OSS) <[email protected]>
> Cc: [email protected]; [email protected]; linux-
> [email protected]; Varun Sethi <[email protected]>
> 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 <[email protected]>
> > > Sent: Thursday, June 25, 2020 3:34 PM
> > > To: Vabhav Sharma (OSS) <[email protected]>
> > > Cc: [email protected]; [email protected]; linux-
> > > [email protected]; Varun Sethi <[email protected]>; Vabhav
> Sharma
> > > <[email protected]>
> > > 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 <[email protected]>
> > > >
> > > > 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 <[email protected]>
> > > > ---
> > > > 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