linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] serial: 8250_exar: derive nr_ports from ID for Acces I/O cards
@ 2021-12-22 19:44 Andy Shevchenko
  2021-12-23 10:05 ` Ilpo Järvinen
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2021-12-22 19:44 UTC (permalink / raw)
  To: Andy Shevchenko, linux-serial, linux-kernel
  Cc: Greg Kroah-Hartman, Jiri Slaby

In the similar way how it's done in 8250_pericom, derive number of
UART ports from PCI ID for Acces I/O cards.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/tty/serial/8250/8250_exar.c | 37 ++++++++++-------------------
 1 file changed, 13 insertions(+), 24 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
index a4508ac0cac9..cf16bd889abd 100644
--- a/drivers/tty/serial/8250/8250_exar.c
+++ b/drivers/tty/serial/8250/8250_exar.c
@@ -611,7 +611,12 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
 
 	maxnr = pci_resource_len(pcidev, bar) >> (board->reg_shift + 3);
 
-	nr_ports = board->num_ports ? board->num_ports : pcidev->device & 0x0f;
+	if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO)
+		nr = BIT(((pcidev->device & 0x38) >> 3) - 1);
+	else if (board->num_ports)
+		nr_ports = board->num_ports;
+	else
+		nr_ports = pcidev->device & 0x0f;
 
 	priv = devm_kzalloc(&pcidev->dev, struct_size(priv, line, nr_ports), GFP_KERNEL);
 	if (!priv)
@@ -710,22 +715,6 @@ static int __maybe_unused exar_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(exar_pci_pm, exar_suspend, exar_resume);
 
-static const struct exar8250_board acces_com_2x = {
-	.num_ports	= 2,
-	.setup		= pci_xr17c154_setup,
-};
-
-static const struct exar8250_board acces_com_4x = {
-	.num_ports	= 4,
-	.setup		= pci_xr17c154_setup,
-};
-
-static const struct exar8250_board acces_com_8x = {
-	.num_ports	= 8,
-	.setup		= pci_xr17c154_setup,
-};
-
-
 static const struct exar8250_board pbn_fastcom335_2 = {
 	.num_ports	= 2,
 	.setup		= pci_fastcom335_setup,
@@ -810,13 +799,13 @@ static const struct exar8250_board pbn_exar_XR17V8358 = {
 	}
 
 static const struct pci_device_id exar_pci_tbl[] = {
-	EXAR_DEVICE(ACCESSIO, COM_2S, acces_com_2x),
-	EXAR_DEVICE(ACCESSIO, COM_4S, acces_com_4x),
-	EXAR_DEVICE(ACCESSIO, COM_8S, acces_com_8x),
-	EXAR_DEVICE(ACCESSIO, COM232_8, acces_com_8x),
-	EXAR_DEVICE(ACCESSIO, COM_2SM, acces_com_2x),
-	EXAR_DEVICE(ACCESSIO, COM_4SM, acces_com_4x),
-	EXAR_DEVICE(ACCESSIO, COM_8SM, acces_com_8x),
+	EXAR_DEVICE(ACCESSIO, COM_2S, pbn_exar_XR17C15x),
+	EXAR_DEVICE(ACCESSIO, COM_4S, pbn_exar_XR17C15x),
+	EXAR_DEVICE(ACCESSIO, COM_8S, pbn_exar_XR17C15x),
+	EXAR_DEVICE(ACCESSIO, COM232_8, pbn_exar_XR17C15x),
+	EXAR_DEVICE(ACCESSIO, COM_2SM, pbn_exar_XR17C15x),
+	EXAR_DEVICE(ACCESSIO, COM_4SM, pbn_exar_XR17C15x),
+	EXAR_DEVICE(ACCESSIO, COM_8SM, pbn_exar_XR17C15x),
 
 	CONNECT_DEVICE(XR17C152, UART_2_232, pbn_connect),
 	CONNECT_DEVICE(XR17C154, UART_4_232, pbn_connect),
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] serial: 8250_exar: derive nr_ports from ID for Acces I/O cards
  2021-12-22 19:44 [PATCH v1 1/1] serial: 8250_exar: derive nr_ports from ID for Acces I/O cards Andy Shevchenko
@ 2021-12-23 10:05 ` Ilpo Järvinen
  2021-12-23 10:18   ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Ilpo Järvinen @ 2021-12-23 10:05 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-serial, LKML, Greg Kroah-Hartman, Jiri Slaby

On Wed, 22 Dec 2021, Andy Shevchenko wrote:

