Skip to content

Commit 1e592e9

Browse files
committed
Merge tag 'tty-6.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial driver fixes from Greg KH: "Here are three small serial/tty driver fixes for 6.8-rc6 that resolve the following reported errors: - riscv hvc console driver fix that was reported by many - amba-pl011 serial driver fix for RS485 mode - stm32 serial driver fix for RS485 mode All of these have been in linux-next all week with no reported problems" * tag 'tty-6.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: serial: amba-pl011: Fix DMA transmission in RS485 mode serial: stm32: do not always set SER_RS485_RX_DURING_TX if RS485 is enabled tty: hvc: Don't enable the RISC-V SBI console by default
2 parents 1eee4ef + 3b69e32 commit 1e592e9

File tree

3 files changed

+38
-34
lines changed

3 files changed

+38
-34
lines changed

drivers/tty/hvc/Kconfig

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,15 @@ config HVC_DCC_SERIALIZE_SMP
108108

109109
config HVC_RISCV_SBI
110110
bool "RISC-V SBI console support"
111-
depends on RISCV_SBI
111+
depends on RISCV_SBI && NONPORTABLE
112112
select HVC_DRIVER
113113
help
114114
This enables support for console output via RISC-V SBI calls, which
115-
is normally used only during boot to output printk.
115+
is normally used only during boot to output printk. This driver
116+
conflicts with real console drivers and should not be enabled on
117+
systems that directly access the console.
116118

117-
If you don't know what do to here, say Y.
119+
If you don't know what do to here, say N.
118120

119121
config HVCS
120122
tristate "IBM Hypervisor Virtual Console Server support"

drivers/tty/serial/amba-pl011.c

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,11 +1339,41 @@ static void pl011_start_tx_pio(struct uart_amba_port *uap)
13391339
}
13401340
}
13411341

1342+
static void pl011_rs485_tx_start(struct uart_amba_port *uap)
1343+
{
1344+
struct uart_port *port = &uap->port;
1345+
u32 cr;
1346+
1347+
/* Enable transmitter */
1348+
cr = pl011_read(uap, REG_CR);
1349+
cr |= UART011_CR_TXE;
1350+
1351+
/* Disable receiver if half-duplex */
1352+
if (!(port->rs485.flags & SER_RS485_RX_DURING_TX))
1353+
cr &= ~UART011_CR_RXE;
1354+
1355+
if (port->rs485.flags & SER_RS485_RTS_ON_SEND)
1356+
cr &= ~UART011_CR_RTS;
1357+
else
1358+
cr |= UART011_CR_RTS;
1359+
1360+
pl011_write(cr, uap, REG_CR);
1361+
1362+
if (port->rs485.delay_rts_before_send)
1363+
mdelay(port->rs485.delay_rts_before_send);
1364+
1365+
uap->rs485_tx_started = true;
1366+
}
1367+
13421368
static void pl011_start_tx(struct uart_port *port)
13431369
{
13441370
struct uart_amba_port *uap =
13451371
container_of(port, struct uart_amba_port, port);
13461372

1373+
if ((uap->port.rs485.flags & SER_RS485_ENABLED) &&
1374+
!uap->rs485_tx_started)
1375+
pl011_rs485_tx_start(uap);
1376+
13471377
if (!pl011_dma_tx_start(uap))
13481378
pl011_start_tx_pio(uap);
13491379
}
@@ -1424,42 +1454,12 @@ static bool pl011_tx_char(struct uart_amba_port *uap, unsigned char c,
14241454
return true;
14251455
}
14261456

1427-
static void pl011_rs485_tx_start(struct uart_amba_port *uap)
1428-
{
1429-
struct uart_port *port = &uap->port;
1430-
u32 cr;
1431-
1432-
/* Enable transmitter */
1433-
cr = pl011_read(uap, REG_CR);
1434-
cr |= UART011_CR_TXE;
1435-
1436-
/* Disable receiver if half-duplex */
1437-
if (!(port->rs485.flags & SER_RS485_RX_DURING_TX))
1438-
cr &= ~UART011_CR_RXE;
1439-
1440-
if (port->rs485.flags & SER_RS485_RTS_ON_SEND)
1441-
cr &= ~UART011_CR_RTS;
1442-
else
1443-
cr |= UART011_CR_RTS;
1444-
1445-
pl011_write(cr, uap, REG_CR);
1446-
1447-
if (port->rs485.delay_rts_before_send)
1448-
mdelay(port->rs485.delay_rts_before_send);
1449-
1450-
uap->rs485_tx_started = true;
1451-
}
1452-
14531457
/* Returns true if tx interrupts have to be (kept) enabled */
14541458
static bool pl011_tx_chars(struct uart_amba_port *uap, bool from_irq)
14551459
{
14561460
struct circ_buf *xmit = &uap->port.state->xmit;
14571461
int count = uap->fifosize >> 1;
14581462

1459-
if ((uap->port.rs485.flags & SER_RS485_ENABLED) &&
1460-
!uap->rs485_tx_started)
1461-
pl011_rs485_tx_start(uap);
1462-
14631463
if (uap->port.x_char) {
14641464
if (!pl011_tx_char(uap, uap->port.x_char, from_irq))
14651465
return true;

drivers/tty/serial/stm32-usart.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ static int stm32_usart_config_rs485(struct uart_port *port, struct ktermios *ter
251251
writel_relaxed(cr3, port->membase + ofs->cr3);
252252
writel_relaxed(cr1, port->membase + ofs->cr1);
253253

254-
rs485conf->flags |= SER_RS485_RX_DURING_TX;
254+
if (!port->rs485_rx_during_tx_gpio)
255+
rs485conf->flags |= SER_RS485_RX_DURING_TX;
256+
255257
} else {
256258
stm32_usart_clr_bits(port, ofs->cr3,
257259
USART_CR3_DEM | USART_CR3_DEP);

0 commit comments

Comments
 (0)