Advertisement
Guest User

Untitled

a guest
Mar 26th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. From bf020fdfbbf362bed0aab90edf457fc6cffc9e46 Mon Sep 17 00:00:00 2001
  2. From: Fabio Estevam <fabio.estevam@freescale.com>
  3. Date: Wed, 26 Mar 2014 12:43:58 -0300
  4. Subject: [PATCH] serial: mxs-auart: Add support for inverted RTS/CTS output
  5.  
  6. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
  7. ---
  8. Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt | 1 +
  9. drivers/tty/serial/mxs-auart.c | 8 ++++++++
  10. 2 files changed, 9 insertions(+)
  11.  
  12. diff --git a/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt b/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt
  13. index 59a40f1..2351f55 100644
  14. --- a/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt
  15. +++ b/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt
  16. @@ -13,6 +13,7 @@ Required properties:
  17. Optional properties:
  18. - fsl,uart-has-rtscts : Indicate the UART has RTS and CTS lines,
  19. it also means you enable the DMA support for this UART.
  20. +- fsl,invert-rtscts: Indicate that RTS output is inverted before transmitted
  21.  
  22. Example:
  23. auart0: serial@8006a000 {
  24. diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
  25. index aa97fd8..6cdcf7e 100644
  26. --- a/drivers/tty/serial/mxs-auart.c
  27. +++ b/drivers/tty/serial/mxs-auart.c
  28. @@ -79,6 +79,8 @@
  29.  
  30. #define AUART_CTRL1_XFER_COUNT(v) ((v) & 0xffff)
  31.  
  32. +#define AUART_CTRL2_INVERT_RTS (1 << 31)
  33. +#define AUART_CTRL2_INVERT_CTS (1 << 30)
  34. #define AUART_CTRL2_DMAONERR (1 << 26)
  35. #define AUART_CTRL2_TXDMAE (1 << 25)
  36. #define AUART_CTRL2_RXDMAE (1 << 24)
  37. @@ -138,6 +140,7 @@ struct mxs_auart_port {
  38. #define MXS_AUART_DMA_TX_SYNC 2 /* bit 2 */
  39. #define MXS_AUART_DMA_RX_READY 3 /* bit 3 */
  40. #define MXS_AUART_RTSCTS 4 /* bit 4 */
  41. +#define MXS_AUART_INVERT_RTSCTS 5 /* bit 5 */
  42. unsigned long flags;
  43. unsigned int ctrl;
  44. enum mxs_auart_type devtype;
  45. @@ -637,6 +640,8 @@ static void mxs_auart_settermios(struct uart_port *u,
  46.  
  47. /* figure out the hardware flow control settings */
  48. if (cflag & CRTSCTS) {
  49. + if (test_bit(MXS_AUART_INVERT_RTSCTS, &s->flags))
  50. + ctrl2 |= AUART_CTRL2_INVERT_RTS | AUART_CTRL2_INVERT_CTS;
  51. /*
  52. * The DMA has a bug(see errata:2836) in mx23.
  53. * So we can not implement the DMA for auart in mx23,
  54. @@ -1023,6 +1028,9 @@ static int serial_mxs_probe_dt(struct mxs_auart_port *s,
  55. if (of_get_property(np, "fsl,uart-has-rtscts", NULL))
  56. set_bit(MXS_AUART_RTSCTS, &s->flags);
  57.  
  58. + if (of_get_property(np, "fsl,invert-rtscts", NULL))
  59. + set_bit(MXS_AUART_INVERT_RTSCTS, &s->flags);
  60. +
  61. return 0;
  62. }
  63.  
  64. --
  65. 1.8.1.2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement