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