Linux Serial subsystem development
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 LKML <linux-kernel@vger.kernel.org>,
	 linux-serial <linux-serial@vger.kernel.org>,
	 Jiri Slaby <jirislaby@kernel.org>
Subject: Re: [PATCH v2 1/1] serial: 8250_of: Drop quirk fot NPCM from 8250_port
Date: Thu, 15 Feb 2024 18:40:15 +0200 (EET)	[thread overview]
Message-ID: <835925e0-0df0-fed6-6b29-0cf4a9f811b0@linux.intel.com> (raw)
In-Reply-To: <20240215145029.581389-1-andriy.shevchenko@linux.intel.com>

On Thu, 15 Feb 2024, Andy Shevchenko wrote:

> We are not supposed to spread quirks in 8250_port module especially
> when we have a separate driver for the hardware in question.
> 
> Move quirk from generic module to the driver that uses it.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: added missing bits.h, reworked error handling in a switch-case
>  drivers/tty/serial/8250/8250_of.c   | 44 +++++++++++++++++++++++++++--
>  drivers/tty/serial/8250/8250_port.c | 24 ----------------
>  2 files changed, 42 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
> index 34f17a9785e7..9dcc17e33269 100644
> --- a/drivers/tty/serial/8250/8250_of.c
> +++ b/drivers/tty/serial/8250/8250_of.c
> @@ -4,7 +4,10 @@
>   *
>   *    Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de>, IBM Corp.
>   */
> +
> +#include <linux/bits.h>
>  #include <linux/console.h>
> +#include <linux/math.h>
>  #include <linux/module.h>
>  #include <linux/slab.h>
>  #include <linux/serial_core.h>
> @@ -25,6 +28,36 @@ struct of_serial_info {
>  	int line;
>  };
>  
> +/* Nuvoton NPCM timeout register */
> +#define UART_NPCM_TOR          7
> +#define UART_NPCM_TOIE         BIT(7)  /* Timeout Interrupt Enable */
> +
> +static int npcm_startup(struct uart_port *port)
> +{
> +	/*
> +	 * Nuvoton calls the scratch register 'UART_TOR' (timeout
> +	 * register). Enable it, and set TIOC (timeout interrupt
> +	 * comparator) to be 0x20 for correct operation.
> +	 */
> +	serial_port_out(port, UART_NPCM_TOR, UART_NPCM_TOIE | 0x20);
> +
> +	return serial8250_do_startup(port);

I know this matches how it is currently done but I wonder if TOIE 
should not be enabled until ->setup_irq() has been called.

-- 
 i.


  reply	other threads:[~2024-02-15 16:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 14:50 [PATCH v2 1/1] serial: 8250_of: Drop quirk fot NPCM from 8250_port Andy Shevchenko
2024-02-15 16:40 ` Ilpo Järvinen [this message]
2024-02-15 16:43   ` Andy Shevchenko
2024-02-16  9:31     ` Ilpo Järvinen
2024-02-16 14:39       ` Andy Shevchenko
2024-02-16 14:41         ` 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=835925e0-0df0-fed6-6b29-0cf4a9f811b0@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /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