819-uart-0002-tty-serial-fsl_lpuart-add-modem-device-reset.patch 1.2 KB

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