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 46acca536c807715d44423aa0014260aaee481c2
Author: hujun5 <[email protected]>
AuthorDate: Fri Mar 13 18:54:45 2026 +0800

    arch/arm64: consolidate common boot sequence into 
arm64_boot_primary_c_routine
    
    Move duplicated initialization steps (MMU/MPU init, MTE init, FDT
    registration, percpu data copy, PSCI init, early serial init) from
    individual chip-level arm64_chip_boot() into the common
    arm64_boot_primary_c_routine(), reducing ~150 lines of redundant code
    across 9 SoC boot files.
    
    Signed-off-by: hujun5 <[email protected]>
---
 arch/arm64/src/a527/a527_boot.c         | 32 ++-----------------
 arch/arm64/src/a64/a64_boot.c           | 32 -------------------
 arch/arm64/src/am62x/am62x_boot.c       | 29 -----------------
 arch/arm64/src/bcm2711/bcm2711_boot.c   | 27 ----------------
 arch/arm64/src/common/arm64_boot.c      | 55 +++++++++++++++++++++++++++++++++
 arch/arm64/src/fvp-v8r/fvp_boot.c       | 23 --------------
 arch/arm64/src/goldfish/goldfish_boot.c | 31 -------------------
 arch/arm64/src/imx8/imx8_boot.c         | 24 +-------------
 arch/arm64/src/imx9/imx9_boot.c         | 30 +-----------------
 arch/arm64/src/qemu/qemu_boot.c         | 37 ----------------------
 arch/arm64/src/rk3399/rk3399_boot.c     | 32 -------------------
 arch/arm64/src/rk3588/rk3588_boot.c     | 17 ----------
 arch/arm64/src/zynq-mpsoc/zynq_boot.c   | 40 ------------------------
 13 files changed, 60 insertions(+), 349 deletions(-)

diff --git a/arch/arm64/src/a527/a527_boot.c b/arch/arm64/src/a527/a527_boot.c
index 1426625f9cd..5e9068bd589 100644
--- a/arch/arm64/src/a527/a527_boot.c
+++ b/arch/arm64/src/a527/a527_boot.c
@@ -25,21 +25,12 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
-#include <stdint.h>
-#include <assert.h>
-#include <nuttx/debug.h>
 
 #include <nuttx/compiler.h>
-#include <nuttx/cache.h>
-#include <nuttx/syslog/syslog_rpmsg.h>
+#include <nuttx/debug.h>
 #include <arch/chip/chip.h>
 #include <arch/board/board_memorymap.h>
 
-#ifdef CONFIG_SMP
-#include "arm64_smp.h"
-#endif
-
-#include "arm64_arch.h"
 #include "arm64_internal.h"
 #include "arm64_mmu.h"
 #include "a527_boot.h"
