blob: f7e03de36507e1c8feb18b07e5b6f3ae878c87df [file] [log] [blame]
developer9445eda2019-11-07 19:28:40 +08001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Configuration for MediaTek MT8518 SoC
4 *
5 * Copyright (C) 2019 MediaTek Inc.
6 * Author: Mingming Lee <mingming.lee@mediatek.com>
7 */
8
9#include <clk.h>
10#include <common.h>
Simon Glassafb02152019-12-28 10:45:01 -070011#include <cpu_func.h>
developer9445eda2019-11-07 19:28:40 +080012#include <dm.h>
13#include <fdtdec.h>
Simon Glass97589732020-05-10 11:40:02 -060014#include <init.h>
developer9445eda2019-11-07 19:28:40 +080015#include <ram.h>
16#include <asm/arch/misc.h>
17#include <asm/armv8/mmu.h>
Simon Glass274e0b02020-05-10 11:39:56 -060018#include <asm/cache.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060019#include <asm/global_data.h>
developer9445eda2019-11-07 19:28:40 +080020#include <asm/sections.h>
21#include <dm/uclass.h>
22#include <dt-bindings/clock/mt8518-clk.h>
23
24DECLARE_GLOBAL_DATA_PTR;
25
26int dram_init(void)
27{
28 int ret;
29
30 ret = fdtdec_setup_memory_banksize();
31 if (ret)
32 return ret;
33
34 return fdtdec_setup_mem_size_base();
35}
36
37int dram_init_banksize(void)
38{
39 gd->bd->bi_dram[0].start = gd->ram_base;
40 gd->bd->bi_dram[0].size = gd->ram_size;
41
42 return 0;
43}
44
Harald Seiler6f14d5f2020-12-15 16:47:52 +010045void reset_cpu(void)
developer9445eda2019-11-07 19:28:40 +080046{
47 psci_system_reset();
48}
49
50int print_cpuinfo(void)
51{
52 printf("CPU: MediaTek MT8518\n");
53 return 0;
54}
55
56static struct mm_region mt8518_mem_map[] = {
57 {
58 /* DDR */
59 .virt = 0x40000000UL,
60 .phys = 0x40000000UL,
61 .size = 0x20000000UL,
62 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE,
63 }, {
64 .virt = 0x00000000UL,
65 .phys = 0x00000000UL,
66 .size = 0x20000000UL,
67 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
68 PTE_BLOCK_NON_SHARE |
69 PTE_BLOCK_PXN | PTE_BLOCK_UXN
70 }, {
71 0,
72 }
73};
74
75struct mm_region *mem_map = mt8518_mem_map;