According to the ESCC datasheet all register values are undetermined until an explicit reset command is sent. This is required to fix an issue with QEMU's ESCC device to ensure that the registers are set to default values if the default power-on values are changed.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- drivers/escc.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/drivers/escc.c b/drivers/escc.c index 4da8917..0f0d43a 100644 --- a/drivers/escc.c +++ b/drivers/escc.c @@ -46,6 +46,9 @@ static volatile unsigned char *escc_serial_dev; #define Tx8 0x60 /* Tx 8 bits/character */ #define DTR 0x80 /* DTR */
+/* Write Register 9 */ +#define SW_CHAN_RESET_B 0x40 /* Software reset channel B */ + /* Write Register 14 (Misc control bits) */ #define BRENAB 1 /* Baud rate generator enable */ #define BRSRC 2 /* Baud rate generator source */ @@ -80,6 +83,9 @@ static void escc_uart_port_putchar(uintptr_t port, unsigned char c)
static void uart_init_line(volatile unsigned char *port, unsigned long baud, int index) { + CTRL(port) = 9; // reg 9 + CTRL(port) = SW_CHAN_RESET_B << index; + CTRL(port) = 4; // reg 4 CTRL(port) = SB1 | X16CLK; // no parity, async, 1 stop bit, 16x // clock