linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: 8250: Do XR17V35X specific wakeup in serial8250_do_startup
@ 2015-06-19 15:12 Joerg Roedel
  2015-06-19 17:09 ` Michael Welling
  0 siblings, 1 reply; 7+ messages in thread
From: Joerg Roedel @ 2015-06-19 15:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, linux-serial, linux-kernel, Joerg Roedel,
	Peter Hurley, Michael Welling, Joe Schultz

From: Joerg Roedel <jroedel@suse.de>

While debugging why my 8-port XR17V35X card does not work
with the in-kernel serial driver, I found that some chip
specific wakeup code is necessary to get it working.

Specificly the EFR_ECB bit needs to be set in the
chip-specific UART_XR_EFR register, so that writing to a
couple of other configuration bits is enabled.

Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Michael Welling <mwelling@ieee.org>
Cc: Joe Schultz <jschultz@xes-inc.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 drivers/tty/serial/8250/8250_core.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 4506e40..de34db3 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -2176,6 +2176,18 @@ int serial8250_do_startup(struct uart_port *port)
 	 */
 	enable_rsa(up);
 #endif
+
+	/*
+	 * Do this right before clearing the FIFOs to prevent
+	 * interrupt storm.
+	 */
+	if (port->type == PORT_XR17V35X) {
+		/* Wake up and initialize UART */
+		serial_port_out(port, UART_XR_EFR, UART_EFR_ECB);
+		serial_port_out(port, UART_IER, 0);
+		serial_port_out(port, UART_LCR, 0);
+	}
+
 	/*
 	 * Clear the FIFO buffers and disable them.
 	 * (they will be reenabled in set_termios())
-- 
1.8.4.5

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

* Re: [PATCH] serial: 8250: Do XR17V35X specific wakeup in serial8250_do_startup
  2015-06-19 15:12 [PATCH] serial: 8250: Do XR17V35X specific wakeup in serial8250_do_startup Joerg Roedel
@ 2015-06-19 17:09 ` Michael Welling
  2015-06-29 15:26   ` Joerg Roedel
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Welling @ 2015-06-19 17:09 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, linux-kernel,
	Joerg Roedel, Peter Hurley, Joe Schultz

On Fri, Jun 19, 2015 at 05:12:17PM +0200, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@suse.de>
> 
> While debugging why my 8-port XR17V35X card does not work
> with the in-kernel serial driver, I found that some chip
> specific wakeup code is necessary to get it working.
> 
> Specificly the EFR_ECB bit needs to be set in the
> chip-specific UART_XR_EFR register, so that writing to a
> couple of other configuration bits is enabled.
> 
> Cc: Peter Hurley <peter@hurleysoftware.com>
> Cc: Michael Welling <mwelling@ieee.org>
> Cc: Joe Schultz <jschultz@xes-inc.com>
> Signed-off-by: Joerg Roedel <jroedel@suse.de>
> ---
>  drivers/tty/serial/8250/8250_core.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
> index 4506e40..de34db3 100644
> --- a/drivers/tty/serial/8250/8250_core.c
> +++ b/drivers/tty/serial/8250/8250_core.c
> @@ -2176,6 +2176,18 @@ int serial8250_do_startup(struct uart_port *port)
>  	 */
>  	enable_rsa(up);
>  #endif
> +
> +	/*
> +	 * Do this right before clearing the FIFOs to prevent
> +	 * interrupt storm.
> +	 */
> +	if (port->type == PORT_XR17V35X) {
> +		/* Wake up and initialize UART */
> +		serial_port_out(port, UART_XR_EFR, UART_EFR_ECB);
> +		serial_port_out(port, UART_IER, 0);
> +		serial_port_out(port, UART_LCR, 0);
> +	}
> +

Looks good to me. The datasheet indicates that bit 4 of the EFR needs to be set to access
to IER [7:5], ISR [5:4], FCR[5:4], MCR[7:5], MSR.

>  	/*
>  	 * Clear the FIFO buffers and disable them.
>  	 * (they will be reenabled in set_termios())
> -- 
> 1.8.4.5
> 

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

* Re: [PATCH] serial: 8250: Do XR17V35X specific wakeup in serial8250_do_startup
  2015-06-19 17:09 ` Michael Welling
