This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 91f2bc0eca30d4db261b4b3405fd61c2ade70c64
Author: hujun5 <[email protected]>
AuthorDate: Sun Oct 26 13:24:42 2025 +0800

    arm64: remove arm64_earlyprintinit
    
    remove arm64_earlyprintinit
    
    Signed-off-by: hujun5 <[email protected]>
---
 arch/arm64/src/a64/a64_lowputc.S           |  9 ------
 arch/arm64/src/common/arm64_head.S         |  8 -----
 arch/arm64/src/fvp-v8r/fvp_lowputc.S       | 47 ++++++++++++++++--------------
 arch/arm64/src/goldfish/goldfish_lowputc.S | 10 -------
 arch/arm64/src/imx8/imx8qm_lowputc.S       |  7 -----
 arch/arm64/src/imx9/imx9_lowputc.c         | 13 ---------
 arch/arm64/src/qemu/qemu_lowputc.S         | 10 -------
 arch/arm64/src/rk3399/rk3399_lowputc.S     |  9 ------
 arch/arm64/src/zynq-mpsoc/zynq_lowputc.S   |  9 ------
 9 files changed, 25 insertions(+), 97 deletions(-)

diff --git a/arch/arm64/src/a64/a64_lowputc.S b/arch/arm64/src/a64/a64_lowputc.S
index 0bfd6f1080a..3f4152e63d0 100644
--- a/arch/arm64/src/a64/a64_lowputc.S
+++ b/arch/arm64/src/a64/a64_lowputc.S
@@ -51,15 +51,6 @@
  * Public Functions
  ****************************************************************************/
 
-/* Initialize A64 UART
- * xb: Register that contains the UART Base Address
- * c:  Scratch register number
- */
-
-GTEXT(arm64_earlyprintinit)
-SECTION_FUNC(text, arm64_earlyprintinit)
-    ret  /* Do nothing because U-Boot has already initialized UART */
-
 /* Wait for A64 UART to be ready to transmit
  * xb: Register that contains the UART Base Address
  * wt: Scratch register number
diff --git a/arch/arm64/src/common/arm64_head.S 
b/arch/arm64/src/common/arm64_head.S
index e61f6d0fc4f..2ed79756be0 100644
--- a/arch/arm64/src/common/arm64_head.S
+++ b/arch/arm64/src/common/arm64_head.S
@@ -218,14 +218,6 @@ primary_core:
 
     bl     __reset_prep_c
 
-#ifdef CONFIG_ARCH_EARLY_PRINT
-    /* Initialize the UART for early print.
-     * Should only be called on the boot CPU
-     */
-
-    bl    arm64_earlyprintinit
-#endif
-
 #ifndef CONFIG_ARCH_SKIP_ZERO_BSS
     bl    arm64_data_initialize
 #endif
diff --git a/arch/arm64/src/fvp-v8r/fvp_lowputc.S 
b/arch/arm64/src/fvp-v8r/fvp_lowputc.S
index 66da6d89825..d1a0f2bdb76 100644
--- a/arch/arm64/src/fvp-v8r/fvp_lowputc.S
+++ b/arch/arm64/src/fvp-v8r/fvp_lowputc.S
@@ -47,32 +47,13 @@
  * Private Functions
  ****************************************************************************/
 
