1 // SPDX-License-Identifier: GPL-2.0+
4 * shuyiqi <shuyiqi@phytium.com.cn>
5 * liuhao <liuhao@phytium.com.cn>
10 #include <asm/armv8/mmu.h>
11 #include <asm/system.h>
13 #include <linux/arm-smccc.h>
14 #include <linux/kernel.h>
18 DECLARE_GLOBAL_DATA_PTR;
23 gd->ram_size = PHYS_SDRAM_1_SIZE;
27 int dram_init_banksize(void)
29 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
30 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
40 void reset_cpu(ulong addr)
42 struct arm_smccc_res res;
44 arm_smccc_smc(0x84000009, 0, 0, 0, 0, 0, 0, 0, &res);
45 debug("reset cpu error, %lx\n", res.a0);
48 static struct mm_region durian_mem_map[] = {
53 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
59 .virt = (u64)PHYS_SDRAM_1,
60 .phys = (u64)PHYS_SDRAM_1,
61 .size = (u64)PHYS_SDRAM_1_SIZE,
62 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
71 struct mm_region *mem_map = durian_mem_map;
73 int print_cpuinfo(void)
75 printf("CPU: Phytium ft2004 %ld MHz\n", gd->cpu_clk);
79 int __asm_flush_l3_dcache(void)
83 for (i = 0; i < HNF_COUNT; i++)
84 writeq(HNF_PSTATE_SFONLY, HNF_PSTATE_REQ + i * HNF_STRIDE);
85 for (i = 0; i < HNF_COUNT; i++) {
87 pstate = readq(HNF_PSTATE_STAT + i * HNF_STRIDE);
88 } while ((pstate & 0xf) != (HNF_PSTATE_SFONLY << 2));
91 for (i = 0; i < HNF_COUNT; i++)
92 writeq(HNF_PSTATE_FULL, HNF_PSTATE_REQ + i * HNF_STRIDE);
97 int last_stage_init(void)
104 ret = scsi_scan(true);
106 printf("scsi scan failed\n");
107 return CMD_RET_FAILURE;