summaryrefslogtreecommitdiff
path: root/drivers/serial
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.m@jp.panasonic.com>2014-10-24 17:00:10 +0900
committerMasahiro Yamada <yamada.m@jp.panasonic.com>2014-10-29 22:53:42 +0900
commitbb72148b2bbc026336d832edcb7bf9e2bde827df (patch)
tree7771b75631115598efeff1e37c32fa99b9860bca /drivers/serial
parent59ca5537be1f17abd6d36dffb5a522b89f36163a (diff)
downloadu-boot-imx-bb72148b2bbc026336d832edcb7bf9e2bde827df.zip
u-boot-imx-bb72148b2bbc026336d832edcb7bf9e2bde827df.tar.gz
u-boot-imx-bb72148b2bbc026336d832edcb7bf9e2bde827df.tar.bz2
serial: UniPhier: add .pending handler
Without .pending handler, tstc() function always returns 1. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial_uniphier.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/serial/serial_uniphier.c b/drivers/serial/serial_uniphier.c
index 9114b3e..faa69f0 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) = {