]> xenbits.xensource.com Git - people/julieng/boot-wrapper-aarch64.git/commitdiff
bootwrapper: improve UART initialisation
authorAndre Przywara <andre.przywara@arm.com>
Tue, 29 Jul 2014 16:18:51 +0000 (17:18 +0100)
committerMark Rutland <mark.rutland@arm.com>
Thu, 6 Nov 2014 17:34:25 +0000 (17:34 +0000)
The PL011 spec requires that baud rate settings should be done by
writing both xBRD registers followed by a write to LCR_H (which we
skipped so far completely).[1]
So include the FBRD register write as well and set up the LCR_H
register to initialise the UART to 8N1.
Also skip the automatic RTS/CTS enablement, as this may not be
used by the peer (and the generic UART does not have it at all).

[1] ARM PL011 TRM, 3.3.7 (top of page 3-14)

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
ns.S

diff --git a/ns.S b/ns.S
index f432bcfbbe1d3754b259ad0ad126301945b0687a..d3feb4aea7474c29e3f9fb9965cd55ba9d2527f0 100644 (file)
--- a/ns.S
+++ b/ns.S
@@ -8,6 +8,8 @@
  */
 
 #define PL011_UARTIBRD 0x24
+#define PL011_UARTFBRD 0x28
+#define PL011_UART_LCR_H       0x2c
 #define PL011_UARTCR   0x30
 
 #define V2M_SYS_CFGDATA        0xa0
@@ -23,8 +25,12 @@ ns_init_system:
        ldr     x4, =UART_BASE
        mov     w5, #0x10
        str     w5, [x4, #PL011_UARTIBRD]
-       mov     w5, #0xc300
-       orr     w5, w5, #0x0001 
+       str     wzr, [x4, #PL011_UARTFBRD]
+       /* set parameters to 8N1 and enable the FIFOs */
+       mov     w5, #0x70
+       str     w5, [x4, #PL011_UART_LCR_H]
+       /* enable the UART, TXen and RXen */
+       mov     w5, #0x301
        str     w5, [x4, #PL011_UARTCR]
 
        /*
@@ -38,4 +44,4 @@ ns_init_system:
        ret
 
        .ltorg
-       .org 0x40
+       .org 0x80