mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-25 08:02:56 +00:00
tty: Add software emulated RS485 support for 8250
Implementation of software emulation of RS485 direction handling is based on omap_serial driver. Before and after transmission RTS is set to the appropriate value. Note that before calling serial8250_em485_init() the caller has to ensure that UART will interrupt when shift register empty. Otherwise, emultaion cannot be used. Both serial8250_em485_init() and serial8250_em485_destroy() are idempotent functions. Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a07a70bcb7
commit
e490c9144c
3 changed files with 229 additions and 4 deletions
|
@ -76,6 +76,12 @@ struct uart_8250_ops {
|
|||
void (*release_irq)(struct uart_8250_port *);
|
||||
};
|
||||
|
||||
struct uart_8250_em485 {
|
||||
struct timer_list start_tx_timer; /* "rs485 start tx" timer */
|
||||
struct timer_list stop_tx_timer; /* "rs485 stop tx" timer */
|
||||
struct timer_list *active_timer; /* pointer to active timer */
|
||||
};
|
||||
|
||||
/*
|
||||
* This should be used by drivers which want to register
|
||||
* their own 8250 ports without registering their own
|
||||
|
@ -122,6 +128,8 @@ struct uart_8250_port {
|
|||
/* 8250 specific callbacks */
|
||||
int (*dl_read)(struct uart_8250_port *);
|
||||
void (*dl_write)(struct uart_8250_port *, int);
|
||||
|
||||
struct uart_8250_em485 *em485;
|
||||
};
|
||||
|
||||
static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue