public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Dawei Li <dawei.li@shingroup.cn>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Jiri Slaby <jirislaby@kernel.org>,
	jszhang@kernel.org, LKML <linux-kernel@vger.kernel.org>,
	linux-serial <linux-serial@vger.kernel.org>,
	set_pte_at@outlook.com, stable@kernel.org
Subject: Re: [PATCH] serial: dw8250: Make DLF feature independent of ADDITIONAL_FEATURE
Date: Mon, 4 Dec 2023 15:20:09 +0200 (EET)	[thread overview]
Message-ID: <48f6fcce-4b5-a7c0-2fc0-989b9a2fba8@linux.intel.com> (raw)
In-Reply-To: <20231204130820.2823688-1-dawei.li@shingroup.cn>

On Mon, 4 Dec 2023, Dawei Li wrote:

> DW apb uart databook defines couples of configuration parameters of
> dw8250 IP, among which there are 2 of them:
> - ADDTIONAL_FEATURE
> " Configure the peripheral to have the option to include FIFO status
>   registers, shadow registers and encoded parameter register. Also
>   configures the peripheral to have UART component version and the
>   peripheral ID registers. "
> 
> - FRACTIONAL_BAUD_DIVISOR_EN
> " Configures the peripheral to have Fractional Baud Rate Divisor.
>   .... "
> 
> These two parameters are completely irrelevant, and supposed to be
> independent of each other. However, in current dw8250 driver
> implementation, they are hooked together.
> 
> The bug was hit when we are bringing up dw8250 IP on our hardware
> platform, in which parameters are configured in such combination:
> - ADDTIONAL_FEATURE disabled;
> - FRACTIONAL_BAUD_DIVISOR_EN enabled;
> 
> Fixes: 701c5e73b296 ("serial: 8250_dw: add fractional divisor support")
> Cc: stable@kernel.org
> Signed-off-by: Dawei Li <dawei.li@shingroup.cn>
> ---
>  drivers/tty/serial/8250/8250_dwlib.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_dwlib.c b/drivers/tty/serial/8250/8250_dwlib.c
> index 84843e204a5e..136ad093c5b6 100644
> --- a/drivers/tty/serial/8250/8250_dwlib.c
> +++ b/drivers/tty/serial/8250/8250_dwlib.c
> @@ -259,17 +259,6 @@ void dw8250_setup_port(struct uart_port *p)
>  	}
>  	up->capabilities |= UART_CAP_NOTEMT;
>  
> -	/*
> -	 * If the Component Version Register returns zero, we know that
> -	 * ADDITIONAL_FEATURES are not enabled. No need to go any further.
> -	 */
> -	reg = dw8250_readl_ext(p, DW_UART_UCV);
> -	if (!reg)
> -		return;
> -
> -	dev_dbg(p->dev, "Designware UART version %c.%c%c\n",
> -		(reg >> 24) & 0xff, (reg >> 16) & 0xff, (reg >> 8) & 0xff);
> -
>  	/* Preserve value written by firmware or bootloader  */
>  	old_dlf = dw8250_readl_ext(p, DW_UART_DLF);
>  	dw8250_writel_ext(p, DW_UART_DLF, ~0U);
> @@ -282,6 +271,17 @@ void dw8250_setup_port(struct uart_port *p)
>  		p->set_divisor = dw8250_set_divisor;
>  	}
>  
> +	/*
> +	 * If the Component Version Register returns zero, we know that
> +	 * ADDITIONAL_FEATURES are not enabled. No need to go any further.
> +	 */
> +	reg = dw8250_readl_ext(p, DW_UART_UCV);
> +	if (!reg)
> +		return;
> +
> +	dev_dbg(p->dev, "Designware UART version %c.%c%c\n",
> +		(reg >> 24) & 0xff, (reg >> 16) & 0xff, (reg >> 8) & 0xff);
> +
>  	reg = dw8250_readl_ext(p, DW_UART_CPR);
>  	if (!reg) {
>  		reg = data->pdata->cpr_val;
> 

The very same code change is already in tty-next (from another author).

-- 
 i.


  reply	other threads:[~2023-12-04 13:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04 13:08 [PATCH] serial: dw8250: Make DLF feature independent of ADDITIONAL_FEATURE Dawei Li
2023-12-04 13:20 ` Ilpo Järvinen [this message]
2023-12-04 13:29   ` Andy Shevchenko
2023-12-05  1:55     ` Dawei Li
2023-12-05 15:55       ` Andy Shevchenko

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=48f6fcce-4b5-a7c0-2fc0-989b9a2fba8@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dawei.li@shingroup.cn \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=jszhang@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=set_pte_at@outlook.com \
    --cc=stable@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