]>
Commit | Line | Data |
---|---|---|
931edc6e GB |
1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | |
3 | * Copyright (C) 2020 | |
4 | * Author(s): Giulio Benetti <giulio.benetti@benettiengineering.com> | |
5 | */ | |
6 | ||
7 | #include <common.h> | |
8 | #include <dm.h> | |
09140113 | 9 | #include <init.h> |
931edc6e GB |
10 | #include <ram.h> |
11 | #include <spl.h> | |
12 | #include <asm/io.h> | |
13 | #include <asm/armv7m.h> | |
14 | ||
15 | DECLARE_GLOBAL_DATA_PTR; | |
16 | ||
17 | int 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 | ||
33 | int dram_init_banksize(void) | |
34 | { | |
35 | return fdtdec_setup_memory_banksize(); | |
36 | } | |
37 | ||
38 | #ifdef CONFIG_SPL_BUILD | |
39 | #ifdef CONFIG_SPL_OS_BOOT | |
40 | int 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 | ||
48 | int 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 | ||
59 | void 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 | ||
66 | u32 spl_boot_device(void) | |
67 | { | |
68 | return BOOT_DEVICE_MMC1; | |
69 | } | |
70 | #endif | |
71 | ||
72 | u32 get_board_rev(void) | |
73 | { | |
74 | return 0; | |
75 | } | |
76 | ||
77 | int board_init(void) | |
78 | { | |
79 | gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100; | |
80 | ||
81 | return 0; | |
82 | } |