From: Jiri Slaby <jirislaby@kernel.org>
To: Crescent Hsieh <crescentcy.hsieh@moxa.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH 1/6] tty: serial: 8250: Fix the amount of ports doesn't match the device
Date: Tue, 11 Jun 2024 09:39:34 +0200 [thread overview]
Message-ID: <4a748c05-c74c-4b4b-bacf-664b774a490e@kernel.org> (raw)
In-Reply-To: <20240607114336.4496-2-crescentcy.hsieh@moxa.com>
On 07. 06. 24, 13:43, Crescent Hsieh wrote:
> Normally, the amount of ports is written at the third digit of device ID
> of Moxa PCI boards, for example: `0x1121` indicates a 2 ports device.
>
> However, `CP116E_A_A` and `CP116E_A_B` are two exceptions, which has 8
> ports but the third digit of device ID is `6`.
>
> This patch fixes the issue above by adding checks.
>
> Signed-off-by: Crescent Hsieh <crescentcy.hsieh@moxa.com>
> ---
> drivers/tty/serial/8250/8250_pci.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
> index 40af74b55933..4e88ee07e548 100644
> --- a/drivers/tty/serial/8250/8250_pci.c
> +++ b/drivers/tty/serial/8250/8250_pci.c
> @@ -2041,6 +2041,10 @@ static int pci_moxa_init(struct pci_dev *dev)
> unsigned int num_ports = (device & 0x00F0) >> 4, i;
> u8 val, init_mode = MOXA_RS232;
>
> + if (device == PCI_DEVICE_ID_MOXA_CP116E_A_A ||
> + device == PCI_DEVICE_ID_MOXA_CP116E_A_B)
> + num_ports = 8;
Can you perhaps introduce a helper like:
static unsigned short mxser_get_nports(struct pci_dev *pdev)
{
switch (pdev->device) {
case ...CP116E_A_A:
case ...CP116E_A_B:
return 8;
}
return FIELD_GET(0x00F0, pdev->device);
}
?
> +
> if (!(pci_moxa_supported_rs(dev) & MOXA_SUPP_RS232)) {
> init_mode = MOXA_RS422;
> }
--
js
suse labs
next prev parent reply other threads:[~2024-06-11 7:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 11:43 [PATCH 0/6] Adjustments and Enhancements for MOXA PCI Serial Boards Crescent Hsieh
2024-06-07 11:43 ` [PATCH 1/6] tty: serial: 8250: Fix the amount of ports doesn't match the device Crescent Hsieh
2024-06-08 9:58 ` Andy Shevchenko
2024-06-11 7:39 ` Jiri Slaby [this message]
2024-06-07 11:43 ` [PATCH 2/6] tty: serial: 8250: Add 2 ports PCI configuration for 921600 BAR 2 Crescent Hsieh
2024-06-07 11:43 ` [PATCH 3/6] tty: mxser: serial: 8250: Relocate device IDs from mxser to 8250_pci Crescent Hsieh
2024-06-11 7:42 ` Jiri Slaby
2024-06-13 10:03 ` Crescent CY Hsieh
2024-06-07 11:43 ` [PATCH 4/6] tty: serial: 8250: Add check for setting default serial interface Crescent Hsieh
2024-06-08 9:57 ` Andy Shevchenko
2024-06-07 11:43 ` [PATCH 5/6] tty: serial: 8250: Add support for Moxa PCIe boards to switch interface Crescent Hsieh
2024-06-08 9:51 ` Andy Shevchenko
2024-06-07 11:43 ` [PATCH 6/6] tty: serial: 8250: Add support for MUEX50 UART Crescent Hsieh
2024-06-08 9:52 ` Andy Shevchenko
2024-06-08 9:47 ` [PATCH 0/6] Adjustments and Enhancements for MOXA PCI Serial Boards Andy Shevchenko
2024-06-13 10:15 ` Crescent CY Hsieh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4a748c05-c74c-4b4b-bacf-664b774a490e@kernel.org \
--to=jirislaby@kernel.org \
--cc=crescentcy.hsieh@moxa.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).