blob: 37243547da81f4ecde9593e396e08eccb9a93587 [file] [log] [blame]
Fabien Parent18380432021-02-15 19:21:11 +01001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2021 MediaTek Inc.
4 * Copyright (C) 2021 BayLibre, SAS
5 * Author: Fabien Parent <fparent@baylibre.com>
6 */
7
8#include <clk.h>
Fabien Parent18380432021-02-15 19:21:11 +01009#include <dm.h>
10#include <fdtdec.h>
11#include <ram.h>
12#include <asm/arch/misc.h>
13#include <asm/armv8/mmu.h>
14#include <asm/sections.h>
15#include <asm/system.h>
16#include <dm/uclass.h>
17#include <dt-bindings/clock/mt8516-clk.h>
18
19DECLARE_GLOBAL_DATA_PTR;
20
21int dram_init(void)
22{
23 int ret;
24
25 ret = fdtdec_setup_memory_banksize();
26 if (ret)
27 return ret;
28
29 return fdtdec_setup_mem_size_base();
30}
31
32int dram_init_banksize(void)
33{
34 gd->bd->bi_dram[0].start = gd->ram_base;
35 gd->bd->bi_dram[0].size = gd->ram_size;
36
37 return 0;
38}
39
40int mtk_pll_early_init(void)
41{
42 return 0;
43}
44
45int mtk_soc_early_init(void)
46{
47 return 0;
48}
49
Patrick Delaunay558e6992021-07-19 11:21:50 +020050void reset_cpu(void)
Fabien Parent18380432021-02-15 19:21:11 +010051{
52 psci_system_reset();
53}
54
55int print_cpuinfo(void)
56{
57 printf("CPU: MediaTek MT8183\n");
58 return 0;
59}
60
61static struct mm_region mt8183_mem_map[] = {
62 {
63 /* DDR */
64 .virt = 0x40000000UL,
65 .phys = 0x40000000UL,
66 .size = 0x80000000UL,
67 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE,
68 }, {
69 .virt = 0x00000000UL,
70 .phys = 0x00000000UL,
71 .size = 0x20000000UL,
72 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
73 PTE_BLOCK_NON_SHARE |
74 PTE_BLOCK_PXN | PTE_BLOCK_UXN
75 }, {
76 0,
77 }
78};
79struct mm_region *mem_map = mt8183_mem_map;