* [PATCH v1 1/2] serial: 8250_lpss: Extract dw8250_do_set_termios() for common use
@ 2021-10-02 18:51 Andy Shevchenko
2021-10-02 18:51 ` [PATCH v1 2/2] serial: 8250_lpss: Enable PSE UART Auto Flow Control Andy Shevchenko
2021-10-05 12:53 ` [PATCH v1 1/2] serial: 8250_lpss: Extract dw8250_do_set_termios() for common use Greg Kroah-Hartman
0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2021-10-02 18:51 UTC (permalink / raw)
To: Andy Shevchenko, linux-serial, linux-kernel
Cc: Greg Kroah-Hartman, Jiri Slaby
Some of the code currently used in dw8250_set_termios(), byt_set_termios()
may be reused by other methods in the future. Extract it to a common helper
function.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/tty/serial/8250/8250_dw.c | 8 ++------
drivers/tty/serial/8250/8250_dwlib.c | 10 ++++++++++
drivers/tty/serial/8250/8250_dwlib.h | 1 +
drivers/tty/serial/8250/8250_lpss.c | 6 +-----
4 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index a3a0154da567..e3c90c9e2448 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -338,7 +338,7 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios,
rate = clk_round_rate(d->clk, newrate);
if (rate > 0) {
/*
- * Premilinary set the uartclk to the new clock rate so the
+ * Preliminary set the uartclk to the new clock rate so the
* clock update event handler caused by the clk_set_rate()
* calling wouldn't actually update the UART divisor since
* we about to do this anyway.
@@ -350,11 +350,7 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios,
}
clk_prepare_enable(d->clk);
- p->status &= ~UPSTAT_AUTOCTS;
- if (termios->c_cflag & CRTSCTS)
- p->status |= UPSTAT_AUTOCTS;
-
- serial8250_do_set_termios(p, termios, old);
+ dw8250_do_set_termios(p, termios, old);
}
static void dw8250_set_ldisc(struct uart_port *p, struct ktermios *termios)
diff --git a/drivers/tty/serial/8250/8250_dwlib.c b/drivers/tty/serial/8250/8250_dwlib.c
index 6d6a78eead3e..622d3b0d89e7 100644
--- a/drivers/tty/serial/8250/8250_dwlib.c
+++ b/drivers/tty/serial/8250/8250_dwlib.c
@@ -77,6 +77,16 @@ static void dw8250_set_divisor(struct uart_port *p, unsigned int baud,
serial8250_do_set_divisor(p, baud, quot, quot_frac);
}
+void dw8250_do_set_termios(struct uart_port *p, struct ktermios *termios, struct ktermios *old)
+{
+ p->status &= ~UPSTAT_AUTOCTS;
+ if (termios->c_cflag & CRTSCTS)
+ p->status |= UPSTAT_AUTOCTS;
+
+ serial8250_do_set_termios(p, termios, old);
+}
+EXPORT_SYMBOL_GPL(dw8250_do_set_termios);
+
void dw8250_setup_port(struct uart_port *p)
{
struct uart_8250_port *up = up_to_u8250p(p);
diff --git a/drivers/tty/serial/8250/8250_dwlib.h b/drivers/tty/serial/8250/8250_dwlib.h
index 9a12953832d3..83d528e5cc21 100644
--- a/drivers/tty/serial/8250/8250_dwlib.h
+++ b/drivers/tty/serial/8250/8250_dwlib.h
@@ -16,4 +16,5 @@ struct dw8250_port_data {
u8 dlf_size;
};
+void dw8250_do_set_termios(struct uart_port *p, struct ktermios *termios, struct ktermios *old);
void dw8250_setup_port(struct uart_port *p);
diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c
index 848d81e3838c..398d2c4a40e3 100644
--- a/drivers/tty/serial/8250/8250_lpss.c
+++ b/drivers/tty/serial/8250/8250_lpss.c
@@ -100,11 +100,7 @@ static void byt_set_termios(struct uart_port *p, struct ktermios *termios,
reg |= BYT_PRV_CLK_EN | BYT_PRV_CLK_UPDATE;
writel(reg, p->membase + BYT_PRV_CLK);
- p->status &= ~UPSTAT_AUTOCTS;
- if (termios->c_cflag & CRTSCTS)
- p->status |= UPSTAT_AUTOCTS;
-
- serial8250_do_set_termios(p, termios, old);
+ dw8250_do_set_termios(p, termios, old);
}
static unsigned int byt_get_mctrl(struct uart_port *port)
--
2.33.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v1 2/2] serial: 8250_lpss: Enable PSE UART Auto Flow Control
2021-10-02 18:51 [PATCH v1 1/2] serial: 8250_lpss: Extract dw8250_do_set_termios() for common use Andy Shevchenko
@ 2021-10-02 18:51 ` Andy Shevchenko
2021-10-05 12:53 ` [PATCH v1 1/2] serial: 8250_lpss: Extract dw8250_do_set_termios() for common use Greg Kroah-Hartman
1 sibling, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2021-10-02 18:51 UTC (permalink / raw)
To: Andy Shevchenko, linux-serial, linux-kernel
Cc: Greg Kroah-Hartman, Jiri Slaby, Aman Kumar
From: Aman Kumar <aman.kumar@intel.com>
Add a call to the custom ->set_termios() which has implementation about
changing the state of RTS and CTS.
Signed-off-by: Aman Kumar <aman.kumar@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/tty/serial/8250/8250_lpss.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c
index 398d2c4a40e3..d3bafec7619d 100644
--- a/drivers/tty/serial/8250/8250_lpss.c
+++ b/drivers/tty/serial/8250/8250_lpss.c
@@ -164,6 +164,9 @@ static int ehl_serial_setup(struct lpss8250 *lpss, struct uart_port *port)
* matching with the registered General Purpose DMA controllers.
*/
up->dma = dma;
+
+ port->set_termios = dw8250_do_set_termios;
+
return 0;
}
--
2.33.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/2] serial: 8250_lpss: Extract dw8250_do_set_termios() for common use
2021-10-02 18:51 [PATCH v1 1/2] serial: 8250_lpss: Extract dw8250_do_set_termios() for common use Andy Shevchenko
2021-10-02 18:51 ` [PATCH v1 2/2] serial: 8250_lpss: Enable PSE UART Auto Flow Control Andy Shevchenko
@ 2021-10-05 12:53 ` Greg Kroah-Hartman
2021-10-05 13:30 ` Andy Shevchenko
1 sibling, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2021-10-05 12:53 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-serial, linux-kernel, Jiri Slaby
On Sat, Oct 02, 2021 at 09:51:40PM +0300, Andy Shevchenko wrote:
> Some of the code currently used in dw8250_set_termios(), byt_set_termios()
> may be reused by other methods in the future. Extract it to a common helper
> function.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/tty/serial/8250/8250_dw.c | 8 ++------
> drivers/tty/serial/8250/8250_dwlib.c | 10 ++++++++++
> drivers/tty/serial/8250/8250_dwlib.h | 1 +
> drivers/tty/serial/8250/8250_lpss.c | 6 +-----
> 4 files changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> index a3a0154da567..e3c90c9e2448 100644
> --- a/drivers/tty/serial/8250/8250_dw.c
> +++ b/drivers/tty/serial/8250/8250_dw.c
> @@ -338,7 +338,7 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios,
> rate = clk_round_rate(d->clk, newrate);
> if (rate > 0) {
> /*
> - * Premilinary set the uartclk to the new clock rate so the
> + * Preliminary set the uartclk to the new clock rate so the
Different change, not mentioned in the changelog, please make this a
separate patch.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/2] serial: 8250_lpss: Extract dw8250_do_set_termios() for common use
2021-10-05 12:53 ` [PATCH v1 1/2] serial: 8250_lpss: Extract dw8250_do_set_termios() for common use Greg Kroah-Hartman
@ 2021-10-05 13:30 ` Andy Shevchenko
0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2021-10-05 13:30 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-serial, linux-kernel, Jiri Slaby
On Tue, Oct 05, 2021 at 02:53:28PM +0200, Greg Kroah-Hartman wrote:
> On Sat, Oct 02, 2021 at 09:51:40PM +0300, Andy Shevchenko wrote:
> > Some of the code currently used in dw8250_set_termios(), byt_set_termios()
> > may be reused by other methods in the future. Extract it to a common helper
> > function.
...
> > - * Premilinary set the uartclk to the new clock rate so the
> > + * Preliminary set the uartclk to the new clock rate so the
>
> Different change, not mentioned in the changelog, please make this a
> separate patch.
Done, v2 has been just sent.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-10-05 13:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-02 18:51 [PATCH v1 1/2] serial: 8250_lpss: Extract dw8250_do_set_termios() for common use Andy Shevchenko
2021-10-02 18:51 ` [PATCH v1 2/2] serial: 8250_lpss: Enable PSE UART Auto Flow Control Andy Shevchenko
2021-10-05 12:53 ` [PATCH v1 1/2] serial: 8250_lpss: Extract dw8250_do_set_termios() for common use Greg Kroah-Hartman
2021-10-05 13:30 ` Andy Shevchenko
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).