1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2016 Stefan Roese <sr@denx.de>
10 #include <asm/cache.h>
11 #include <asm/ptrace.h>
12 #include <linux/libfdt.h>
13 #include <linux/sizes.h>
16 #include <asm/system.h>
17 #include <asm/arch/cpu.h>
18 #include <asm/arch/soc.h>
19 #include <asm/armv8/mmu.h>
21 DECLARE_GLOBAL_DATA_PTR;
24 * Not all memory is mapped in the MMU. So we need to restrict the
25 * memory size so that U-Boot does not try to access it. Also, the
26 * internal registers are located at 0xf000.0000 - 0xffff.ffff.
27 * Currently only 2GiB are mapped for system memory. This is what
28 * we pass to the U-Boot subsystem here.
30 #define USABLE_RAM_SIZE 0x80000000
32 ulong board_get_usable_ram_top(ulong total_size)
34 if (gd->ram_size > USABLE_RAM_SIZE)
35 return USABLE_RAM_SIZE;
41 * On ARMv8, MBus is not configured in U-Boot. To enable compilation
42 * of the already implemented drivers, lets add a dummy version of
43 * this function so that linking does not fail.
45 const struct mbus_dram_target_info *mvebu_mbus_dram_info(void)
50 __weak int dram_init_banksize(void)
52 if (CONFIG_IS_ENABLED(ARMADA_8K))
53 return a8k_dram_init_banksize();
54 else if (CONFIG_IS_ENABLED(ARMADA_3700))
55 return a3700_dram_init_banksize();
57 return fdtdec_setup_memory_banksize();
60 __weak int dram_init(void)
62 if (CONFIG_IS_ENABLED(ARMADA_8K)) {
63 gd->ram_size = a8k_dram_scan_ap_sz();
64 if (gd->ram_size != 0)
68 if (CONFIG_IS_ENABLED(ARMADA_3700))
69 return a3700_dram_init();
71 if (fdtdec_setup_mem_size_base() != 0)
77 int arch_cpu_init(void)
79 /* Nothing to do (yet) */
83 int arch_early_init_r(void)
90 * Loop over all MISC uclass drivers to call the comphy code
91 * and init all CP110 devices enabled in the DT
95 /* Call the comphy code via the MISC uclass driver */
96 ret = uclass_get_device(UCLASS_MISC, i++, &dev);
98 /* We're done, once no further CP110 device is found */
103 /* Cause the SATA device to do its early init */
104 uclass_first_device(UCLASS_AHCI, &dev);
107 /* Trigger PCIe devices detection */