e25436b8eed82e985367efa1f01327605f6ca6fb
[15.05/openwrt.git] / target / linux / pxa / patches-2.6.21 / 024-bugfix-serial-register-status.patch
1 Index: linux-2.6.21gum/drivers/serial/pxa.c
2 ===================================================================
3 --- linux-2.6.21gum.orig/drivers/serial/pxa.c
4 +++ linux-2.6.21gum/drivers/serial/pxa.c
5 @@ -57,6 +57,8 @@ struct uart_pxa_port {
6         unsigned int            lsr_break_flag;
7         unsigned int            cken;
8         char                    *name;
9 +       unsigned int            msr;
10 +       unsigned int            lsr;
11  };
12  
13  static inline unsigned int serial_in(struct uart_pxa_port *up, int offset)
14 @@ -159,6 +161,7 @@ static inline void receive_chars(struct 
15  
16         ignore_char:
17                 *status = serial_in(up, UART_LSR);
18 +               up->lsr = *status;
19         } while ((*status & UART_LSR_DR) && (max_count-- > 0));
20         tty_flip_buffer_push(tty);
21  }
22 @@ -211,7 +214,7 @@ static inline void check_modem_status(st
23         int status;
24  
25         status = serial_in(up, UART_MSR);
26 -
27 +       up->msr = status;
28         if ((status & UART_MSR_ANY_DELTA) == 0)
29                 return;
30  
31 @@ -242,6 +245,7 @@ static inline irqreturn_t serial_pxa_irq
32                 //printk(KERN_WARNING "serial_pxa_irq: odd -- interrupt triggered, but no interrupt in IIR: %08x\n",iir);
33         }
34         lsr = serial_in(up, UART_LSR);
35 +       up->lsr = lsr;
36         if (lsr & UART_LSR_DR)
37                 receive_chars(up, &lsr);
38         check_modem_status(up);
39 @@ -258,7 +262,7 @@ static unsigned int serial_pxa_tx_empty(
40         unsigned int ret;
41  
42         spin_lock_irqsave(&up->port.lock, flags);
43 -       ret = serial_in(up, UART_LSR) & UART_LSR_TEMT ? TIOCSER_TEMT : 0;
44 +       ret = up->lsr & UART_LSR_TEMT ? TIOCSER_TEMT : 0;
45         spin_unlock_irqrestore(&up->port.lock, flags);
46  
47         return ret;
48 @@ -270,7 +274,7 @@ static unsigned int serial_pxa_get_mctrl
49         unsigned char status;
50         unsigned int ret;
51  
52 -       status = serial_in(up, UART_MSR);
53 +       status = up->msr;
54  
55         ret = 0;
56         if (status & UART_MSR_DCD)
57 @@ -400,10 +404,10 @@ static int serial_pxa_startup(struct uar
58         /*
59          * And clear the interrupt registers again for luck.
60          */
61 -       (void) serial_in(up, UART_LSR);
62 +       up->lsr = serial_in(up, UART_LSR);
63         (void) serial_in(up, UART_RX);
64         (void) serial_in(up, UART_IIR);
65 -       (void) serial_in(up, UART_MSR);
66 +       up->msr = serial_in(up, UART_MSR);
67  
68         return 0;
69  }