blob: dbc248f84a74053735c29456fda3e2f0791dce81 [file] [log] [blame]
Kever Yanga381bcf2016-07-19 21:16:59 +08001/*
2 * Copyright (c) 2016 Rockchip Electronics Co., Ltd
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <asm/armv8/mmu.h>
Kever Yang27b95d22016-10-07 15:56:16 +08009#include <asm/io.h>
10#include <asm/arch/hardware.h>
11
Kever Yang975e4ab2017-06-23 16:11:11 +080012DECLARE_GLOBAL_DATA_PTR;
13
Kever Yang27b95d22016-10-07 15:56:16 +080014#define GRF_EMMCCORE_CON11 0xff77f02c
Kever Yanga381bcf2016-07-19 21:16:59 +080015
16static struct mm_region rk3399_mem_map[] = {
17 {
18 .virt = 0x0UL,
19 .phys = 0x0UL,
Kever Yang90c91272017-04-17 16:42:44 +080020 .size = 0xf8000000UL,
Kever Yanga381bcf2016-07-19 21:16:59 +080021 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
22 PTE_BLOCK_INNER_SHARE
23 }, {
Kever Yang90c91272017-04-17 16:42:44 +080024 .virt = 0xf8000000UL,
25 .phys = 0xf8000000UL,
26 .size = 0x08000000UL,
Kever Yanga381bcf2016-07-19 21:16:59 +080027 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
28 PTE_BLOCK_NON_SHARE |
29 PTE_BLOCK_PXN | PTE_BLOCK_UXN
30 }, {
31 /* List terminator */
32 0,
33 }
34};
35
36struct mm_region *mem_map = rk3399_mem_map;
Kever Yang27b95d22016-10-07 15:56:16 +080037
Kever Yang975e4ab2017-06-23 16:11:11 +080038int dram_init_banksize(void)
39{
40 size_t max_size = min((unsigned long)gd->ram_size, gd->ram_top);
41
42 /* Reserve 0x200000 for ATF bl31 */
43 gd->bd->bi_dram[0].start = 0x200000;
44 gd->bd->bi_dram[0].size = max_size - gd->bd->bi_dram[0].start;
45
46 return 0;
47}
48
Kever Yang27b95d22016-10-07 15:56:16 +080049int arch_cpu_init(void)
50{
51 /* We do some SoC one time setting here. */
52
53 /* Emmc clock generator: disable the clock multipilier */
54 rk_clrreg(GRF_EMMCCORE_CON11, 0x0ff);
55
56 return 0;
57}