include: uapi: serial: add support of rts delays in nanoseconds

Add support of rs485 delay in nanoseconds.

With fast data rates (1Mbaut or more), 1ms become quite long. Users need
to be able to set shorter delays than 1 ms in order not to slow down the
channel unnecessarily. This enables faster communication channels without
changing the baudrate.

Signed-off-by: Erwan Le Ray <erwan.leray@foss.st.com>
Signed-off-by: Borut Seljak <borut.seljak@t-2.net>
Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
Change-Id: I72cdf03197b7c3abfc1f2fa0c03e91b665461be1
This commit is contained in:
Erwan Le Ray
2020-04-12 19:06:20 +02:00
committed by Eric Fourmont
parent f2c236575f
commit 8fe0cd660f
2 changed files with 6 additions and 4 deletions

View File

@ -3464,10 +3464,10 @@ EXPORT_SYMBOL_GPL(uart_get_rs485_mode);
/* Compile-time assertions for serial_rs485 layout */
static_assert(offsetof(struct serial_rs485, padding) ==
(offsetof(struct serial_rs485, delay_rts_after_send) + sizeof(__u32)));
(offsetof(struct serial_rs485, delay_rts_after_send_ns) + sizeof(__u32)));
static_assert(offsetof(struct serial_rs485, padding1) ==
offsetof(struct serial_rs485, padding[1]));
static_assert((offsetof(struct serial_rs485, padding[4]) + sizeof(__u32)) ==
static_assert((offsetof(struct serial_rs485, padding[2]) + sizeof(__u32)) ==
sizeof(struct serial_rs485));
MODULE_DESCRIPTION("Serial driver core");

View File

@ -134,16 +134,18 @@ struct serial_rs485 {
__u32 delay_rts_before_send; /* Delay before send (milliseconds) */
__u32 delay_rts_after_send; /* Delay after send (milliseconds) */
__u32 delay_rts_before_send_ns; /* Delay before send (nanoseconds) */
__u32 delay_rts_after_send_ns; /* Delay after send (nanoseconds) */
/* The fields below are defined by flags */
union {
__u32 padding[5]; /* Memory is cheap, new structs are a pain */
__u32 padding[3]; /* Memory is cheap, new structs are a pain */
struct {
__u8 addr_recv;
__u8 addr_dest;
__u8 padding0[2];
__u32 padding1[4];
__u32 padding1[2];
};
};
};