diff options
author | Jesper Nilsson <jespern@axis.com> | 2010-10-28 06:08:27 -0400 |
---|---|---|
committer | Jesper Nilsson <jespern@axis.com> | 2010-10-28 06:13:27 -0400 |
commit | c7213fc4ed592070f1010da39b0bf0eb2395b619 (patch) | |
tree | ca3124a48ecd7d29077e8e5de1d70375cea2ff0a | |
parent | 94479c017b58f69e2304d88c2826ba445cd4cd99 (diff) |
CRIS: Fix RS485 delay handling.
Very recently, the RS485 interface has been fixed by adding two further
fields (see commit 1b6331848b69d1ed165a6bdc75c4046d68767563).
Check the value of the flag SER_RS485_RTS_BEFORE_SEND before delaying.
Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
-rw-r--r-- | drivers/serial/crisv10.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index 20402c604c10..fa62578fcd20 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c | |||
@@ -1411,11 +1411,12 @@ e100_enable_rs485(struct tty_struct *tty, struct serial_rs485 *r) | |||
1411 | CONFIG_ETRAX_RS485_LTC1387_RXEN_PORT_G_BIT, 1); | 1411 | CONFIG_ETRAX_RS485_LTC1387_RXEN_PORT_G_BIT, 1); |
1412 | #endif | 1412 | #endif |
1413 | 1413 | ||
1414 | info->rs485.flags = r->flags; | 1414 | info->rs485 = *r; |
1415 | if (r->delay_rts_before_send >= 1000) | 1415 | |
1416 | /* Maximum delay before RTS equal to 1000 */ | ||
1417 | if (info->rs485.delay_rts_before_send >= 1000) | ||
1416 | info->rs485.delay_rts_before_send = 1000; | 1418 | info->rs485.delay_rts_before_send = 1000; |
1417 | else | 1419 | |
1418 | info->rs485.delay_rts_before_send = r->delay_rts_before_send; | ||
1419 | /* printk("rts: on send = %i, after = %i, enabled = %i", | 1420 | /* printk("rts: on send = %i, after = %i, enabled = %i", |
1420 | info->rs485.rts_on_send, | 1421 | info->rs485.rts_on_send, |
1421 | info->rs485.rts_after_sent, | 1422 | info->rs485.rts_after_sent, |
@@ -3234,9 +3235,9 @@ rs_write(struct tty_struct *tty, | |||
3234 | e100_disable_rx(info); | 3235 | e100_disable_rx(info); |
3235 | e100_enable_rx_irq(info); | 3236 | e100_enable_rx_irq(info); |
3236 | #endif | 3237 | #endif |
3237 | 3238 | if ((info->rs485.flags & SER_RS485_RTS_BEFORE_SEND) && | |
3238 | if (info->rs485.delay_rts_before_send > 0) | 3239 | (info->rs485.delay_rts_before_send > 0)) |
3239 | msleep(info->rs485.delay_rts_before_send); | 3240 | msleep(info->rs485.delay_rts_before_send); |
3240 | } | 3241 | } |
3241 | #endif /* CONFIG_ETRAX_RS485 */ | 3242 | #endif /* CONFIG_ETRAX_RS485 */ |
3242 | 3243 | ||
@@ -3694,6 +3695,11 @@ rs_ioctl(struct tty_struct *tty, struct file * file, | |||
3694 | 3695 | ||
3695 | rs485data.delay_rts_before_send = rs485ctrl.delay_rts_before_send; | 3696 | rs485data.delay_rts_before_send = rs485ctrl.delay_rts_before_send; |
3696 | rs485data.flags = 0; | 3697 | rs485data.flags = 0; |
3698 | if (rs485data.delay_rts_before_send != 0) | ||
3699 | rs485data.flags |= SER_RS485_RTS_BEFORE_SEND; | ||
3700 | else | ||
3701 | rs485data.flags &= ~(SER_RS485_RTS_BEFORE_SEND); | ||
3702 | |||
3697 | if (rs485ctrl.enabled) | 3703 | if (rs485ctrl.enabled) |
3698 | rs485data.flags |= SER_RS485_ENABLED; | 3704 | rs485data.flags |= SER_RS485_ENABLED; |
3699 | else | 3705 | else |
@@ -4527,6 +4533,7 @@ static int __init rs_init(void) | |||
4527 | /* Set sane defaults */ | 4533 | /* Set sane defaults */ |
4528 | info->rs485.flags &= ~(SER_RS485_RTS_ON_SEND); | 4534 | info->rs485.flags &= ~(SER_RS485_RTS_ON_SEND); |
4529 | info->rs485.flags |= SER_RS485_RTS_AFTER_SEND; | 4535 | info->rs485.flags |= SER_RS485_RTS_AFTER_SEND; |
4536 | info->rs485.flags &= ~(SER_RS485_RTS_BEFORE_SEND); | ||
4530 | info->rs485.delay_rts_before_send = 0; | 4537 | info->rs485.delay_rts_before_send = 0; |
4531 | info->rs485.flags &= ~(SER_RS485_ENABLED); | 4538 | info->rs485.flags &= ~(SER_RS485_ENABLED); |
4532 | #endif | 4539 | #endif |