Skip to contentSkip to conversation

serial: 8250_bcm7271: improve bcm7271 8250 port

PATCH In review Justin Chen 2 participants 2 messages Aug 21, 2023 – Aug 22, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 serial: 8250_bcm7271: improve bcm7271 8250 port

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.

---
v4
- Switch PORT_BCM7271 back to 76

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       | 3 +++
 3 files changed, 12 insertions(+), 3 deletions(-)
drivers/tty/serial/8250/8250_bcm7271.c +1 -3
index d4b05d7ad9e8..aa5aff046756 100644
@@ -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");
drivers/tty/serial/8250/8250_port.c +8 -0
index 16aeb1420137..7fb1d7c00001 100644
@@ -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 */
include/uapi/linux/serial_core.h +3 -0
index 281fa286555c..7e66067b6c06 100644
@@ -144,6 +144,9 @@
 /* Blackfin bf5xx */
 #define PORT_BFIN	75
 
+/* Broadcom BCM7271 UART */
+#define PORT_BCM7271	76
+
 /* Broadcom SB1250, etc. SOC */
 #define PORT_SB1250_DUART	77
 
Signature · 1 line
2.7.4
Reviewed-by on v4 1/1
#1 lore raw
Quoted 7 lines · Justin Chen

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.

FWIW,

...

drivers/tty/serial/8250/8250_port.c static const struct serial8250_config uart_config[] = { · line 332

Quoted 8 lines
drivers/tty/serial/8250/8250_port.c +8 -0
+	[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,
+	},

Strictly speaking it's better to keep this ordered according to the number, but it's fine like this anyway.

Signature · 2 lines
With Best Regards,
Andy Shevchenko