@@ -89,6 +80,7 @@ static void a527_copy_overlap(uint8_t *dest, const uint8_t 
*src,
 {
   uint8_t *d = dest + count - 1;
   const uint8_t *s = src + count - 1;
+  volatile uint8_t c;           /* Prevent compiler optimization */
 
   if (dest <= src)
     {
@@ -98,7 +90,7 @@ static void a527_copy_overlap(uint8_t *dest, const uint8_t 
*src,
 
   while (count--)
     {
-      volatile uint8_t c = *s;  /* Prevent compiler optimization */
+      c = *s;
       *d = c;
       d--;
       s--;
@@ -234,30 +226,12 @@ void arm64_chip_boot(void)
 
   a527_copy_ramdisk();
 
-  /* Map the RAM and I/O Memory, enable the MMU */
-
-  arm64_mmu_init(true);
-
-#if defined(CONFIG_ARM64_PSCI)
-  /* Init the Power State Coordination Interface */
-
-  arm64_psci_init("smc");
-#endif
-
   /* Perform board-specific device initialization. This would include
    * configuration of board specific resources such as GPIOs, LEDs, etc.
    */
 
   a527_board_initialize();
 
-#ifdef USE_EARLYSERIALINIT
-  /* Perform early serial initialization if we are going to use the serial
-   * driver.
-   */
-
-  arm64_earlyserialinit();
-#endif
-
 #ifdef CONFIG_ARCH_PERF_EVENTS
   up_perf_init((void *)CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC);
 #endif
diff --git a/arch/arm64/src/a64/a64_boot.c b/arch/arm64/src/a64/a64_boot.c
index fc369f52852..6829e94abe1 100644
--- a/arch/arm64/src/a64/a64_boot.c
+++ b/arch/arm64/src/a64/a64_boot.c
@@ -26,26 +26,11 @@
 
 #include <nuttx/config.h>
 
-#include <stdint.h>
-#include <assert.h>
-#include <nuttx/debug.h>
-
-#include <nuttx/cache.h>
-#ifdef CONFIG_LEGACY_PAGING
-#  include <nuttx/page.h>
-#endif
-
 #include <arch/chip/chip.h>
 
-#ifdef CONFIG_SMP
-#include "arm64_smp.h"
-#endif
-
-#include "arm64_arch.h"
 #include "arm64_internal.h"
 #include "arm64_mmu.h"
 #include "a64_boot.h"
-#include "a64_serial.h"
 
 /****************************************************************************
  * Private Data
@@ -100,28 +85,11 @@ void arm64_el_init(void)
 
 void arm64_chip_boot(void)
 {
-  /* MAP IO and DRAM, enable MMU. */
-
-  arm64_mmu_init(true);
-
-#if defined(CONFIG_ARM64_PSCI)
-  arm64_psci_init("smc");
-
-#endif
-
   /* Perform board-specific device initialization. This would include
    * configuration of board specific resources such as GPIOs, LEDs, etc.
    */
 
   a64_board_initialize();
-
-#ifdef USE_EARLYSERIALINIT
-  /* Perform early serial initialization if we are going to use the serial
-   * driver.
-   */
-
-  arm64_earlyserialinit();
-#endif
 }
 
 #if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT)
diff --git a/arch/arm64/src/am62x/am62x_boot.c 
b/arch/arm64/src/am62x/am62x_boot.c
index 987b5f95e6d..35076f13002 100644
--- a/arch/arm64/src/am62x/am62x_boot.c
+++ b/arch/arm64/src/am62x/am62x_boot.c
@@ -26,23 +26,11 @@
 
 #include <nuttx/config.h>
 
-#include <stdint.h>
-#include <assert.h>
-#include <debug.h>
-
-#include <nuttx/cache.h>
-
 #include <arch/chip/chip.h>
 
-#ifdef CONFIG_SMP
-#  include "arm64_smp.h"
-#endif
-
-#include "arm64_arch.h"
 #include "arm64_internal.h"
 #include "arm64_mmu.h"
 #include "am62x_boot.h"
-#include "am62x_serial.h"
 
 /****************************************************************************
  * Private Data
@@ -123,24 +111,7 @@ void arm64_el_init(void)
 
 void arm64_chip_boot(void)
 {
-#ifdef CONFIG_ARCH_USE_MMU
-  arm64_mmu_init(true);
-#endif
-
-#if defined(CONFIG_ARM64_PSCI) && defined(CONFIG_SMP)
-  /* Keep PSCI out of the initial UP bring-up path until the basic
-   * boot-to-NSH flow is stable on AM62x.  PSCI is still available for
-   * future SMP enablement.
-   */
-
-  arm64_psci_init("smc");
-#endif
-
   am62x_board_initialize();
-
-#ifdef USE_EARLYSERIALINIT
-  arm64_earlyserialinit();
-#endif
 }
 
 /****************************************************************************
diff --git a/arch/arm64/src/bcm2711/bcm2711_boot.c 
b/arch/arm64/src/bcm2711/bcm2711_boot.c
index f0f1a53d659..111da02d026 100644
--- a/arch/arm64/src/bcm2711/bcm2711_boot.c
+++ b/arch/arm64/src/bcm2711/bcm2711_boot.c
@@ -26,27 +26,17 @@
 
 #include <nuttx/config.h>
 
-#include <assert.h>
-#include <nuttx/debug.h>
-#include <nuttx/cache.h>
-
 #include <arch/chip/chip.h>
 
-#include "arm64_arch.h"
 #include "arm64_internal.h"
 #include "arm64_mmu.h"
 #include "bcm2711_boot.h"
-#include "bcm2711_serial.h"
 #include "bcm2711_mailbox.h"
 
 #ifdef CONFIG_SMP
 #include "bcm2711_cpustart.h"
 #endif
 
-#ifdef CONFIG_LEGACY_PAGING
-#include <nuttx/page.h>
-#endif
-
 /****************************************************************************
  * Private Data
  ****************************************************************************/
@@ -150,26 +140,9 @@ void arm64_el_init(void)
 
 void arm64_chip_boot(void)
 {
-  /* MAP IO and DRAM, enable MMU. */
-
-  arm64_mmu_init(true);
-
-#if defined(CONFIG_ARM64_PSCI)
-  arm64_psci_init("smc");
-
-#endif
-
   /* Perform board-specific device initialization. This would include
    * configuration of board specific resources such as GPIOs, LEDs, etc.
    */
 
   bcm2711_board_initialize();
-
-#ifdef USE_EARLYSERIALINIT
-  /* Perform early serial initialization if we are going to use the serial
-   * driver.
-   */
-
-  arm64_earlyserialinit();
-#endif
 }
diff --git a/arch/arm64/src/common/arm64_boot.c 
b/arch/arm64/src/common/arm64_boot.c
index 1dfacf867d4..5f5f1bad22b 100644
--- a/arch/arm64/src/common/arm64_boot.c
+++ b/arch/arm64/src/common/arm64_boot.c
@@ -33,6 +33,8 @@
 
 #include "arm64_internal.h"
 #include "arm64_arch.h"
+#include "arm64_mpu.h"
+#include "arm64_mmu.h"
 
 /****************************************************************************
  * Public Data
@@ -238,6 +240,59 @@ void arm64_boot_el1_init(void)
 
 void arm64_boot_primary_c_routine(void)
 {
+#ifdef CONFIG_ARCH_HAVE_MPU
+  arm64_mpu_init(true);
+#endif
+
+#if defined(CONFIG_ARCH_HAVE_MMU)
+#  if defined(CONFIG_ARCH_CHIP_IMX9) && !defined(CONFIG_ARCH_USE_MMU)
+  /* i.MX9 BL2 bootloaders deliberately boot without the MMU: TF-A
+   * reconfigures it afterwards and the translation tables cost ~50 KB.
+   * MMU setup is only performed when CONFIG_ARCH_USE_MMU is selected.
+   */
+#  else
+  /* MAP IO and DRAM, enable MMU. */
+
+  arm64_mmu_init(true);
+#  endif
+#endif
+
+#ifdef CONFIG_ARM64_MTE
+  arm64_mte_init();
+#endif
+
+#ifdef CONFIG_PERCPU_SECTION
+  /* Copy the percpu data segment of cpu0 to the other CPUs. */
+
+  for (int cpu = 1; cpu < CONFIG_NCPUS; cpu++)
+    {
+      memcpy((void *)((uintptr_t)_sdata_percpu + PERCPU_OFFSET * cpu),
+             _ldata_percpu,
+             (uintptr_t)_edata_percpu - (uintptr_t)_sdata_percpu);
+    }
+#endif
+
+#ifdef CONFIG_ARM64_PSCI
+#  if defined(CONFIG_ARCH_CHIP_QEMU_WITH_HV)
+  arm64_psci_init("hvc");
+#  elif defined(CONFIG_ARCH_CHIP_AM62X) && !defined(CONFIG_SMP)
+  /* Keep PSCI out of the initial UP bring-up path until the basic
+   * boot-to-NSH flow is stable on AM62x.  PSCI is still available for
+   * future SMP enablement.
+   */
+#  elif CONFIG_ARCH_ARM64_EXCEPTION_LEVEL < 3
+  arm64_psci_init("smc");
+#  endif
+#endif
+
   arm64_chip_boot();
+
+#ifdef USE_EARLYSERIALINIT
+  /* Perform early serial initialization if we are going to use the serial
+   * driver.
+   */
+
+  arm64_earlyserialinit();
+#endif
   nx_start();
 }
diff --git a/arch/arm64/src/fvp-v8r/fvp_boot.c 
b/arch/arm64/src/fvp-v8r/fvp_boot.c
index 42a405f54e4..26871a716f7 100644
--- a/arch/arm64/src/fvp-v8r/fvp_boot.c
+++ b/arch/arm64/src/fvp-v8r/fvp_boot.c
@@ -26,19 +26,11 @@
 
 #include <nuttx/config.h>
 
-#include <stdint.h>
-#include <assert.h>
-#include <nuttx/debug.h>
 #include <nuttx/userspace.h>
 
 #include <arch/barriers.h>
 #include <arch/chip/chip.h>
 
-#ifdef CONFIG_SMP
-#include "arm64_smp.h"
-#endif
-
-#include "arm64_arch.h"
 #include "arm64_internal.h"
 #include "arm64_mpu.h"
 #include "chip.h"
@@ -46,7 +38,6 @@
 #include "fvp_userspace.h"
 
 #include <arch/board/board_memorymap.h>
-#include <nuttx/serial/uart_pl011.h>
 
 /****************************************************************************
  * Private Data
@@ -123,30 +114,16 @@ int arm64_get_cpuid(uint64_t mpid)
 
 void arm64_chip_boot(void)
 {
-  arm64_mpu_init(true);
-
 #ifdef CONFIG_BUILD_PROTECTED
   fvp_userspace();
 #endif
 
-#if defined(CONFIG_ARM64_PSCI)
-  arm64_psci_init("smc");
-#endif
-
   /* Perform board-specific device initialization. This would include
    * configuration of board specific resources such as GPIOs, LEDs, etc.
    */
 
   fvp_board_initialize();
 
-#ifdef USE_EARLYSERIALINIT
-  /* Perform early serial initialization if we are going to use the serial
-   * driver.
-   */
-
-  arm64_earlyserialinit();
-#endif
-
 #ifdef CONFIG_ARCH_PERF_EVENTS
   up_perf_init((void *)CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC);
 #endif
diff --git a/arch/arm64/src/goldfish/goldfish_boot.c 
b/arch/arm64/src/goldfish/goldfish_boot.c
index 820f2f2991e..17ccfcb7103 100644
--- a/arch/arm64/src/goldfish/goldfish_boot.c
+++ b/arch/arm64/src/goldfish/goldfish_boot.c
@@ -26,27 +26,12 @@
 
 #include <nuttx/config.h>
 
-#include <stdint.h>
-#include <assert.h>
-#include <nuttx/debug.h>
-
-#include <nuttx/cache.h>
-#ifdef CONFIG_LEGACY_PAGING
-#  include <nuttx/page.h>
-#endif
-
 #include <arch/barriers.h>
 #include <arch/chip/chip.h>
 
-#ifdef CONFIG_SMP
-#include "arm64_smp.h"
-#endif
-
-#include "arm64_arch.h"
 #include "arm64_internal.h"
 #include "arm64_mmu.h"
 #include "goldfish_boot.h"
-#include "goldfish_serial.h"
 
 #ifdef CONFIG_DEVICE_TREE
 #  include <nuttx/fdt.h>
@@ -148,32 +133,16 @@ void arm64_el_init(void)
 
 void arm64_chip_boot(void)
 {
-  /* MAP IO and DRAM, enable MMU. */
-
-  arm64_mmu_init(true);
-
 #ifdef CONFIG_DEVICE_TREE
   fdt_register((const char *)0x40000000);
 #endif
 
-#ifdef CONFIG_ARM64_PSCI
-  arm64_psci_init("smc");
-#endif
-
   /* Perform board-specific device initialization. This would include
    * configuration of board specific resources such as GPIOs, LEDs, etc.
    */
 
   goldfish_board_initialize();
 
-#ifdef USE_EARLYSERIALINIT
-  /* Perform early serial initialization if we are going to use the serial
-   * driver.
-   */
-
-  arm64_earlyserialinit();
-#endif
-
 #ifdef CONFIG_ARCH_PERF_EVENTS
   up_perf_init((void *)GOLDFISH_PMU_CYCLES_PER_SEC);
 #endif
diff --git a/arch/arm64/src/imx8/imx8_boot.c b/arch/arm64/src/imx8/imx8_boot.c
index 290dba66dde..cb559156817 100644
--- a/arch/arm64/src/imx8/imx8_boot.c
+++ b/arch/arm64/src/imx8/imx8_boot.c
@@ -26,22 +26,12 @@
 
 #include <nuttx/config.h>
 
-#include <stdint.h>
-#include <assert.h>
-#include <nuttx/debug.h>
-
-#include <nuttx/cache.h>
-#ifdef CONFIG_LEGACY_PAGING
-#  include <nuttx/page.h>
-#endif
-
 #include <arch/barriers.h>
 #include <arch/chip/chip.h>
-#include "arm64_arch.h"
+
 #include "arm64_internal.h"
 #include "arm64_mmu.h"
 #include "imx8_boot.h"
-#include "imx8_serial.h"
 
 /****************************************************************************
  * Private Data
@@ -104,24 +94,12 @@ void arm64_el_init(void)
 
 void arm64_chip_boot(void)
 {
-  /* MAP IO and DRAM, enable MMU. */
-
-  arm64_mmu_init(true);
-
   /* Perform board-specific device initialization. This would include
    * configuration of board specific resources such as GPIOs, LEDs, etc.
    */
 
   imx8_board_initialize();
 
-#ifdef USE_EARLYSERIALINIT
-  /* Perform early serial initialization if we are going to use the serial
-   * driver.
-   */
-
-  arm64_earlyserialinit();
-#endif
-
 #ifdef CONFIG_ARCH_PERF_EVENTS
   up_perf_init((void *)CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC);
 #endif
diff --git a/arch/arm64/src/imx9/imx9_boot.c b/arch/arm64/src/imx9/imx9_boot.c
index 88eca0f3bc5..bcdb700a4cc 100644
--- a/arch/arm64/src/imx9/imx9_boot.c
+++ b/arch/arm64/src/imx9/imx9_boot.c
@@ -26,17 +26,8 @@
 
 #include <nuttx/config.h>
 
-#include <stdint.h>
-#include <assert.h>
-#include <nuttx/debug.h>
-
-#include <nuttx/cache.h>
-#ifdef CONFIG_PAGING
-#  include <nuttx/page.h>
-#endif
-
 #include <arch/chip/chip.h>
-#include "arm64_arch.h"
+
 #include "arm64_internal.h"
 #include "arm64_mmu.h"
 
@@ -44,7 +35,6 @@
 #include "imx9_clockconfig.h"
 #include "imx9_ccm.h"
 #include "imx9_trdc.h"
-#include "imx9_serial.h"
 #include "imx9_gpio.h"
 #include "imx9_lowputc.h"
 #include "imx9_system_ctl.h"
@@ -226,36 +216,18 @@ void arm64_chip_boot(void)
 #endif
 #endif
 
-#ifdef CONFIG_ARCH_USE_MMU
-  /* MAP IO and DRAM, enable MMU. */
-
-  arm64_mmu_init(true);
-#endif
-
   /* Do UART early initialization & pin muxing */
 
 #ifdef CONFIG_IMX9_LPUART
   imx9_lowsetup();
 #endif
 
-#if defined(CONFIG_ARM64_PSCI)
-  arm64_psci_init("smc");
-#endif
-
   /* Initialize pin interrupt support */
 
 #ifdef CONFIG_IMX9_GPIO_IRQ
   imx9_gpioirq_initialize();
 #endif
 
-#ifdef USE_EARLYSERIALINIT
-  /* Perform early serial initialization if we are going to use the serial
-   * driver.
-   */
-
-  arm64_earlyserialinit();
-#endif
-
   /* Perform board-specific device initialization. This would include
    * configuration of board specific resources such as GPIOs, LEDs, etc.
    */
diff --git a/arch/arm64/src/qemu/qemu_boot.c b/arch/arm64/src/qemu/qemu_boot.c
index 490c2cc3795..0299cbf19be 100644
--- a/arch/arm64/src/qemu/qemu_boot.c
+++ b/arch/arm64/src/qemu/qemu_boot.c
@@ -26,26 +26,11 @@
 
 #include <nuttx/config.h>
 
-#include <stdint.h>
-#include <assert.h>
-#include <nuttx/debug.h>
-
-#include <nuttx/cache.h>
-#ifdef CONFIG_LEGACY_PAGING
-#  include <nuttx/page.h>
-#endif
-
 #include <arch/chip/chip.h>
 
-#ifdef CONFIG_SMP
-#include "arm64_smp.h"
-#endif
-
-#include "arm64_arch.h"
 #include "arm64_internal.h"
 #include "arm64_mmu.h"
 #include "qemu_boot.h"
-#include "qemu_serial.h"
 
 #ifdef CONFIG_DEVICE_TREE
 #  include <nuttx/fdt.h>
@@ -156,24 +141,10 @@ void arm64_el_init(void)
 
 void arm64_chip_boot(void)
 {
-  /* MAP IO and DRAM, enable MMU. */
-
-  arm64_mmu_init(true);
-
-#ifdef CONFIG_ARM64_MTE
-  arm64_mte_init();
-#endif
-
 #ifdef CONFIG_DEVICE_TREE
   fdt_register((const char *)0x40000000);
 #endif
 
-#if defined(CONFIG_ARCH_CHIP_QEMU_WITH_HV) && defined(CONFIG_ARM64_PSCI)
-  arm64_psci_init("hvc");
-#elif defined(CONFIG_ARM64_PSCI)
-  arm64_psci_init("smc");
-#endif
-
   /* Perform board-specific device initialization. This would include
    * configuration of board specific resources such as GPIOs, LEDs, etc.
    */
@@ -182,14 +153,6 @@ void arm64_chip_boot(void)
   qemu_board_initialize();
 #endif
 
-#ifdef USE_EARLYSERIALINIT
-  /* Perform early serial initialization if we are going to use the serial
-   * driver.
-   */
-
-  arm64_earlyserialinit();
-#endif
-
 #ifdef CONFIG_ARCH_PERF_EVENTS
   up_perf_init((void *)CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC);
 #endif
diff --git a/arch/arm64/src/rk3399/rk3399_boot.c 
b/arch/arm64/src/rk3399/rk3399_boot.c
index 0727f180979..2a87fa2a9ec 100644
--- a/arch/arm64/src/rk3399/rk3399_boot.c
+++ b/arch/arm64/src/rk3399/rk3399_boot.c
@@ -26,26 +26,11 @@
 
 #include <nuttx/config.h>
 
-#include <stdint.h>
-#include <assert.h>
-#include <nuttx/debug.h>
-
-#include <nuttx/cache.h>
-#ifdef CONFIG_LEGACY_PAGING
-#  include <nuttx/page.h>
-#endif
-
 #include <arch/chip/chip.h>
 
-#ifdef CONFIG_SMP
-#include "arm64_smp.h"
-#endif
-
-#include "arm64_arch.h"
 #include "arm64_internal.h"
 #include "arm64_mmu.h"
 #include "rk3399_boot.h"
-#include "rk3399_serial.h"
 
 /****************************************************************************
  * Private Data
@@ -100,28 +85,11 @@ void arm64_el_init(void)
 
 void arm64_chip_boot(void)
 {
-  /* MAP IO and DRAM, enable MMU. */
-
-  arm64_mmu_init(true);
-
-#if defined(CONFIG_ARM64_PSCI)
-  arm64_psci_init("smc");
-
-#endif
-
   /* Perform board-specific device initialization. This would include
    * configuration of board specific resources such as GPIOs, LEDs, etc.
    */
 
   rk3399_board_initialize();
-
-#ifdef USE_EARLYSERIALINIT
-  /* Perform early serial initialization if we are going to use the serial
-   * driver.
-   */
-
-  arm64_earlyserialinit();
-#endif
 }
 
 #if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT)
diff --git a/arch/arm64/src/rk3588/rk3588_boot.c 
b/arch/arm64/src/rk3588/rk3588_boot.c
index aed9f15903d..01d68bcba9e 100644
--- a/arch/arm64/src/rk3588/rk3588_boot.c
+++ b/arch/arm64/src/rk3588/rk3588_boot.c
@@ -28,11 +28,6 @@
 
 #include <arch/chip/chip.h>
 
-#ifdef CONFIG_SMP
-#  include "arm64_smp.h"
-#endif
-
-#include "arm64_arch.h"
 #include "arm64_internal.h"
 #include "arm64_mmu.h"
 #include "rk3588_boot.h"
@@ -79,19 +74,7 @@ void arm64_chip_boot(void)
 {
   rk3588_memory_initialize();
 
-  /* Map I/O and DRAM, then enable the MMU. */
-
-  arm64_mmu_init(true);
-
-#if defined(CONFIG_ARM64_PSCI)
-  arm64_psci_init("smc");
-#endif
-
   rk3588_board_initialize();
-
-#ifdef USE_EARLYSERIALINIT
-  arm64_earlyserialinit();
-#endif
 }
 
 #if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT)
diff --git a/arch/arm64/src/zynq-mpsoc/zynq_boot.c 
b/arch/arm64/src/zynq-mpsoc/zynq_boot.c
index abf10121af0..7c74b723876 100644
--- a/arch/arm64/src/zynq-mpsoc/zynq_boot.c
+++ b/arch/arm64/src/zynq-mpsoc/zynq_boot.c
@@ -26,27 +26,12 @@
 
 #include <nuttx/config.h>
 
-#include <stdint.h>
-#include <assert.h>
-#include <nuttx/debug.h>
-
-#include <nuttx/cache.h>
-#ifdef CONFIG_LEGACY_PAGING
-#  include <nuttx/page.h>
-#endif
-
 #include <arch/barriers.h>
 #include <arch/chip/chip.h>
 
-#ifdef CONFIG_SMP
-#include "arm64_smp.h"
-#endif
-
-#include "arm64_arch.h"
 #include "arm64_internal.h"
 #include "arm64_mmu.h"
 #include "zynq_boot.h"
-#include "zynq_serial.h"
 #include "hardware/zynq_pll.h"
 
 /****************************************************************************
@@ -169,37 +154,12 @@ int arm64_get_cpuid(uint64_t mpid)
 
 void arm64_chip_boot(void)
 {
-  /* MAP IO and DRAM, enable MMU. */
-
-  arm64_mmu_init(true);
-
-#if defined(CONFIG_ARM64_PSCI)
-
-  /* Default exception level is EL1 for the NuttX OS. However, if we debug
-   * NuttX by JTAG, The XSCT of Vivado SDK will set the Zynq MPSoC
-   * to EL3. Other levels are not supported at the moment. And in this
-   * operating condition, we can't use SMC for there's no ATF support.
-   */
-
-#if CONFIG_ARCH_ARM64_EXCEPTION_LEVEL < 3
-  arm64_psci_init("smc");
-#endif
-#endif
-
   /* Perform board-specific device initialization. This would include
    * configuration of board specific resources such as GPIOs, LEDs, etc.
    */
 
   zynq_board_initialize();
 
-#ifdef USE_EARLYSERIALINIT
-  /* Perform early serial initialization if we are going to use the serial
-   * driver.
-   */
-
-  arm64_earlyserialinit();
-#endif
-
 #ifdef CONFIG_ARCH_PERF_EVENTS
   up_perf_init((void *)mpsoc_clk_rate_get(acpu));
 #endif

Reply via email to