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