public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] serial: 8250 dw: clear FIFO before writting LCR
@ 2025-08-19 19:06 adriana
  2025-08-20  6:00 ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: adriana @ 2025-08-19 19:06 UTC (permalink / raw)
  To: linux-serial, linux-kernel
  Cc: ilpo.jarvinnen, andriy.shevchenko, gregkh, jirislaby, john.ogness,
	Adriana Nicolae

This patch is proposing a custom configuration for Synopsys DesignWare
serial to be used by products with associated compatible string in the
device tree.

The PORT_DWAPB config will be used instead of the default PORT_16550A
which does not include the UART_FCR_CLEAR_RCVR and UART_FCR_CLEAR_XMIT
bits for the FIFO configuration register. Having those flags is necessary
to clear FIFO when the serial port is reconfigured with do_set_termios.

Additionally, inside the do_set_termios we use the LCR (Line Control
Register) to enable DLAB bit in order to access DLL/DLM (Divisor Latch
Low/High) registers for baud rate setting. These 2 registers are sharing
the same address space with UART_TX/UART_RX and UART_IER. The sequence is:

(1) enable DLAB -> (2) set baud -> (3) disable DLAB -> (4) reset FCR

When there is a TX or RX flow on the serial while we attempt to set/clear
DLAB, the LCR write will be ignored and we will get a IIR_BUSY interrupt
afterwards which is cleared by only reading the USR (UART status register).

The sequence above can leave the serial in an unstable state in two cases:

- if UART is busy while (1), then LCR is still pointing to the normal set of
registers, which means the code setting DLL/DLM is actually writing into TX or
modifying interrupts in UART_IER which may end with either a garbage character
on the console or with serial interrupts disabled.

- if UART is busy while (3), then LCR remains pointing to DLL/DLM instead of
moving back to RX/TX. The first transfer on the serial will be stuck because
the transmit/receive registers are not accessible unless the DLAB bit
is cleared.

The changes in this patch include a specific serial_out function for this UART
type similar to the one for Armada-38x devices in commit
b7639b0b15ddd1a4686b0142e70dfb122eefc88f with some changes in the tx_wait_empty
function to check the UART status by looking at the USR register and actively
try to clear FIFO to reduce time before a LCR write since the characters will
be lost otherwise after baud rate change.

The USR register may report that UART is busy even if TX/TX FIFO is already
empty so we will loop until all USR[0] (UART busy status) is cleared and USR[1]
TX FIFO is empty (RX FIFO bits should be 0 in this case).
Keeping the same timeout of 20ms as measurements with the 9600 baud when
the console was busy it took max 1.9ms to get the UART free state.

---
Changes in v2:
- Updated the mailing list.

Signed-off-by: Adriana Nicolae <adriana@arista.com>
---
 drivers/tty/serial/8250/8250_dw.c   |   52 +++++++++++++++++++++++++++++++++++
 drivers/tty/serial/8250/8250_port.c |    8 +++++
 include/uapi/linux/serial_core.h    |    3 ++
 3 files changed, 63 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index a53ba04d9770..985a2650f3f3 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -33,6 +33,9 @@
 /* Offsets for the DesignWare specific registers */
 #define DW_UART_USR	0x1f /* UART Status Register */
 #define DW_UART_DMASA	0xa8 /* DMA Software Ack */
+#define DW_UART_USR_BUSY 0x1 /* UART Busy status */
+#define DW_UART_USR_TFNF 0x2 /* UART TX FIFO not full */
+#define DW_UART_USR_TFE  0x4 /* UART TX FIFO empty */
 
 #define OCTEON_UART_USR	0x27 /* UART Status Register */
 
@@ -56,6 +59,10 @@
 #define DW_UART_QUIRK_IS_DMA_FC		BIT(3)
 #define DW_UART_QUIRK_APMC0D08		BIT(4)
 #define DW_UART_QUIRK_CPR_VALUE		BIT(5)
