All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] serial: 8250_bcm7271: improve bcm7271 8250 port
@ 2023-08-18 21:26 Justin Chen
  2023-08-21  8:49 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Justin Chen @ 2023-08-18 21:26 UTC (permalink / raw)
  To: linux-serial
  Cc: Justin Chen, Al Cooper, Broadcom internal kernel review list,
	Greg Kroah-Hartman, Jiri Slaby, Ilpo Järvinen,
	Andy Shevchenko, Florian Fainelli, John Ogness, Jiaqing Zhao,
	open list:TTY LAYER

[-- Attachment #1: Type: text/plain, Size: 2907 bytes --]

The 8250 BCM7271 UART is not a direct match to PORT_16550A and other
generic ports do not match its hardware capabilities. PORT_ALTR matches
the rx trigger levels, but its vendor configurations are not compatible.
Unfortunately this means we need to create another port to fully capture
the hardware capabilities of the BCM7271 UART.

To alleviate some latency pressures, we default the rx trigger level to 8.

Signed-off-by: Justin Chen <justin.chen@broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Acked-by: Doug Berger <opendmb@gmail.com>
---
v3
	- Switch PORT_BCM7271 to 13
	- Added trailing comma to struct declaration

v2
	- Switch PORT_BCM7271 to 76
	- Elaborated commit message
	- Renamed port name

 drivers/tty/serial/8250/8250_bcm7271.c | 4 +---
 drivers/tty/serial/8250/8250_port.c    | 8 ++++++++
 include/uapi/linux/serial_core.h       | 1 +
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/8250/8250_bcm7271.c
index d4b05d7ad9e8..aa5aff046756 100644
--- a/drivers/tty/serial/8250/8250_bcm7271.c
+++ b/drivers/tty/serial/8250/8250_bcm7271.c
@@ -1042,7 +1042,7 @@ static int brcmuart_probe(struct platform_device *pdev)
 	dev_dbg(dev, "DMA is %senabled\n", priv->dma_enabled ? "" : "not ");
 
 	memset(&up, 0, sizeof(up));
-	up.port.type = PORT_16550A;
+	up.port.type = PORT_BCM7271;
 	up.port.uartclk = clk_rate;
 	up.port.dev = dev;
 	up.port.mapbase = mapbase;
@@ -1056,8 +1056,6 @@ static int brcmuart_probe(struct platform_device *pdev)
 		| UPF_FIXED_PORT | UPF_FIXED_TYPE;
 	up.port.dev = dev;
 	up.port.private_data = priv;
-	up.capabilities = UART_CAP_FIFO | UART_CAP_AFE;
-	up.port.fifosize = 32;
 
 	/* Check for a fixed line number */
 	ret = of_alias_get_id(np, "serial");
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 16aeb1420137..7fb1d7c00001 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -322,6 +322,14 @@ static const struct serial8250_config uart_config[] = {
 		.rxtrig_bytes   = {2, 66, 130, 194},
 		.flags          = UART_CAP_FIFO,
 	},
+	[PORT_BCM7271] = {
+		.name		= "Broadcom BCM7271 UART",
+		.fifo_size	= 32,
+		.tx_loadsz	= 32,
+		.fcr		= UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01,
+		.rxtrig_bytes	= {1, 8, 16, 30},
+		.flags		= UART_CAP_FIFO | UART_CAP_AFE,
+	},
 };
 
 /* Uart divisor latch read */
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
index 281fa286555c..04ea56a0c342 100644
--- a/include/uapi/linux/serial_core.h
+++ b/include/uapi/linux/serial_core.h
@@ -26,6 +26,7 @@
 /*
  * The type definitions.  These are from Ted Ts'o's serial.h
  */
+#define PORT_BCM7271	13	/* Broadcom BCM7271 UART */
 #define PORT_NS16550A	14
 #define PORT_XSCALE	15
 #define PORT_RM9000	16	/* PMC-Sierra RM9xxx internal UART */
-- 
2.7.4


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4206 bytes --]

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

* Re: [PATCH v3] serial: 8250_bcm7271: improve bcm7271 8250 port
  2023-08-18 21:26 [PATCH v3] serial: 8250_bcm7271: improve bcm7271 8250 port Justin Chen
@ 2023-08-21  8:49 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2023-08-21  8:49 UTC (permalink / raw)
  To: Justin Chen
  Cc: linux-serial, Al Cooper, Broadcom internal kernel review list,
	Greg Kroah-Hartman, Jiri Slaby, Ilpo Järvinen,
	Florian Fainelli, John Ogness, Jiaqing Zhao, open list:TTY LAYER

On Fri, Aug 18, 2023 at 02:26:08PM -0700, Justin Chen wrote:
> The 8250 BCM7271 UART is not a direct match to PORT_16550A and other
> generic ports do not match its hardware capabilities. PORT_ALTR matches
> the rx trigger levels, but its vendor configurations are not compatible.
> Unfortunately this means we need to create another port to fully capture
> the hardware capabilities of the BCM7271 UART.
> 
> To alleviate some latency pressures, we default the rx trigger level to 8.

...

> v3
> 	- Switch PORT_BCM7271 to 13

This was very bad suggestion, sorry. You need to use another gap.

So, that seventy something was good enough.


-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2023-08-21  8:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-18 21:26 [PATCH v3] serial: 8250_bcm7271: improve bcm7271 8250 port Justin Chen
2023-08-21  8:49 ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.