2022-09-09 11:59:11 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2022 MediaTek Inc.
|
|
|
|
* Author: Sam Shih <sam.shih@mediatek.com>
|
|
|
|
*/
|
|
|
|
|
2023-07-19 09:15:41 +00:00
|
|
|
#include <fdtdec.h>
|
2022-09-09 11:59:11 +00:00
|
|
|
#include <init.h>
|
|
|
|
#include <asm/armv8/mmu.h>
|
|
|
|
#include <asm/system.h>
|
|
|
|
#include <asm/global_data.h>
|
2023-07-19 09:15:41 +00:00
|
|
|
#include <asm/u-boot.h>
|
2022-10-29 00:27:08 +00:00
|
|
|
#include <linux/sizes.h>
|
2022-09-09 11:59:11 +00:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
|
|
|
int dram_init(void)
|
|
|
|
{
|
2023-07-19 09:15:41 +00:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = fdtdec_setup_mem_size_base();
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_1G);
|
2022-09-09 11:59:11 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-03-09 16:22:07 +00:00
|
|
|
void reset_cpu(void)
|
2022-09-09 11:59:11 +00:00
|
|
|
{
|
|
|
|
psci_system_reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct mm_region mt7981_mem_map[] = {
|
|
|
|
{
|
|
|
|
/* DDR */
|
|
|
|
.virt = 0x40000000UL,
|
|
|
|
.phys = 0x40000000UL,
|
|
|
|
.size = 0x80000000UL,
|
|
|
|
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE,
|
|
|
|
}, {
|
|
|
|
.virt = 0x00000000UL,
|
|
|
|
.phys = 0x00000000UL,
|
|
|
|
.size = 0x40000000UL,
|
|
|
|
.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
|
|
|
|
PTE_BLOCK_NON_SHARE |
|
|
|
|
PTE_BLOCK_PXN | PTE_BLOCK_UXN
|
|
|
|
}, {
|
|
|
|
0,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mm_region *mem_map = mt7981_mem_map;
|