+#define DW_UART_QUIRK_APB		BIT(6)
+
+#define DW8250_REG( p, reg ) \
+	((void __iomem *)(p->membase + ((reg) << p->regshift)))
 
 struct dw8250_platform_data {
 	u8 usr_reg;
@@ -220,6 +227,47 @@ static void dw8250_serial_out38x(struct uart_port *p, unsigned int offset, u32 v
 	dw8250_serial_out(p, offset, value);
 }
 
+/* Drain FIFO and wait for USR to be not busy and TX/RX FIFO empty */
+static void dw8250_tx_wait_empty_apb(struct uart_port *p)
+{
+	unsigned int tries = 20000;
+	unsigned int delay_threshold = tries - 1000;
+	unsigned int usr;
+
+	while (tries--) {
+		usr = readl(DW8250_REG(p, DW_UART_USR));
+
+		/* Check UART free and TX/RX FIFO empty */
+		if ((usr & ~DW_UART_USR_TFNF) == DW_UART_USR_TFE)
+			break;
+
+		/* FIFO is still not empty, try to clear it */
+		if (tries < delay_threshold) {
+			writel(UART_FCR_ENABLE_FIFO, DW8250_REG(p, UART_FCR));
+			writel(UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |
+			UART_FCR_CLEAR_XMIT, DW8250_REG(p, UART_FCR));
+			writel(0, DW8250_REG(p, UART_FCR));
+			udelay (1);
+		}
+	}
+}
+
+static void dw8250_serial_outapb(struct uart_port *p, int offset, int value)
+{
+       struct dw8250_data *d = to_dw8250_data(p->private_data);
+
+	if(offset == UART_LCR && !d->uart_16550_compatible)
+		dw8250_tx_wait_empty_apb(p);
+
+	writel(value, DW8250_REG(p, offset));
+
+	if (offset == UART_LCR && !d->uart_16550_compatible) {
+		/* Check FIFO is left enabled and LCR was written */
+		writel(UART_FCR_ENABLE_FIFO, DW8250_REG(p, UART_FCR));
+		dw8250_check_lcr(p, value);
+	}
+}
+
 static u32 dw8250_serial_in(struct uart_port *p, unsigned int offset)
 {
 	u32 value = readb(p->membase + (offset << p->regshift));
@@ -520,6 +568,12 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data)
 		p->serial_in = dw8250_serial_in32;
 		data->uart_16550_compatible = true;
 	}
+	if (quirks & DW_UART_QUIRK_DWAPB) {
+		p->type = PORT_DWAPB;
+		p->flags |= UPF_FIXED_TYPE;
+		p->serial_out = dw8250_serial_outapb;
+		data->skip_autocfg = true;
+	}
 }
 
 static void dw8250_reset_control_assert(void *data)
