diff options
| author | Scott Telford <stelford@cadence.com> | 2016-09-22 11:58:16 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-27 06:54:41 -0400 |
| commit | c41251b17563234371a9b376ed4914efa4bc079b (patch) | |
| tree | 7fa3e64e794043e6184232621af6a7272b46bacc /drivers/tty/serial | |
| parent | 212d249b6acbe00ac3617938433ce785c2d68e88 (diff) | |
serial: xuartps: Add some register initialisation to cdns_early_console_setup()
Add initialisation of control register and baud rate to
cdns_early_console_setup(), required when running kernel standalone
without a boot loader. Baud rate is only initialised when specified in
earlycon command-line option, otherwise it is assumed this has been
set by a boot loader. Updated Documentation/kernel-parameters.txt
accordingly.
Signed-off-by: Scott Telford <stelford@cadence.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial')
| -rw-r--r-- | drivers/tty/serial/xilinx_uartps.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 39f41bfd7c22..f37edaa5ac75 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c | |||
| @@ -1165,9 +1165,34 @@ static void __init cdns_early_write(struct console *con, const char *s, | |||
| 1165 | static int __init cdns_early_console_setup(struct earlycon_device *device, | 1165 | static int __init cdns_early_console_setup(struct earlycon_device *device, |
| 1166 | const char *opt) | 1166 | const char *opt) |
| 1167 | { | 1167 | { |
| 1168 | if (!device->port.membase) | 1168 | struct uart_port *port = &device->port; |
| 1169 | |||
| 1170 | if (!port->membase) | ||
| 1169 | return -ENODEV; | 1171 | return -ENODEV; |
| 1170 | 1172 | ||
| 1173 | /* initialise control register */ | ||
| 1174 | writel(CDNS_UART_CR_TX_EN|CDNS_UART_CR_TXRST|CDNS_UART_CR_RXRST, | ||
| 1175 | port->membase + CDNS_UART_CR); | ||
| 1176 | |||
| 1177 | /* only set baud if specified on command line - otherwise | ||
| 1178 | * assume it has been initialized by a boot loader. | ||
| 1179 | */ | ||
| 1180 | if (device->baud) { | ||
| 1181 | u32 cd = 0, bdiv = 0; | ||
| 1182 | u32 mr; | ||
| 1183 | int div8; | ||
| 1184 | |||
| 1185 | cdns_uart_calc_baud_divs(port->uartclk, device->baud, | ||
| 1186 | &bdiv, &cd, &div8); | ||
| 1187 | mr = CDNS_UART_MR_PARITY_NONE; | ||
| 1188 | if (div8) | ||
| 1189 | mr |= CDNS_UART_MR_CLKSEL; | ||
| 1190 | |||
| 1191 | writel(mr, port->membase + CDNS_UART_MR); | ||
| 1192 | writel(cd, port->membase + CDNS_UART_BAUDGEN); | ||
| 1193 | writel(bdiv, port->membase + CDNS_UART_BAUDDIV); | ||
| 1194 | } | ||
| 1195 | |||
| 1171 | device->con->write = cdns_early_write; | 1196 | device->con->write = cdns_early_write; |
| 1172 | 1197 | ||
| 1173 | return 0; | 1198 | return 0; |
