UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer nikola.stojkov
Observer
509 Views
Registered: ‎03-01-2017

Uart parity error handling problem in xuartps

Jump to solution

Hello Everyone,

 

We are experiencing issue with Xilinx Kernel 3.15 in xuartps when using in our application parity. When we set parity to odd and receive data as even Linux hangs after this. 

 

Any help is appreciated.

 

Best Regards,

Nikola

0 Kudos
1 Solution

Accepted Solutions
Observer nikola.stojkov
Observer
449 Views
Registered: ‎03-01-2017

Re: Uart parity error handling problem in xuartps

Jump to solution

If someone needs this in future here is the patch:

 

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index c3c252d..c205488 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -13,6 +13,12 @@
* still shows in the naming of this file, the kconfig symbols and some symbols
* in the code.
*/
+
+ /* 13.09.2018 PATCH for PARITY issue:
+ Djordje Vujic,
+ Darko Alavanja
+ Nikola Stojkov
+ */

#if defined(CONFIG_SERIAL_XILINX_PS_UART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
@@ -37,7 +43,7 @@
#define CDNS_UART_MINOR 0 /* works best with devtmpfs */
#define CDNS_UART_NR_PORTS 2
#define CDNS_UART_FIFO_SIZE 64 /* FIFO size */
-#define CDNS_UART_REGISTER_SPACE 0xFFF
+#define CDNS_UART_REGISTER_SPACE 0x1000 /* PATCH */

#define cdns_uart_readl(offset) ioread32(port->membase + offset)
#define cdns_uart_writel(val, offset) iowrite32(val, port->membase + offset)
@@ -792,8 +798,20 @@ static int cdns_uart_startup(struct uart_port *port)
cdns_uart_writel(cdns_uart_readl(CDNS_UART_ISR_OFFSET),
CDNS_UART_ISR_OFFSET);

+ /* PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH
+ * Do not enable parity error interrupt for the following
+ * reason: When parity error interrupt is enabled, each Rx
+ * parity error always results in 2 events. The first one
+ * being parity error interrupt and the second one with a
+ * proper Rx interrupt with the incoming data. Disabling
+ * parity error interrupt ensures better handling of parity
+ * error events. With this change, for a parity error case, we
+ * get a Rx interrupt with parity error set in ISR register
+ * and we still handle parity errors in the desired way.
+ *PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH/
+
/* Set the Interrupt Registers with desired interrupts */
- cdns_uart_writel(CDNS_UART_IXR_TXEMPTY | CDNS_UART_IXR_PARITY |
+ cdns_uart_writel(CDNS_UART_IXR_TXEMPTY |
CDNS_UART_IXR_FRAMING | CDNS_UART_IXR_OVERRUN |
CDNS_UART_IXR_RXTRIG | CDNS_UART_IXR_TOUT,
CDNS_UART_IER_OFFSET);
@@ -1466,3 +1484,4 @@ module_exit(cdns_uart_exit);
MODULE_DESCRIPTION("Driver for Cadence UART");
MODULE_AUTHOR("Xilinx Inc.");
MODULE_LICENSE("GPL");
+

View solution in original post

0 Kudos
1 Reply
Observer nikola.stojkov
Observer
450 Views
Registered: ‎03-01-2017

Re: Uart parity error handling problem in xuartps

Jump to solution

If someone needs this in future here is the patch:

 

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index c3c252d..c205488 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -13,6 +13,12 @@
* still shows in the naming of this file, the kconfig symbols and some symbols
* in the code.
*/
+
+ /* 13.09.2018 PATCH for PARITY issue:
+ Djordje Vujic,
+ Darko Alavanja
+ Nikola Stojkov
+ */

#if defined(CONFIG_SERIAL_XILINX_PS_UART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
@@ -37,7 +43,7 @@
#define CDNS_UART_MINOR 0 /* works best with devtmpfs */
#define CDNS_UART_NR_PORTS 2
#define CDNS_UART_FIFO_SIZE 64 /* FIFO size */
-#define CDNS_UART_REGISTER_SPACE 0xFFF
+#define CDNS_UART_REGISTER_SPACE 0x1000 /* PATCH */

#define cdns_uart_readl(offset) ioread32(port->membase + offset)
#define cdns_uart_writel(val, offset) iowrite32(val, port->membase + offset)
@@ -792,8 +798,20 @@ static int cdns_uart_startup(struct uart_port *port)
cdns_uart_writel(cdns_uart_readl(CDNS_UART_ISR_OFFSET),
CDNS_UART_ISR_OFFSET);

+ /* PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH
+ * Do not enable parity error interrupt for the following
+ * reason: When parity error interrupt is enabled, each Rx
+ * parity error always results in 2 events. The first one
+ * being parity error interrupt and the second one with a
+ * proper Rx interrupt with the incoming data. Disabling
+ * parity error interrupt ensures better handling of parity
+ * error events. With this change, for a parity error case, we
+ * get a Rx interrupt with parity error set in ISR register
+ * and we still handle parity errors in the desired way.
+ *PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH PATCH/
+
/* Set the Interrupt Registers with desired interrupts */
- cdns_uart_writel(CDNS_UART_IXR_TXEMPTY | CDNS_UART_IXR_PARITY |
+ cdns_uart_writel(CDNS_UART_IXR_TXEMPTY |
CDNS_UART_IXR_FRAMING | CDNS_UART_IXR_OVERRUN |
CDNS_UART_IXR_RXTRIG | CDNS_UART_IXR_TOUT,
CDNS_UART_IER_OFFSET);
@@ -1466,3 +1484,4 @@ module_exit(cdns_uart_exit);
MODULE_DESCRIPTION("Driver for Cadence UART");
MODULE_AUTHOR("Xilinx Inc.");
MODULE_LICENSE("GPL");
+

View solution in original post

0 Kudos