1 // SPDX-License-Identifier: GPL-2.0+
12 #include <asm/armv8/mmu.h>
13 #include <asm/cache.h>
14 #include <asm/system.h>
16 #include <linux/arm-smccc.h>
17 #include <linux/kernel.h>
21 DECLARE_GLOBAL_DATA_PTR;
26 gd->ram_size = PHYS_SDRAM_1_SIZE;
30 int dram_init_banksize(void)
32 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
33 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
43 void reset_cpu(ulong addr)
45 struct arm_smccc_res res;
47 arm_smccc_smc(0x84000009, 0, 0, 0, 0, 0, 0, 0, &res);
48 debug("reset cpu error, %lx\n", res.a0);
51 static struct mm_region durian_mem_map[] = {
56 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
62 .virt = (u64)PHYS_SDRAM_1,
63 .phys = (u64)PHYS_SDRAM_1,
64 .size = (u64)PHYS_SDRAM_1_SIZE,
65 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
74 struct mm_region *mem_map = durian_mem_map;
76 int print_cpuinfo(void)
78 printf("CPU: Phytium ft2004 %ld MHz\n", gd->cpu_clk);
82 int __asm_flush_l3_dcache(void)
86 for (i = 0; i < HNF_COUNT; i++)
87 writeq(HNF_PSTATE_SFONLY, HNF_PSTATE_REQ + i * HNF_STRIDE);
88 for (i = 0; i < HNF_COUNT; i++) {
90 pstate = readq(HNF_PSTATE_STAT + i * HNF_STRIDE);
91 } while ((pstate & 0xf) != (HNF_PSTATE_SFONLY << 2));
94 for (i = 0; i < HNF_COUNT; i++)
95 writeq(HNF_PSTATE_FULL, HNF_PSTATE_REQ + i * HNF_STRIDE);
100 int last_stage_init(void)
107 ret = scsi_scan(true);
109 printf("scsi scan failed\n");
110 return CMD_RET_FAILURE;