Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
[safe/jmp/linux-2.6] / include / linux / serial_core.h
index 57abcea..3b2f6c0 100644 (file)
@@ -39,7 +39,8 @@
 #define PORT_RSA       13
 #define PORT_NS16550A  14
 #define PORT_XSCALE    15
-#define PORT_MAX_8250  15      /* max port ID */
+#define PORT_RM9000    16      /* PMC-Sierra RM9xxx internal UART */
+#define PORT_MAX_8250  16      /* max port ID */
 
 /*
  * ARM specific type numbers.  These are not currently guaranteed
 #define PORT_SUNZILOG  38
 #define PORT_SUNSAB    39
 
-/* NEC v850.  */
-#define PORT_V850E_UART        40
-
-/* DZ */
-#define PORT_DZ                47
+/* DEC */
+#define PORT_DZ                46
+#define PORT_ZS                47
 
 /* Parisc type numbers. */
 #define PORT_MUX       48
 
-/* Atmel AT91RM9200 SoC */
-#define PORT_AT91RM9200 49
+/* Atmel AT91 / AT32 SoC */
+#define PORT_ATMEL     49
 
 /* Macintosh Zilog type numbers */
 #define PORT_MAC_ZILOG 50      /* m68k : not yet implemented */
 /*Digi jsm */
 #define PORT_JSM        69
 
-#define PORT_IP3106    70
+#define PORT_PNX8XXX   70
 
 /* Hilscher netx */
 #define PORT_NETX      71
 /* SUN4V Hypervisor Console */
 #define PORT_SUNHV     72
 
+#define PORT_S3C2412   73
+
+/* Xilinx uartlite */
+#define PORT_UARTLITE  74
+
+/* Blackfin bf5xx */
+#define PORT_BFIN      75
+
+/* Micrel KS8695 */
+#define PORT_KS8695    76
+
+/* Broadcom SB1250, etc. SOC */
+#define PORT_SB1250_DUART      77
+
+/* Freescale ColdFire */
+#define PORT_MCF       78
+
+/* Blackfin SPORT */
+#define PORT_BFIN_SPORT                79
+
+/* MN10300 on-chip UART numbers */
+#define PORT_MN10300           80
+#define PORT_MN10300_CTS       81
+
+#define PORT_SC26XX    82
+
 #ifdef __KERNEL__
 
-#include <linux/config.h>
 #include <linux/compiler.h>
 #include <linux/interrupt.h>
 #include <linux/circ_buf.h>
 #include <linux/sched.h>
 #include <linux/tty.h>
 #include <linux/mutex.h>
+#include <linux/sysrq.h>
 
 struct uart_port;
 struct uart_info;
@@ -162,8 +187,10 @@ struct uart_ops {
        void            (*break_ctl)(struct uart_port *, int ctl);
        int             (*startup)(struct uart_port *);
        void            (*shutdown)(struct uart_port *);
-       void            (*set_termios)(struct uart_port *, struct termios *new,
-                                      struct termios *old);
+       void            (*flush_buffer)(struct uart_port *);
+       void            (*set_termios)(struct uart_port *, struct ktermios *new,
+                                      struct ktermios *old);
+       void            (*set_ldisc)(struct uart_port *);
        void            (*pm)(struct uart_port *, unsigned int state,
                              unsigned int oldstate);
        int             (*set_wake)(struct uart_port *, unsigned int state);
@@ -187,6 +214,10 @@ struct uart_ops {
        void            (*config_port)(struct uart_port *, int);
        int             (*verify_port)(struct uart_port *, struct serial_struct *);
        int             (*ioctl)(struct uart_port *, unsigned int, unsigned long);
+#ifdef CONFIG_CONSOLE_POLL
+       void    (*poll_put_char)(struct uart_port *, unsigned char);
+       int             (*poll_get_char)(struct uart_port *);
+#endif
 };
 
 #define UART_CONFIG_TYPE       (1 << 0)
@@ -214,16 +245,20 @@ struct uart_port {
        unsigned char __iomem   *membase;               /* read/write[bwl] */
        unsigned int            irq;                    /* irq number */
        unsigned int            uartclk;                /* base uart clock */
-       unsigned char           fifosize;               /* tx fifo size */
+       unsigned int            fifosize;               /* tx fifo size */
        unsigned char           x_char;                 /* xon/xoff char */
        unsigned char           regshift;               /* reg offset shift */
        unsigned char           iotype;                 /* io access style */
+       unsigned char           unused1;
 
 #define UPIO_PORT              (0)
 #define UPIO_HUB6              (1)
 #define UPIO_MEM               (2)
 #define UPIO_MEM32             (3)
 #define UPIO_AU                        (4)                     /* Au1x00 type IO */
+#define UPIO_TSI               (5)                     /* Tsi108/109 type IO */
+#define UPIO_DWAPB             (6)                     /* DesignWare APB UART */
+#define UPIO_RM9000            (7)                     /* RM9000 type IO */
 
        unsigned int            read_status_mask;       /* driver specific */
        unsigned int            ignore_status_mask;     /* driver specific */
@@ -254,6 +289,8 @@ struct uart_port {
 #define UPF_CONS_FLOW          ((__force upf_t) (1 << 23))
 #define UPF_SHARE_IRQ          ((__force upf_t) (1 << 24))
 #define UPF_BOOT_AUTOCONF      ((__force upf_t) (1 << 28))
+#define UPF_FIXED_PORT         ((__force upf_t) (1 << 29))
+#define UPF_DEAD               ((__force upf_t) (1 << 30))
 #define UPF_IOREMAP            ((__force upf_t) (1 << 31))
 
 #define UPF_CHANGE_MASK                ((__force upf_t) (0x17fff))
@@ -265,10 +302,12 @@ struct uart_port {
        const struct uart_ops   *ops;
        unsigned int            custom_divisor;
        unsigned int            line;                   /* port index */
-       unsigned long           mapbase;                /* for ioremap */
+       resource_size_t         mapbase;                /* for ioremap */
        struct device           *dev;                   /* parent device */
        unsigned char           hub6;                   /* this should be in the 8250 driver */
-       unsigned char           unused[3];
+       unsigned char           suspended;
+       unsigned char           unused[2];
+       void                    *private_data;          /* generic platform data pointer */
 };
 
 /*
@@ -302,24 +341,23 @@ typedef unsigned int __bitwise__ uif_t;
  * stuff here.
  */
 struct uart_info {
-       struct tty_struct       *tty;
+       struct tty_port         port;
        struct circ_buf         xmit;
        uif_t                   flags;
 
 /*
  * Definitions for info->flags.  These are _private_ to serial_core, and
  * are specific to this structure.  They may be queried by low level drivers.
+ *
+ * FIXME: use the ASY_ definitions
  */
 #define UIF_CHECK_CD           ((__force uif_t) (1 << 25))
 #define UIF_CTS_FLOW           ((__force uif_t) (1 << 26))
 #define UIF_NORMAL_ACTIVE      ((__force uif_t) (1 << 29))
 #define UIF_INITIALIZED                ((__force uif_t) (1 << 31))
-
-       int                     blocked_open;
+#define UIF_SUSPENDED          ((__force uif_t) (1 << 30))
 
        struct tasklet_struct   tlet;
-
-       wait_queue_head_t       open_wait;
        wait_queue_head_t       delta_msr_wait;
 };
 
@@ -333,7 +371,6 @@ struct uart_driver {
        struct module           *owner;
        const char              *driver_name;
        const char              *dev_name;
-       const char              *devfs_name;
        int                      major;
        int                      minor;
        int                      nr;
@@ -354,8 +391,8 @@ void uart_write_wakeup(struct uart_port *port);
  */
 void uart_update_timeout(struct uart_port *port, unsigned int cflag,
                         unsigned int baud);
-unsigned int uart_get_baud_rate(struct uart_port *port, struct termios *termios,
-                               struct termios *old, unsigned int min,
+unsigned int uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
+                               struct ktermios *old, unsigned int min,
                                unsigned int max);
 unsigned int uart_get_divisor(struct uart_port *port, unsigned int baud);
 
@@ -369,6 +406,9 @@ void uart_parse_options(char *options, int *baud, int *parity, int *bits,
 int uart_set_options(struct uart_port *port, struct console *co, int baud,
                     int parity, int bits, int flow);
 struct tty_driver *uart_console_device(struct console *co, int *index);
+void uart_console_write(struct uart_port *port, const char *s,
+                       unsigned int count,
+                       void (*putchar)(struct uart_port *, int));
 
 /*
  * Port/driver registration/removal
@@ -394,20 +434,19 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
 #define uart_circ_chars_free(circ)     \
        (CIRC_SPACE((circ)->head, (circ)->tail, UART_XMIT_SIZE))
 
-#define uart_tx_stopped(port         \
-       ((port)->info->tty->stopped || (port)->info->tty->hw_stopped)
+#define uart_tx_stopped(portp)         \
+       ((portp)->info->port.tty->stopped || (portp)->info->port.tty->hw_stopped)
 
 /*
  * The following are helper functions for the low level drivers.
  */
 static inline int
-uart_handle_sysrq_char(struct uart_port *port, unsigned int ch,
-                      struct pt_regs *regs)
+uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
 {
 #ifdef SUPPORT_SYSRQ
        if (port->sysrq) {
                if (ch && time_before(jiffies, port->sysrq)) {
-                       handle_sysrq(ch, regs, NULL);
+                       handle_sysrq(ch, port->info ? port->info->port.tty : NULL);
                        port->sysrq = 0;
                        return 1;
                }
@@ -417,7 +456,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch,
        return 0;
 }
 #ifndef SUPPORT_SYSRQ
-#define uart_handle_sysrq_char(port,ch,regs) uart_handle_sysrq_char(port, 0, NULL)
+#define uart_handle_sysrq_char(port,ch) uart_handle_sysrq_char(port, 0)
 #endif
 
 /*
@@ -436,7 +475,7 @@ static inline int uart_handle_break(struct uart_port *port)
        }
 #endif
        if (port->flags & UPF_SAK)
-               do_SAK(info->tty);
+               do_SAK(info->port.tty);
        return 0;
 }
 
@@ -459,9 +498,9 @@ uart_handle_dcd_change(struct uart_port *port, unsigned int status)
 
        if (info->flags & UIF_CHECK_CD) {
                if (status)
-                       wake_up_interruptible(&info->open_wait);
-               else if (info->tty)
-                       tty_hangup(info->tty);
+                       wake_up_interruptible(&info->port.open_wait);
+               else if (info->port.tty)
+                       tty_hangup(info->port.tty);
        }
 }
 
@@ -474,7 +513,7 @@ static inline void
 uart_handle_cts_change(struct uart_port *port, unsigned int status)
 {
        struct uart_info *info = port->info;
-       struct tty_struct *tty = info->tty;
+       struct tty_struct *tty = info->port.tty;
 
        port->icount.cts++;
 
@@ -500,7 +539,7 @@ static inline void
 uart_insert_char(struct uart_port *port, unsigned int status,
                 unsigned int overrun, unsigned int ch, unsigned int flag)
 {
-       struct tty_struct *tty = port->info->tty;
+       struct tty_struct *tty = port->info->port.tty;
 
        if ((status & port->ignore_status_mask & ~overrun) == 0)
                tty_insert_flip_char(tty, ch, flag);