|
@@ -117,7 +117,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
|
|
|
|
static inline bool is_imx8qxp_lpuart(struct lpuart_port *sport)
|
|
static inline bool is_imx8qxp_lpuart(struct lpuart_port *sport)
|
|
{
|
|
{
|
|
-@@ -1000,19 +1021,15 @@ static irqreturn_t lpuart32_int(int irq,
|
|
|
|
|
|
+@@ -998,19 +1019,15 @@ static irqreturn_t lpuart32_int(int irq,
|
|
if ((sts & UARTSTAT_TDRE) && !sport->lpuart_dma_tx_use)
|
|
if ((sts & UARTSTAT_TDRE) && !sport->lpuart_dma_tx_use)
|
|
lpuart32_txint(sport);
|
|
lpuart32_txint(sport);
|
|
|
|
|
|
@@ -141,7 +141,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
if (lpuart_is_32(sport)) {
|
|
if (lpuart_is_32(sport)) {
|
|
unsigned long sr = lpuart32_read(&sport->port, UARTSTAT);
|
|
unsigned long sr = lpuart32_read(&sport->port, UARTSTAT);
|
|
|
|
|
|
-@@ -1064,8 +1081,21 @@ static void lpuart_copy_rx_to_tty(struct
|
|
|
|
|
|
+@@ -1062,8 +1079,21 @@ static void lpuart_copy_rx_to_tty(struct
|
|
writeb(cr2, sport->port.membase + UARTCR2);
|
|
writeb(cr2, sport->port.membase + UARTCR2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -164,7 +164,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
|
|
|
|
spin_lock_irqsave(&sport->port.lock, flags);
|
|
spin_lock_irqsave(&sport->port.lock, flags);
|
|
|
|
|
|
-@@ -1128,7 +1158,33 @@ static void lpuart_copy_rx_to_tty(struct
|
|
|
|
|
|
+@@ -1126,7 +1156,33 @@ static void lpuart_copy_rx_to_tty(struct
|
|
spin_unlock_irqrestore(&sport->port.lock, flags);
|
|
spin_unlock_irqrestore(&sport->port.lock, flags);
|
|
|
|
|
|
tty_flip_buffer_push(port);
|
|
tty_flip_buffer_push(port);
|
|
@@ -199,7 +199,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
}
|
|
}
|
|
|
|
|
|
static void lpuart_dma_rx_complete(void *arg)
|
|
static void lpuart_dma_rx_complete(void *arg)
|
|
-@@ -1136,6 +1192,8 @@ static void lpuart_dma_rx_complete(void
|
|
|
|
|
|
+@@ -1134,6 +1190,8 @@ static void lpuart_dma_rx_complete(void
|
|
struct lpuart_port *sport = arg;
|
|
struct lpuart_port *sport = arg;
|
|
|
|
|
|
lpuart_copy_rx_to_tty(sport);
|
|
lpuart_copy_rx_to_tty(sport);
|
|
@@ -208,7 +208,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
}
|
|
}
|
|
|
|
|
|
static void lpuart_timer_func(struct timer_list *t)
|
|
static void lpuart_timer_func(struct timer_list *t)
|
|
-@@ -1143,13 +1201,78 @@ static void lpuart_timer_func(struct tim
|
|
|
|
|
|
+@@ -1141,13 +1199,78 @@ static void lpuart_timer_func(struct tim
|
|
struct lpuart_port *sport = from_timer(sport, t, lpuart_timer);
|
|
struct lpuart_port *sport = from_timer(sport, t, lpuart_timer);
|
|
|
|
|
|
lpuart_copy_rx_to_tty(sport);
|
|
lpuart_copy_rx_to_tty(sport);
|
|
@@ -291,7 +291,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
int bits, baud;
|
|
int bits, baud;
|
|
struct tty_port *port = &sport->port.state->port;
|
|
struct tty_port *port = &sport->port.state->port;
|
|
struct tty_struct *tty = port->tty;
|
|
struct tty_struct *tty = port->tty;
|
|
-@@ -1169,6 +1292,18 @@ static inline int lpuart_start_rx_dma(st
|
|
|
|
|
|
+@@ -1167,6 +1290,18 @@ static inline int lpuart_start_rx_dma(st
|
|
sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len) - 1));
|
|
sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len) - 1));
|
|
if (sport->rx_dma_rng_buf_len < 16)
|
|
if (sport->rx_dma_rng_buf_len < 16)
|
|
sport->rx_dma_rng_buf_len = 16;
|
|
sport->rx_dma_rng_buf_len = 16;
|
|
@@ -310,7 +310,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
|
|
|
|
ring->buf = kzalloc(sport->rx_dma_rng_buf_len, GFP_ATOMIC);
|
|
ring->buf = kzalloc(sport->rx_dma_rng_buf_len, GFP_ATOMIC);
|
|
if (!ring->buf)
|
|
if (!ring->buf)
|
|
-@@ -1194,32 +1329,7 @@ static inline int lpuart_start_rx_dma(st
|
|
|
|
|
|
+@@ -1192,32 +1327,7 @@ static inline int lpuart_start_rx_dma(st
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -344,7 +344,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
}
|
|
}
|
|
|
|
|
|
static void lpuart_dma_rx_free(struct uart_port *port)
|
|
static void lpuart_dma_rx_free(struct uart_port *port)
|
|
-@@ -1405,8 +1515,10 @@ static void lpuart_setup_watermark(struc
|
|
|
|
|
|
+@@ -1403,8 +1513,10 @@ static void lpuart_setup_watermark(struc
|
|
writeb(UARTSFIFO_RXUF, sport->port.membase + UARTSFIFO);
|
|
writeb(UARTSFIFO_RXUF, sport->port.membase + UARTSFIFO);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -356,7 +356,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
|
|
|
|
/* Restore cr2 */
|
|
/* Restore cr2 */
|
|
writeb(cr2_saved, sport->port.membase + UARTCR2);
|
|
writeb(cr2_saved, sport->port.membase + UARTCR2);
|
|
-@@ -1427,6 +1539,7 @@ static void lpuart32_setup_watermark(str
|
|
|
|
|
|
+@@ -1425,6 +1537,7 @@ static void lpuart32_setup_watermark(str
|
|
{
|
|
{
|
|
unsigned long val, ctrl;
|
|
unsigned long val, ctrl;
|
|
unsigned long ctrl_saved;
|
|
unsigned long ctrl_saved;
|
|
@@ -364,7 +364,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
|
|
|
|
ctrl = lpuart32_read(&sport->port, UARTCTRL);
|
|
ctrl = lpuart32_read(&sport->port, UARTCTRL);
|
|
ctrl_saved = ctrl;
|
|
ctrl_saved = ctrl;
|
|
-@@ -1438,12 +1551,26 @@ static void lpuart32_setup_watermark(str
|
|
|
|
|
|
+@@ -1436,12 +1549,26 @@ static void lpuart32_setup_watermark(str
|
|
val = lpuart32_read(&sport->port, UARTFIFO);
|
|
val = lpuart32_read(&sport->port, UARTFIFO);
|
|
val |= UARTFIFO_TXFE | UARTFIFO_RXFE;
|
|
val |= UARTFIFO_TXFE | UARTFIFO_RXFE;
|
|
val |= UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH;
|
|
val |= UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH;
|
|
@@ -392,7 +392,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
/* Restore cr2 */
|
|
/* Restore cr2 */
|
|
lpuart32_write(&sport->port, ctrl_saved, UARTCTRL);
|
|
lpuart32_write(&sport->port, ctrl_saved, UARTCTRL);
|
|
}
|
|
}
|
|
-@@ -1455,17 +1582,29 @@ static void lpuart32_setup_watermark_ena
|
|
|
|
|
|
+@@ -1453,17 +1580,29 @@ static void lpuart32_setup_watermark_ena
|
|
lpuart32_setup_watermark(sport);
|
|
lpuart32_setup_watermark(sport);
|
|
|
|
|
|
temp = lpuart32_read(&sport->port, UARTCTRL);
|
|
temp = lpuart32_read(&sport->port, UARTCTRL);
|
|
@@ -423,7 +423,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
static void lpuart_tx_dma_startup(struct lpuart_port *sport)
|
|
static void lpuart_tx_dma_startup(struct lpuart_port *sport)
|
|
{
|
|
{
|
|
u32 uartbaud;
|
|
u32 uartbaud;
|
|
-@@ -1529,19 +1668,23 @@ static int lpuart_startup(struct uart_po
|
|
|
|
|
|
+@@ -1527,19 +1666,23 @@ static int lpuart_startup(struct uart_po
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -454,7 +454,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
if (!sport->lpuart_dma_tx_use)
|
|
if (!sport->lpuart_dma_tx_use)
|
|
temp |= UARTCTRL_TIE;
|
|
temp |= UARTCTRL_TIE;
|
|
lpuart32_write(&sport->port, temp, UARTCTRL);
|
|
lpuart32_write(&sport->port, temp, UARTCTRL);
|
|
-@@ -1574,12 +1717,12 @@ static int lpuart32_startup(struct uart_
|
|
|
|
|
|
+@@ -1572,12 +1715,12 @@ static int lpuart32_startup(struct uart_
|
|
|
|
|
|
spin_lock_irqsave(&sport->port.lock, flags);
|
|
spin_lock_irqsave(&sport->port.lock, flags);
|
|
|
|
|
|
@@ -469,7 +469,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
lpuart32_configure(sport);
|
|
lpuart32_configure(sport);
|
|
|
|
|
|
spin_unlock_irqrestore(&sport->port.lock, flags);
|
|
spin_unlock_irqrestore(&sport->port.lock, flags);
|
|
-@@ -1589,7 +1732,7 @@ static int lpuart32_startup(struct uart_
|
|
|
|
|
|
+@@ -1587,7 +1730,7 @@ static int lpuart32_startup(struct uart_
|
|
static void lpuart_dma_shutdown(struct lpuart_port *sport)
|
|
static void lpuart_dma_shutdown(struct lpuart_port *sport)
|
|
{
|
|
{
|
|
if (sport->lpuart_dma_rx_use) {
|
|
if (sport->lpuart_dma_rx_use) {
|
|
@@ -478,7 +478,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
lpuart_dma_rx_free(&sport->port);
|
|
lpuart_dma_rx_free(&sport->port);
|
|
}
|
|
}
|
|
|
|
|
|
-@@ -1630,11 +1773,22 @@ static void lpuart32_shutdown(struct uar
|
|
|
|
|
|
+@@ -1628,11 +1771,22 @@ static void lpuart32_shutdown(struct uar
|
|
|
|
|
|
spin_lock_irqsave(&port->lock, flags);
|
|
spin_lock_irqsave(&port->lock, flags);
|
|
|
|
|
|
@@ -503,7 +503,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
|
|
|
|
spin_unlock_irqrestore(&port->lock, flags);
|
|
spin_unlock_irqrestore(&port->lock, flags);
|
|
|
|
|
|
-@@ -1731,10 +1885,10 @@ lpuart_set_termios(struct uart_port *por
|
|
|
|
|
|
+@@ -1729,10 +1883,10 @@ lpuart_set_termios(struct uart_port *por
|
|
* baud rate and restart Rx DMA path.
|
|
* baud rate and restart Rx DMA path.
|
|
*
|
|
*
|
|
* Since timer function acqures sport->port.lock, need to stop before
|
|
* Since timer function acqures sport->port.lock, need to stop before
|
|
@@ -516,7 +516,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
lpuart_dma_rx_free(&sport->port);
|
|
lpuart_dma_rx_free(&sport->port);
|
|
}
|
|
}
|
|
|
|
|
|
-@@ -1946,10 +2100,10 @@ lpuart32_set_termios(struct uart_port *p
|
|
|
|
|
|
+@@ -1944,10 +2098,10 @@ lpuart32_set_termios(struct uart_port *p
|
|
* baud rate and restart Rx DMA path.
|
|
* baud rate and restart Rx DMA path.
|
|
*
|
|
*
|
|
* Since timer function acqures sport->port.lock, need to stop before
|
|
* Since timer function acqures sport->port.lock, need to stop before
|
|
@@ -529,7 +529,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
lpuart_dma_rx_free(&sport->port);
|
|
lpuart_dma_rx_free(&sport->port);
|
|
}
|
|
}
|
|
|
|
|
|
-@@ -2458,6 +2612,10 @@ static int lpuart_probe(struct platform_
|
|
|
|
|
|
+@@ -2456,6 +2610,10 @@ static int lpuart_probe(struct platform_
|
|
sport->port.dev = &pdev->dev;
|
|
sport->port.dev = &pdev->dev;
|
|
sport->port.type = PORT_LPUART;
|
|
sport->port.type = PORT_LPUART;
|
|
sport->devtype = sdata->devtype;
|
|
sport->devtype = sdata->devtype;
|
|
@@ -540,7 +540,7 @@ Signed-off-by: Fugang Duan <[email protected]>
|
|
ret = platform_get_irq(pdev, 0);
|
|
ret = platform_get_irq(pdev, 0);
|
|
if (ret < 0)
|
|
if (ret < 0)
|
|
return ret;
|
|
return ret;
|
|
-@@ -2620,7 +2778,7 @@ static int lpuart_suspend(struct device
|
|
|
|
|
|
+@@ -2618,7 +2776,7 @@ static int lpuart_suspend(struct device
|
|
* Rx DMA path before suspend and start Rx DMA path on resume.
|
|
* Rx DMA path before suspend and start Rx DMA path on resume.
|
|
*/
|
|
*/
|
|
if (irq_wake) {
|
|
if (irq_wake) {
|