+    .section .data
+    g_earlyprint_flag: .word 0
+
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
-/***************************************************************************
- * Name: arm64_earlyprintinit
- *
- * PL011 UART initialization
- * xb: register which contains the UART base address
- * c: scratch register number
- *
- ***************************************************************************/
-
-GTEXT(arm64_earlyprintinit)
-SECTION_FUNC(text, arm64_earlyprintinit)
-    ldr   x15, =CONFIG_UART0_BASE
-    mov   x0, #(7372800 / EARLY_UART_PL011_BAUD_RATE % 16)
-    strh  w0, [x15, #0x28]      /* -> UARTFBRD (Baud divisor fraction) */
-    mov   x0, #(7372800 / EARLY_UART_PL011_BAUD_RATE / 16)
-    strh  w0, [x15, #0x24]      /* -> UARTIBRD (Baud divisor integer) */
-    mov   x0, #0x60             /* 8n1 */
-    str   w0, [x15, #0x2C]      /* -> UARTLCR_H (Line control) */
-    ldr   x0, =0x00000301       /* RXE | TXE | UARTEN */
-    str   w0, [x15, #0x30]      /* -> UARTCR (Control Register) */
-    ret
-
 /* PL011 UART wait UART to be ready to transmit
  * xb: register which contains the UART base address
  * c: scratch register number
@@ -100,6 +81,28 @@ SECTION_FUNC(text, arm64_earlyprintinit)
 
 GTEXT(arm64_lowputc)
 SECTION_FUNC(text, arm64_lowputc)
+
+    /* Init Uart */
+
+    ldr    x15, =g_earlyprint_flag
+    ldr    w2, [x15, #0]
+    cmp    w2, #1
+    beq    1f                   /* Init Ok */
+    mov    w2, #1
+    str    w2, [x15, #0]
+
+    ldr   x15, =CONFIG_UART0_BASE
+    mov   x2, #(7372800 / EARLY_UART_PL011_BAUD_RATE % 16)
+    strh  w2, [x15, #0x28]      /* -> UARTFBRD (Baud divisor fraction) */
+    mov   x2, #(7372800 / EARLY_UART_PL011_BAUD_RATE / 16)
+    strh  w2, [x15, #0x24]      /* -> UARTIBRD (Baud divisor integer) */
+    mov   x2, #0x60             /* 8n1 */
+    str   w2, [x15, #0x2C]      /* -> UARTLCR_H (Line control) */
+    ldr   x2, =0x00000301       /* RXE | TXE | UARTEN */
+    str   w2, [x15, #0x30]      /* -> UARTCR (Control Register) */
+1:
+    /* lowputc */
+
     ldr   x15, =CONFIG_UART0_BASE
     early_uart_ready x15, w2
     early_uart_transmit x15, w0
diff --git a/arch/arm64/src/goldfish/goldfish_lowputc.S 
b/arch/arm64/src/goldfish/goldfish_lowputc.S
index 89a88c8874f..d27067cfb4a 100644
--- a/arch/arm64/src/goldfish/goldfish_lowputc.S
+++ b/arch/arm64/src/goldfish/goldfish_lowputc.S
@@ -50,16 +50,6 @@
  * Public Functions
  ****************************************************************************/
 
-/* PL011 UART initialization
- */
-
-GTEXT(arm64_earlyprintinit)
-SECTION_FUNC(text, arm64_earlyprintinit)
-    /* it's seem we can do nothing at the qemu platform
-     * for qemu pl011, the QEMU has already initialized UART
-     */
-    ret
-
 /* PL011 UART wait UART to be ready to transmit
  * xb: register which contains the UART base address
  * c: scratch register number
diff --git a/arch/arm64/src/imx8/imx8qm_lowputc.S 
b/arch/arm64/src/imx8/imx8qm_lowputc.S
index 43e81b752b9..851daa40e6b 100644
--- a/arch/arm64/src/imx8/imx8qm_lowputc.S
+++ b/arch/arm64/src/imx8/imx8qm_lowputc.S
@@ -52,13 +52,6 @@
  * Public Functions
  ****************************************************************************/
 
-/* PL011 UART initialization */
-
-GTEXT(arm64_earlyprintinit)
-SECTION_FUNC(text, arm64_earlyprintinit)
-    /* Already initialized in bootloader */
-    ret
-
 /* i.MX8QM wait LPUART to be ready to transmit
  * rb: register which contains the UART base address
  * rc: scratch register
diff --git a/arch/arm64/src/imx9/imx9_lowputc.c 
b/arch/arm64/src/imx9/imx9_lowputc.c
index 5e5b8365ae5..044ee1b4eb9 100644
--- a/arch/arm64/src/imx9/imx9_lowputc.c
+++ b/arch/arm64/src/imx9/imx9_lowputc.c
@@ -474,19 +474,6 @@ int imx9_lpuart_configure(uint32_t base, int uartnum,
   return OK;
 }
 
-/****************************************************************************
- * Name: arm64_earlyprintinit
- *
- * Description:
- *   Configure LPUART1 for non-interrupt driven operation
- *
- ****************************************************************************/
-
-void arm64_earlyprintinit(char ch)
-{
-  /* Assume bootloader has already set up the LPUART1 */
-}
-
 /****************************************************************************
  * Name: arm64_lowputc
  *
diff --git a/arch/arm64/src/qemu/qemu_lowputc.S 
b/arch/arm64/src/qemu/qemu_lowputc.S
index f1ec5b5f95b..a46ff7d8965 100644
--- a/arch/arm64/src/qemu/qemu_lowputc.S
+++ b/arch/arm64/src/qemu/qemu_lowputc.S
@@ -52,16 +52,6 @@
  * Public Functions
  ****************************************************************************/
 
-/* PL011 UART initialization
- */
-
-GTEXT(arm64_earlyprintinit)
-SECTION_FUNC(text, arm64_earlyprintinit)
-    /* it's seem we can do nothing at the qemu platform
-     * for qemu pl011, the QEMU has already initialized UART
-     */
-    ret
-
 /* PL011 UART wait UART to be ready to transmit
  * xb: register which contains the UART base address
  * c: scratch register number
diff --git a/arch/arm64/src/rk3399/rk3399_lowputc.S 
b/arch/arm64/src/rk3399/rk3399_lowputc.S
index 1e76a0896c3..8eb086373bf 100644
--- a/arch/arm64/src/rk3399/rk3399_lowputc.S
+++ b/arch/arm64/src/rk3399/rk3399_lowputc.S
@@ -50,15 +50,6 @@
  * Public Functions
  ****************************************************************************/
 
-/* Initialize A64 UART
- * xb: Register that contains the UART Base Address
- * c:  Scratch register number
- */
-
-GTEXT(arm64_earlyprintinit)
-SECTION_FUNC(text, arm64_earlyprintinit)
-    ret  /* Do nothing because U-Boot has already initialized UART */
-
 /* Wait for RK3399 UART to be ready to transmit
  * xb: Register that contains the UART Base Address
  * wt: Scratch register number
diff --git a/arch/arm64/src/zynq-mpsoc/zynq_lowputc.S 
b/arch/arm64/src/zynq-mpsoc/zynq_lowputc.S
index 25bd8dee33d..7777b0e7baf 100644
--- a/arch/arm64/src/zynq-mpsoc/zynq_lowputc.S
+++ b/arch/arm64/src/zynq-mpsoc/zynq_lowputc.S
@@ -52,15 +52,6 @@
  * Public Functions
  ****************************************************************************/
 
-/* Initialize Zynq Mpsoc UART
- * xb: Register that contains the UART Base Address
- * c:  Scratch register number
- */
-
-GTEXT(arm64_earlyprintinit)
-SECTION_FUNC(text, arm64_earlyprintinit)
-    ret  /* Do nothing because U-Boot has already initialized UART */
-
 /* Wait for XCZU28DR UART to be ready to transmit
  * xb: Register that contains the UART Base Address
  * wt: Scratch register number

Reply via email to