summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authordanh-arm <dan.handley@arm.com>2016-02-01 19:03:41 +0000
committerdanh-arm <dan.handley@arm.com>2016-02-01 19:03:41 +0000
commit51b57481c1cca38bc9d11922e2cff33c13992892 (patch)
treefbb3082fd92ab5f801ccb426d0ecd6e8170e9cc7 /drivers
parent7b46d0d81a5853051750b716d577c283619bd480 (diff)
parent9400b40ea4c71153a63c1f1cdaa416d45a325ec5 (diff)
Merge pull request #501 from jcastillo-arm/jc/tf-issues/300
Disable PL011 UART before configuring it
Diffstat (limited to 'drivers')
-rw-r--r--drivers/arm/pl011/pl011_console.S16
-rw-r--r--drivers/console/console.S2
2 files changed, 16 insertions, 2 deletions
diff --git a/drivers/arm/pl011/pl011_console.S b/drivers/arm/pl011/pl011_console.S
index 47608da3..f29f895b 100644
--- a/drivers/arm/pl011/pl011_console.S
+++ b/drivers/arm/pl011/pl011_console.S
@@ -54,7 +54,7 @@
* w1 - Uart clock in Hz
* w2 - Baud rate
* Out: return 1 on success else 0 on error
- * Clobber list : x1, x2
+ * Clobber list : x1, x2, x3, x4
* -----------------------------------------------
*/
func console_core_init
@@ -64,6 +64,20 @@ func console_core_init
/* Check baud rate and uart clock for sanity */
cbz w1, core_init_fail
cbz w2, core_init_fail
+ /* Disable uart before programming */
+ ldr w3, [x0, #UARTCR]
+ mov w4, #PL011_UARTCR_UARTEN
+ bic w3, w3, w4
+ str w3, [x0, #UARTCR]
+ /* Flush the transmit FIFO */
+ ldr w3, [x0, #UARTLCR_H]
+ mov w4, #PL011_UARTLCR_H_FEN
+ bic w3, w3, w4
+ str w3, [x0, #UARTLCR_H]
+ /* Wait for the end of Tx of current character */
+busy_loop:
+ ldr w3, [x0, #UARTFR]
+ tbnz w3, #PL011_UARTFR_BUSY_BIT, busy_loop
/* Program the baudrate */
/* Divisor = (Uart clock * 4) / baudrate */
lsl w1, w1, #2
diff --git a/drivers/console/console.S b/drivers/console/console.S
index b7723638..797b5645 100644
--- a/drivers/console/console.S
+++ b/drivers/console/console.S
@@ -54,7 +54,7 @@
* w1 - Uart clock in Hz
* w2 - Baud rate
* out: return 1 on success else 0 on error
- * Clobber list : x1 - x3
+ * Clobber list : x1 - x4
* -----------------------------------------------
*/
func console_init