Fix uart_mini initialization and emulation

This commit is contained in:
2019-12-02 12:59:40 +01:00
parent 417106b967
commit 6c4dba0929
11 changed files with 46 additions and 33 deletions
+2 -2
View File
@@ -23,7 +23,7 @@
#define UART_QEMU 1
#ifndef UART_DEFAULT
#define UART_DEFAULT UART_QEMU
#define UART_DEFAULT UART_MINI
#endif
#if UART_DEFAULT == UART_MINI
@@ -40,7 +40,7 @@
#else
#warning "Unsopported default UART"
#warning "Unsupported default UART"
#endif
+7 -5
View File
@@ -26,16 +26,18 @@ uart_mini_init(void)
/* Enable UART Mini and its registers*/
aarch64_set32r(AUX_ENABLES, 1);
/* Disable auto flow control, TX and RX */
aarch64_set32r(AUX_MU_CNTL_REG, 0);
/* Disable TX and RX interrupts */
aarch64_set32r(AUX_MU_IER_REG, 0);
/* Disable auto flow control, TX and RX */
aarch64_set32r(AUX_MU_CNTL_REG, 0);
/* Set 8bit mode */
aarch64_set32r(AUX_MU_LCR_REG, 0);
aarch64_set32r(AUX_MU_LCR_REG, 3);
/* Set RTS line HIGH */
aarch64_set32r(AUX_MU_MCR_REG, 0);
/* Set baud rate 115200 */
aarch64_set32r(AUX_MU_BAUD_REG, 0x10E);
aarch64_set32r(AUX_MU_IER_REG, 0);
aarch64_set32r(AUX_MU_IIR_REG, 0xC6);
aarch64_set32r(AUX_MU_BAUD_REG, 270);
sel = aarch64_get32r(GPFSEL1);
/* clean and set ALT5 for GPIO14 */
@@ -53,7 +55,7 @@ uart_mini_init(void)
aarch64_set32r(GPPUDCLK0, 0);
/* Enable TX and RX */
aarch64_set32r(AUX_MU_CNTL_REG, 0x03);
aarch64_set32r(AUX_MU_CNTL_REG, 3);
return 0;
}