37fd23d2050bd1ebd86ceed9b5ec47538498dc30
[openwrt/staging/jow.git] /
1 From 5b05462e88dc87d83566d04dd196b4f3d9dc0eef Mon Sep 17 00:00:00 2001
2 From: Fugang Duan <fugang.duan@nxp.com>
3 Date: Mon, 28 Jan 2019 10:12:52 +0800
4 Subject: [PATCH] tty: serial: fsl_lpuart: add modem device reset
5
6 Add modem device reset, wthether to reset depend on dts configuration.
7
8 Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
9 ---
10 drivers/tty/serial/fsl_lpuart.c | 10 ++++++++++
11 1 file changed, 10 insertions(+)
12
13 --- a/drivers/tty/serial/fsl_lpuart.c
14 +++ b/drivers/tty/serial/fsl_lpuart.c
15 @@ -22,6 +22,7 @@
16 #include <linux/of_dma.h>
17 #include <linux/pm_domain.h>
18 #include <linux/pm_runtime.h>
19 +#include <linux/reset.h>
20 #include <linux/serial_core.h>
21 #include <linux/slab.h>
22 #include <linux/tty_flip.h>
23 @@ -1544,8 +1545,17 @@ static void lpuart32_configure(struct lp
24 static int lpuart32_startup(struct uart_port *port)
25 {
26 struct lpuart_port *sport = container_of(port, struct lpuart_port, port);
27 + struct tty_port *tty_port = &sport->port.state->port;
28 unsigned long flags;
29 unsigned long temp;
30 + int ret;
31 +
32 + /* some modem may need reset */
33 + if (!tty_port_suspended(tty_port)) {
34 + ret = device_reset(sport->port.dev);
35 + if (ret && ret != -ENOENT)
36 + return ret;
37 + }
38
39 /* determine FIFO size */
40 temp = lpuart32_read(&sport->port, UARTFIFO);