Advertisement
Guest User

Untitled

a guest
Apr 30th, 2014
566
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.87 KB | None | 0 0
  1. --- a/drivers/tty/serial/mxs-auart.c
  2. +++ b/drivers/tty/serial/mxs-auart.c
  3. @@ -137,6 +137,7 @@
  4.  #define MXS_AUART_DMA_TX_SYNC  2  /* bit 2 */
  5.  #define MXS_AUART_DMA_RX_READY 3  /* bit 3 */
  6.  #define MXS_AUART_RTSCTS   4  /* bit 4 */
  7. +#define MXS_AUART_RS485        5 /* bit 5 */
  8.     unsigned long flags;
  9.     unsigned int ctrl;
  10.     enum mxs_auart_type devtype;
  11. @@ -279,7 +280,9 @@
  12.         return;
  13.     }
  14.  
  15. -
  16. +   if ((test_bit(MXS_AUART_RS485, &s->flags)) && (!(readl(s->port.membase + AUART_STAT) & AUART_STAT_TXFF)) && ((s->port.x_char) || (!uart_circ_empty(xmit) && !uart_tx_stopped(&s->port))))
  17. +       writel(AUART_CTRL2_RTS, s->port.membase + AUART_CTRL2_CLR);
  18. +  
  19.     while (!(readl(s->port.membase + AUART_STAT) &
  20.          AUART_STAT_TXFF)) {
  21.         if (s->port.x_char) {
  22. @@ -309,6 +312,10 @@
  23.  
  24.     if (uart_tx_stopped(&s->port))
  25.         mxs_auart_stop_tx(&s->port);
  26. +   if(test_bit(MXS_AUART_RS485, &s->flags)) {
  27. +       while ((readl(s->port.membase + AUART_STAT) & AUART_STAT_BUSY));
  28. +       writel(AUART_CTRL2_RTS, s->port.membase + AUART_CTRL2_SET);
  29. +   }
  30.  }
  31.  
  32.  static void mxs_auart_rx_char(struct mxs_auart_port *s)
  33. @@ -632,7 +639,7 @@
  34.         ctrl |= AUART_LINECTRL_STP2;
  35.  
  36.     /* figure out the hardware flow control settings */
  37. -   if (cflag & CRTSCTS) {
  38. +   if ((cflag & CRTSCTS) && ~(test_bit(MXS_AUART_RS485, &s->flags))) {
  39.         /*
  40.          * The DMA has a bug(see errata:2836) in mx23.
  41.          * So we can not implement the DMA for auart in mx23,
  42. @@ -649,6 +656,8 @@
  43.         ctrl2 |= AUART_CTRL2_CTSEN | AUART_CTRL2_RTSEN;
  44.     } else {
  45.         ctrl2 &= ~(AUART_CTRL2_CTSEN | AUART_CTRL2_RTSEN);
  46. +       if (test_bit(MXS_AUART_RS485, &s->flags))
  47. +           ctrl2 |= AUART_CTRL2_RTS;
  48.     }
  49.  
  50.     /* set baud rate */
  51. @@ -1011,6 +1020,10 @@
  52.     if (of_get_property(np, "fsl,uart-has-rtscts", NULL))
  53.         set_bit(MXS_AUART_RTSCTS, &s->flags);
  54.  
  55. +   if (of_get_property(np, "fsl,rs485-uart", NULL))
  56. +       set_bit(MXS_AUART_RS485, &s->flags);
  57. +
  58. +
  59.     return 0;
  60.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement