]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/arm/mach-meson/board.c
board_f: Drop setup_dram_config() wrapper
[people/ms/u-boot.git] / arch / arm / mach-meson / board.c
CommitLineData
bfcef28a
BG
1/*
2 * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <libfdt.h>
9#include <linux/err.h>
10#include <asm/arch/gxbb.h>
c7757d46 11#include <asm/arch/sm.h>
bfcef28a
BG
12#include <asm/armv8/mmu.h>
13#include <asm/unaligned.h>
14
15DECLARE_GLOBAL_DATA_PTR;
16
17int dram_init(void)
18{
19 const fdt64_t *val;
20 int offset;
21 int len;
22
23 offset = fdt_path_offset(gd->fdt_blob, "/memory");
24 if (offset < 0)
25 return -EINVAL;
26
27 val = fdt_getprop(gd->fdt_blob, offset, "reg", &len);
28 if (len < sizeof(*val) * 2)
29 return -EINVAL;
30
31 /* Use unaligned access since cache is still disabled */
32 gd->ram_size = get_unaligned_be64(&val[1]);
33
34 return 0;
35}
36
76b00aca 37int dram_init_banksize(void)
bfcef28a
BG
38{
39 /* Reserve first 16 MiB of RAM for firmware */
40 gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE + (16 * 1024 * 1024);
41 gd->bd->bi_dram[0].size = gd->ram_size - (16 * 1024 * 1024);
76b00aca
SG
42
43 return 0;
bfcef28a
BG
44}
45
46void reset_cpu(ulong addr)
47{
51bfb5b6 48 psci_system_reset();
bfcef28a
BG
49}
50
51static struct mm_region gxbb_mem_map[] = {
52 {
cd4b0c5f
YS
53 .virt = 0x0UL,
54 .phys = 0x0UL,
bfcef28a
BG
55 .size = 0x80000000UL,
56 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
57 PTE_BLOCK_INNER_SHARE
58 }, {
cd4b0c5f
YS
59 .virt = 0x80000000UL,
60 .phys = 0x80000000UL,
bfcef28a
BG
61 .size = 0x80000000UL,
62 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
63 PTE_BLOCK_NON_SHARE |
64 PTE_BLOCK_PXN | PTE_BLOCK_UXN
65 }, {
66 /* List terminator */
67 0,
68 }
69};
70
71struct mm_region *mem_map = gxbb_mem_map;