linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] serial: exar: Fix GPIO configuration for Sealevel cards based on XR17V35X
@ 2020-07-21 20:08 Matthew Howell
  2020-07-22  7:37 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Howell @ 2020-07-21 20:08 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial, jeff.baldwin, ryan.wenglarz, matthew.howell


From: Matthew Howell <matthew.howell@sealevel.com>

Sealevel XR17V35X based devices are inoperable on kernel versions
4.11 and above due to a change in the GPIO preconfiguration introduced in commit
7dea8165f1d. This patch fixes this by preconfiguring the GPIO on Sealevel
cards to the value (0x00) used prior to commit 7dea8165f1d

With GPIOs preconfigured as per commit 7dea8165f1d all ports on
Sealevel XR17V35X based devices become stuck in high impedance
mode, regardless of dip-switch or software configuration. This
causes the device to become effectively unusable. This patch (in
various forms) has been distributed to our customers and no issues
related to it have been reported.

Fixes: 7dea8165f1d ("serial: exar: Preconfigure xr17v35x MPIOs as output")
Signed-off-by: Matthew Howell <matthew.howell@sealevel.com>

Patch resubmitted as per comments received on
https://www.spinics.net/lists/linux-serial/msg39371.html

Moved problem description and justification above the signed-off-by
line.

checkpatch.pl reports no styling issues with the diff below.

Let me know if I need to make any other changes.

--- linux/drivers/tty/serial/8250/8250_exar.c.orig    2020-07-09 11:05:03.920060577 -0400
+++ linux/drivers/tty/serial/8250/8250_exar.c    2020-07-13 11:54:44.386718167 -0400
@@ -326,7 +326,20 @@ static void setup_gpio(struct pci_dev *p
      * devices will export them as GPIOs, so we pre-configure them safely
      * as inputs.
      */
-    u8 dir = pcidev->vendor == PCI_VENDOR_ID_EXAR ? 0xff : 0x00;
+
+    u8 dir = 0x00;
+
+    if  ((pcidev->vendor == PCI_VENDOR_ID_EXAR) &&
+        (pcidev->subsystem_vendor != PCI_VENDOR_ID_SEALEVEL))
+    {
+       // Configure GPIO as inputs for Commtech adapters
+       dir = 0xff;
+    }
+    else
+    {
+       // Configure GPIO as outputs for SeaLevel adapters
+       dir = 0x00;
+    }

     writeb(0x00, p + UART_EXAR_MPIOINT_7_0);
     writeb(0x00, p + UART_EXAR_MPIOLVL_7_0);


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

* Re: [PATCH v3] serial: exar: Fix GPIO configuration for Sealevel cards based on XR17V35X
  2020-07-21 20:08 [PATCH v3] serial: exar: Fix GPIO configuration for Sealevel cards based on XR17V35X Matthew Howell
@ 2020-07-22  7:37 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2020-07-22  7:37 UTC (permalink / raw)
  To: Matthew Howell; +Cc: linux-serial, jeff.baldwin, ryan.wenglarz, matthew.howell

On Tue, Jul 21, 2020 at 04:08:17PM -0400, Matthew Howell wrote:
> 
> From: Matthew Howell <matthew.howell@sealevel.com>
> 
> Sealevel XR17V35X based devices are inoperable on kernel versions
> 4.11 and above due to a change in the GPIO preconfiguration introduced in commit
> 7dea8165f1d. This patch fixes this by preconfiguring the GPIO on Sealevel
> cards to the value (0x00) used prior to commit 7dea8165f1d
> 
> With GPIOs preconfigured as per commit 7dea8165f1d all ports on
> Sealevel XR17V35X based devices become stuck in high impedance
> mode, regardless of dip-switch or software configuration. This
> causes the device to become effectively unusable. This patch (in
> various forms) has been distributed to our customers and no issues
> related to it have been reported.
> 
> Fixes: 7dea8165f1d ("serial: exar: Preconfigure xr17v35x MPIOs as output")
> Signed-off-by: Matthew Howell <matthew.howell@sealevel.com>
> 
> Patch resubmitted as per comments received on
> https://www.spinics.net/lists/linux-serial/msg39371.html
> 
> Moved problem description and justification above the signed-off-by
> line.
> 
> checkpatch.pl reports no styling issues with the diff below.
> 
> Let me know if I need to make any other changes.

You should put a --- line after the signed-off-by line, so these
comments do not show up in the changelog.

> 
> --- linux/drivers/tty/serial/8250/8250_exar.c.orig    2020-07-09 11:05:03.920060577 -0400
> +++ linux/drivers/tty/serial/8250/8250_exar.c    2020-07-13 11:54:44.386718167 -0400
> @@ -326,7 +326,20 @@ static void setup_gpio(struct pci_dev *p
>       * devices will export them as GPIOs, so we pre-configure them safely
>       * as inputs.
>       */
> -    u8 dir = pcidev->vendor == PCI_VENDOR_ID_EXAR ? 0xff : 0x00;
> +
> +    u8 dir = 0x00;
> +
> +    if  ((pcidev->vendor == PCI_VENDOR_ID_EXAR) &&
> +        (pcidev->subsystem_vendor != PCI_VENDOR_ID_SEALEVEL))
> +    {
> +       // Configure GPIO as inputs for Commtech adapters
> +       dir = 0xff;
> +    }
> +    else
> +    {
> +       // Configure GPIO as outputs for SeaLevel adapters
> +       dir = 0x00;
> +    }
> 
>      writeb(0x00, p + UART_EXAR_MPIOINT_7_0);
>      writeb(0x00, p + UART_EXAR_MPIOLVL_7_0);
> 

Your patch has all tabs turned to spaces, making this impossible to
apply.

Also, always run your patch through scripts/checkpatch.pl to fix the
obvious coding style issues in it before sending it out.

v4?  :)

thanks,

greg k-h

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

end of thread, other threads:[~2020-07-22  7:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-21 20:08 [PATCH v3] serial: exar: Fix GPIO configuration for Sealevel cards based on XR17V35X Matthew Howell
2020-07-22  7:37 ` Greg KH

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