blob: 7496029705f61ea4a76831a090af9a6e68e1b946 [file] [log] [blame]
Fabien Parent4640e2a2021-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>
9#include <common.h>
10#include <dm.h>
11#include <fdtdec.h>
12#include <ram.h>
13#include <asm/arch/misc.h>
14#include <asm/armv8/mmu.h>
15#include <asm/sections.h>
16#include <asm/system.h>
17#include <dm/uclass.h>
18#include <dt-bindings/clock/mt8516-clk.h>
19
20DECLARE_GLOBAL_DATA_PTR;
21
22int dram_init(void)
23{
24 int ret;
25
26 ret = fdtdec_setup_memory_banksize();
27 if (ret)
28 return ret;
29
30 return fdtdec_setup_mem_size_base();
31}
32
33int dram_init_banksize(void)
34{
35 gd->bd->bi_dram[0].start = gd->ram_base;
36 gd->bd->bi_dram[0].size = gd->ram_size;
37
38 return 0;
39}
40
41int mtk_pll_early_init(void)
42{
43 return 0;
44}
45
46int mtk_soc_early_init(void)
47{
48 return 0;
49}
50
Patrick Delaunay3fa1bdc2021-07-19 11:21:50 +020051void reset_cpu(void)
Fabien Parent4640e2a2021-02-15 19:21:11 +010052{
53 psci_system_reset();
54}
55
56int print_cpuinfo(void)
57{
58 printf("CPU: MediaTek MT8183\n");
59 return 0;
60}
61
62static struct mm_region mt8183_mem_map[] = {
63 {
64 /* DDR */
65 .virt = 0x40000000UL,
66 .phys = 0x40000000UL,
67 .size = 0x80000000UL,
68 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE,
69 }, {
70 .virt = 0x00000000UL,
71 .phys = 0x00000000UL,
72 .size = 0x20000000UL,
73 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
74 PTE_BLOCK_NON_SHARE |
75 PTE_BLOCK_PXN | PTE_BLOCK_UXN
76 }, {
77 0,
78 }
79};
80struct mm_region *mem_map = mt8183_mem_map;