If CONFIG_EARLY_UART_PL011_BAUD_RATE is set to 0 then the code will
not try to initialize the UART, so that bootloader or firmware
settings can be used for maximum compatibility.
+
+ - CONFIG_EARLY_UART_PL011_MMIO32 is, optionally, used to enable 32-bit
+ only accesses to registers.
- scif
- CONFIG_EARLY_UART_SCIF_VERSION_* is, optionally, the interface version
of the UART. Default to version NONE.
default 115200 if EARLY_PRINTK_FASTMODEL
default 0
+config EARLY_UART_PL011_MMIO32
+ bool "32-bit only MMIO for PL011 early printk"
+ depends on EARLY_UART_PL011
+ help
+ If specified, all accesses to PL011 registers made from early printk code
+ will be done using 32-bit only accessors.
+
config EARLY_UART_INIT
depends on EARLY_UART_PL011 && EARLY_UART_PL011_BAUD_RATE != 0
def_bool y
*/
.macro early_uart_init rb, rc, rd
mov \rc, #(7372800 / CONFIG_EARLY_UART_PL011_BAUD_RATE % 16)
- strb \rc, [\rb, #FBRD] /* -> UARTFBRD (Baud divisor fraction) */
+ PL011_STRB \rc, [\rb, #FBRD] /* -> UARTFBRD (Baud divisor fraction) */
mov \rc, #(7372800 / CONFIG_EARLY_UART_PL011_BAUD_RATE / 16)
- strh \rc, [\rb, #IBRD] /* -> UARTIBRD (Baud divisor integer) */
+ PL011_STRH \rc, [\rb, #IBRD] /* -> UARTIBRD (Baud divisor integer) */
mov \rc, #WLEN_8 /* 8n1 */
- strb \rc, [\rb, #LCR_H] /* -> UARTLCR_H (Line control) */
+ PL011_STRB \rc, [\rb, #LCR_H] /* -> UARTLCR_H (Line control) */
ldr \rc, =(RXE | TXE | UARTEN) /* RXE | TXE | UARTEN */
- strh \rc, [\rb, #CR] /* -> UARTCR (Control Register) */
+ PL011_STRH \rc, [\rb, #CR] /* -> UARTCR (Control Register) */
.endm
/*
*/
.macro early_uart_ready rb, rc
1:
- ldrh \rc, [\rb, #FR] /* <- UARTFR (Flag register) */
+ PL011_LDRH \rc, [\rb, #FR] /* <- UARTFR (Flag register) */
tst \rc, #BUSY /* Check BUSY bit */
bne 1b /* Wait for the UART to be ready */
.endm
* rt: register which contains the character to transmit
*/
.macro early_uart_transmit rb, rt
- strb \rt, [\rb, #DR] /* -> UARTDR (Data Register) */
+ PL011_STRB \rt, [\rb, #DR] /* -> UARTDR (Data Register) */
.endm
/*
*/
.macro early_uart_init xb, c
mov x\c, #(7372800 / CONFIG_EARLY_UART_PL011_BAUD_RATE % 16)
- strb w\c, [\xb, #FBRD] /* -> UARTFBRD (Baud divisor fraction) */
+ PL011_STRB w\c, [\xb, #FBRD] /* -> UARTFBRD (Baud divisor fraction) */
mov x\c, #(7372800 / CONFIG_EARLY_UART_PL011_BAUD_RATE / 16)
- strh w\c, [\xb, #IBRD] /* -> UARTIBRD (Baud divisor integer) */
+ PL011_STRH w\c, [\xb, #IBRD] /* -> UARTIBRD (Baud divisor integer) */
mov x\c, #WLEN_8 /* 8n1 */
- strb w\c, [\xb, #LCR_H] /* -> UARTLCR_H (Line control) */
+ PL011_STRB w\c, [\xb, #LCR_H] /* -> UARTLCR_H (Line control) */
ldr x\c, =(RXE | TXE | UARTEN)
- strh w\c, [\xb, #CR] /* -> UARTCR (Control Register) */
+ PL011_STRH w\c, [\xb, #CR] /* -> UARTCR (Control Register) */
.endm
/*
*/
.macro early_uart_ready xb, c
1:
- ldrh w\c, [\xb, #FR] /* <- UARTFR (Flag register) */
+ PL011_LDRH w\c, [\xb, #FR] /* <- UARTFR (Flag register) */
tst w\c, #BUSY /* Check BUSY bit */
b.ne 1b /* Wait for the UART to be ready */
.endm
* wt: register which contains the character to transmit
*/
.macro early_uart_transmit xb, wt
- strb \wt, [\xb, #DR] /* -> UARTDR (Data Register) */
+ PL011_STRB \wt, [\xb, #DR] /* -> UARTDR (Data Register) */
.endm
/*
#ifndef __ASM_ARM_PL011_H
#define __ASM_ARM_PL011_H
+#ifdef __ASSEMBLY__
+
+/*
+ * PL011 registers are 8/16-bit wide. However, there are implementations that
+ * can only handle 32-bit accesses. The following macros used in early printk
+ * are defined to distinguish accessors for normal case from 32-bit MMIO one.
+ */
+#ifdef CONFIG_EARLY_UART_PL011_MMIO32
+#define PL011_STRH str
+#define PL011_STRB str
+#define PL011_LDRH ldr
+#else
+#define PL011_STRH strh
+#define PL011_STRB strb
+#define PL011_LDRH ldrh
+#endif
+
+#endif /* __ASSEMBLY__ */
+
/* PL011 register addresses */
#define DR (0x00)
#define RSR (0x04)