* [PATCH] serial: 8250_exar: Bug fix for determination of number of ports for Commtech PCIe cards
@ 2020-08-12 21:49 Valmer Huhn
2020-08-13 13:51 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Valmer Huhn @ 2020-08-12 21:49 UTC (permalink / raw)
To: gregkh, andriy.shevchenko, sudip.mukherjee, jan.kiszka; +Cc: linux-serial
serial: 8250_exar: Bug fix for determination of number of ports for
Commtech PCIe cards
The following line is used to determine the number of ports for each exar
board in a/drivers/tty/serial/8250/8250_exar.c:589
nr_ports = board->num_ports ? board->num_ports : pcidev->device & 0x0f;
If the number of ports a card has is not explicitly specified, it defaults
to the rightmost 4 bits of the PCI device ID. This is prone to error since
not all PCI device IDs contain a number which corresponds to the number of
ports that card provides.
This particular case involves COMMTECH_4224PCIE and COMMTECH_4228PCIE
cards with device ID 0x0020 and 0x0021. Currently the multiport cards
receive 0 and 1 port instead of 4 and 8 ports respectively.
To fix this, each Commtech Fastcom PCIe card is given a struct where the
number of ports is explicitly specified. This ensures 'board->num_ports'
is used instead of the default 'pcidev->device & 0x0f'.
Signed-off-by: Valmer Huhn <valmer.huhn@concurrent-rt.com>
Tested-by: Valmer Huhn <valmer.huhn@concurrent-rt.com>
---
Thank you,
Valmer Huhn
diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
index ddb6aeb76dc5..793906afb0f6 100644
--- a/drivers/tty/serial/8250/8250_exar.c
+++ b/drivers/tty/serial/8250/8250_exar.c
@@ -734,6 +734,24 @@ static const struct exar8250_board pbn_exar_XR17V35x = {
.exit = pci_xr17v35x_exit,
};
+static const struct exar8250_board pbn_fastcom_XR17V352 = {
+ .num_ports = 2,
+ .setup = pci_xr17v35x_setup,
+ .exit = pci_xr17v35x_exit,
+};
+
+static const struct exar8250_board pbn_fastcom_XR17V354 = {
+ .num_ports = 4,
+ .setup = pci_xr17v35x_setup,
+ .exit = pci_xr17v35x_exit,
+};
+
+static const struct exar8250_board pbn_fastcom_XR17V358 = {
+ .num_ports = 8,
+ .setup = pci_xr17v35x_setup,
+ .exit = pci_xr17v35x_exit,
+};
+
static const struct exar8250_board pbn_exar_XR17V4358 = {
.num_ports = 12,
.setup = pci_xr17v35x_setup,
@@ -801,9 +819,9 @@ static const struct pci_device_id exar_pci_tbl[] = {
EXAR_DEVICE(EXAR, XR17V358, pbn_exar_XR17V35x),
EXAR_DEVICE(EXAR, XR17V4358, pbn_exar_XR17V4358),
EXAR_DEVICE(EXAR, XR17V8358, pbn_exar_XR17V8358),
- EXAR_DEVICE(COMMTECH, 4222PCIE, pbn_exar_XR17V35x),
- EXAR_DEVICE(COMMTECH, 4224PCIE, pbn_exar_XR17V35x),
- EXAR_DEVICE(COMMTECH, 4228PCIE, pbn_exar_XR17V35x),
+ EXAR_DEVICE(COMMTECH, 4222PCIE, pbn_fastcom_XR17V352),
+ EXAR_DEVICE(COMMTECH, 4224PCIE, pbn_fastcom_XR17V354),
+ EXAR_DEVICE(COMMTECH, 4228PCIE, pbn_fastcom_XR17V358),
EXAR_DEVICE(COMMTECH, 4222PCI335, pbn_fastcom335_2),
EXAR_DEVICE(COMMTECH, 4224PCI335, pbn_fastcom335_4),
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] serial: 8250_exar: Bug fix for determination of number of ports for Commtech PCIe cards
2020-08-12 21:49 [PATCH] serial: 8250_exar: Bug fix for determination of number of ports for Commtech PCIe cards Valmer Huhn
@ 2020-08-13 13:51 ` Andy Shevchenko
2020-08-13 16:42 ` Valmer Huhn
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2020-08-13 13:51 UTC (permalink / raw)
To: Valmer Huhn; +Cc: gregkh, sudip.mukherjee, jan.kiszka, linux-serial
On Wed, Aug 12, 2020 at 05:49:37PM -0400, Valmer Huhn wrote:
Thanks for the report. It needs a slight corrections I tell about below.
> serial: 8250_exar: Bug fix for determination of number of ports for
> Commtech PCIe cards
This should not be present in the body.
And in the subject it would be better to reduce the text to something like
serial: 8250_exar: Fix number of ports for Commtech PCIe cards
> The following line is used to determine the number of ports for each exar
> board in a/drivers/tty/serial/8250/8250_exar.c:589
There is no a/ folder and we don't need the full path anyway, just something
like '8250_exar.c line 589' is enough.
Also refer to Exar with capitalized name.
> nr_ports = board->num_ports ? board->num_ports : pcidev->device & 0x0f;
>
> If the number of ports a card has is not explicitly specified, it defaults
> to the rightmost 4 bits of the PCI device ID. This is prone to error since
> not all PCI device IDs contain a number which corresponds to the number of
> ports that card provides.
>
> This particular case involves COMMTECH_4224PCIE and COMMTECH_4228PCIE
> cards with device ID 0x0020 and 0x0021. Currently the multiport cards
'...with device IDs 0x0020, 0x0021 and 0x0022.'
> receive 0 and 1 port instead of 4 and 8 ports respectively.
and update this accordingly.
> To fix this, each Commtech Fastcom PCIe card is given a struct where the
> number of ports is explicitly specified. This ensures 'board->num_ports'
> is used instead of the default 'pcidev->device & 0x0f'.
Please, add a Fixes tag.
Fixes: d0aeaa83f0b0 ("serial: exar: split out the exar code from 8250_pci")
> Signed-off-by: Valmer Huhn <valmer.huhn@concurrent-rt.com>
> Tested-by: Valmer Huhn <valmer.huhn@concurrent-rt.com>
...
> - EXAR_DEVICE(COMMTECH, 4222PCIE, pbn_exar_XR17V35x),
> - EXAR_DEVICE(COMMTECH, 4224PCIE, pbn_exar_XR17V35x),
> - EXAR_DEVICE(COMMTECH, 4228PCIE, pbn_exar_XR17V35x),
> + EXAR_DEVICE(COMMTECH, 4222PCIE, pbn_fastcom_XR17V352),
> + EXAR_DEVICE(COMMTECH, 4224PCIE, pbn_fastcom_XR17V354),
> + EXAR_DEVICE(COMMTECH, 4228PCIE, pbn_fastcom_XR17V358),
For sake of the consistency I would rather see them as
pbn_fastcom35x_2/4/8.
> EXAR_DEVICE(COMMTECH, 4222PCI335, pbn_fastcom335_2),
> EXAR_DEVICE(COMMTECH, 4224PCI335, pbn_fastcom335_4),
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] serial: 8250_exar: Bug fix for determination of number of ports for Commtech PCIe cards
2020-08-13 13:51 ` Andy Shevchenko
@ 2020-08-13 16:42 ` Valmer Huhn
0 siblings, 0 replies; 3+ messages in thread
From: Valmer Huhn @ 2020-08-13 16:42 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: gregkh, sudip.mukherjee, jan.kiszka, linux-serial
On Thu, Aug 13, 2020 at 04:51:11PM +0300, Andy Shevchenko wrote:
> On Wed, Aug 12, 2020 at 05:49:37PM -0400, Valmer Huhn wrote:
>
> Thanks for the report. It needs a slight corrections I tell about below.
Thank you very much for your feedback.
> > serial: 8250_exar: Bug fix for determination of number of ports for
> > Commtech PCIe cards
>
> This should not be present in the body.
> And in the subject it would be better to reduce the text to something like
>
> serial: 8250_exar: Fix number of ports for Commtech PCIe cards
I will resubmit the patch with this subject line and include the changes
you suggested.
Thank you,
Valmer Huhn
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-13 16:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-12 21:49 [PATCH] serial: 8250_exar: Bug fix for determination of number of ports for Commtech PCIe cards Valmer Huhn
2020-08-13 13:51 ` Andy Shevchenko
2020-08-13 16:42 ` Valmer Huhn
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.