[PATCH v3 05/10] litex serial: add setbrg callback
Antony Pavlov
antonynpavlov at gmail.com
Tue May 25 00:19:47 PDT 2021
From: Marek Czerski <m.czerski at ap-tech.pl>
setbrg callback (set baudrate) is needed by the loadx/loady commands.
Because litex serial has fixed baudrate the callback only checks if
the requested baudrate is the same as the CONFIG_BAUDRATE.
---
drivers/serial/serial_litex.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/serial/serial_litex.c b/drivers/serial/serial_litex.c
index 8562a45ecc..9d35a6e44a 100644
--- a/drivers/serial/serial_litex.c
+++ b/drivers/serial/serial_litex.c
@@ -58,6 +58,13 @@ static int litex_serial_tstc(struct console_device *cdev)
return !litex_serial_readb(cdev, UART_RXEMPTY);
}
+static int litex_setial_setbaudrate(struct console_device *cdev, int baudrate)
+{
+ if (baudrate != CONFIG_BAUDRATE)
+ return -EINVAL;
+ return 0;
+}
+
static int litex_serial_probe(struct device_d *dev)
{
struct resource *iores;
@@ -73,7 +80,7 @@ static int litex_serial_probe(struct device_d *dev)
cdev->tstc = &litex_serial_tstc;
cdev->putc = &litex_serial_putc;
cdev->getc = &litex_serial_getc;
- cdev->setbrg = NULL;
+ cdev->setbrg = &litex_setial_setbaudrate;
console_register(cdev);
--
2.31.1
More information about the barebox
mailing list