Diff below makes the console on the odroid-xu4 actually work.  I don't
completely understand the current code.  It doesn't check whether a
character can be written before doing so.  Instead it tries to make
sure the transmission of the character completes.  But that seems to
fail, possibly because the code tries to cater for both FIFO and
non-FIFO mode.  Since u-boot puts the chip into FIFO mode, I think we
can simply check whether there is room in the FIFO before we transmit
and be done with it.

ok?


Index: exuart.c
===================================================================
RCS file: /cvs/src/sys/arch/armv7/exynos/exuart.c,v
retrieving revision 1.7
diff -u -p -r1.7 exuart.c
--- exuart.c    21 Aug 2016 06:36:23 -0000      1.7
+++ exuart.c    5 Mar 2017 11:27:25 -0000
@@ -883,12 +883,10 @@ exuartcnputc(dev_t dev, int c)
 {
        int s;
        s = splhigh();
-       bus_space_write_1(exuartconsiot, exuartconsioh, EXUART_UTXH, 
(uint8_t)c);
-       while((bus_space_read_2(exuartconsiot, exuartconsioh, EXUART_UTRSTAT) &
-           EXUART_UTRSTAT_TXBEMPTY) != 0 &&
-             (bus_space_read_2(exuartconsiot, exuartconsioh, EXUART_UFSTAT) &
-           (EXUART_UFSTAT_TX_FIFO_CNT_MASK|EXUART_UFSTAT_TX_FIFO_FULL)) != 0)
+       while (bus_space_read_4(exuartconsiot, exuartconsioh, EXUART_UFSTAT) &
+          EXUART_UFSTAT_TX_FIFO_FULL)
                ;
+       bus_space_write_1(exuartconsiot, exuartconsioh, EXUART_UTXH, c);
        splx(s);
 }
 

Reply via email to