History

serial: 8250: Add IIR FIFOs enabled field properly

Don't use magic literals & comments but define a real field instead for UART_IIR_FIFO_ENABLED and name also the values.

Ilpo Järvinen committed 3 years ago

Commit 3398cc41 parent 67a9aee2 files · +11 −10Browse files

Unified · Split

2 files
  1. drivers/tty/serial/8250/8250_port.c +7 −10
  2. include/uapi/linux/serial_reg.h +4 −0
drivers/tty/serial/8250/8250_port.c+7−10
@@ -1293,22 +1293,19 @@ static void autoconfig(struct uart_8250_port *up) · 1292 unmodified lines
12931293
12941294 serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO);
12951295
1296− /* Assign this as it is to truncate any bits above 7. */
1297− scratch = serial_in(up, UART_IIR);
1298−
1299− switch (scratch >> 6) {
1300− case 0:
1296+ switch (serial_in(up, UART_IIR) & UART_IIR_FIFO_ENABLED) {
1297+ case UART_IIR_FIFO_ENABLED_8250:
13011298 autoconfig_8250(up);
13021299 break;
1303− case 1:
1304− port->type = PORT_UNKNOWN;
1305− break;
1306− case 2:
1300+ case UART_IIR_FIFO_ENABLED_16550:
13071301 port->type = PORT_16550;
13081302 break;
1309− case 3:
1303+ case UART_IIR_FIFO_ENABLED_16550A:
13101304 autoconfig_16550a(up);
13111305 break;
1306+ default:
1307+ port->type = PORT_UNKNOWN;
1308+ break;
13121309 }
13131310
13141311 #ifdef CONFIG_SERIAL_8250_RSA
include/uapi/linux/serial_reg.h+4−0
@@ -44,6 +44,10 @@ · 43 unmodified lines
4444 #define UART_IIR_RX_TIMEOUT 0x0c /* OMAP RX Timeout interrupt */
4545 #define UART_IIR_XOFF 0x10 /* OMAP XOFF/Special Character */
4646 #define UART_IIR_CTS_RTS_DSR 0x20 /* OMAP CTS/RTS/DSR Change */
47+#define UART_IIR_FIFO_ENABLED 0xc0 /* FIFOs enabled / port type identification */
48+#define UART_IIR_FIFO_ENABLED_8250 0x00 /* 8250: no FIFO */
49+#define UART_IIR_FIFO_ENABLED_16550 0x80 /* 16550: (broken/unusable) FIFO */
50+#define UART_IIR_FIFO_ENABLED_16550A 0xc0 /* 16550A: FIFO enabled */
4751
4852 #define UART_FCR 2 /* Out: FIFO Control Register */
4953 #define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t