Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'tty-6.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull serial driver fixes from Greg KH:
"Here are some small serial driver fixes for some reported problems.
Nothing major, just:

- sc16is7xx irq check fix

- 8250 fifo underflow fix

- serial_port and 8250 iotype fixes

Most of these have been in linux-next already, and all have passed
0-day testing"

* tag 'tty-6.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
serial: 8250: Fix fifo underflow on flush
serial: 8250_pnp: Remove unneeded ->iotype assignment
serial: 8250_platform: Remove unneeded ->iotype assignment
serial: 8250_of: Remove unneeded ->iotype assignment
serial: port: Make ->iotype validation global in __uart_read_properties()
serial: port: Always update ->iotype in __uart_read_properties()
serial: port: Assign ->iotype correctly when ->iobase is set
serial: sc16is7xx: Fix IRQ number check behavior

+35 -26
+2
drivers/tty/serial/8250/8250.h
··· 374 374 375 375 #ifdef CONFIG_SERIAL_8250_DMA 376 376 extern int serial8250_tx_dma(struct uart_8250_port *); 377 + extern void serial8250_tx_dma_flush(struct uart_8250_port *); 377 378 extern int serial8250_rx_dma(struct uart_8250_port *); 378 379 extern void serial8250_rx_dma_flush(struct uart_8250_port *); 379 380 extern int serial8250_request_dma(struct uart_8250_port *); ··· 407 406 { 408 407 return -1; 409 408 } 409 + static inline void serial8250_tx_dma_flush(struct uart_8250_port *p) { } 410 410 static inline int serial8250_rx_dma(struct uart_8250_port *p) 411 411 { 412 412 return -1;
+16
drivers/tty/serial/8250/8250_dma.c
··· 149 149 return ret; 150 150 } 151 151 152 + void serial8250_tx_dma_flush(struct uart_8250_port *p) 153 + { 154 + struct uart_8250_dma *dma = p->dma; 155 + 156 + if (!dma->tx_running) 157 + return; 158 + 159 + /* 160 + * kfifo_reset() has been called by the serial core, avoid 161 + * advancing and underflowing in __dma_tx_complete(). 162 + */ 163 + dma->tx_size = 0; 164 + 165 + dmaengine_terminate_async(dma->rxchan); 166 + } 167 + 152 168 int serial8250_rx_dma(struct uart_8250_port *p) 153 169 { 154 170 struct uart_8250_dma *dma = p->dma;
-1
drivers/tty/serial/8250/8250_of.c
··· 110 110 spin_lock_init(&port->lock); 111 111 112 112 if (resource_type(&resource) == IORESOURCE_IO) { 113 - port->iotype = UPIO_PORT; 114 113 port->iobase = resource.start; 115 114 } else { 116 115 port->mapbase = resource.start;
-9
drivers/tty/serial/8250/8250_platform.c
··· 112 112 struct device *dev = &pdev->dev; 113 113 struct uart_8250_port uart = { }; 114 114 struct resource *regs; 115 - unsigned char iotype; 116 115 int ret, line; 117 116 118 117 regs = platform_get_mem_or_io(pdev, 0); ··· 121 122 switch (resource_type(regs)) { 122 123 case IORESOURCE_IO: 123 124 uart.port.iobase = regs->start; 124 - iotype = UPIO_PORT; 125 125 break; 126 126 case IORESOURCE_MEM: 127 127 uart.port.mapbase = regs->start; 128 128 uart.port.mapsize = resource_size(regs); 129 129 uart.port.flags = UPF_IOREMAP; 130 - iotype = UPIO_MEM; 131 130 break; 132 131 default: 133 132 return -EINVAL; ··· 143 146 ret = 0; 144 147 if (ret) 145 148 return ret; 146 - 147 - /* 148 - * The previous call may not set iotype correctly when reg-io-width 149 - * property is absent and it doesn't support IO port resource. 150 - */ 151 - uart.port.iotype = iotype; 152 149 153 150 line = serial8250_register_8250_port(&uart); 154 151 if (line < 0)
-10
drivers/tty/serial/8250/8250_pnp.c
··· 436 436 { 437 437 struct uart_8250_port uart, *port; 438 438 int ret, flags = dev_id->driver_data; 439 - unsigned char iotype; 440 439 long line; 441 440 442 441 if (flags & UNKNOWN_DEV) { ··· 447 448 memset(&uart, 0, sizeof(uart)); 448 449 if ((flags & CIR_PORT) && pnp_port_valid(dev, 2)) { 449 450 uart.port.iobase = pnp_port_start(dev, 2); 450 - iotype = UPIO_PORT; 451 451 } else if (pnp_port_valid(dev, 0)) { 452 452 uart.port.iobase = pnp_port_start(dev, 0); 453 - iotype = UPIO_PORT; 454 453 } else if (pnp_mem_valid(dev, 0)) { 455 454 uart.port.mapbase = pnp_mem_start(dev, 0); 456 455 uart.port.mapsize = pnp_mem_len(dev, 0); 457 - iotype = UPIO_MEM; 458 456 uart.port.flags = UPF_IOREMAP; 459 457 } else 460 458 return -ENODEV; ··· 466 470 ret = 0; 467 471 if (ret) 468 472 return ret; 469 - 470 - /* 471 - * The previous call may not set iotype correctly when reg-io-width 472 - * property is absent and it doesn't support IO port resource. 473 - */ 474 - uart.port.iotype = iotype; 475 473 476 474 if (flags & CIR_PORT) { 477 475 uart.port.flags |= UPF_FIXED_PORT | UPF_FIXED_TYPE;
+9
drivers/tty/serial/8250/8250_port.c
··· 2555 2555 serial8250_do_shutdown(port); 2556 2556 } 2557 2557 2558 + static void serial8250_flush_buffer(struct uart_port *port) 2559 + { 2560 + struct uart_8250_port *up = up_to_u8250p(port); 2561 + 2562 + if (up->dma) 2563 + serial8250_tx_dma_flush(up); 2564 + } 2565 + 2558 2566 static unsigned int serial8250_do_get_divisor(struct uart_port *port, 2559 2567 unsigned int baud, 2560 2568 unsigned int *frac) ··· 3252 3244 .break_ctl = serial8250_break_ctl, 3253 3245 .startup = serial8250_startup, 3254 3246 .shutdown = serial8250_shutdown, 3247 + .flush_buffer = serial8250_flush_buffer, 3255 3248 .set_termios = serial8250_set_termios, 3256 3249 .set_ldisc = serial8250_set_ldisc, 3257 3250 .pm = serial8250_pm,
+1 -1
drivers/tty/serial/sc16is7xx.c
··· 1561 1561 /* Always ask for fixed clock rate from a property. */ 1562 1562 device_property_read_u32(dev, "clock-frequency", &uartclk); 1563 1563 1564 - s->polling = !!irq; 1564 + s->polling = (irq <= 0); 1565 1565 if (s->polling) 1566 1566 dev_dbg(dev, 1567 1567 "No interrupt pin definition, falling back to polling mode\n");
+7 -5
drivers/tty/serial/serial_port.c
··· 173 173 * The caller is responsible to initialize the following fields of the @port 174 174 * ->dev (must be valid) 175 175 * ->flags 176 + * ->iobase 176 177 * ->mapbase 177 178 * ->mapsize 178 179 * ->regshift (if @use_defaults is false) ··· 215 214 /* Read the registers I/O access type (default: MMIO 8-bit) */ 216 215 ret = device_property_read_u32(dev, "reg-io-width", &value); 217 216 if (ret) { 218 - port->iotype = UPIO_MEM; 217 + port->iotype = port->iobase ? UPIO_PORT : UPIO_MEM; 219 218 } else { 220 219 switch (value) { 221 220 case 1: ··· 228 227 port->iotype = device_is_big_endian(dev) ? UPIO_MEM32BE : UPIO_MEM32; 229 228 break; 230 229 default: 231 - if (!use_defaults) { 232 - dev_err(dev, "Unsupported reg-io-width (%u)\n", value); 233 - return -EINVAL; 234 - } 235 230 port->iotype = UPIO_UNKNOWN; 236 231 break; 237 232 } 233 + } 234 + 235 + if (!use_defaults && port->iotype == UPIO_UNKNOWN) { 236 + dev_err(dev, "Unsupported reg-io-width (%u)\n", value); 237 + return -EINVAL; 238 238 } 239 239 240 240 /* Read the address mapping base offset (default: no offset) */