common: Drop log.h from common header
[platform/kernel/u-boot.git] / board / freescale / imxrt1020-evk / imxrt1020-evk.c
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>
9 #include <init.h>
10 #include <log.h>
11 #include <ram.h>
12 #include <spl.h>
13 #include <asm/io.h>
14 #include <asm/armv7m.h>
15
16 DECLARE_GLOBAL_DATA_PTR;
17
18 int dram_init(void)
19 {
20 #ifndef CONFIG_SUPPORT_SPL
21         int rv;
22         struct udevice *dev;
23
24         rv = uclass_get_device(UCLASS_RAM, 0, &dev);
25         if (rv) {
26                 debug("DRAM init failed: %d\n", rv);
27                 return rv;
28         }
29
30 #endif
31         return fdtdec_setup_mem_size_base();
32 }
33
34 int dram_init_banksize(void)
35 {
36         return fdtdec_setup_memory_banksize();
37 }
38
39 #ifdef CONFIG_SPL_BUILD
40 #ifdef CONFIG_SPL_OS_BOOT
41 int spl_start_uboot(void)
42 {
43         debug("SPL: booting kernel\n");
44         /* break into full u-boot on 'c' */
45         return serial_tstc() && serial_getc() == 'c';
46 }
47 #endif
48
49 int spl_dram_init(void)
50 {
51         struct udevice *dev;
52         int rv;
53
54         rv = uclass_get_device(UCLASS_RAM, 0, &dev);
55         if (rv)
56                 debug("DRAM init failed: %d\n", rv);
57         return rv;
58 }
59
60 void spl_board_init(void)
61 {
62         spl_dram_init();
63         preloader_console_init();
64         arch_cpu_init(); /* to configure mpu for sdram rw permissions */
65 }
66
67 u32 spl_boot_device(void)
68 {
69         return BOOT_DEVICE_MMC1;
70 }
71 #endif
72
73 u32 get_board_rev(void)
74 {
75         return 0;
76 }
77
78 int board_init(void)
79 {
80         gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
81
82         return 0;
83 }