rk_serial: make when tx dma is only enable work functionally
authorhhb <hhb@rock-chips.com>
Thu, 23 Aug 2012 02:57:52 +0000 (10:57 +0800)
committerhhb <hhb@rock-chips.com>
Thu, 23 Aug 2012 02:57:52 +0000 (10:57 +0800)
drivers/tty/serial/rk_serial.c

index 7b41d278ec5c884d4a1244cf7a301a3f5be951d4..558abd77faf58ea9c47193fbac09e1f804e86f64 100644 (file)
 *\r
 *v0.0 : this driver is 2.6.32 kernel driver;\r
 *v0.1 : this driver is 3.0.8 kernel driver;\r
-*v1.0 : 1.modify dma dirver;\r
+*v1.0 : 2012-08-09
+*              1.modify dma dirver;\r
 *              2.enable Programmable THRE Interrupt Mode, so we can just judge ((up->iir & 0x0f) == 0x02) when transmit\r
 *              3.reset uart and set it to loopback state to ensure setting baud rate sucessfully \r
+*v1.1 : 2012-08-23
+*              1. dma driver:make "when tx dma is only enable" work functionally       
 */\r
-#define VERSION_AND_TIME  "rk_serial.c v1.0 2012-08-09"\r
+#define VERSION_AND_TIME  "rk_serial.c v1.1 2012-08-23"\r
 \r
 #define PORT_RK                90\r
 #define UART_USR       0x1F    /* UART Status Register */\r
@@ -969,6 +972,12 @@ static void serial_rk_handle_port(struct uart_rk_port *up)
                                DEBUG_INTR("error:lsr=0x%x\n", status);\r
                        }\r
                }\r
+
+               if(!(up->dma->use_dma & RX_DMA)) {\r
+                       if (status & (UART_LSR_DR | UART_LSR_BI)) {\r
+                               receive_chars(up, &status);\r
+                       }\r
+               }
 \r
                if ((up->iir & 0x0f) == 0x02) {\r
                        transmit_chars(up);\r
@@ -1515,7 +1524,10 @@ serial_rk_set_termios(struct uart_port *port, struct ktermios *termios,
                if (up->dma->use_dma) {\r
                        up->ier |= UART_IER_RLSI;\r
                        up->ier |= UART_IER_PTIME;   //Programmable THRE Interrupt Mode Enable\r
-                       serial_rk_start_rx_dma(&up->port);\r
+                       if (up->dma->use_dma & RX_DMA)
+                               serial_rk_start_rx_dma(&up->port);
+                       else
+                               up->ier |= UART_IER_RDI;\r
                } else\r
 #endif\r
                {\r
@@ -1823,7 +1835,8 @@ static int __devinit serial_rk_probe(struct platform_device *pdev)
        up->port.uartclk = clk_get_rate(up->clk);\r
 \r
 #if USE_DMA\r
-       /* set dma config */\r
+       /* set dma config */
+       pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);\r
        if(up->dma->use_dma & RX_DMA) {\r
                pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);\r
                //timer\r
@@ -1844,8 +1857,8 @@ static int __devinit serial_rk_probe(struct platform_device *pdev)
                        dev_info(up->port.dev, "dmam_alloc_coherent dma_rx_buffer fail\n");\r
                }\r
                else {\r
-                       dev_info(up->port.dev, "dma_rx_buffer 0x%08x\n", (unsigned) up->dma->rx_buffer);\r
-                       dev_info(up->port.dev, "up 0x%08x\n", (unsigned)up->dma);\r
+                       dev_info(up->port.dev, "dma_rx_buffer 0x%08x, phy:0x%08x\n", (unsigned) up->dma->rx_buffer, (unsigned)up->dma->rx_phy_addr);\r
+                       //dev_info(up->port.dev, "up 0x%08x\n", (unsigned)up->dma);\r
                }\r
 \r
                // work queue\r