/* This function scans each BD in sequence. If we find a BD that is not ready (READY=1), then we return 0 indicating that the QE is still sending data. If we reach the last BD (WRAP=1), then we know we've scanned the entire list, and all BDs are done.  */
static unsigned int qe_uart_tx_empty(struct uart_port *port)
/* This function scans each BD in sequence. If we find a BD that is not ready (READY=1), then we return 0 indicating that the QE is still sending data. If we reach the last BD (WRAP=1), then we know we've scanned the entire list, and all BDs are done.  */
static unsigned int qe_uart_tx_empty(struct uart_port *port)
{
	struct uart_qe_port *qe_port =
		container_of(port, struct uart_qe_port, port);
	struct qe_bd *bdp = qe_port->tx_bd_base;
	while (1) {
		if (in_be16(&bdp->status) & BD_SC_READY)
			return 0;
		if (in_be16(&bdp->status) & BD_SC_WRAP)
			return 1;
		bdp++;
	};
}