summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/serial/serial_lpuart.c13
-rw-r--r--include/serial/lpuart.h2
2 files changed, 10 insertions, 5 deletions
diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index f28035a..246fc3d 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -68,11 +68,14 @@ static int lpuart_serial_setbaudrate(struct console_device *cdev,
lpuart_enable(lpuart, false);
- lpuart_setbrg(lpuart->base,
- clk_get_rate(lpuart->clk),
- baudrate);
-
- lpuart_enable(lpuart, true);
+ /*
+ * We treat baudrate of 0 as a request to disable UART
+ */
+ if (baudrate) {
+ lpuart_setbrg(lpuart->base, clk_get_rate(lpuart->clk),
+ baudrate);
+ lpuart_enable(lpuart, true);
+ }
lpuart->baudrate = baudrate;
diff --git a/include/serial/lpuart.h b/include/serial/lpuart.h
index a920291..9c6e271 100644
--- a/include/serial/lpuart.h
+++ b/include/serial/lpuart.h
@@ -228,6 +228,8 @@ static inline void lpuart_setbrg(void __iomem *base,
unsigned int bfra;
u16 sbr;
+ BUG_ON(!baudrate);
+
sbr = (u16) (refclock / (16 * baudrate));
writeb(sbr >> 8, base + UARTBDH);