xref: /openbmc/u-boot/board/mscc/servalt/servalt.c (revision 57efeb04)
1 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2 /*
3  * Copyright (c) 2018 Microsemi Corporation
4  */
5 
6 #include <common.h>
7 #include <asm/io.h>
8 #include <led.h>
9 
10 enum {
11 	BOARD_TYPE_PCB116 = 0xAABBCE00,
12 };
13 
14 int board_early_init_r(void)
15 {
16 	/* Prepare SPI controller to be used in master mode */
17 	writel(0, BASE_CFG + ICPU_SW_MODE);
18 
19 	/* Address of boot parameters */
20 	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE;
21 
22 	/* LED setup */
23 	if (IS_ENABLED(CONFIG_LED))
24 		led_default_state();
25 
26 	return 0;
27 }
28 
29 static void do_board_detect(void)
30 {
31 	gd->board_type = BOARD_TYPE_PCB116; /* ServalT */
32 }
33 
34 #if defined(CONFIG_MULTI_DTB_FIT)
35 int board_fit_config_name_match(const char *name)
36 {
37 	if (gd->board_type == BOARD_TYPE_PCB116 &&
38 	    strcmp(name, "servalt_pcb116") == 0)
39 		return 0;
40 	return -1;
41 }
42 #endif
43 
44 #if defined(CONFIG_DTB_RESELECT)
45 int embedded_dtb_select(void)
46 {
47 	do_board_detect();
48 	fdtdec_setup();
49 
50 	return 0;
51 }
52 #endif
53