blob: fbbf6789b50541893ea00f03b613a9e53dd2930d [file] [log] [blame]
TracyMg_Lie6a8c6f2023-12-25 11:21:34 +08001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2023, Phytium Technology Co., Ltd.
4 * lixinde <lixinde@phytium.com.cn>
5 * weichangzheng <weichangzheng@phytium.com.cn>
6 */
7
8#include <stdio.h>
9#include <command.h>
10#include <init.h>
11#include <asm/armv8/mmu.h>
12#include <asm/io.h>
13#include <linux/arm-smccc.h>
14#include <scsi.h>
TracyMg_Lie6a8c6f2023-12-25 11:21:34 +080015#include "cpu.h"
16
17DECLARE_GLOBAL_DATA_PTR;
18
19int mach_cpu_init(void)
20{
21 check_reset();
22 return 0;
23}
24
25int board_early_init_f(void)
26{
27 pcie_init();
28 return 0;
29}
30
31int dram_init(void)
32{
33 debug("Phytium ddr init\n");
34 ddr_init();
35
36 gd->mem_clk = 0;
37 gd->ram_size = PHYS_SDRAM_1_SIZE;
38
39 sec_init();
40 debug("PBF relocate done\n");
41
42 return 0;
43}
44
45int dram_init_banksize(void)
46{
47 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
48 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
49
50 return 0;
51}
52
53int board_init(void)
54{
55 return 0;
56}
57
58void reset_cpu(void)
59{
60 struct arm_smccc_res res;
61
62 debug("run in reset cpu\n");
63 arm_smccc_smc(0x84000009, 0, 0, 0, 0, 0, 0, 0, &res);
64 if (res.a0 != 0)
65 panic("reset cpu error, %lx\n", res.a0);
66}
67
68static struct mm_region pe2201_mem_map[] = {
69 {
70 .virt = 0x0UL,
71 .phys = 0x0UL,
72 .size = 0x80000000UL,
73 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | PTE_BLOCK_NON_SHARE | PTE_BLOCK_PXN
74 },
75 {
76 .virt = 0x80000000UL,
77 .phys = 0x80000000UL,
78 .size = 0x7b000000UL,
79 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_NS | PTE_BLOCK_INNER_SHARE
80 },
81 {
82 0,
83 }
84};
85
86struct mm_region *mem_map = pe2201_mem_map;
87
88int last_stage_init(void)
89{
90 return 0;
91}