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