xref: /openbmc/linux/include/linux/serial.h (revision d9c1d3cb)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * include/linux/serial.h
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  * Copyright (C) 1992 by Theodore Ts'o.
51da177e4SLinus Torvalds  *
61da177e4SLinus Torvalds  * Redistribution of this file is permitted under the terms of the GNU
71da177e4SLinus Torvalds  * Public License (GPL)
81da177e4SLinus Torvalds  */
91da177e4SLinus Torvalds #ifndef _LINUX_SERIAL_H
101da177e4SLinus Torvalds #define _LINUX_SERIAL_H
111da177e4SLinus Torvalds 
12607ca46eSDavid Howells #include <uapi/linux/serial.h>
1334619de1SIlpo Järvinen #include <uapi/linux/serial_reg.h>
141da177e4SLinus Torvalds 
15ef460db2SIlpo Järvinen #define UART_IER_ALL_INTR	(UART_IER_MSI | \
16ef460db2SIlpo Järvinen 				 UART_IER_RLSI | \
17ef460db2SIlpo Järvinen 				 UART_IER_THRI | \
18ef460db2SIlpo Järvinen 				 UART_IER_RDI)
19ef460db2SIlpo Järvinen 
20797bd4d4SJiri Slaby /* Helper for dealing with UART_LCR_WLEN* defines */
21797bd4d4SJiri Slaby #define UART_LCR_WLEN(x)	((x) - 5)
22ba3fe7abSAlan Cox 
2334619de1SIlpo Järvinen /* FIFO and shifting register empty */
2434619de1SIlpo Järvinen #define UART_LSR_BOTH_EMPTY	(UART_LSR_TEMT | UART_LSR_THRE)
2534619de1SIlpo Järvinen 
uart_lsr_tx_empty(u16 lsr)2634619de1SIlpo Järvinen static inline bool uart_lsr_tx_empty(u16 lsr)
2734619de1SIlpo Järvinen {
2834619de1SIlpo Järvinen 	return (lsr & UART_LSR_BOTH_EMPTY) == UART_LSR_BOTH_EMPTY;
2934619de1SIlpo Järvinen }
3034619de1SIlpo Järvinen 
31*d9c1d3cbSIlpo Järvinen #define UART_MSR_STATUS_BITS	(UART_MSR_DCD | \
32*d9c1d3cbSIlpo Järvinen 				 UART_MSR_RI | \
33*d9c1d3cbSIlpo Järvinen 				 UART_MSR_DSR | \
34*d9c1d3cbSIlpo Järvinen 				 UART_MSR_CTS)
35*d9c1d3cbSIlpo Järvinen 
361da177e4SLinus Torvalds /*
371da177e4SLinus Torvalds  * Counters of the input lines (CTS, DSR, RI, CD) interrupts
381da177e4SLinus Torvalds  */
391da177e4SLinus Torvalds 
401da177e4SLinus Torvalds struct async_icount {
411da177e4SLinus Torvalds 	__u32	cts, dsr, rng, dcd, tx, rx;
421da177e4SLinus Torvalds 	__u32	frame, parity, overrun, brk;
431da177e4SLinus Torvalds 	__u32	buf_overrun;
441da177e4SLinus Torvalds };
451da177e4SLinus Torvalds 
46661f83a6SRussell King #include <linux/compiler.h>
47661f83a6SRussell King 
481da177e4SLinus Torvalds #endif /* _LINUX_SERIAL_H */
49