blob: b6a0d2567e556e28fbd00620f3298a7a8f0686d9 [file] [log] [blame]
Giulio Benetti6986d6b2020-01-10 15:51:48 +01001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2019
4 * Author(s): Giulio Benetti <giulio.benetti@benettiengineering.com>
5 */
6
7#include <common.h>
8#include <dm.h>
Simon Glass97589732020-05-10 11:40:02 -06009#include <init.h>
Giulio Benetti6986d6b2020-01-10 15:51:48 +010010#include <ram.h>
11#include <spl.h>
12#include <asm/io.h>
13#include <asm/armv7m.h>
14
15DECLARE_GLOBAL_DATA_PTR;
16
17int dram_init(void)
18{
19#ifndef CONFIG_SUPPORT_SPL
20 int rv;
21 struct udevice *dev;
22
23 rv = uclass_get_device(UCLASS_RAM, 0, &dev);
24 if (rv) {
25 debug("DRAM init failed: %d\n", rv);
26 return rv;
27 }
28
29#endif
30 return fdtdec_setup_mem_size_base();
31}
32
33int dram_init_banksize(void)
34{
35 return fdtdec_setup_memory_banksize();
36}
37
38#ifdef CONFIG_SPL_BUILD
39#ifdef CONFIG_SPL_OS_BOOT
40int spl_start_uboot(void)
41{
42 debug("SPL: booting kernel\n");
43 /* break into full u-boot on 'c' */
44 return serial_tstc() && serial_getc() == 'c';
45}
46#endif
47
48int spl_dram_init(void)
49{
50 struct udevice *dev;
51 int rv;
52
53 rv = uclass_get_device(UCLASS_RAM, 0, &dev);
54 if (rv)
55 debug("DRAM init failed: %d\n", rv);
56 return rv;
57}
58
59void spl_board_init(void)
60{
61 spl_dram_init();
62 preloader_console_init();
63 arch_cpu_init(); /* to configure mpu for sdram rw permissions */
64}
65
66u32 spl_boot_device(void)
67{
68 return BOOT_DEVICE_MMC1;
69}
70#endif
71
72u32 get_board_rev(void)
73{
74 return 0;
75}
76
77int board_init(void)
78{
79 gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
80
81 return 0;
82}