[meta-xilinx] xilinx_uartps infinite wait loop

Jean-Francois Dagenais jeff.dagenais at gmail.com
Wed Apr 17 06:20:35 PDT 2019


Hi all,

In the last year, in xilinx_uartps.c, this loop appeared at the top of cdns_uart_set_termios

	/* Wait for the transmit FIFO to empty before making changes */
	if (!(readl(port->membase + CDNS_UART_CR) &
				CDNS_UART_CR_TX_DIS)) {
		while (!(readl(port->membase + CDNS_UART_SR) &
				CDNS_UART_SR_TXEMPTY)) {
			cpu_relax();
		}
	}


When (and this happens by default for us) ttyPS0 is a console for init or Systemd, it goes into this function, then, if no cable is connected, it will wait forever, essentially looking like the system doesn't boot since Systemd is very early in it's process and doesn't do anything else.

My current workaround is to add "console=tty0" (a virtual console) to the kernel command line. But this is a hassle when the console is required since I need to hack my boot parameters to switch the console back to ttyPS0. But when I do, then this system absolutely needs this cable sucking the bytes off the tx fifo otherwise the system doesn't reboot or completely boots.

This loop seems quite odd since it has no out. Would it be reasonable to add a timed out where if some amount of time has passed, the code can assume no-one cares about the bytes in the FIFO and we can proceed anyway? Or better, a way to detect no cable is connected and thus the loop will run forever?


Thanks!


More information about the meta-xilinx mailing list