UART cleanup
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 31 Dec 2016 20:14:22 +0000 (12:14 -0800)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 31 Dec 2016 20:14:22 +0000 (12:14 -0800)
arm_chainloader/drivers/uart.c
romstage.c

index 3b20ac1..0bce936 100644 (file)
@@ -1,10 +1,10 @@
 #include <hardware.h>\r
 \r
+#define UART_DR     (UART_BASE+0x00)\r
+#define UART_FR     (UART_BASE+0x18)\r
+\r
 void uart_putc(unsigned int ch)\r
 {\r
-       while(1) {\r
-               if (mmio_read32(AUX_MU_LSR_REG) & 0x20)\r
-                       break;\r
-       }\r
-       mmio_write32(AUX_MU_IO_REG, ch);\r
+        while(mmio_read32(UART_FR) & 0x20);\r
+        mmio_write32(UART_DR, ch);\r
 }\r
index 5cf7b40..7a4a7fe 100644 (file)
@@ -53,14 +53,6 @@ void uart_init(void) {
        ra |= 4 << 12;\r
        GP_FSEL1 = ra;\r
 \r
-        /*\r
-        CM_UARTCTL = CM_PASSWORD | CM_SRC_OSC | CM_UARTCTL_FRAC_SET;\r
-        udelay(150);\r
-        CM_UARTDIV = CM_PASSWORD | 0x6666;\r
-        udelay(150);\r
-        CM_UARTCTL |= CM_UARTCTL_ENAB_SET;\r
-        udelay(150);*/\r
-        \r
         mmio_write32(UART_CR, 0);\r
 \r
         GP_PUD = 0;\r
@@ -77,8 +69,6 @@ void uart_init(void) {
         mmio_write32(UART_FBRD, 40);\r
         mmio_write32(UART_LCRH, 0x70);\r
         mmio_write32(UART_CR, 0x301);\r
-\r
-//        for(;;) uart_putc('B');\r
 }\r
 \r
 void led_init(void) {\r
@@ -181,7 +171,6 @@ int _main(unsigned int cpuid, unsigned int load_address) {
        led_init();\r
        uart_init();\r
 \r
-        for(;;) {\r
        printf(\r
                "=========================================================\n"\r
                "::\n"\r
@@ -194,7 +183,6 @@ int _main(unsigned int cpuid, unsigned int load_address) {
                __DATE__, __TIME__,\r
                "OPENSOURCE"\r
        );\r
-        }\r
 \r
        printf("CPUID    = 0x%X\n", cpuid);\r
        printf("LoadAddr = 0x%X\n", load_address);\r
This page took 0.026199 seconds and 4 git commands to generate.