[PATCH 5/5] serial: assert DTR for serial console devices



[PATCH 5/5] serial: assert DTR for serial console devices

Some RS-232 devices require DTR to be asserted before they can be
used. DTR is normally asserted in uart_startup() when the port is
opened. But we don't actually open serial console ports, so assert
DTR when the port is added.

BTW:
earlyprintk and early_uart are hard coded to set DTR/RTS.

Signed-off-by: Yinghai Lu <yinghai.lu@xxxxxxx>
Cc: Russell King <rmk@xxxxxxxxxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxxx>
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@xxxxxx>

diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 326020f..e5a3d8b 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -2303,8 +2303,14 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port)
* It may be that the port was not available.
*/
if (port->type != PORT_UNKNOWN &&
- port->cons && !(port->cons->flags & CON_ENABLED))
+ port->cons && !(port->cons->flags & CON_ENABLED)) {
+ /*
+ * We normally assert DTR when a port is opened, but serial
+ * console devices aren't actually opened, so do it here.
+ */
+ uart_set_mctrl(port, TIOCM_DTR);
register_console(port->cons);
+ }

/*
* Ensure UPF_DEAD is not set.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Timer ...
    ... SOME of the spelling we get here.... ... simulation processes don't - but it can ... port "clk" cannot be read ... Assert throws an error when its boolean expression is false. ...
    (comp.lang.vhdl)
  • Re: program wont read w/o DTR resistance
    ... > that draw their power from the DTR line). ... > computer and the modified device on a serial line and a resistor ... > low-level going on in either the kernel or the serial port ...
    (comp.os.linux.development.system)
  • Re: program wont read w/o DTR resistance
    ... >> that draw their power from the DTR line). ... > How have you set up the serial port? ... Hey Dave, ... interpret DTR assertion as there being a listening machine onthe other end. ...
    (comp.os.linux.development.system)
  • Re: 1 serial port 2 parity types? MFC based app needs assistance.
    ... device sending data while the device is in the wrong mode. ... from the paralell port to switch between tow transmit lines form two ... the port assert DTR when transmitting. ...
    (microsoft.public.vc.mfc)
  • Re: 1 serial port 2 parity types? MFC based app needs assistance.
    ... device sending data while the device is in the wrong mode. ... from the paralell port to switch between tow transmit lines form two ... the port assert DTR when transmitting. ...
    (microsoft.public.vc.mfc)