new serial flow control
Quoted 8 lines · Samual Thibault
(quoted diff) +8
-0+ } else if (info->flags & ASYNC_TVB_FLOW) { + if (status & UART_MSR_CTS) { + if (!(info->MCR & UART_MCR_RTS)) { + /* start of TVB frame, raise RTS to greet data */ + info->MCR |= UART_MCR_RTS; + serial_out(info, UART_MCR, info->MCR); +#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) + printk("TVB frame start...");
Review
Quoted 10 lines
(quoted diff) +10
-0+#endif + } + } else { + if (info->MCR & UART_MCR_RTS) { + /* CTS went down, lower RTS as well */ + info->MCR &= ~UART_MCR_RTS; + serial_out(info, UART_MCR, info->MCR); +#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) + printk("TVB frame started..."); +#endif
^^^^^^^
Shouldn't this be "ended"? ... or "end" since frame begin msg says "start" i.e. is not past tense?
--Chuck Ebbert
Le mar 05 oct 2004 à 12:46:34 -0400, Chuck Ebbert a tapoté sur son clavier :
Quoted 22 lines
Quoted 8 lines · Samual Thibault
(quoted diff) +8
-0+ } else if (info->flags & ASYNC_TVB_FLOW) { + if (status & UART_MSR_CTS) { + if (!(info->MCR & UART_MCR_RTS)) { + /* start of TVB frame, raise RTS to greet data */ + info->MCR |= UART_MCR_RTS; + serial_out(info, UART_MCR, info->MCR); +#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) + printk("TVB frame start...");Review
Quoted 10 lines
(quoted diff) +10
-0+#endif + } + } else { + if (info->MCR & UART_MCR_RTS) { + /* CTS went down, lower RTS as well */ + info->MCR &= ~UART_MCR_RTS; + serial_out(info, UART_MCR, info->MCR); +#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) + printk("TVB frame started..."); +#endif^^^^^^^
Quoted 2 lines
Shouldn't this be "ended"? ... or "end" since frame begin msg says "start" i.e. is not past tense?
No: data actually pass _after_ CTS and RTS are lowered back: the flow control only indicate the beginning of one frame.
Regards,
Samuel Thibault
Quoted 2 lines · Samuel Thibault
No: data actually pass _after_ CTS and RTS are lowered back: the flow control only indicate the beginning of one frame.
Ok I've pondered this somewhat. I don't think the hack proposed is the right answer for this. I believe you should implement a simple line discipline for this device so that it stays out of the general code.
Right now that poses a challenge but if drivers were to implement ldisc->modem_change() or a similar callback for such events an ldisc could then handle many of the grungy suprises and handle them once and in one place.
Thoughts ?
Alan
Quoted 4 lines · Alan Cox
Quoted 2 lines · Samuel Thibault
No: data actually pass _after_ CTS and RTS are lowered back: the flow control only indicate the beginning of one frame.
Quoted 8 lines
Ok I've pondered this somewhat. I don't think the hack proposed is the right answer for this. I believe you should implement a simple line discipline for this device so that it stays out of the general code.
Right now that poses a challenge but if drivers were to implement
ldisc->modem_change()or a similar callback for such events an ldisc could then handle many of the grungy suprises and handle them once and in one place.
To me at least that sounds like a good solution. I can't help but wonder whether moving some of the usual modem line status change processing should also be moved into the higher levels. This will probably make more sense if the "block till ready" code also moves, which I think Ted was considering at one point.
However, that's probably something to think about later.
Signature · 4 lines
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial coreQuoted 2 lines · Russell King
I can't help but wonder whether moving some of the usual modem line status change processing should also be moved into the higher levels.
The more I'm thinking about it, the more I think it's not a good idea:
that would require *every* line discipline to implement hardware flow control (just like xon/xoff), while I think they shouldn't really care about it.
The asynchronous ppp ldisc for instance can be used on a serial line, but can very well be used on a ssh tunnel (in which case rts/cts flow control has no meaning).
I can understand that xon/xoff processing be implemented in ldiscs since it is characters stuff, but one can't ask the ldisc to know details about hardware flow control which depends on the tty it is used on.
Regards,
Samuel Thibault
Quoted 8 lines · Samuel Thibault
Quoted 2 lines · Russell King
I can't help but wonder whether moving some of the usual modem line status change processing should also be moved into the higher levels.
The more I'm thinking about it, the more I think it's not a good idea:
that would require *every* line discipline to implement hardware flow control (just like xon/xoff), while I think they shouldn't really care about it.
Please note that I said "into the higher levels" and not "into line disciplines" - I completely agree with you. For the general case, line disciplines do not need to know that the CTS signal has been deasserted, or that DCD has deasserted - these are all meaningless to the vast majority.
There are special cases though, such as the one being discussed in this thread, where it does make sense for the line discipline to override the default behaviour.
Signature · 4 lines
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial coreQuoted 4 lines · Alan Cox
Right now that poses a challenge but if drivers were to implement
ldisc->modem_change()or a similar callback for such events an ldisc could then handle many of the grungy suprises and handle them once and in one place.
Surprises like regular RTS/CTS flow control ?
Aren't there serial chips that are able to handle it themselves ? (so that the _serial driver_ should be responsible for that, doing it in software if needed)
I'm asking because there was some funny bug not that far ago: async ppp people thought that xon/xoff were processed in the serial driver, because "some serial chips may be able to handle that themselves". So they weren't processing them. But actually it's really up to the ldisc to process them. Thus nobody was processing it !
Regards,
Samuel Thibault
Quoted 2 lines · Samuel Thibault
I'm asking because there was some funny bug not that far ago: async ppp people thought that xon/xoff were processed in the serial driver,
For some record
http://groups.google.com/groups?threadm=Pine.LNX.4.10.10112042358240.2290-100000@youpi.residence.ens-lyon.fr#link15
and
http://groups.google.com/groups?threadm=Pine.LNX.4.10.10112062257590.1328-100000@youpi.residence.ens-lyon.fr
(google didn't like the subject change)
Regards,
Samuel Thibault
Quoted 4 lines · Alan Cox
Quoted 2 lines · Samuel Thibault
No: data actually pass _after_ CTS and RTS are lowered back: the flow control only indicate the beginning of one frame.
Quoted 8 lines
Ok I've pondered this somewhat. I don't think the hack proposed is the right answer for this. I believe you should implement a simple line discipline for this device so that it stays out of the general code.
Right now that poses a challenge but if drivers were to implement
ldisc->modem_change()or a similar callback for such events an ldisc could then handle many of the grungy suprises and handle them once and in one place.
Serial drivers should then at least (when seeing ldisc->modem_change != NULL) do no RTS/CTS/DTR/etc handling at all (to avoid interfering), and activate "MSI" for calling modem_change in the interrupt handler.
Being able to call port->ops->start/stop_tx by some way will also be necessary, by grouping
{
struct uart_state *state = tty->driver_data;
struct uart_port *port = state->port;
tty->hw_stopped = 0;
port->ops->start_tx(port, 0);
uart_write_wakeup(port);
}
and its dual in some function for instance.
Regards,
Samuel Thibault