@@ -755,6 +809,7 @@ static const struct dev_pm_ops dw8250_pm_ops = {
 
 static const struct dw8250_platform_data dw8250_dw_apb = {
 	.usr_reg = DW_UART_USR,
+	.quirks = DW_UART_QUIRK_APB,
 };
 
 static const struct dw8250_platform_data dw8250_octeon_3860_data = {
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 2da9db960d09..3882a71920f6 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -310,6 +310,14 @@ static const struct serial8250_config uart_config[] = {
 		.rxtrig_bytes	= {1, 8, 16, 30},
 		.flags		= UART_CAP_FIFO | UART_CAP_AFE,
 	},
+	[PORT_DWAPB] = {
+		.name		= "Synopsys DesignWare",
+		.fifo_size	= 16,
+		.tx_loadsz	= 16,
+		.fcr		= UART_FCR_ENABLE_FIFO |
+				  UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT,
+		.flags		= UART_CAP_FIFO | UART_CAP_AFE | UART_CAP_IRDA,
+	},
 };
 
 /* Uart divisor latch read */
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
index 9c007a106330..8386436b813f 100644
--- a/include/uapi/linux/serial_core.h
+++ b/include/uapi/linux/serial_core.h
@@ -231,6 +231,9 @@
 /* Sunplus UART */
 #define PORT_SUNPLUS	123
 
+/* Synopsys DesignWare */
+#define PORT_DWAPB		124
+
 /* Generic type identifier for ports which type is not important to userspace. */
 #define PORT_GENERIC	(-1)
 

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

* [PATCH v2] serial: 8250 dw: clear FIFO before writting LCR
@ 2025-08-19 19:13 adriana
  2025-08-20  4:01 ` Jiri Slaby
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: adriana @ 2025-08-19 19:13 UTC (permalink / raw)
  To: linux-serial, linux-kernel
  Cc: ilpo.jarvinnen, andriy.shevchenko, gregkh, jirislaby, john.ogness,
	Adriana Nicolae

This patch is proposing a custom configuration for Synopsys DesignWare
serial to be used by products with associated compatible string in the
device tree.

The PORT_DWAPB config will be used instead of the default PORT_16550A
which does not include the UART_FCR_CLEAR_RCVR and UART_FCR_CLEAR_XMIT
bits for the FIFO configuration register. Having those flags is necessary
to clear FIFO when the serial port is reconfigured with do_set_termios.

Additionally, inside the do_set_termios we use the LCR (Line Control
Register) to enable DLAB bit in order to access DLL/DLM (Divisor Latch
Low/High) registers for baud rate setting. These 2 registers are sharing
the same address space with UART_TX/UART_RX and UART_IER. The sequence is:

(1) enable DLAB -> (2) set baud -> (3) disable DLAB -> (4) reset FCR

When there is a TX or RX flow on the serial while we attempt to set/clear
DLAB, the LCR write will be ignored and we will get a IIR_BUSY interrupt
afterwards which is cleared by only reading the USR (UART status register).

The sequence above can leave the serial in an unstable state in two cases:

- if UART is busy while (1), then LCR is still pointing to the normal set of
registers, which means the code setting DLL/DLM is actually writing into TX or
modifying interrupts in UART_IER which may end with either a garbage character
on the console or with serial interrupts disabled.

- if UART is busy while (3), then LCR remains pointing to DLL/DLM instead of
moving back to RX/TX. The first transfer on the serial will be stuck because
the transmit/receive registers are not accessible unless the DLAB bit
is cleared.

The changes in this patch include a specific serial_out function for this UART
type similar to the one for Armada-38x devices in commit
b7639b0b15ddd1a4686b0142e70dfb122eefc88f with some changes in the tx_wait_empty
function to check the UART status by looking at the USR register and actively
try to clear FIFO to reduce time before a LCR write since the characters will
be lost otherwise after baud rate change.

The USR register may report that UART is busy even if TX/TX FIFO is already
empty so we will loop until all USR[0] (UART busy status) is cleared and USR[1]
TX FIFO is empty (RX FIFO bits should be 0 in this case).
Keeping the same timeout of 20ms as measurements with the 9600 baud when
the console was busy it took max 1.9ms to get the UART free state.

---
Changes in v2:
- Updated the mailing list.

Signed-off-by: Adriana Nicolae <adriana@arista.com>
---
 drivers/tty/serial/8250/8250_dw.c   |   52 +++++++++++++++++++++++++++++++++++
 drivers/tty/serial/8250/8250_port.c |    8 +++++
 include/uapi/linux/serial_core.h    |    3 ++
 3 files changed, 63 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index a53ba04d9770..985a2650f3f3 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -33,6 +33,9 @@
 /* Offsets for the DesignWare specific registers */
 #define DW_UART_USR	0x1f /* UART Status Register */
 #define DW_UART_DMASA	0xa8 /* DMA Software Ack */
+#define DW_UART_USR_BUSY 0x1 /* UART Busy status */
+#define DW_UART_USR_TFNF 0x2 /* UART TX FIFO not full */
+#define DW_UART_USR_TFE  0x4 /* UART TX FIFO empty */
 
 #define OCTEON_UART_USR	0x27 /* UART Status Register */
 
@@ -56,6 +59,10 @@
 #define DW_UART_QUIRK_IS_DMA_FC		BIT(3)
 #define DW_UART_QUIRK_APMC0D08		BIT(4)
 #define DW_UART_QUIRK_CPR_VALUE		BIT(5)
+#define DW_UART_QUIRK_APB		BIT(6)
+
+#define DW8250_REG( p, reg ) \
+	((void __iomem *)(p->membase + ((reg) << p->regshift)))
 
 struct dw8250_platform_data {
 	u8 usr_reg;
@@ -220,6 +227,47 @@ static void dw8250_serial_out38x(struct uart_port *p, unsigned int offset, u32 v
 	dw8250_serial_out(p, offset, value);
 }
 
+/* Drain FIFO and wait for USR to be not busy and TX/RX FIFO empty */
+static void dw8250_tx_wait_empty_apb(struct uart_port *p)
+{
+	unsigned int tries = 20000;
+	unsigned int delay_threshold = tries - 1000;
+	unsigned int usr;
+
+	while (tries--) {
+		usr = readl(DW8250_REG(p, DW_UART_USR));
+
+		/* Check UART free and TX/RX FIFO empty */
+		if ((usr & ~DW_UART_USR_TFNF) == DW_UART_USR_TFE)
+			break;
+
+		/* FIFO is still not empty, try to clear it */
+		if (tries < delay_threshold) {
+			writel(UART_FCR_ENABLE_FIFO, DW8250_REG(p, UART_FCR));
+			writel(UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |
+			UART_FCR_CLEAR_XMIT, DW8250_REG(p, UART_FCR));
+			writel(0, DW8250_REG(p, UART_FCR));
+			udelay (1);
+		}
+	}
+}
+
+static void dw8250_serial_outapb(struct uart_port *p, int offset, int value)
+{
+       struct dw8250_data *d = to_dw8250_data(p->private_data);
+
+	if(offset == UART_LCR && !d->uart_16550_compatible)
+		dw8250_tx_wait_empty_apb(p);
+
+	writel(value, DW8250_REG(p, offset));
+
+	if (offset == UART_LCR && !d->uart_16550_compatible) {
+		/* Check FIFO is left enabled and LCR was written */
+		writel(UART_FCR_ENABLE_FIFO, DW8250_REG(p, UART_FCR));
+		dw8250_check_lcr(p, value);
+	}
+}
+
 static u32 dw8250_serial_in(struct uart_port *p, unsigned int offset)
 {
 	u32 value = readb(p->membase + (offset << p->regshift));
@@ -520,6 +568,12 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data)
 		p->serial_in = dw8250_serial_in32;
 		data->uart_16550_compatible = true;
 	}
+	if (quirks & DW_UART_QUIRK_DWAPB) {
+		p->type = PORT_DWAPB;
+		p->flags |= UPF_FIXED_TYPE;
+		p->serial_out = dw8250_serial_outapb;
+		data->skip_autocfg = true;
+	}
 }
 
 static void dw8250_reset_control_assert(void *data)
@@ -755,6 +809,7 @@ static const struct dev_pm_ops dw8250_pm_ops = {
 
 static const struct dw8250_platform_data dw8250_dw_apb = {
 	.usr_reg = DW_UART_USR,
+	.quirks = DW_UART_QUIRK_APB,
 };
 
 static const struct dw8250_platform_data dw8250_octeon_3860_data = {
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 2da9db960d09..3882a71920f6 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -310,6 +310,14 @@ static const struct serial8250_config uart_config[] = {
 		.rxtrig_bytes	= {1, 8, 16, 30},
 		.flags		= UART_CAP_FIFO | UART_CAP_AFE,
 	},
+	[PORT_DWAPB] = {
+		.name		= "Synopsys DesignWare",
+		.fifo_size	= 16,
+		.tx_loadsz	= 16,
+		.fcr		= UART_FCR_ENABLE_FIFO |
+				  UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT,
+		.flags		= UART_CAP_FIFO | UART_CAP_AFE | UART_CAP_IRDA,
+	},
 };
 
 /* Uart divisor latch read */
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
index 9c007a106330..8386436b813f 100644
--- a/include/uapi/linux/serial_core.h
+++ b/include/uapi/linux/serial_core.h
@@ -231,6 +231,9 @@
 /* Sunplus UART */
 #define PORT_SUNPLUS	123
 
+/* Synopsys DesignWare */
+#define PORT_DWAPB		124
+
 /* Generic type identifier for ports which type is not important to userspace. */
 #define PORT_GENERIC	(-1)
 

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

* Re: [PATCH v2] serial: 8250 dw: clear FIFO before writting LCR
  2025-08-19 19:13 adriana
@ 2025-08-20  4:01 ` Jiri Slaby
  2025-08-20  4:06   ` Jiri Slaby
  2025-08-20  5:59 ` Greg KH
  2025-08-20  6:33 ` kernel test robot
  2 siblings, 1 reply; 8+ messages in thread
From: Jiri Slaby @ 2025-08-20  4:01 UTC (permalink / raw)
  To: adriana, linux-serial, linux-kernel
  Cc: ilpo.jarvinnen, andriy.shevchenko, gregkh, john.ogness

On 19. 08. 25, 21:13, adriana@arista.com wrote:
> This patch is proposing a custom configuration for Synopsys DesignWare
> serial to be used by products with associated compatible string in the
> device tree.
> 
> The PORT_DWAPB config will be used instead of the default PORT_16550A
> which does not include the UART_FCR_CLEAR_RCVR and UART_FCR_CLEAR_XMIT
> bits for the FIFO configuration register. Having those flags is necessary
> to clear FIFO when the serial port is reconfigured with do_set_termios.

How was this tested? I assume it does not even compile.

-- 
js
suse labs

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

* Re: [PATCH v2] serial: 8250 dw: clear FIFO before writting LCR
  2025-08-20  4:01 ` Jiri Slaby
@ 2025-08-20  4:06   ` Jiri Slaby
  0 siblings, 0 replies; 8+ messages in thread
From: Jiri Slaby @ 2025-08-20  4:06 UTC (permalink / raw)
  To: adriana, linux-serial, Linux kernel mailing list
  Cc: ilpo.jarvinen, andriy.shevchenko, gregkh, john.ogness

Huh, you mangled even e-mails:

5.1.0 - Unknown address error 550-'5.1.1 
<ilpo.jarvinnen@linux.intel.com>: Recipient address rejected: User 
unknown in virtual mailbox table'

<linux-kernel@vger.kernel.rg>: Host or domain name not found. Name service
     error for name=vger.kernel.rg type=AAAA: Host not found

On 20. 08. 25, 6:01, Jiri Slaby wrote:
> On 19. 08. 25, 21:13, adriana@arista.com wrote:
>> This patch is proposing a custom configuration for Synopsys DesignWare
>> serial to be used by products with associated compatible string in the
>> device tree.
>>
>> The PORT_DWAPB config will be used instead of the default PORT_16550A
>> which does not include the UART_FCR_CLEAR_RCVR and UART_FCR_CLEAR_XMIT
>> bits for the FIFO configuration register. Having those flags is necessary
>> to clear FIFO when the serial port is reconfigured with do_set_termios.
> 
> How was this tested? I assume it does not even compile.
> 

-- 
js
suse labs


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

* Re: [PATCH v2] serial: 8250 dw: clear FIFO before writting LCR
  2025-08-19 19:13 adriana
  2025-08-20  4:01 ` Jiri Slaby
@ 2025-08-20  5:59 ` Greg KH
  2025-08-20  6:33 ` kernel test robot
  2 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2025-08-20  5:59 UTC (permalink / raw)
  To: adriana
  Cc: linux-serial, linux-kernel, ilpo.jarvinnen, andriy.shevchenko,
	jirislaby, john.ogness

On Tue, Aug 19, 2025 at 12:13:14PM -0700, adriana@arista.com wrote:
> The USR register may report that UART is busy even if TX/TX FIFO is already
> empty so we will loop until all USR[0] (UART busy status) is cleared and USR[1]
> TX FIFO is empty (RX FIFO bits should be 0 in this case).
> Keeping the same timeout of 20ms as measurements with the 9600 baud when
> the console was busy it took max 1.9ms to get the UART free state.
> 
> ---
> Changes in v2:
> - Updated the mailing list.
> 
> Signed-off-by: Adriana Nicolae <adriana@arista.com>
> ---

Your signed-off-by needs to be above the --- line.  Take a look at a few
of the thousands of examples on the mailing list for how to get this
right.

One tiny comment:

> diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
> index 9c007a106330..8386436b813f 100644
> --- a/include/uapi/linux/serial_core.h
> +++ b/include/uapi/linux/serial_core.h
> @@ -231,6 +231,9 @@
>  /* Sunplus UART */
>  #define PORT_SUNPLUS	123
>  
> +/* Synopsys DesignWare */
> +#define PORT_DWAPB		124

Why do you need to export this value to userspace?

thanks,

greg k-h

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

* Re: [PATCH v2] serial: 8250 dw: clear FIFO before writting LCR
  2025-08-19 19:06 [PATCH v2] serial: 8250 dw: clear FIFO before writting LCR adriana
@ 2025-08-20  6:00 ` Greg KH
  2025-08-20  6:10   ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2025-08-20  6:00 UTC (permalink / raw)
  To: adriana
  Cc: linux-serial, linux-kernel, ilpo.jarvinnen, andriy.shevchenko,
	jirislaby, john.ogness

On Tue, Aug 19, 2025 at 12:06:21PM -0700, adriana@arista.com wrote:
> This patch is proposing a custom configuration for Synopsys DesignWare
> serial to be used by products with associated compatible string in the
> device tree.

<snip>

you sent 2 v2 patches?  Which one is which?

confused,

greg k-h

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

* Re: [PATCH v2] serial: 8250 dw: clear FIFO before writting LCR
  2025-08-20  6:00 ` Greg KH
@ 2025-08-20  6:10   ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2025-08-20  6:10 UTC (permalink / raw)
  To: adriana
  Cc: linux-serial, linux-kernel, ilpo.jarvinnen, andriy.shevchenko,
	jirislaby, john.ogness

On Wed, Aug 20, 2025 at 08:00:15AM +0200, Greg KH wrote:
> On Tue, Aug 19, 2025 at 12:06:21PM -0700, adriana@arista.com wrote:
> > This patch is proposing a custom configuration for Synopsys DesignWare
> > serial to be used by products with associated compatible string in the
> > device tree.
> 
> <snip>
> 
> you sent 2 v2 patches?  Which one is which?

Oops, no, I got 3 different ones?

Still confused,

greg k-h

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

* Re: [PATCH v2] serial: 8250 dw: clear FIFO before writting LCR
  2025-08-19 19:13 adriana
  2025-08-20  4:01 ` Jiri Slaby
  2025-08-20  5:59 ` Greg KH
@ 2025-08-20  6:33 ` kernel test robot
  2 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2025-08-20  6:33 UTC (permalink / raw)
  To: adriana, linux-serial, linux-kernel
  Cc: oe-kbuild-all, ilpo.jarvinnen, andriy.shevchenko, gregkh,
	jirislaby, john.ogness, Adriana Nicolae

Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on tty/tty-testing]
[also build test ERROR on tty/tty-next tty/tty-linus linus/master v6.17-rc2 next-20250819]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/adriana-arista-com/serial-8250-dw-clear-FIFO-before-writting-LCR/20250820-031410
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
patch link:    https://lore.kernel.org/r/20250819191314.3452283-1-adriana%40arista.com
patch subject: [PATCH v2] serial: 8250 dw: clear FIFO before writting LCR
config: i386-randconfig-002-20250820 (https://download.01.org/0day-ci/archive/20250820/202508201459.9CiUfUhb-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250820/202508201459.9CiUfUhb-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202508201459.9CiUfUhb-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/tty/serial/8250/8250_dw.c: In function 'dw8250_serial_outapb':
>> drivers/tty/serial/8250/8250_dw.c:267:17: error: too few arguments to function 'dw8250_check_lcr'
     267 |                 dw8250_check_lcr(p, value);
         |                 ^~~~~~~~~~~~~~~~
   drivers/tty/serial/8250/8250_dw.c:155:13: note: declared here
     155 | static void dw8250_check_lcr(struct uart_port *p, unsigned int offset, u32 value)
         |             ^~~~~~~~~~~~~~~~
   drivers/tty/serial/8250/8250_dw.c: In function 'dw8250_quirks':
>> drivers/tty/serial/8250/8250_dw.c:571:22: error: 'DW_UART_QUIRK_DWAPB' undeclared (first use in this function); did you mean 'DW_UART_QUIRK_APB'?
     571 |         if (quirks & DW_UART_QUIRK_DWAPB) {
         |                      ^~~~~~~~~~~~~~~~~~~
         |                      DW_UART_QUIRK_APB
   drivers/tty/serial/8250/8250_dw.c:571:22: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/tty/serial/8250/8250_dw.c:574:31: error: assignment to 'void (*)(struct uart_port *, unsigned int,  u32)' {aka 'void (*)(struct uart_port *, unsigned int,  unsigned int)'} from incompatible pointer type 'void (*)(struct uart_port *, int,  int)' [-Werror=incompatible-pointer-types]
     574 |                 p->serial_out = dw8250_serial_outapb;
         |                               ^
   cc1: some warnings being treated as errors


vim +/dw8250_check_lcr +267 drivers/tty/serial/8250/8250_dw.c

   254	
   255	static void dw8250_serial_outapb(struct uart_port *p, int offset, int value)
   256	{
   257	       struct dw8250_data *d = to_dw8250_data(p->private_data);
   258	
   259		if(offset == UART_LCR && !d->uart_16550_compatible)
   260			dw8250_tx_wait_empty_apb(p);
   261	
   262		writel(value, DW8250_REG(p, offset));
   263	
   264		if (offset == UART_LCR && !d->uart_16550_compatible) {
   265			/* Check FIFO is left enabled and LCR was written */
   266			writel(UART_FCR_ENABLE_FIFO, DW8250_REG(p, UART_FCR));
 > 267			dw8250_check_lcr(p, value);
   268		}
   269	}
   270	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2025-08-20  6:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19 19:06 [PATCH v2] serial: 8250 dw: clear FIFO before writting LCR adriana
2025-08-20  6:00 ` Greg KH
2025-08-20  6:10   ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2025-08-19 19:13 adriana
2025-08-20  4:01 ` Jiri Slaby
2025-08-20  4:06   ` Jiri Slaby
2025-08-20  5:59 ` Greg KH
2025-08-20  6:33 ` kernel test robot

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