kernel: bump 5.4 to 5.4.203
[openwrt/openwrt.git] / target / linux / layerscape / patches-5.4 / 819-uart-0005-tty-serial-fsl_lpuart-enable-dma-mode-for-imx8qxp.patch
index f07abc2469a01b51fa0bd70d564b14138900eb1d..22261a4cd5427508369a000549dd3aaebf637cff 100644 (file)
@@ -60,7 +60,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
  /* Rx DMA timeout in ms, which is used to calculate Rx ring buffer size */
  #define DMA_RX_TIMEOUT                (10)
  
-@@ -254,6 +261,9 @@ struct lpuart_port {
+@@ -252,6 +259,9 @@ struct lpuart_port {
        unsigned int            txfifo_size;
        unsigned int            rxfifo_size;
  
@@ -70,7 +70,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
        bool                    lpuart_dma_tx_use;
        bool                    lpuart_dma_rx_use;
        struct dma_chan         *dma_tx_chan;
-@@ -279,33 +289,45 @@ struct lpuart_soc_data {
+@@ -276,33 +286,45 @@ struct lpuart_soc_data {
        enum lpuart_type devtype;
        char iotype;
        u8 reg_off;
@@ -116,7 +116,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
  };
  
  static const struct of_device_id lpuart_dt_ids[] = {
-@@ -320,6 +342,7 @@ MODULE_DEVICE_TABLE(of, lpuart_dt_ids);
+@@ -317,6 +339,7 @@ MODULE_DEVICE_TABLE(of, lpuart_dt_ids);
  
  /* Forward declare this for the dma callbacks*/
  static void lpuart_dma_tx_complete(void *arg);
@@ -124,7 +124,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
  
  static inline bool is_layerscape_lpuart(struct lpuart_port *sport)
  {
-@@ -1011,19 +1034,15 @@ static irqreturn_t lpuart32_int(int irq,
+@@ -1008,19 +1031,15 @@ static irqreturn_t lpuart32_int(int irq,
        if ((sts & UARTSTAT_TDRE) && !sport->lpuart_dma_tx_use)
                lpuart32_txint(sport);
  
@@ -148,7 +148,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
        if (lpuart_is_32(sport)) {
                unsigned long sr = lpuart32_read(&sport->port, UARTSTAT);
  
-@@ -1075,8 +1094,21 @@ static void lpuart_copy_rx_to_tty(struct
+@@ -1072,8 +1091,21 @@ static void lpuart_copy_rx_to_tty(struct
                        writeb(cr2, sport->port.membase + UARTCR2);
                }
        }
@@ -171,7 +171,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
  
        spin_lock_irqsave(&sport->port.lock, flags);
  
-@@ -1139,7 +1171,33 @@ static void lpuart_copy_rx_to_tty(struct
+@@ -1136,7 +1168,33 @@ static void lpuart_copy_rx_to_tty(struct
        spin_unlock_irqrestore(&sport->port.lock, flags);
  
        tty_flip_buffer_push(port);
@@ -206,7 +206,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
  }
  
  static void lpuart_dma_rx_complete(void *arg)
-@@ -1147,6 +1205,8 @@ static void lpuart_dma_rx_complete(void
+@@ -1144,6 +1202,8 @@ static void lpuart_dma_rx_complete(void
        struct lpuart_port *sport = arg;
  
        lpuart_copy_rx_to_tty(sport);
@@ -215,7 +215,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
  }
  
  static void lpuart_timer_func(struct timer_list *t)
-@@ -1154,13 +1214,78 @@ static void lpuart_timer_func(struct tim
+@@ -1151,13 +1211,78 @@ static void lpuart_timer_func(struct tim
        struct lpuart_port *sport = from_timer(sport, t, lpuart_timer);
  
        lpuart_copy_rx_to_tty(sport);
@@ -298,7 +298,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
        int bits, baud;
        struct tty_port *port = &sport->port.state->port;
        struct tty_struct *tty = port->tty;
-@@ -1180,6 +1305,18 @@ static inline int lpuart_start_rx_dma(st
+@@ -1177,6 +1302,18 @@ static inline int lpuart_start_rx_dma(st
        sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len) - 1));
        if (sport->rx_dma_rng_buf_len < 16)
                sport->rx_dma_rng_buf_len = 16;
@@ -317,7 +317,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
  
        ring->buf = kzalloc(sport->rx_dma_rng_buf_len, GFP_ATOMIC);
        if (!ring->buf)
-@@ -1205,32 +1342,7 @@ static inline int lpuart_start_rx_dma(st
+@@ -1202,32 +1339,7 @@ static inline int lpuart_start_rx_dma(st
                return ret;
        }
  
@@ -351,7 +351,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
  }
  
  static void lpuart_dma_rx_free(struct uart_port *port)
-@@ -1416,8 +1528,10 @@ static void lpuart_setup_watermark(struc
+@@ -1413,8 +1525,10 @@ static void lpuart_setup_watermark(struc
                writeb(UARTSFIFO_RXUF, sport->port.membase + UARTSFIFO);
        }
  
@@ -363,7 +363,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
  
        /* Restore cr2 */
        writeb(cr2_saved, sport->port.membase + UARTCR2);
-@@ -1438,6 +1552,7 @@ static void lpuart32_setup_watermark(str
+@@ -1435,6 +1549,7 @@ static void lpuart32_setup_watermark(str
  {
        unsigned long val, ctrl;
        unsigned long ctrl_saved;
@@ -371,7 +371,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
  
        ctrl = lpuart32_read(&sport->port, UARTCTRL);
        ctrl_saved = ctrl;
-@@ -1449,12 +1564,26 @@ static void lpuart32_setup_watermark(str
+@@ -1446,12 +1561,26 @@ static void lpuart32_setup_watermark(str
        val = lpuart32_read(&sport->port, UARTFIFO);
        val |= UARTFIFO_TXFE | UARTFIFO_RXFE;
        val |= UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH;
@@ -399,7 +399,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
        /* Restore cr2 */
        lpuart32_write(&sport->port, ctrl_saved, UARTCTRL);
  }
-@@ -1466,17 +1595,29 @@ static void lpuart32_setup_watermark_ena
+@@ -1463,17 +1592,29 @@ static void lpuart32_setup_watermark_ena
        lpuart32_setup_watermark(sport);
  
        temp = lpuart32_read(&sport->port, UARTCTRL);
@@ -430,7 +430,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
  static void lpuart_tx_dma_startup(struct lpuart_port *sport)
  {
        u32 uartbaud;
-@@ -1540,19 +1681,23 @@ static int lpuart_startup(struct uart_po
+@@ -1537,19 +1678,23 @@ static int lpuart_startup(struct uart_po
        return 0;
  }
  
@@ -461,7 +461,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
        if (!sport->lpuart_dma_tx_use)
                temp |= UARTCTRL_TIE;
        lpuart32_write(&sport->port, temp, UARTCTRL);
-@@ -1596,12 +1741,12 @@ static int lpuart32_startup(struct uart_
+@@ -1593,12 +1738,12 @@ static int lpuart32_startup(struct uart_
  
        spin_lock_irqsave(&sport->port.lock, flags);
  
@@ -476,7 +476,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
        lpuart32_configure(sport);
  
        spin_unlock_irqrestore(&sport->port.lock, flags);
-@@ -1611,7 +1756,7 @@ static int lpuart32_startup(struct uart_
+@@ -1608,7 +1753,7 @@ static int lpuart32_startup(struct uart_
  static void lpuart_dma_shutdown(struct lpuart_port *sport)
  {
        if (sport->lpuart_dma_rx_use) {
@@ -485,7 +485,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
                lpuart_dma_rx_free(&sport->port);
        }
  
-@@ -1652,11 +1797,22 @@ static void lpuart32_shutdown(struct uar
+@@ -1649,11 +1794,22 @@ static void lpuart32_shutdown(struct uar
  
        spin_lock_irqsave(&port->lock, flags);
  
@@ -510,7 +510,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
  
        spin_unlock_irqrestore(&port->lock, flags);
  
-@@ -1753,10 +1909,10 @@ lpuart_set_termios(struct uart_port *por
+@@ -1750,10 +1906,10 @@ lpuart_set_termios(struct uart_port *por
         * baud rate and restart Rx DMA path.
         *
         * Since timer function acqures sport->port.lock, need to stop before
@@ -523,7 +523,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
                lpuart_dma_rx_free(&sport->port);
        }
  
-@@ -1968,10 +2124,10 @@ lpuart32_set_termios(struct uart_port *p
+@@ -1965,10 +2121,10 @@ lpuart32_set_termios(struct uart_port *p
         * baud rate and restart Rx DMA path.
         *
         * Since timer function acqures sport->port.lock, need to stop before
@@ -536,7 +536,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
                lpuart_dma_rx_free(&sport->port);
        }
  
-@@ -2483,6 +2639,10 @@ static int lpuart_probe(struct platform_
+@@ -2480,6 +2636,10 @@ static int lpuart_probe(struct platform_
        sport->port.dev = &pdev->dev;
        sport->port.type = PORT_LPUART;
        sport->devtype = sdata->devtype;
@@ -547,7 +547,7 @@ Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
        ret = platform_get_irq(pdev, 0);
        if (ret < 0)
                return ret;
-@@ -2645,7 +2805,7 @@ static int lpuart_suspend(struct device
+@@ -2630,7 +2790,7 @@ static int lpuart_suspend(struct device
                 * Rx DMA path before suspend and start Rx DMA path on resume.
                 */
                if (irq_wake) {