Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH] serial: dw8250: Make DLF feature independent of ADDITIONAL_FEATURE
@ 2023-12-04 13:08 Dawei Li
  2023-12-04 13:20 ` Ilpo Järvinen
  0 siblings, 1 reply; 5+ messages in thread
From: Dawei Li @ 2023-12-04 13:08 UTC (permalink / raw)
  To: gregkh, ilpo.jarvinen, andriy.shevchenko
  Cc: jirislaby, jszhang, linux-kernel, linux-serial, set_pte_at,
	Dawei Li, stable

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;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-05 15:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2023-12-04 13:29   ` Andy Shevchenko
2023-12-05  1:55     ` Dawei Li
2023-12-05 15:55       ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox