Skip to content

Commit 6974711

Browse files
Gerhard Engledergregkh
authored andcommitted
serial: Keep rs485 settings for devices without firmware node
Commit fe7f0fa ("serial: 8250: Support rs485 devicetree properties") retrieves rs485 properties for 8250 drivers. These properties are read from the firmware node of the device within uart_get_rs485_mode(). If the firmware node does not exist, then the rs485 flags are still reset. Thus, 8250 driver cannot set rs485 flags to enable a defined rs485 mode during driver loading. This is no problem so far, as no 8250 driver sets the rs485 flags. The default rs485 mode can also be set by firmware nodes. But for some devices a firmware node does not exist. E.g., for a PCIe based serial interface on x86 no device tree is available and the ACPI information of the BIOS often cannot by modified. In this case it shall be possible, that a driver works out of the box by setting a reasonable default rs485 mode. If no firmware node exists, then it should be possible for the driver to set a reasonable default rs485 mode. Therefore, reset rs485 flags only if a firmware node exists. Signed-off-by: Gerhard Engleder <eg@keba.com> Cc: Lukas Wunner <lukas@wunner.de> Reviewed-by: Lukas Wunner <lukas@wunner.de> Link: https://patch.msgid.link/20251023151229.11774-2-gerhard@engleder-embedded.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent abffd1e commit 6974711

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/tty/serial/serial_core.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3502,6 +3502,14 @@ int uart_get_rs485_mode(struct uart_port *port)
35023502
if (!(port->rs485_supported.flags & SER_RS485_ENABLED))
35033503
return 0;
35043504

3505+
/*
3506+
* Retrieve properties only if a firmware node exists. If no firmware
3507+
* node exists, then don't touch rs485 config and keep initial rs485
3508+
* properties set by driver.
3509+
*/
3510+
if (!dev_fwnode(dev))
3511+
return 0;
3512+
35053513
ret = device_property_read_u32_array(dev, "rs485-rts-delay",
35063514
rs485_delay, 2);
35073515
if (!ret) {

0 commit comments

Comments
 (0)