> In the similar way how it's done in 8250_pericom, derive number of
> UART ports from PCI ID for Acces I/O cards.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/tty/serial/8250/8250_exar.c | 37 ++++++++++-------------------
>  1 file changed, 13 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
> index a4508ac0cac9..cf16bd889abd 100644
> --- a/drivers/tty/serial/8250/8250_exar.c
> +++ b/drivers/tty/serial/8250/8250_exar.c
> @@ -611,7 +611,12 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
>  
>  	maxnr = pci_resource_len(pcidev, bar) >> (board->reg_shift + 3);
>  
> -	nr_ports = board->num_ports ? board->num_ports : pcidev->device & 0x0f;
> +	if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO)
> +		nr = BIT(((pcidev->device & 0x38) >> 3) - 1);

Shouldn't this be nr_ports = ...

-- 
 i.


> +	else if (board->num_ports)
> +		nr_ports = board->num_ports;
> +	else
> +		nr_ports = pcidev->device & 0x0f;
>  
>  	priv = devm_kzalloc(&pcidev->dev, struct_size(priv, line, nr_ports), GFP_KERNEL);
>  	if (!priv)
> @@ -710,22 +715,6 @@ static int __maybe_unused exar_resume(struct device *dev)
>  
>  static SIMPLE_DEV_PM_OPS(exar_pci_pm, exar_suspend, exar_resume);
>  
> -static const struct exar8250_board acces_com_2x = {
> -	.num_ports	= 2,
> -	.setup		= pci_xr17c154_setup,
> -};
> -
> -static const struct exar8250_board acces_com_4x = {
> -	.num_ports	= 4,
> -	.setup		= pci_xr17c154_setup,
> -};
> -
> -static const struct exar8250_board acces_com_8x = {
> -	.num_ports	= 8,
> -	.setup		= pci_xr17c154_setup,
> -};
> -
> -
>  static const struct exar8250_board pbn_fastcom335_2 = {
>  	.num_ports	= 2,
>  	.setup		= pci_fastcom335_setup,
> @@ -810,13 +799,13 @@ static const struct exar8250_board pbn_exar_XR17V8358 = {
>  	}
>  
>  static const struct pci_device_id exar_pci_tbl[] = {
> -	EXAR_DEVICE(ACCESSIO, COM_2S, acces_com_2x),
> -	EXAR_DEVICE(ACCESSIO, COM_4S, acces_com_4x),
> -	EXAR_DEVICE(ACCESSIO, COM_8S, acces_com_8x),
> -	EXAR_DEVICE(ACCESSIO, COM232_8, acces_com_8x),
> -	EXAR_DEVICE(ACCESSIO, COM_2SM, acces_com_2x),
> -	EXAR_DEVICE(ACCESSIO, COM_4SM, acces_com_4x),
> -	EXAR_DEVICE(ACCESSIO, COM_8SM, acces_com_8x),
> +	EXAR_DEVICE(ACCESSIO, COM_2S, pbn_exar_XR17C15x),
> +	EXAR_DEVICE(ACCESSIO, COM_4S, pbn_exar_XR17C15x),
> +	EXAR_DEVICE(ACCESSIO, COM_8S, pbn_exar_XR17C15x),
> +	EXAR_DEVICE(ACCESSIO, COM232_8, pbn_exar_XR17C15x),
> +	EXAR_DEVICE(ACCESSIO, COM_2SM, pbn_exar_XR17C15x),
> +	EXAR_DEVICE(ACCESSIO, COM_4SM, pbn_exar_XR17C15x),
> +	EXAR_DEVICE(ACCESSIO, COM_8SM, pbn_exar_XR17C15x),
>  
>  	CONNECT_DEVICE(XR17C152, UART_2_232, pbn_connect),
>  	CONNECT_DEVICE(XR17C154, UART_4_232, pbn_connect),
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] serial: 8250_exar: derive nr_ports from ID for Acces I/O cards
  2021-12-23 10:05 ` Ilpo Järvinen
@ 2021-12-23 10:18   ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2021-12-23 10:18 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: linux-serial, LKML, Greg Kroah-Hartman, Jiri Slaby

On Thu, Dec 23, 2021 at 12:05:11PM +0200, Ilpo Järvinen wrote:
> On Wed, 22 Dec 2021, Andy Shevchenko wrote:

...

> > -	nr_ports = board->num_ports ? board->num_ports : pcidev->device & 0x0f;
> > +	if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO)
> > +		nr = BIT(((pcidev->device & 0x38) >> 3) - 1);
> 
> Shouldn't this be nr_ports = ...

Yeah, sorry for that. By some reason I have no such config option enabled and
my builds haven't failed.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-23 10:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-22 19:44 [PATCH v1 1/1] serial: 8250_exar: derive nr_ports from ID for Acces I/O cards Andy Shevchenko
2021-12-23 10:05 ` Ilpo Järvinen
2021-12-23 10:18   ` Andy Shevchenko

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).