*\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 : 2012-08-09
+*v1.0 : 2012-08-09\r
* 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\r
* 1. dma driver:make "when tx dma is only enable" work functionally \r
*v1.2 : 2012-08-28\r
-* 1. dma driver:serial rx use new dma interface rk29_dma_enqueue_ring \r
+* 1. dma driver:serial rx use new dma interface rk29_dma_enqueue_ring \r
+*v1.3 : 2012-12-14\r
+* 1. When enable Programmable THRE Interrupt Mode, in lsr register, only UART_LSR_TEMT means transmit empty, but\r
+ UART_LSR_THRE doesn't. So, the macro BOTH_EMPTY should be replaced with UART_LSR_TEMT.\r
*/\r
-#define VERSION_AND_TIME "rk_serial.c v1.2 2012-08-28"\r
+#define VERSION_AND_TIME "rk_serial.c v1.3 2012-12-14"\r
\r
#define PORT_RK 90\r
#define UART_USR 0x1F /* UART Status Register */\r
#define UART_SRR 0x22 /* software reset register */\r
#define UART_RESET 0x01\r
\r
-#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)\r
+\r
+//#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)\r
\r
#define UART_NR 4 //uart port number\r
\r
+\r
/* configurate whether the port transmit-receive by DMA in menuconfig*/\r
#define OPEN_DMA 1\r
#define CLOSE_DMA 0\r
DEBUG_INTR("error:lsr=0x%x\n", status);\r
}\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
\r
if ((up->iir & 0x0f) == 0x02) {\r
transmit_chars(up);\r
up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;\r
spin_unlock_irqrestore(&up->port.lock, flags);\r
\r
- return (lsr & BOTH_EMPTY) == BOTH_EMPTY ? TIOCSER_TEMT : 0;\r
+ return (lsr & UART_LSR_TEMT) == UART_LSR_TEMT ? TIOCSER_TEMT : 0;\r
}\r
\r
static unsigned int serial_rk_get_mctrl(struct uart_port *port)\r
ier = serial_in(up, UART_IER);\r
serial_out(up, UART_IER, 0);\r
\r
- wait_for_xmitr(up, BOTH_EMPTY);\r
+ wait_for_xmitr(up, UART_LSR_TEMT);\r
/*\r
* Send the character out.\r
* If a LF, also do CR...\r
*/\r
serial_out(up, UART_TX, c);\r
if (c == 10) {\r
- wait_for_xmitr(up, BOTH_EMPTY);\r
+ wait_for_xmitr(up, UART_LSR_TEMT);\r
serial_out(up, UART_TX, 13);\r
}\r
\r
* Finally, wait for transmitter to become empty\r
* and restore the IER\r
*/\r
- wait_for_xmitr(up, BOTH_EMPTY);\r
+ wait_for_xmitr(up, UART_LSR_TEMT);\r
serial_out(up, UART_IER, ier);\r
}\r
\r
if (up->dma->use_dma) {\r
up->ier |= UART_IER_RLSI;\r
up->ier |= UART_IER_PTIME; //Programmable THRE Interrupt Mode Enable\r
- if (up->dma->use_dma & RX_DMA)
- serial_rk_start_rx_dma(&up->port);
- else
+ if (up->dma->use_dma & RX_DMA)\r
+ serial_rk_start_rx_dma(&up->port);\r
+ else\r
up->ier |= UART_IER_RDI;\r
} else\r
#endif\r
* Finally, wait for transmitter to become empty\r
* and restore the IER\r
*/\r
- wait_for_xmitr(up, BOTH_EMPTY);\r
+ wait_for_xmitr(up, UART_LSR_TEMT);\r
serial_out(up, UART_IER, ier);\r
\r
#if 0\r
up->port.uartclk = clk_get_rate(up->clk);\r
\r
#if USE_DMA\r
- /* set dma config */
+ /* set dma config */\r
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);\r
if(up->dma->use_dma & RX_DMA) {\r
//timer\r