From: Phil Edworthy <phil.edworthy@xxxxxxxxxxx> DW UART controllers can be synthesized without the CPR register. In this case, allow to the platform information to provide a CPR value. Signed-off-by: Phil Edworthy <phil.edworthy@xxxxxxxxxxx> Co-developed-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx> Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx> --- drivers/tty/serial/8250/8250_dwlib.c | 4 ++++ drivers/tty/serial/8250/8250_dwlib.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/tty/serial/8250/8250_dwlib.c b/drivers/tty/serial/8250/8250_dwlib.c index 622d3b0d89e7..cef20ca3ad61 100644 --- a/drivers/tty/serial/8250/8250_dwlib.c +++ b/drivers/tty/serial/8250/8250_dwlib.c @@ -5,6 +5,7 @@ #include <linux/device.h> #include <linux/io.h> #include <linux/kernel.h> +#include <linux/property.h> #include <linux/serial_8250.h> #include <linux/serial_core.h> @@ -90,6 +91,7 @@ EXPORT_SYMBOL_GPL(dw8250_do_set_termios); void dw8250_setup_port(struct uart_port *p) { struct uart_8250_port *up = up_to_u8250p(p); + const struct dw8250_platform_data *pdata = device_get_match_data(up->port.dev); u32 reg; /* @@ -116,6 +118,8 @@ void dw8250_setup_port(struct uart_port *p) } reg = dw8250_readl_ext(p, DW_UART_CPR); + if (!reg && pdata) + reg = pdata->cpr; if (!reg) return; diff --git a/drivers/tty/serial/8250/8250_dwlib.h b/drivers/tty/serial/8250/8250_dwlib.h index 766f80799d13..704ba91ab09f 100644 --- a/drivers/tty/serial/8250/8250_dwlib.h +++ b/drivers/tty/serial/8250/8250_dwlib.h @@ -22,6 +22,7 @@ struct dw8250_port_data { struct dw8250_platform_data { unsigned long quirks; + u32 cpr; }; struct dw8250_data { -- 2.27.0