blob: d74ecb9690d8a9f469369d4f7e3b079398ae11c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2022 Starfive, Inc.
* Author: yanhong <yanhong.wang@starfivetech.com>
*
*/
#include <common.h>
#include <init.h>
#include <spl.h>
#include <log.h>
#include <linux/delay.h>
#include <image.h>
#include <asm/arch/spl.h>
#include <asm/io.h>
#define MODE_SELECT_REG 0x1702002c
int spl_board_init_f(void)
{
int ret;
ret = spl_soc_init();
if (ret) {
debug("JH7110 SPL init failed: %d\n", ret);
return ret;
}
return 0;
}
u32 spl_boot_device(void)
{
int boot_mode = 0;
boot_mode = readl((const volatile void *)MODE_SELECT_REG) & 0xF;
switch (boot_mode) {
case 0:
return BOOT_DEVICE_SPI;
case 1:
return BOOT_DEVICE_MMC2;
case 2:
return BOOT_DEVICE_MMC1;
case 4:
return BOOT_DEVICE_UART;
default:
debug("Unsupported boot device 0x%x.\n",
boot_mode);
return BOOT_DEVICE_NONE;
}
}
struct image_header *spl_get_load_buffer(ssize_t offset, size_t size)
{
return (struct image_header *)(STARFIVE_SPL_BOOT_LOAD_ADDR);
}
void board_init_f(ulong dummy)
{
int ret;
ret = spl_early_init();
if (ret)
panic("spl_early_init() failed: %d\n", ret);
arch_cpu_init_dm();
preloader_console_init();
ret = spl_board_init_f();
if (ret) {
debug("spl_board_init_f init failed: %d\n", ret);
return;
}
}
#ifdef CONFIG_SPL_LOAD_FIT
int board_fit_config_name_match(const char *name)
{
/* boot using first FIT config */
return 0;
}
#endif
|