0001
0002
0003
0004
0005
0006
0007 #ifndef LINUX_SERIAL_CORE_H
0008 #define LINUX_SERIAL_CORE_H
0009
0010 #include <linux/bitops.h>
0011 #include <linux/compiler.h>
0012 #include <linux/console.h>
0013 #include <linux/interrupt.h>
0014 #include <linux/circ_buf.h>
0015 #include <linux/spinlock.h>
0016 #include <linux/sched.h>
0017 #include <linux/tty.h>
0018 #include <linux/mutex.h>
0019 #include <linux/sysrq.h>
0020 #include <uapi/linux/serial_core.h>
0021
0022 #ifdef CONFIG_SERIAL_CORE_CONSOLE
0023 #define uart_console(port) \
0024 ((port)->cons && (port)->cons->index == (port)->line)
0025 #else
0026 #define uart_console(port) ({ (void)port; 0; })
0027 #endif
0028
0029 struct uart_port;
0030 struct serial_struct;
0031 struct device;
0032 struct gpio_desc;
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373 struct uart_ops {
0374 unsigned int (*tx_empty)(struct uart_port *);
0375 void (*set_mctrl)(struct uart_port *, unsigned int mctrl);
0376 unsigned int (*get_mctrl)(struct uart_port *);
0377 void (*stop_tx)(struct uart_port *);
0378 void (*start_tx)(struct uart_port *);
0379 void (*throttle)(struct uart_port *);
0380 void (*unthrottle)(struct uart_port *);
0381 void (*send_xchar)(struct uart_port *, char ch);
0382 void (*stop_rx)(struct uart_port *);
0383 void (*start_rx)(struct uart_port *);
0384 void (*enable_ms)(struct uart_port *);
0385 void (*break_ctl)(struct uart_port *, int ctl);
0386 int (*startup)(struct uart_port *);
0387 void (*shutdown)(struct uart_port *);
0388 void (*flush_buffer)(struct uart_port *);
0389 void (*set_termios)(struct uart_port *, struct ktermios *new,
0390 struct ktermios *old);
0391 void (*set_ldisc)(struct uart_port *, struct ktermios *);
0392 void (*pm)(struct uart_port *, unsigned int state,
0393 unsigned int oldstate);
0394 const char *(*type)(struct uart_port *);
0395 void (*release_port)(struct uart_port *);
0396 int (*request_port)(struct uart_port *);
0397 void (*config_port)(struct uart_port *, int);
0398 int (*verify_port)(struct uart_port *, struct serial_struct *);
0399 int (*ioctl)(struct uart_port *, unsigned int, unsigned long);
0400 #ifdef CONFIG_CONSOLE_POLL
0401 int (*poll_init)(struct uart_port *);
0402 void (*poll_put_char)(struct uart_port *, unsigned char);
0403 int (*poll_get_char)(struct uart_port *);
0404 #endif
0405 };
0406
0407 #define NO_POLL_CHAR 0x00ff0000
0408 #define UART_CONFIG_TYPE (1 << 0)
0409 #define UART_CONFIG_IRQ (1 << 1)
0410
0411 struct uart_icount {
0412 __u32 cts;
0413 __u32 dsr;
0414 __u32 rng;
0415 __u32 dcd;
0416 __u32 rx;
0417 __u32 tx;
0418 __u32 frame;
0419 __u32 overrun;
0420 __u32 parity;
0421 __u32 brk;
0422 __u32 buf_overrun;
0423 };
0424
0425 typedef unsigned int __bitwise upf_t;
0426 typedef unsigned int __bitwise upstat_t;
0427
0428 struct uart_port {
0429 spinlock_t lock;
0430 unsigned long iobase;
0431 unsigned char __iomem *membase;
0432 unsigned int (*serial_in)(struct uart_port *, int);
0433 void (*serial_out)(struct uart_port *, int, int);
0434 void (*set_termios)(struct uart_port *,
0435 struct ktermios *new,
0436 struct ktermios *old);
0437 void (*set_ldisc)(struct uart_port *,
0438 struct ktermios *);
0439 unsigned int (*get_mctrl)(struct uart_port *);
0440 void (*set_mctrl)(struct uart_port *, unsigned int);
0441 unsigned int (*get_divisor)(struct uart_port *,
0442 unsigned int baud,
0443 unsigned int *frac);
0444 void (*set_divisor)(struct uart_port *,
0445 unsigned int baud,
0446 unsigned int quot,
0447 unsigned int quot_frac);
0448 int (*startup)(struct uart_port *port);
0449 void (*shutdown)(struct uart_port *port);
0450 void (*throttle)(struct uart_port *port);
0451 void (*unthrottle)(struct uart_port *port);
0452 int (*handle_irq)(struct uart_port *);
0453 void (*pm)(struct uart_port *, unsigned int state,
0454 unsigned int old);
0455 void (*handle_break)(struct uart_port *);
0456 int (*rs485_config)(struct uart_port *,
0457 struct ktermios *termios,
0458 struct serial_rs485 *rs485);
0459 int (*iso7816_config)(struct uart_port *,
0460 struct serial_iso7816 *iso7816);
0461 unsigned int irq;
0462 unsigned long irqflags;
0463 unsigned int uartclk;
0464 unsigned int fifosize;
0465 unsigned char x_char;
0466 unsigned char regshift;
0467 unsigned char iotype;
0468 unsigned char quirks;
0469
0470 #define UPIO_PORT (SERIAL_IO_PORT)
0471 #define UPIO_HUB6 (SERIAL_IO_HUB6)
0472 #define UPIO_MEM (SERIAL_IO_MEM)
0473 #define UPIO_MEM32 (SERIAL_IO_MEM32)
0474 #define UPIO_AU (SERIAL_IO_AU)
0475 #define UPIO_TSI (SERIAL_IO_TSI)
0476 #define UPIO_MEM32BE (SERIAL_IO_MEM32BE)
0477 #define UPIO_MEM16 (SERIAL_IO_MEM16)
0478
0479
0480 #define UPQ_NO_TXEN_TEST BIT(0)
0481
0482 unsigned int read_status_mask;
0483 unsigned int ignore_status_mask;
0484 struct uart_state *state;
0485 struct uart_icount icount;
0486
0487 struct console *cons;
0488
0489 upf_t flags;
0490
0491
0492
0493
0494
0495
0496
0497
0498
0499
0500
0501 #define UPF_FOURPORT ((__force upf_t) ASYNC_FOURPORT )
0502 #define UPF_SAK ((__force upf_t) ASYNC_SAK )
0503 #define UPF_SPD_HI ((__force upf_t) ASYNC_SPD_HI )
0504 #define UPF_SPD_VHI ((__force upf_t) ASYNC_SPD_VHI )
0505 #define UPF_SPD_CUST ((__force upf_t) ASYNC_SPD_CUST )
0506 #define UPF_SPD_WARP ((__force upf_t) ASYNC_SPD_WARP )
0507 #define UPF_SPD_MASK ((__force upf_t) ASYNC_SPD_MASK )
0508 #define UPF_SKIP_TEST ((__force upf_t) ASYNC_SKIP_TEST )
0509 #define UPF_AUTO_IRQ ((__force upf_t) ASYNC_AUTO_IRQ )
0510 #define UPF_HARDPPS_CD ((__force upf_t) ASYNC_HARDPPS_CD )
0511 #define UPF_SPD_SHI ((__force upf_t) ASYNC_SPD_SHI )
0512 #define UPF_LOW_LATENCY ((__force upf_t) ASYNC_LOW_LATENCY )
0513 #define UPF_BUGGY_UART ((__force upf_t) ASYNC_BUGGY_UART )
0514 #define UPF_MAGIC_MULTIPLIER ((__force upf_t) ASYNC_MAGIC_MULTIPLIER )
0515
0516 #define UPF_NO_THRE_TEST ((__force upf_t) (1 << 19))
0517
0518 #define UPF_AUTO_CTS ((__force upf_t) (1 << 20))
0519 #define UPF_AUTO_RTS ((__force upf_t) (1 << 21))
0520 #define UPF_HARD_FLOW ((__force upf_t) (UPF_AUTO_CTS | UPF_AUTO_RTS))
0521
0522 #define UPF_SOFT_FLOW ((__force upf_t) (1 << 22))
0523 #define UPF_CONS_FLOW ((__force upf_t) (1 << 23))
0524 #define UPF_SHARE_IRQ ((__force upf_t) (1 << 24))
0525 #define UPF_EXAR_EFR ((__force upf_t) (1 << 25))
0526 #define UPF_BUG_THRE ((__force upf_t) (1 << 26))
0527
0528 #define UPF_FIXED_TYPE ((__force upf_t) (1 << 27))
0529 #define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28))
0530 #define UPF_FIXED_PORT ((__force upf_t) (1 << 29))
0531 #define UPF_DEAD ((__force upf_t) (1 << 30))
0532 #define UPF_IOREMAP ((__force upf_t) (1 << 31))
0533
0534 #define __UPF_CHANGE_MASK 0x17fff
0535 #define UPF_CHANGE_MASK ((__force upf_t) __UPF_CHANGE_MASK)
0536 #define UPF_USR_MASK ((__force upf_t) (UPF_SPD_MASK|UPF_LOW_LATENCY))
0537
0538 #if __UPF_CHANGE_MASK > ASYNC_FLAGS
0539 #error Change mask not equivalent to userspace-visible bit defines
0540 #endif
0541
0542
0543
0544
0545
0546 upstat_t status;
0547
0548 #define UPSTAT_CTS_ENABLE ((__force upstat_t) (1 << 0))
0549 #define UPSTAT_DCD_ENABLE ((__force upstat_t) (1 << 1))
0550 #define UPSTAT_AUTORTS ((__force upstat_t) (1 << 2))
0551 #define UPSTAT_AUTOCTS ((__force upstat_t) (1 << 3))
0552 #define UPSTAT_AUTOXOFF ((__force upstat_t) (1 << 4))
0553 #define UPSTAT_SYNC_FIFO ((__force upstat_t) (1 << 5))
0554
0555 int hw_stopped;
0556 unsigned int mctrl;
0557 unsigned int frame_time;
0558 unsigned int type;
0559 const struct uart_ops *ops;
0560 unsigned int custom_divisor;
0561 unsigned int line;
0562 unsigned int minor;
0563 resource_size_t mapbase;
0564 resource_size_t mapsize;
0565 struct device *dev;
0566
0567 unsigned long sysrq;
0568 unsigned int sysrq_ch;
0569 unsigned char has_sysrq;
0570 unsigned char sysrq_seq;
0571
0572 unsigned char hub6;
0573 unsigned char suspended;
0574 unsigned char console_reinit;
0575 const char *name;
0576 struct attribute_group *attr_group;
0577 const struct attribute_group **tty_groups;
0578 struct serial_rs485 rs485;
0579 struct serial_rs485 rs485_supported;
0580 struct gpio_desc *rs485_term_gpio;
0581 struct serial_iso7816 iso7816;
0582 void *private_data;
0583 };
0584
0585 static inline int serial_port_in(struct uart_port *up, int offset)
0586 {
0587 return up->serial_in(up, offset);
0588 }
0589
0590 static inline void serial_port_out(struct uart_port *up, int offset, int value)
0591 {
0592 up->serial_out(up, offset, value);
0593 }
0594
0595
0596
0597
0598
0599
0600
0601 enum uart_pm_state {
0602 UART_PM_STATE_ON = 0,
0603 UART_PM_STATE_OFF = 3,
0604 UART_PM_STATE_UNDEFINED,
0605 };
0606
0607
0608
0609
0610 struct uart_state {
0611 struct tty_port port;
0612
0613 enum uart_pm_state pm_state;
0614 struct circ_buf xmit;
0615
0616 atomic_t refcount;
0617 wait_queue_head_t remove_wait;
0618 struct uart_port *uart_port;
0619 };
0620
0621 #define UART_XMIT_SIZE PAGE_SIZE
0622
0623
0624
0625 #define WAKEUP_CHARS 256
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635
0636 static inline void uart_xmit_advance(struct uart_port *up, unsigned int chars)
0637 {
0638 struct circ_buf *xmit = &up->state->xmit;
0639
0640 xmit->tail = (xmit->tail + chars) & (UART_XMIT_SIZE - 1);
0641 up->icount.tx += chars;
0642 }
0643
0644 struct module;
0645 struct tty_driver;
0646
0647 struct uart_driver {
0648 struct module *owner;
0649 const char *driver_name;
0650 const char *dev_name;
0651 int major;
0652 int minor;
0653 int nr;
0654 struct console *cons;
0655
0656
0657
0658
0659
0660 struct uart_state *state;
0661 struct tty_driver *tty_driver;
0662 };
0663
0664 void uart_write_wakeup(struct uart_port *port);
0665
0666
0667
0668
0669 void uart_update_timeout(struct uart_port *port, unsigned int cflag,
0670 unsigned int baud);
0671 unsigned int uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
0672 struct ktermios *old, unsigned int min,
0673 unsigned int max);
0674 unsigned int uart_get_divisor(struct uart_port *port, unsigned int baud);
0675
0676
0677
0678
0679 static inline unsigned long uart_fifo_timeout(struct uart_port *port)
0680 {
0681 u64 fifo_timeout = (u64)READ_ONCE(port->frame_time) * port->fifosize;
0682
0683
0684 fifo_timeout += 20 * NSEC_PER_MSEC;
0685
0686 return max(nsecs_to_jiffies(fifo_timeout), 1UL);
0687 }
0688
0689
0690 static inline int uart_poll_timeout(struct uart_port *port)
0691 {
0692 int timeout = uart_fifo_timeout(port);
0693
0694 return timeout > 6 ? (timeout / 2 - 2) : 1;
0695 }
0696
0697
0698
0699
0700 struct earlycon_device {
0701 struct console *con;
0702 struct uart_port port;
0703 char options[16];
0704 unsigned int baud;
0705 };
0706
0707 struct earlycon_id {
0708 char name[15];
0709 char name_term;
0710 char compatible[128];
0711 int (*setup)(struct earlycon_device *, const char *options);
0712 };
0713
0714 extern const struct earlycon_id __earlycon_table[];
0715 extern const struct earlycon_id __earlycon_table_end[];
0716
0717 #if defined(CONFIG_SERIAL_EARLYCON) && !defined(MODULE)
0718 #define EARLYCON_USED_OR_UNUSED __used
0719 #else
0720 #define EARLYCON_USED_OR_UNUSED __maybe_unused
0721 #endif
0722
0723 #define OF_EARLYCON_DECLARE(_name, compat, fn) \
0724 static const struct earlycon_id __UNIQUE_ID(__earlycon_##_name) \
0725 EARLYCON_USED_OR_UNUSED __section("__earlycon_table") \
0726 __aligned(__alignof__(struct earlycon_id)) \
0727 = { .name = __stringify(_name), \
0728 .compatible = compat, \
0729 .setup = fn }
0730
0731 #define EARLYCON_DECLARE(_name, fn) OF_EARLYCON_DECLARE(_name, "", fn)
0732
0733 extern int of_setup_earlycon(const struct earlycon_id *match,
0734 unsigned long node,
0735 const char *options);
0736
0737 #ifdef CONFIG_SERIAL_EARLYCON
0738 extern bool earlycon_acpi_spcr_enable __initdata;
0739 int setup_earlycon(char *buf);
0740 #else
0741 static const bool earlycon_acpi_spcr_enable EARLYCON_USED_OR_UNUSED;
0742 static inline int setup_earlycon(char *buf) { return 0; }
0743 #endif
0744
0745 static inline bool uart_console_enabled(struct uart_port *port)
0746 {
0747 return uart_console(port) && (port->cons->flags & CON_ENABLED);
0748 }
0749
0750 struct uart_port *uart_get_console(struct uart_port *ports, int nr,
0751 struct console *c);
0752 int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr,
0753 char **options);
0754 void uart_parse_options(const char *options, int *baud, int *parity, int *bits,
0755 int *flow);
0756 int uart_set_options(struct uart_port *port, struct console *co, int baud,
0757 int parity, int bits, int flow);
0758 struct tty_driver *uart_console_device(struct console *co, int *index);
0759 void uart_console_write(struct uart_port *port, const char *s,
0760 unsigned int count,
0761 void (*putchar)(struct uart_port *, unsigned char));
0762
0763
0764
0765
0766 int uart_register_driver(struct uart_driver *uart);
0767 void uart_unregister_driver(struct uart_driver *uart);
0768 int uart_add_one_port(struct uart_driver *reg, struct uart_port *port);
0769 int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port);
0770 bool uart_match_port(const struct uart_port *port1,
0771 const struct uart_port *port2);
0772
0773
0774
0775
0776 int uart_suspend_port(struct uart_driver *reg, struct uart_port *port);
0777 int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
0778
0779 #define uart_circ_empty(circ) ((circ)->head == (circ)->tail)
0780 #define uart_circ_clear(circ) ((circ)->head = (circ)->tail = 0)
0781
0782 #define uart_circ_chars_pending(circ) \
0783 (CIRC_CNT((circ)->head, (circ)->tail, UART_XMIT_SIZE))
0784
0785 #define uart_circ_chars_free(circ) \
0786 (CIRC_SPACE((circ)->head, (circ)->tail, UART_XMIT_SIZE))
0787
0788 static inline int uart_tx_stopped(struct uart_port *port)
0789 {
0790 struct tty_struct *tty = port->state->port.tty;
0791 if ((tty && tty->flow.stopped) || port->hw_stopped)
0792 return 1;
0793 return 0;
0794 }
0795
0796 static inline bool uart_cts_enabled(struct uart_port *uport)
0797 {
0798 return !!(uport->status & UPSTAT_CTS_ENABLE);
0799 }
0800
0801 static inline bool uart_softcts_mode(struct uart_port *uport)
0802 {
0803 upstat_t mask = UPSTAT_CTS_ENABLE | UPSTAT_AUTOCTS;
0804
0805 return ((uport->status & mask) == UPSTAT_CTS_ENABLE);
0806 }
0807
0808
0809
0810
0811
0812 extern void uart_handle_dcd_change(struct uart_port *uport,
0813 unsigned int status);
0814 extern void uart_handle_cts_change(struct uart_port *uport,
0815 unsigned int status);
0816
0817 extern void uart_insert_char(struct uart_port *port, unsigned int status,
0818 unsigned int overrun, unsigned int ch, unsigned int flag);
0819
0820 void uart_xchar_out(struct uart_port *uport, int offset);
0821
0822 #ifdef CONFIG_MAGIC_SYSRQ_SERIAL
0823 #define SYSRQ_TIMEOUT (HZ * 5)
0824
0825 bool uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch);
0826
0827 static inline int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
0828 {
0829 if (!port->sysrq)
0830 return 0;
0831
0832 if (ch && time_before(jiffies, port->sysrq)) {
0833 if (sysrq_mask()) {
0834 handle_sysrq(ch);
0835 port->sysrq = 0;
0836 return 1;
0837 }
0838 if (uart_try_toggle_sysrq(port, ch))
0839 return 1;
0840 }
0841 port->sysrq = 0;
0842
0843 return 0;
0844 }
0845
0846 static inline int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch)
0847 {
0848 if (!port->sysrq)
0849 return 0;
0850
0851 if (ch && time_before(jiffies, port->sysrq)) {
0852 if (sysrq_mask()) {
0853 port->sysrq_ch = ch;
0854 port->sysrq = 0;
0855 return 1;
0856 }
0857 if (uart_try_toggle_sysrq(port, ch))
0858 return 1;
0859 }
0860 port->sysrq = 0;
0861
0862 return 0;
0863 }
0864
0865 static inline void uart_unlock_and_check_sysrq(struct uart_port *port)
0866 {
0867 int sysrq_ch;
0868
0869 if (!port->has_sysrq) {
0870 spin_unlock(&port->lock);
0871 return;
0872 }
0873
0874 sysrq_ch = port->sysrq_ch;
0875 port->sysrq_ch = 0;
0876
0877 spin_unlock(&port->lock);
0878
0879 if (sysrq_ch)
0880 handle_sysrq(sysrq_ch);
0881 }
0882
0883 static inline void uart_unlock_and_check_sysrq_irqrestore(struct uart_port *port,
0884 unsigned long flags)
0885 {
0886 int sysrq_ch;
0887
0888 if (!port->has_sysrq) {
0889 spin_unlock_irqrestore(&port->lock, flags);
0890 return;
0891 }
0892
0893 sysrq_ch = port->sysrq_ch;
0894 port->sysrq_ch = 0;
0895
0896 spin_unlock_irqrestore(&port->lock, flags);
0897
0898 if (sysrq_ch)
0899 handle_sysrq(sysrq_ch);
0900 }
0901 #else
0902 static inline int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
0903 {
0904 return 0;
0905 }
0906 static inline int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch)
0907 {
0908 return 0;
0909 }
0910 static inline void uart_unlock_and_check_sysrq(struct uart_port *port)
0911 {
0912 spin_unlock(&port->lock);
0913 }
0914 static inline void uart_unlock_and_check_sysrq_irqrestore(struct uart_port *port,
0915 unsigned long flags)
0916 {
0917 spin_unlock_irqrestore(&port->lock, flags);
0918 }
0919 #endif
0920
0921
0922
0923
0924 static inline int uart_handle_break(struct uart_port *port)
0925 {
0926 struct uart_state *state = port->state;
0927
0928 if (port->handle_break)
0929 port->handle_break(port);
0930
0931 #ifdef CONFIG_MAGIC_SYSRQ_SERIAL
0932 if (port->has_sysrq && uart_console(port)) {
0933 if (!port->sysrq) {
0934 port->sysrq = jiffies + SYSRQ_TIMEOUT;
0935 return 1;
0936 }
0937 port->sysrq = 0;
0938 }
0939 #endif
0940 if (port->flags & UPF_SAK)
0941 do_SAK(state->port.tty);
0942 return 0;
0943 }
0944
0945
0946
0947
0948 #define UART_ENABLE_MS(port,cflag) ((port)->flags & UPF_HARDPPS_CD || \
0949 (cflag) & CRTSCTS || \
0950 !((cflag) & CLOCAL))
0951
0952 int uart_get_rs485_mode(struct uart_port *port);
0953 int uart_rs485_config(struct uart_port *port);
0954 #endif