summaryrefslogtreecommitdiffstats
path: root/drivers/serial/serial_imx.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-02-21 01:23:53 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2009-03-19 12:21:29 +0100
commit3fdcf5b6c855bbd870e60ac4ba7551650f87baf3 (patch)
tree4927b75afd0b94bdae84ba1d25f5c3170a956408 /drivers/serial/serial_imx.c
parent8a2e721fc56e848f182dddb9e494ed284e382d09 (diff)
downloadbarebox-3fdcf5b6c855bbd870e60ac4ba7551650f87baf3.tar.gz
imx serial driver: add flush support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/serial/serial_imx.c')
-rw-r--r--drivers/serial/serial_imx.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index 488adfb..6cb260b 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -263,6 +263,13 @@ static int imx_serial_getc(struct console_device *cdev)
return ch;
}
+static void imx_serial_flush(struct console_device *cdev)
+{
+ struct device_d *dev = cdev->dev;
+
+ while (!(USR2(dev->map_base) & USR2_TXDC));
+}
+
static int imx_serial_setbaudrate(struct console_device *cdev, int baudrate)
{
struct device_d *dev = cdev->dev;
@@ -293,6 +300,7 @@ static int imx_serial_probe(struct device_d *dev)
cdev->tstc = imx_serial_tstc;
cdev->putc = imx_serial_putc;
cdev->getc = imx_serial_getc;
+ cdev->flush = imx_serial_flush;
cdev->setbrg = imx_serial_setbaudrate;
imx_serial_init_port(cdev);
@@ -306,10 +314,18 @@ static int imx_serial_probe(struct device_d *dev)
return 0;
}
+static void imx_serial_remove(struct device_d *dev)
+{
+ struct console_device *cdev = dev->type_data;
+
+ imx_serial_flush(cdev);
+}
+
static struct driver_d imx_serial_driver = {
- .name = "imx_serial",
- .probe = imx_serial_probe,
- .type = DEVICE_TYPE_CONSOLE,
+ .name = "imx_serial",
+ .probe = imx_serial_probe,
+ .remove = imx_serial_remove,
+ .type = DEVICE_TYPE_CONSOLE,
};
static int imx_serial_init(void)