mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 07:47:50 +00:00
serial: Keep rs485 settings for devices without firmware node
Commit fe7f0fa43c ("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
abffd1e6c4
commit
6974711cf7
@@ -3502,6 +3502,14 @@ int uart_get_rs485_mode(struct uart_port *port)
|
||||
if (!(port->rs485_supported.flags & SER_RS485_ENABLED))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Retrieve properties only if a firmware node exists. If no firmware
|
||||
* node exists, then don't touch rs485 config and keep initial rs485
|
||||
* properties set by driver.
|
||||
*/
|
||||
if (!dev_fwnode(dev))
|
||||
return 0;
|
||||
|
||||
ret = device_property_read_u32_array(dev, "rs485-rts-delay",
|
||||
rs485_delay, 2);
|
||||
if (!ret) {
|
||||
|
||||
Reference in New Issue
Block a user