Merge tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[firefly-linux-kernel-4.4.55.git] / include / linux / serial_core.h
index 057038cf27880d34a17e428fb51baccf563692c2..baf3e1d08416faaf34edd51bca72c2801e7e7e06 100644 (file)
@@ -123,6 +123,7 @@ struct uart_port {
        void                    (*set_termios)(struct uart_port *,
                                               struct ktermios *new,
                                               struct ktermios *old);
+       void                    (*set_mctrl)(struct uart_port *, unsigned int);
        int                     (*startup)(struct uart_port *port);
        void                    (*shutdown)(struct uart_port *port);
        void                    (*throttle)(struct uart_port *port);
@@ -190,8 +191,10 @@ struct uart_port {
 #define UPF_NO_TXEN_TEST       ((__force upf_t) (1 << 15))
 #define UPF_MAGIC_MULTIPLIER   ((__force upf_t) ASYNC_MAGIC_MULTIPLIER /* 16 */ )
 
-/* Port has hardware-assisted h/w flow control (iow, auto-RTS *not* auto-CTS) */
-#define UPF_HARD_FLOW          ((__force upf_t) (1 << 21))
+/* Port has hardware-assisted h/w flow control */
+#define UPF_AUTO_CTS           ((__force upf_t) (1 << 20))
+#define UPF_AUTO_RTS           ((__force upf_t) (1 << 21))
+#define UPF_HARD_FLOW          ((__force upf_t) (UPF_AUTO_CTS | UPF_AUTO_RTS))
 /* Port has hardware-assisted s/w flow control */
 #define UPF_SOFT_FLOW          ((__force upf_t) (1 << 22))
 #define UPF_CONS_FLOW          ((__force upf_t) (1 << 23))
@@ -213,11 +216,17 @@ struct uart_port {
 #error Change mask not equivalent to userspace-visible bit defines
 #endif
 
-       /* status must be updated while holding port lock */
+       /*
+        * Must hold termios_rwsem, port mutex and port lock to change;
+        * can hold any one lock to read.
+        */
        upstat_t                status;
 
 #define UPSTAT_CTS_ENABLE      ((__force upstat_t) (1 << 0))
 #define UPSTAT_DCD_ENABLE      ((__force upstat_t) (1 << 1))
+#define UPSTAT_AUTORTS         ((__force upstat_t) (1 << 2))
+#define UPSTAT_AUTOCTS         ((__force upstat_t) (1 << 3))
+#define UPSTAT_AUTOXOFF                ((__force upstat_t) (1 << 4))
 
        int                     hw_stopped;             /* sw-assisted CTS flow state */
        unsigned int            mctrl;                  /* current modem ctrl settings */
@@ -391,6 +400,13 @@ static inline bool uart_cts_enabled(struct uart_port *uport)
        return !!(uport->status & UPSTAT_CTS_ENABLE);
 }
 
+static inline bool uart_softcts_mode(struct uart_port *uport)
+{
+       upstat_t mask = UPSTAT_CTS_ENABLE | UPSTAT_AUTOCTS;
+
+       return ((uport->status & mask) == UPSTAT_CTS_ENABLE);
+}
+
 /*
  * The following are helper functions for the low level drivers.
  */