@ 2015-06-29 15:26   ` Joerg Roedel
  0 siblings, 0 replies; 7+ messages in thread
From: Joerg Roedel @ 2015-06-29 15:26 UTC (permalink / raw)
  To: Michael Welling
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, linux-kernel,
	Joerg Roedel, Peter Hurley, Joe Schultz

On Fri, Jun 19, 2015 at 12:09:10PM -0500, Michael Welling wrote:
> 
> Looks good to me. The datasheet indicates that bit 4 of the EFR needs to be set to access
> to IER [7:5], ISR [5:4], FCR[5:4], MCR[7:5], MSR.

Thanks! I updated the patch a little bit and wrote a better changelog
entry, mentioning the above bits. Will send a new version after the
merge window.


	Joerg

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

* [PATCH] serial: 8250: Do XR17V35X specific wakeup in serial8250_do_startup
@ 2015-07-16  8:29 Joerg Roedel
  2015-07-16  8:55 ` Michael Welling
  2015-07-17 13:34 ` Peter Hurley
  0 siblings, 2 replies; 7+ messages in thread
From: Joerg Roedel @ 2015-07-16  8:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Peter Hurley, Sebastian Andrzej Siewior, Tony Lindgren, Alan Cox,
	linux-serial, linux-kernel, Joerg Roedel, Michael Welling,
	Joe Schultz

From: Joerg Roedel <jroedel@suse.de>

The XR17V35X UART needs the ECB bit set in its XR_EFR
register to enable access to IER [7:5], ISR [5:4], FCR[5:4],
MCR[7:5], and MSR [7:0].

Also reset the IER register to mask interrupts after access
to all bits of this register has been enabled.

This makes my 8-port XR17V35X working with the in-kernel
serial driver.

Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Michael Welling <mwelling@ieee.org>
Cc: Joe Schultz <jschultz@xes-inc.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 drivers/tty/serial/8250/8250_core.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 37fff12..4124a91 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -2164,6 +2164,21 @@ int serial8250_do_startup(struct uart_port *port)
 	 */
 	enable_rsa(up);
 #endif
+
+	if (port->type == PORT_XR17V35X) {
+		/*
+		 * First enable access to IER [7:5], ISR [5:4], FCR [5:4],
+		 * MCR [7:5] and MSR [7:0]
+		 */
+		serial_port_out(port, UART_XR_EFR, UART_EFR_ECB);
+
+		/*
+		 * Make sure all interrups are masked until initialization is
+		 * complete and the FIFOs are cleared
+		 */
+		serial_port_out(port, UART_IER, 0);
+	}
+
 	/*
 	 * Clear the FIFO buffers and disable them.
 	 * (they will be reenabled in set_termios())
-- 
1.9.1

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

* Re: [PATCH] serial: 8250: Do XR17V35X specific wakeup in serial8250_do_startup
  2015-07-16  8:29 Joerg Roedel
@ 2015-07-16  8:55 ` Michael Welling
  2015-07-17 13:34 ` Peter Hurley
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Welling @ 2015-07-16  8:55 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: Greg Kroah-Hartman, Jiri Slaby, Peter Hurley,
	Sebastian Andrzej Siewior, Tony Lindgren, Alan Cox, linux-serial,
	linux-kernel, Joerg Roedel, Joe Schultz

On Thu, Jul 16, 2015 at 10:29:13AM +0200, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@suse.de>
> 
> The XR17V35X UART needs the ECB bit set in its XR_EFR
> register to enable access to IER [7:5], ISR [5:4], FCR[5:4],
> MCR[7:5], and MSR [7:0].
> 
> Also reset the IER register to mask interrupts after access
> to all bits of this register has been enabled.
> 
> This makes my 8-port XR17V35X working with the in-kernel
> serial driver.
> 
> Cc: Peter Hurley <peter@hurleysoftware.com>
> Cc: Michael Welling <mwelling@ieee.org>
> Cc: Joe Schultz <jschultz@xes-inc.com>
> Signed-off-by: Joerg Roedel <jroedel@suse.de>
> ---
>  drivers/tty/serial/8250/8250_core.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
> index 37fff12..4124a91 100644
> --- a/drivers/tty/serial/8250/8250_core.c
> +++ b/drivers/tty/serial/8250/8250_core.c
> @@ -2164,6 +2164,21 @@ int serial8250_do_startup(struct uart_port *port)
>  	 */
>  	enable_rsa(up);
>  #endif
> +
> +	if (port->type == PORT_XR17V35X) {
> +		/*
> +		 * First enable access to IER [7:5], ISR [5:4], FCR [5:4],
> +		 * MCR [7:5] and MSR [7:0]
> +		 */
> +		serial_port_out(port, UART_XR_EFR, UART_EFR_ECB);
> +
> +		/*
> +		 * Make sure all interrups are masked until initialization is
> +		 * complete and the FIFOs are cleared
> +		 */
> +		serial_port_out(port, UART_IER, 0);
> +	}
> +

Reviewed-by: Michael Welling <mwelling@ieee.org>

>  	/*
>  	 * Clear the FIFO buffers and disable them.
>  	 * (they will be reenabled in set_termios())
> -- 
> 1.9.1
> 

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

* Re: [PATCH] serial: 8250: Do XR17V35X specific wakeup in serial8250_do_startup
  2015-07-16  8:29 Joerg Roedel
  2015-07-16  8:55 ` Michael Welling
@ 2015-07-17 13:34 ` Peter Hurley
  2015-07-28  7:20   ` Joerg Roedel
  1 sibling, 1 reply; 7+ messages in thread
From: Peter Hurley @ 2015-07-17 13:34 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: Greg Kroah-Hartman, Jiri Slaby, Sebastian Andrzej Siewior,
	Tony Lindgren, Alan Cox, linux-serial, linux-kernel, Joerg Roedel,
	Michael Welling, Joe Schultz

On 07/16/2015 04:29 AM, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@suse.de>
> 
> The XR17V35X UART needs the ECB bit set in its XR_EFR
> register to enable access to IER [7:5], ISR [5:4], FCR[5:4],
> MCR[7:5], and MSR [7:0].
> 
> Also reset the IER register to mask interrupts after access
> to all bits of this register has been enabled.
> 
> This makes my 8-port XR17V35X working with the in-kernel
> serial driver.

Reviewed-by: Peter Hurley <peter@hurleysoftware.com>

Also, would you please find out what bits are set in the IER
that this fixes and let me know? I don't have this hardware.

Regards,
Peter Hurley

> Cc: Peter Hurley <peter@hurleysoftware.com>
> Cc: Michael Welling <mwelling@ieee.org>
> Cc: Joe Schultz <jschultz@xes-inc.com>
> Signed-off-by: Joerg Roedel <jroedel@suse.de>
> ---
>  drivers/tty/serial/8250/8250_core.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
> index 37fff12..4124a91 100644
> --- a/drivers/tty/serial/8250/8250_core.c
> +++ b/drivers/tty/serial/8250/8250_core.c
> @@ -2164,6 +2164,21 @@ int serial8250_do_startup(struct uart_port *port)
>  	 */
>  	enable_rsa(up);
>  #endif
> +
> +	if (port->type == PORT_XR17V35X) {
> +		/*
> +		 * First enable access to IER [7:5], ISR [5:4], FCR [5:4],
> +		 * MCR [7:5] and MSR [7:0]
> +		 */
> +		serial_port_out(port, UART_XR_EFR, UART_EFR_ECB);
> +
> +		/*
> +		 * Make sure all interrups are masked until initialization is
> +		 * complete and the FIFOs are cleared
> +		 */
> +		serial_port_out(port, UART_IER, 0);
> +	}
> +
>  	/*
>  	 * Clear the FIFO buffers and disable them.
>  	 * (they will be reenabled in set_termios())
> 

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

* Re: [PATCH] serial: 8250: Do XR17V35X specific wakeup in serial8250_do_startup
  2015-07-17 13:34 ` Peter Hurley
@ 2015-07-28  7:20   ` Joerg Roedel
  0 siblings, 0 replies; 7+ messages in thread
From: Joerg Roedel @ 2015-07-28  7:20 UTC (permalink / raw)
  To: Peter Hurley
  Cc: Greg Kroah-Hartman, Jiri Slaby, Sebastian Andrzej Siewior,
	Tony Lindgren, Alan Cox, linux-serial, linux-kernel, Joerg Roedel,
	Michael Welling, Joe Schultz

Hi Peter,

On Fri, Jul 17, 2015 at 09:34:31AM -0400, Peter Hurley wrote:
> On 07/16/2015 04:29 AM, Joerg Roedel wrote:
> > From: Joerg Roedel <jroedel@suse.de>
> > 
> > The XR17V35X UART needs the ECB bit set in its XR_EFR
> > register to enable access to IER [7:5], ISR [5:4], FCR[5:4],
> > MCR[7:5], and MSR [7:0].
> > 
> > Also reset the IER register to mask interrupts after access
> > to all bits of this register has been enabled.
> > 
> > This makes my 8-port XR17V35X working with the in-kernel
> > serial driver.
> 
> Reviewed-by: Peter Hurley <peter@hurleysoftware.com>

Thanks for your review.

> Also, would you please find out what bits are set in the IER
> that this fixes and let me know? I don't have this hardware.

Unfortunatly I put the card back into a production machine and can't
easily check this anymore. But I'll let you know when I update the
kernel on the box next time.


	Joerg

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

end of thread, other threads:[~2015-07-28  7:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-19 15:12 [PATCH] serial: 8250: Do XR17V35X specific wakeup in serial8250_do_startup Joerg Roedel
2015-06-19 17:09 ` Michael Welling
2015-06-29 15:26   ` Joerg Roedel
  -- strict thread matches above, loose matches on Subject: below --
2015-07-16  8:29 Joerg Roedel
2015-07-16  8:55 ` Michael Welling
2015-07-17 13:34 ` Peter Hurley
2015-07-28  7:20   ` Joerg Roedel

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