diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-09 04:49:23 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-09 04:49:23 +0300 |
commit | 8f3207c7eab9d885cc64c778416537034a7d9c5b (patch) | |
tree | 733ec3a8c62b1906a72a6075966c1f57a37b0387 /include | |
parent | bf5f89463f5b3109a72ed13ca62b57e90213387d (diff) | |
parent | 8e1c21f486944bf92f2a981f23ee811a45f5eaff (diff) | |
download | linux-8f3207c7eab9d885cc64c778416537034a7d9c5b.tar.xz |
Merge tag 'tty-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial updates from Greg KH:
"Here is the "big" TTY/Serial patch updates for 4.12-rc1
Not a lot of new things here, the normal number of serial driver
updates and additions, tiny bugs fixed, and some core files split up
to make future changes a bit easier for Nicolas's "tiny-tty" work.
All of these have been in linux-next for a while"
* tag 'tty-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (62 commits)
serial: small Makefile reordering
tty: split job control support into a file of its own
tty: move baudrate handling code to a file of its own
console: move console_init() out of tty_io.c
serial: 8250_early: Add earlycon support for Palmchip UART
tty: pl011: use "qdf2400_e44" as the earlycon name for QDF2400 E44
vt: make mouse selection of non-ASCII consistent
vt: set mouse selection word-chars to gpm's default
imx-serial: Reduce RX DMA startup latency when opening for reading
serial: omap: suspend device on probe errors
serial: omap: fix runtime-pm handling on unbind
tty: serial: omap: add UPF_BOOT_AUTOCONF flag for DT init
serial: samsung: Remove useless spinlock
serial: samsung: Add missing checks for dma_map_single failure
serial: samsung: Use right device for DMA-mapping calls
serial: imx: setup DCEDTE early and ensure DCD and RI irqs to be off
tty: fix comment typo s/repsonsible/responsible/
tty: amba-pl011: Fix spurious TX interrupts
serial: xuartps: Enable clocks in the pm disable case also
serial: core: Re-use struct uart_port {name} field
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/atmel_serial.h | 169 | ||||
-rw-r--r-- | include/linux/console.h | 2 | ||||
-rw-r--r-- | include/linux/serdev.h | 21 | ||||
-rw-r--r-- | include/linux/serial_core.h | 1 | ||||
-rw-r--r-- | include/linux/tty.h | 13 |
5 files changed, 30 insertions, 176 deletions
diff --git a/include/linux/atmel_serial.h b/include/linux/atmel_serial.h deleted file mode 100644 index bd2560502f3c..000000000000 --- a/include/linux/atmel_serial.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * include/linux/atmel_serial.h - * - * Copyright (C) 2005 Ivan Kokshaysky - * Copyright (C) SAN People - * - * USART registers. - * Based on AT91RM9200 datasheet revision E. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#ifndef ATMEL_SERIAL_H -#define ATMEL_SERIAL_H - -#define ATMEL_US_CR 0x00 /* Control Register */ -#define ATMEL_US_RSTRX BIT(2) /* Reset Receiver */ -#define ATMEL_US_RSTTX BIT(3) /* Reset Transmitter */ -#define ATMEL_US_RXEN BIT(4) /* Receiver Enable */ -#define ATMEL_US_RXDIS BIT(5) /* Receiver Disable */ -#define ATMEL_US_TXEN BIT(6) /* Transmitter Enable */ -#define ATMEL_US_TXDIS BIT(7) /* Transmitter Disable */ -#define ATMEL_US_RSTSTA BIT(8) /* Reset Status Bits */ -#define ATMEL_US_STTBRK BIT(9) /* Start Break */ -#define ATMEL_US_STPBRK BIT(10) /* Stop Break */ -#define ATMEL_US_STTTO BIT(11) /* Start Time-out */ -#define ATMEL_US_SENDA BIT(12) /* Send Address */ -#define ATMEL_US_RSTIT BIT(13) /* Reset Iterations */ -#define ATMEL_US_RSTNACK BIT(14) /* Reset Non Acknowledge */ -#define ATMEL_US_RETTO BIT(15) /* Rearm Time-out */ -#define ATMEL_US_DTREN BIT(16) /* Data Terminal Ready Enable */ -#define ATMEL_US_DTRDIS BIT(17) /* Data Terminal Ready Disable */ -#define ATMEL_US_RTSEN BIT(18) /* Request To Send Enable */ -#define ATMEL_US_RTSDIS BIT(19) /* Request To Send Disable */ -#define ATMEL_US_TXFCLR BIT(24) /* Transmit FIFO Clear */ -#define ATMEL_US_RXFCLR BIT(25) /* Receive FIFO Clear */ -#define ATMEL_US_TXFLCLR BIT(26) /* Transmit FIFO Lock Clear */ -#define ATMEL_US_FIFOEN BIT(30) /* FIFO enable */ -#define ATMEL_US_FIFODIS BIT(31) /* FIFO disable */ - -#define ATMEL_US_MR 0x04 /* Mode Register */ -#define ATMEL_US_USMODE GENMASK(3, 0) /* Mode of the USART */ -#define ATMEL_US_USMODE_NORMAL 0 -#define ATMEL_US_USMODE_RS485 1 -#define ATMEL_US_USMODE_HWHS 2 -#define ATMEL_US_USMODE_MODEM 3 -#define ATMEL_US_USMODE_ISO7816_T0 4 -#define ATMEL_US_USMODE_ISO7816_T1 6 -#define ATMEL_US_USMODE_IRDA 8 -#define ATMEL_US_USCLKS GENMASK(5, 4) /* Clock Selection */ -#define ATMEL_US_USCLKS_MCK (0 << 4) -#define ATMEL_US_USCLKS_MCK_DIV8 (1 << 4) -#define ATMEL_US_USCLKS_SCK (3 << 4) -#define ATMEL_US_CHRL GENMASK(7, 6) /* Character Length */ -#define ATMEL_US_CHRL_5 (0 << 6) -#define ATMEL_US_CHRL_6 (1 << 6) -#define ATMEL_US_CHRL_7 (2 << 6) -#define ATMEL_US_CHRL_8 (3 << 6) -#define ATMEL_US_SYNC BIT(8) /* Synchronous Mode Select */ -#define ATMEL_US_PAR GENMASK(11, 9) /* Parity Type */ -#define ATMEL_US_PAR_EVEN (0 << 9) -#define ATMEL_US_PAR_ODD (1 << 9) -#define ATMEL_US_PAR_SPACE (2 << 9) -#define ATMEL_US_PAR_MARK (3 << 9) -#define ATMEL_US_PAR_NONE (4 << 9) -#define ATMEL_US_PAR_MULTI_DROP (6 << 9) -#define ATMEL_US_NBSTOP GENMASK(13, 12) /* Number of Stop Bits */ -#define ATMEL_US_NBSTOP_1 (0 << 12) -#define ATMEL_US_NBSTOP_1_5 (1 << 12) -#define ATMEL_US_NBSTOP_2 (2 << 12) -#define ATMEL_US_CHMODE GENMASK(15, 14) /* Channel Mode */ -#define ATMEL_US_CHMODE_NORMAL (0 << 14) -#define ATMEL_US_CHMODE_ECHO (1 << 14) -#define ATMEL_US_CHMODE_LOC_LOOP (2 << 14) -#define ATMEL_US_CHMODE_REM_LOOP (3 << 14) -#define ATMEL_US_MSBF BIT(16) /* Bit Order */ -#define ATMEL_US_MODE9 BIT(17) /* 9-bit Character Length */ -#define ATMEL_US_CLKO BIT(18) /* Clock Output Select */ -#define ATMEL_US_OVER BIT(19) /* Oversampling Mode */ -#define ATMEL_US_INACK BIT(20) /* Inhibit Non Acknowledge */ -#define ATMEL_US_DSNACK BIT(21) /* Disable Successive NACK */ -#define ATMEL_US_MAX_ITER GENMASK(26, 24) /* Max Iterations */ -#define ATMEL_US_FILTER BIT(28) /* Infrared Receive Line Filter */ - -#define ATMEL_US_IER 0x08 /* Interrupt Enable Register */ -#define ATMEL_US_RXRDY BIT(0) /* Receiver Ready */ -#define ATMEL_US_TXRDY BIT(1) /* Transmitter Ready */ -#define ATMEL_US_RXBRK BIT(2) /* Break Received / End of Break */ -#define ATMEL_US_ENDRX BIT(3) /* End of Receiver Transfer */ -#define ATMEL_US_ENDTX BIT(4) /* End of Transmitter Transfer */ -#define ATMEL_US_OVRE BIT(5) /* Overrun Error */ -#define ATMEL_US_FRAME BIT(6) /* Framing Error */ -#define ATMEL_US_PARE BIT(7) /* Parity Error */ -#define ATMEL_US_TIMEOUT BIT(8) /* Receiver Time-out */ -#define ATMEL_US_TXEMPTY BIT(9) /* Transmitter Empty */ -#define ATMEL_US_ITERATION BIT(10) /* Max number of Repetitions Reached */ -#define ATMEL_US_TXBUFE BIT(11) /* Transmission Buffer Empty */ -#define ATMEL_US_RXBUFF BIT(12) /* Reception Buffer Full */ -#define ATMEL_US_NACK BIT(13) /* Non Acknowledge */ -#define ATMEL_US_RIIC BIT(16) /* Ring Indicator Input Change */ -#define ATMEL_US_DSRIC BIT(17) /* Data Set Ready Input Change */ -#define ATMEL_US_DCDIC BIT(18) /* Data Carrier Detect Input Change */ -#define ATMEL_US_CTSIC BIT(19) /* Clear to Send Input Change */ -#define ATMEL_US_RI BIT(20) /* RI */ -#define ATMEL_US_DSR BIT(21) /* DSR */ -#define ATMEL_US_DCD BIT(22) /* DCD */ -#define ATMEL_US_CTS BIT(23) /* CTS */ - -#define ATMEL_US_IDR 0x0c /* Interrupt Disable Register */ -#define ATMEL_US_IMR 0x10 /* Interrupt Mask Register */ -#define ATMEL_US_CSR 0x14 /* Channel Status Register */ -#define ATMEL_US_RHR 0x18 /* Receiver Holding Register */ -#define ATMEL_US_THR 0x1c /* Transmitter Holding Register */ -#define ATMEL_US_SYNH BIT(15) /* Transmit/Receive Sync */ - -#define ATMEL_US_BRGR 0x20 /* Baud Rate Generator Register */ -#define ATMEL_US_CD GENMASK(15, 0) /* Clock Divider */ -#define ATMEL_US_FP_OFFSET 16 /* Fractional Part */ -#define ATMEL_US_FP_MASK 0x7 - -#define ATMEL_US_RTOR 0x24 /* Receiver Time-out Register for USART */ -#define ATMEL_UA_RTOR 0x28 /* Receiver Time-out Register for UART */ -#define ATMEL_US_TO GENMASK(15, 0) /* Time-out Value */ - -#define ATMEL_US_TTGR 0x28 /* Transmitter Timeguard Register */ -#define ATMEL_US_TG GENMASK(7, 0) /* Timeguard Value */ - -#define ATMEL_US_FIDI 0x40 /* FI DI Ratio Register */ -#define ATMEL_US_NER 0x44 /* Number of Errors Register */ -#define ATMEL_US_IF 0x4c /* IrDA Filter Register */ - -#define ATMEL_US_CMPR 0x90 /* Comparaison Register */ -#define ATMEL_US_FMR 0xa0 /* FIFO Mode Register */ -#define ATMEL_US_TXRDYM(data) (((data) & 0x3) << 0) /* TX Ready Mode */ -#define ATMEL_US_RXRDYM(data) (((data) & 0x3) << 4) /* RX Ready Mode */ -#define ATMEL_US_ONE_DATA 0x0 -#define ATMEL_US_TWO_DATA 0x1 -#define ATMEL_US_FOUR_DATA 0x2 -#define ATMEL_US_FRTSC BIT(7) /* FIFO RTS pin Control */ -#define ATMEL_US_TXFTHRES(thr) (((thr) & 0x3f) << 8) /* TX FIFO Threshold */ -#define ATMEL_US_RXFTHRES(thr) (((thr) & 0x3f) << 16) /* RX FIFO Threshold */ -#define ATMEL_US_RXFTHRES2(thr) (((thr) & 0x3f) << 24) /* RX FIFO Threshold2 */ - -#define ATMEL_US_FLR 0xa4 /* FIFO Level Register */ -#define ATMEL_US_TXFL(reg) (((reg) >> 0) & 0x3f) /* TX FIFO Level */ -#define ATMEL_US_RXFL(reg) (((reg) >> 16) & 0x3f) /* RX FIFO Level */ - -#define ATMEL_US_FIER 0xa8 /* FIFO Interrupt Enable Register */ -#define ATMEL_US_FIDR 0xac /* FIFO Interrupt Disable Register */ -#define ATMEL_US_FIMR 0xb0 /* FIFO Interrupt Mask Register */ -#define ATMEL_US_FESR 0xb4 /* FIFO Event Status Register */ -#define ATMEL_US_TXFEF BIT(0) /* Transmit FIFO Empty Flag */ -#define ATMEL_US_TXFFF BIT(1) /* Transmit FIFO Full Flag */ -#define ATMEL_US_TXFTHF BIT(2) /* Transmit FIFO Threshold Flag */ -#define ATMEL_US_RXFEF BIT(3) /* Receive FIFO Empty Flag */ -#define ATMEL_US_RXFFF BIT(4) /* Receive FIFO Full Flag */ -#define ATMEL_US_RXFTHF BIT(5) /* Receive FIFO Threshold Flag */ -#define ATMEL_US_TXFPTEF BIT(6) /* Transmit FIFO Pointer Error Flag */ -#define ATMEL_US_RXFPTEF BIT(7) /* Receive FIFO Pointer Error Flag */ -#define ATMEL_US_TXFLOCK BIT(8) /* Transmit FIFO Lock (FESR only) */ -#define ATMEL_US_RXFTHF2 BIT(9) /* Receive FIFO Threshold Flag 2 */ - -#define ATMEL_US_NAME 0xf0 /* Ip Name */ -#define ATMEL_US_VERSION 0xfc /* Ip Version */ - -#endif diff --git a/include/linux/console.h b/include/linux/console.h index 5949d1855589..b8920a031a3e 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -212,4 +212,6 @@ extern bool vgacon_text_force(void); static inline bool vgacon_text_force(void) { return false; } #endif +extern void console_init(void); + #endif /* _LINUX_CONSOLE_H */ diff --git a/include/linux/serdev.h b/include/linux/serdev.h index 37395b8eb8f1..cda76c6506ca 100644 --- a/include/linux/serdev.h +++ b/include/linux/serdev.h @@ -41,12 +41,16 @@ struct serdev_device_ops { * @nr: Device number on serdev bus. * @ctrl: serdev controller managing this device. * @ops: Device operations. + * @write_comp Completion used by serdev_device_write() internally + * @write_lock Lock to serialize access when writing data */ struct serdev_device { struct device dev; int nr; struct serdev_controller *ctrl; const struct serdev_device_ops *ops; + struct completion write_comp; + struct mutex write_lock; }; static inline struct serdev_device *to_serdev_device(struct device *d) @@ -170,7 +174,7 @@ static inline void serdev_controller_write_wakeup(struct serdev_controller *ctrl if (!serdev || !serdev->ops->write_wakeup) return; - serdev->ops->write_wakeup(ctrl->serdev); + serdev->ops->write_wakeup(serdev); } static inline int serdev_controller_receive_buf(struct serdev_controller *ctrl, @@ -182,7 +186,7 @@ static inline int serdev_controller_receive_buf(struct serdev_controller *ctrl, if (!serdev || !serdev->ops->receive_buf) return -EINVAL; - return serdev->ops->receive_buf(ctrl->serdev, data, count); + return serdev->ops->receive_buf(serdev, data, count); } #if IS_ENABLED(CONFIG_SERIAL_DEV_BUS) @@ -194,7 +198,8 @@ void serdev_device_set_flow_control(struct serdev_device *, bool); void serdev_device_wait_until_sent(struct serdev_device *, long); int serdev_device_get_tiocm(struct serdev_device *); int serdev_device_set_tiocm(struct serdev_device *, int, int); -int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_t); +void serdev_device_write_wakeup(struct serdev_device *); +int serdev_device_write(struct serdev_device *, const unsigned char *, size_t, unsigned long); void serdev_device_write_flush(struct serdev_device *); int serdev_device_write_room(struct serdev_device *); @@ -240,7 +245,8 @@ static inline int serdev_device_set_tiocm(struct serdev_device *serdev, int set, { return -ENOTSUPP; } -static inline int serdev_device_write_buf(struct serdev_device *sdev, const unsigned char *buf, size_t count) +static inline int serdev_device_write(struct serdev_device *sdev, const unsigned char *buf, + size_t count, unsigned long timeout) { return -ENODEV; } @@ -306,4 +312,11 @@ static inline struct device *serdev_tty_port_register(struct tty_port *port, static inline void serdev_tty_port_unregister(struct tty_port *port) {} #endif /* CONFIG_SERIAL_DEV_CTRL_TTYPORT */ +static inline int serdev_device_write_buf(struct serdev_device *serdev, + const unsigned char *data, + size_t count) +{ + return serdev_device_write(serdev, data, count, 0); +} + #endif /*_LINUX_SERDEV_H */ diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 58484fb35cc8..64d892f1e5cd 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -247,6 +247,7 @@ struct uart_port { unsigned char suspended; unsigned char irq_wake; unsigned char unused[2]; + const char *name; /* port name */ struct attribute_group *attr_group; /* port specific attributes */ const struct attribute_group **tty_groups; /* all attributes (serial core use only) */ struct serial_rs485 rs485; diff --git a/include/linux/tty.h b/include/linux/tty.h index 1017e904c0a3..d07cd2105a6c 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -390,7 +390,6 @@ static inline bool tty_throttled(struct tty_struct *tty) } #ifdef CONFIG_TTY -extern void console_init(void); extern void tty_kref_put(struct tty_struct *tty); extern struct pid *tty_get_pgrp(struct tty_struct *tty); extern void tty_vhangup_self(void); @@ -402,8 +401,6 @@ extern struct tty_struct *get_current_tty(void); extern int __init tty_init(void); extern const char *tty_name(const struct tty_struct *tty); #else -static inline void console_init(void) -{ } static inline void tty_kref_put(struct tty_struct *tty) { } static inline struct pid *tty_get_pgrp(struct tty_struct *tty) @@ -478,9 +475,13 @@ extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws); extern int is_current_pgrp_orphaned(void); extern void tty_hangup(struct tty_struct *tty); extern void tty_vhangup(struct tty_struct *tty); +extern void tty_vhangup_session(struct tty_struct *tty); extern int tty_hung_up_p(struct file *filp); extern void do_SAK(struct tty_struct *tty); extern void __do_SAK(struct tty_struct *tty); +extern void tty_open_proc_set_tty(struct file *filp, struct tty_struct *tty); +extern int tty_signal_session_leader(struct tty_struct *tty, int exit_session); +extern void session_clear_tty(struct pid *session); extern void no_tty(void); extern void tty_buffer_free_all(struct tty_port *port); extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld); @@ -528,6 +529,8 @@ extern void tty_ldisc_flush(struct tty_struct *tty); extern long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg); extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); +extern long tty_jobctrl_ioctl(struct tty_struct *tty, struct tty_struct *real_tty, + struct file *file, unsigned int cmd, unsigned long arg); extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); extern void tty_default_fops(struct file_operations *fops); extern struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx); @@ -669,7 +672,11 @@ extern int tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p, /* n_tty.c */ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops); +#ifdef CONFIG_TTY extern void __init n_tty_init(void); +#else +static inline void n_tty_init(void) { } +#endif /* tty_audit.c */ #ifdef CONFIG_AUDIT |