Mxuart patch

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Mxuart patch

Mxuart patch

This patch implements (or exposes) routines to poll the imx uarts. The KGDB drivers need these methods to be implemented or the ttymxc driver is not sufficient. The synthetic CONFIG_CONSOLE_POLL value activates these routines (or CONFIG_SERIAL_MXC_CONSOLE for the polled write). There is still no poll routines in -855-ge067785, which is the September 2010 Linux release from Freescale. Also not in Linux 2.6.36 drivers/serial/imx.c either.

$ git diff drivers/serial/mxc_uart.c 
diff --git a/drivers/serial/mxc_uart.c b/drivers/serial/mxc_uart.c 
index ae6d2e1..728b607 100644 
--- a/drivers/serial/mxc_uart.c 
+++ b/drivers/serial/mxc_uart.c 
@@ -1551,6 +1551,28 @@ mxcuart_pm(struct uart_port *port, unsigned int state, unsigned int oldstate) 
                            clk_enable(umxc->clk); 
   }  +#ifdef CONFIG_CONSOLE_POLL 
+/* 
+ * Read a character from the UART. 
+ */ 
+static inline int mxcuart_console_read_char(struct uart_port *port) 
+{ 
+       volatile unsigned int status; 
+    int ch; 
+ 
+       do { 
+               status = readl(port->membase + MXC_UARTUSR2); 
+       } while ((status & MXC_UARTUSR2_RDR) == 0); 
+       ch = readl(port->membase + MXC_UARTURXD); 
+/* Ignore parity errors, etc. */ 
+/*  status = ch | UART_CREAD_BIT; */ 
+    ch &= 0xff; 
+ 
+    return ch; 
+} 
+static void mxcuart_console_write_char(struct uart_port *port, char ch); 
+#endif 
+ 
   /*! 
    * This structure contains the pointers to the control functions that are 
    * invoked by the core serial driver to access the UART hardware. The 
@@ -1575,14 +1597,18 @@ static struct uart_ops mxc_ops = { 
                .config_port = mxcuart_config_port, 
                .verify_port = mxcuart_verify_port, 
                .send_xchar = mxcuart_send_xchar, 
+#ifdef CONFIG_CONSOLE_POLL 
+              .poll_put_char = mxcuart_console_write_char, 
+              .poll_get_char = mxcuart_console_read_char, 
+#endif 
};  

-#ifdef CONFIG_SERIAL_MXC_CONSOLE 
+#if defined(CONFIG_SERIAL_MXC_CONSOLE) || defined (CONFIG_CONSOLE_POLL)  

   /* 
    * Write out a character once the UART is ready 
    */ 
-static inline void mxcuart_console_write_char(struct uart_port *port, char ch) 
+static void mxcuart_console_write_char(struct uart_port *port, char ch) 
   { 
           volatile unsigned int status;  

@@ -1592,6 +1618,10 @@ static inline void mxcuart_console_write_char(struct uart_port *port, char ch) 
               writel(ch, port->membase + MXC_UARTUTXD); 
    }  

+#endif 
+ 
+#ifdef CONFIG_SERIAL_MXC_CONSOLE 
+ 
   /*! 
    * This function is called to write the console messages through the UART port. 
    * 


Labels (1)
No ratings
Version history
Last update:
‎09-10-2020 02:03 AM
Updated by: