summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCrescent CY Hsieh <crescentcy.hsieh@moxa.com>2024-01-02 13:31:33 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-01-04 16:21:47 +0100
commit9903f2f2e1c0306df5e35080552502659475e751 (patch)
tree111d55eaf64e5d37579ededa5c92ebab20954bc1
parentd8a02844791360ed156ce5935bc50754ea22e299 (diff)
tty: serial: 8250: Set RS232 as default for Moxa PCIe board initialization
After switching the serial interface of the Moxa RS232 PCIe boards, it fails to reset to RS232 when attempting to reload 8250_pci driver. This patch set RS232 as the default setting during the initialization of Moxa PCIe board. Signed-off-by: Crescent CY Hsieh <crescentcy.hsieh@moxa.com> Link: https://lore.kernel.org/r/20240102053133.9795-1-crescentcy.hsieh@moxa.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/8250/8250_pci.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index 8ccf691935b7..0d35c77fad9e 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -2039,12 +2039,13 @@ static int pci_moxa_init(struct pci_dev *dev)
unsigned short device = dev->device;
resource_size_t iobar_addr = pci_resource_start(dev, 2);
unsigned int num_ports = (device & 0x00F0) >> 4, i;
- u8 val;
+ u8 val, init_mode = MOXA_RS232;
if (!(pci_moxa_supported_rs(dev) & MOXA_SUPP_RS232)) {
- for (i = 0; i < num_ports; ++i)
- pci_moxa_set_interface(dev, i, MOXA_RS422);
+ init_mode = MOXA_RS422;
}
+ for (i = 0; i < num_ports; ++i)
+ pci_moxa_set_interface(dev, i, init_mode);
/*
* Enable hardware buffer to prevent break signal output when system boots up.