public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: linux-serial@vger.kernel.org,
	"Greg KH" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	linux-kernel@vger.kernel.org, "Lukas Wunner" <lukas@wunner.de>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Lino Sanfilippo" <LinoSanfilippo@gmx.de>
Subject: Re: [PATCH v7 2/6] serial: 8250: create lsr_save_mask
Date: Wed, 15 Jun 2022 17:01:32 +0300	[thread overview]
Message-ID: <YqnmPHB8qBXIBou+@smile.fi.intel.com> (raw)
In-Reply-To: <20220615124829.34516-3-ilpo.jarvinen@linux.intel.com>

On Wed, Jun 15, 2022 at 03:48:25PM +0300, Ilpo Järvinen wrote:
> Allow drivers to alter LSR save mask.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
>  drivers/tty/serial/8250/8250.h      | 2 +-
>  drivers/tty/serial/8250/8250_core.c | 4 ++++
>  drivers/tty/serial/8250/8250_dw.c   | 2 +-
>  include/linux/serial_8250.h         | 1 +
>  4 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
> index 0ff5688ba90c..5cc967fe3b59 100644
> --- a/drivers/tty/serial/8250/8250.h
> +++ b/drivers/tty/serial/8250/8250.h
> @@ -138,7 +138,7 @@ static inline u16 serial_lsr_in(struct uart_8250_port *up)
>  	u16 lsr = up->lsr_saved_flags;
>  
>  	lsr |= serial_in(up, UART_LSR);
> -	up->lsr_saved_flags = lsr & LSR_SAVE_FLAGS;
> +	up->lsr_saved_flags = lsr & up->lsr_save_mask;
>  
>  	return lsr;
>  }
> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
> index 90ddc8924811..57e86133af4f 100644
> --- a/drivers/tty/serial/8250/8250_core.c
> +++ b/drivers/tty/serial/8250/8250_core.c
> @@ -1007,6 +1007,7 @@ int serial8250_register_8250_port(const struct uart_8250_port *up)
>  		uart->port.rs485	= up->port.rs485;
>  		uart->rs485_start_tx	= up->rs485_start_tx;
>  		uart->rs485_stop_tx	= up->rs485_stop_tx;
> +		uart->lsr_save_mask	= up->lsr_save_mask;
>  		uart->dma		= up->dma;
>  
>  		/* Take tx_loadsz from fifosize if it wasn't set separately */
> @@ -1094,6 +1095,9 @@ int serial8250_register_8250_port(const struct uart_8250_port *up)
>  			ret = 0;
>  		}
>  
> +		if (!uart->lsr_save_mask)
> +			uart->lsr_save_mask = LSR_SAVE_FLAGS;	/* Use default LSR mask */
> +
>  		/* Initialise interrupt backoff work if required */
>  		if (up->overrun_backoff_time_ms > 0) {
>  			uart->overrun_backoff_time_ms =
> diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> index 4cc69bb612ab..167a691c7b19 100644
> --- a/drivers/tty/serial/8250/8250_dw.c
> +++ b/drivers/tty/serial/8250/8250_dw.c
> @@ -129,7 +129,7 @@ static void dw8250_tx_wait_empty(struct uart_port *p)
>  
>  	while (tries--) {
>  		lsr = readb (p->membase + (UART_LSR << p->regshift));
> -		up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;
> +		up->lsr_saved_flags |= lsr & up->lsr_save_mask;
>  
>  		if (lsr & UART_LSR_TEMT)
>  			break;
> diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
> index 4565f25ba9a2..8c7b793aa4d7 100644
> --- a/include/linux/serial_8250.h
> +++ b/include/linux/serial_8250.h
> @@ -120,6 +120,7 @@ struct uart_8250_port {
>  	 */
>  #define LSR_SAVE_FLAGS UART_LSR_BRK_ERROR_BITS
>  	u16			lsr_saved_flags;
> +	u16			lsr_save_mask;
>  #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
>  	unsigned char		msr_saved_flags;
>  
> -- 
> 2.30.2
> 

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2022-06-15 14:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220615124829.34516-1-ilpo.jarvinen@linux.intel.com>
2022-06-15 12:48 ` [PATCH v7 1/6] serial: 8250: make saved LSR larger Ilpo Järvinen
2022-06-15 14:00   ` Andy Shevchenko
2022-06-15 12:48 ` [PATCH v7 2/6] serial: 8250: create lsr_save_mask Ilpo Järvinen
2022-06-15 14:01   ` Andy Shevchenko [this message]
2022-06-15 12:48 ` [PATCH v7 3/6] serial: 8250_lpss: Use 32-bit reads Ilpo Järvinen
2022-06-15 12:48 ` [PATCH v7 4/6] serial: take termios_rwsem for .rs485_config() & pass termios as param Ilpo Järvinen
2022-06-15 14:05   ` Andy Shevchenko
2022-06-16  5:15     ` Ilpo Järvinen
2022-06-15 12:48 ` [PATCH v7 5/6] serial: Support for RS-485 multipoint addresses Ilpo Järvinen
2022-06-15 14:13   ` Andy Shevchenko
2022-06-16  5:04     ` Ilpo Järvinen
2022-06-16  5:48       ` Jiri Slaby
2022-06-16  7:53         ` Ilpo Järvinen
2022-06-15 12:48 ` [PATCH v7 6/6] serial: 8250_dwlib: Support for 9th bit multipoint addressing Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YqnmPHB8qBXIBou+@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=LinoSanfilippo@gmx.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox