aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/serial_core.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/serial_core.h')
-rw-r--r--include/linux/serial_core.h104
1 files changed, 17 insertions, 87 deletions
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index eadf33d0abba..c91ace70c21d 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -207,6 +207,10 @@
207/* Xilinx PSS UART */ 207/* Xilinx PSS UART */
208#define PORT_XUARTPS 98 208#define PORT_XUARTPS 98
209 209
210/* Atheros AR933X SoC */
211#define PORT_AR933X 99
212
213
210#ifdef __KERNEL__ 214#ifdef __KERNEL__
211 215
212#include <linux/compiler.h> 216#include <linux/compiler.h>
@@ -351,6 +355,7 @@ struct uart_port {
351#define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) 355#define UPF_CONS_FLOW ((__force upf_t) (1 << 23))
352#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) 356#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24))
353#define UPF_EXAR_EFR ((__force upf_t) (1 << 25)) 357#define UPF_EXAR_EFR ((__force upf_t) (1 << 25))
358#define UPF_IIR_ONCE ((__force upf_t) (1 << 26))
354/* The exact UART type is known and should not be probed. */ 359/* The exact UART type is known and should not be probed. */
355#define UPF_FIXED_TYPE ((__force upf_t) (1 << 27)) 360#define UPF_FIXED_TYPE ((__force upf_t) (1 << 27))
356#define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28)) 361#define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28))
@@ -483,10 +488,19 @@ static inline int uart_tx_stopped(struct uart_port *port)
483/* 488/*
484 * The following are helper functions for the low level drivers. 489 * The following are helper functions for the low level drivers.
485 */ 490 */
491
492extern void uart_handle_dcd_change(struct uart_port *uport,
493 unsigned int status);
494extern void uart_handle_cts_change(struct uart_port *uport,
495 unsigned int status);
496
497extern void uart_insert_char(struct uart_port *port, unsigned int status,
498 unsigned int overrun, unsigned int ch, unsigned int flag);
499
500#ifdef SUPPORT_SYSRQ
486static inline int 501static inline int
487uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) 502uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
488{ 503{
489#ifdef SUPPORT_SYSRQ
490 if (port->sysrq) { 504 if (port->sysrq) {
491 if (ch && time_before(jiffies, port->sysrq)) { 505 if (ch && time_before(jiffies, port->sysrq)) {
492 handle_sysrq(ch); 506 handle_sysrq(ch);
@@ -495,11 +509,10 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
495 } 509 }
496 port->sysrq = 0; 510 port->sysrq = 0;
497 } 511 }
498#endif
499 return 0; 512 return 0;
500} 513}
501#ifndef SUPPORT_SYSRQ 514#else
502#define uart_handle_sysrq_char(port,ch) uart_handle_sysrq_char(port, 0) 515#define uart_handle_sysrq_char(port,ch) ({ (void)port; 0; })
503#endif 516#endif
504 517
505/* 518/*
@@ -522,89 +535,6 @@ static inline int uart_handle_break(struct uart_port *port)
522 return 0; 535 return 0;
523} 536}
524 537
525/**
526 * uart_handle_dcd_change - handle a change of carrier detect state
527 * @uport: uart_port structure for the open port
528 * @status: new carrier detect status, nonzero if active
529 */
530static inline void
531uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
532{
533 struct uart_state *state = uport->state;
534 struct tty_port *port = &state->port;
535 struct tty_ldisc *ld = tty_ldisc_ref(port->tty);
536 struct pps_event_time ts;
537
538 if (ld && ld->ops->dcd_change)
539 pps_get_ts(&ts);
540
541 uport->icount.dcd++;
542#ifdef CONFIG_HARD_PPS
543 if ((uport->flags & UPF_HARDPPS_CD) && status)
544 hardpps();
545#endif
546
547 if (port->flags & ASYNC_CHECK_CD) {
548 if (status)
549 wake_up_interruptible(&port->open_wait);
550 else if (port->tty)
551 tty_hangup(port->tty);
552 }
553
554 if (ld && ld->ops->dcd_change)
555 ld->ops->dcd_change(port->tty, status, &ts);
556 if (ld)
557 tty_ldisc_deref(ld);
558}
559
560/**
561 * uart_handle_cts_change - handle a change of clear-to-send state
562 * @uport: uart_port structure for the open port
563 * @status: new clear to send status, nonzero if active
564 */
565static inline void
566uart_handle_cts_change(struct uart_port *uport, unsigned int status)
567{
568 struct tty_port *port = &uport->state->port;
569 struct tty_struct *tty = port->tty;
570
571 uport->icount.cts++;
572
573 if (port->flags & ASYNC_CTS_FLOW) {
574 if (tty->hw_stopped) {
575 if (status) {
576 tty->hw_stopped = 0;
577 uport->ops->start_tx(uport);
578 uart_write_wakeup(uport);
579 }
580 } else {
581 if (!status) {
582 tty->hw_stopped = 1;
583 uport->ops->stop_tx(uport);
584 }
585 }
586 }
587}
588
589#include <linux/tty_flip.h>
590
591static inline void
592uart_insert_char(struct uart_port *port, unsigned int status,
593 unsigned int overrun, unsigned int ch, unsigned int flag)
594{
595 struct tty_struct *tty = port->state->port.tty;
596
597 if ((status & port->ignore_status_mask & ~overrun) == 0)
598 tty_insert_flip_char(tty, ch, flag);
599
600 /*
601 * Overrun is special. Since it's reported immediately,
602 * it doesn't affect the current character.
603 */
604 if (status & ~port->ignore_status_mask & overrun)
605 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
606}
607
608/* 538/*
609 * UART_ENABLE_MS - determine if port should enable modem status irqs 539 * UART_ENABLE_MS - determine if port should enable modem status irqs
610 */ 540 */