From: Masahiro Yamada Date: Fri, 24 Oct 2014 08:00:10 +0000 (+0900) Subject: serial: UniPhier: add .pending handler X-Git-Tag: v2015.01-rc1~67^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bb72148b2bbc026336d832edcb7bf9e2bde827df;p=u-boot serial: UniPhier: add .pending handler Without .pending handler, tstc() function always returns 1. Signed-off-by: Masahiro Yamada --- diff --git a/drivers/serial/serial_uniphier.c b/drivers/serial/serial_uniphier.c index 9114b3ed60..faa69f0a27 100644 --- a/drivers/serial/serial_uniphier.c +++ b/drivers/serial/serial_uniphier.c @@ -93,6 +93,16 @@ static int uniphier_serial_putc(struct udevice *dev, const char c) return 0; } +static int uniphier_serial_pending(struct udevice *dev, bool input) +{ + struct uniphier_serial __iomem *port = uniphier_serial_port(dev); + + if (input) + return readb(&port->lsr) & UART_LSR_DR; + else + return !(readb(&port->lsr) & UART_LSR_THRE); +} + int uniphier_serial_probe(struct udevice *dev) { struct uniphier_serial_private_data *priv = dev_get_priv(dev); @@ -134,6 +144,7 @@ static const struct dm_serial_ops uniphier_serial_ops = { .setbrg = uniphier_serial_setbrg, .getc = uniphier_serial_getc, .putc = uniphier_serial_putc, + .pending = uniphier_serial_pending, }; U_BOOT_DRIVER(uniphier_serial) = {