serial: ns16550: implement ops->clear callback
Thus, the flushc() can work normally. Change-Id: I544ed0ffcbc5564913bf89bf1a83c6d540ae6b6a Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
parent
c1e72b20c9
commit
7c86130655
|
|
@ -363,20 +363,6 @@ static int ns16550_serial_putc(struct udevice *dev, const char ch)
|
||||||
if (ch == '\n')
|
if (ch == '\n')
|
||||||
WATCHDOG_RESET();
|
WATCHDOG_RESET();
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ROCKCHIP
|
|
||||||
/*
|
|
||||||
* Wait fifo flush.
|
|
||||||
*
|
|
||||||
* UART_USR: bit2 trans_fifo_empty:
|
|
||||||
* 0 = Transmit FIFO is not empty
|
|
||||||
* 1 = Transmit FIFO is empty
|
|
||||||
*/
|
|
||||||
if (gd->flags & GD_FLG_OS_RUN) {
|
|
||||||
while (!(serial_in(&com_port->rbr + 0x1f) & 0x04))
|
|
||||||
;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -413,6 +399,24 @@ static int ns16550_serial_setbrg(struct udevice *dev, int baudrate)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ns16550_serial_clear(struct udevice *dev)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_ARCH_ROCKCHIP
|
||||||
|
struct NS16550 *const com_port = dev_get_priv(dev);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Wait fifo flush.
|
||||||
|
*
|
||||||
|
* UART_USR: bit2 trans_fifo_empty:
|
||||||
|
* 0 = Transmit FIFO is not empty
|
||||||
|
* 1 = Transmit FIFO is empty
|
||||||
|
*/
|
||||||
|
while (!(serial_in(&com_port->rbr + 0x1f) & 0x04))
|
||||||
|
;
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ns16550_serial_probe(struct udevice *dev)
|
int ns16550_serial_probe(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct NS16550 *const com_port = dev_get_priv(dev);
|
struct NS16550 *const com_port = dev_get_priv(dev);
|
||||||
|
|
@ -521,6 +525,7 @@ const struct dm_serial_ops ns16550_serial_ops = {
|
||||||
.pending = ns16550_serial_pending,
|
.pending = ns16550_serial_pending,
|
||||||
.getc = ns16550_serial_getc,
|
.getc = ns16550_serial_getc,
|
||||||
.setbrg = ns16550_serial_setbrg,
|
.setbrg = ns16550_serial_setbrg,
|
||||||
|
.clear = ns16550_serial_clear,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if CONFIG_IS_ENABLED(SERIAL_PRESENT)
|
#if CONFIG_IS_ENABLED(SERIAL_PRESENT)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue