Horatiu Vultur | 8609f2b | 2019-01-17 15:33:28 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: (GPL-2.0+ OR MIT) |
| 2 | /* |
| 3 | * Copyright (c) 2018 Microsemi Corporation |
| 4 | */ |
| 5 | |
| 6 | #include <common.h> |
Simon Glass | 2dc9c34 | 2020-05-10 11:40:01 -0600 | [diff] [blame] | 7 | #include <image.h> |
Simon Glass | a7b5130 | 2019-11-14 12:57:46 -0700 | [diff] [blame] | 8 | #include <init.h> |
Horatiu Vultur | 8609f2b | 2019-01-17 15:33:28 +0100 | [diff] [blame] | 9 | #include <asm/io.h> |
| 10 | #include <led.h> |
| 11 | |
| 12 | enum { |
| 13 | BOARD_TYPE_PCB116 = 0xAABBCE00, |
| 14 | }; |
| 15 | |
| 16 | int 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 | |
| 31 | static void do_board_detect(void) |
| 32 | { |
| 33 | gd->board_type = BOARD_TYPE_PCB116; /* ServalT */ |
| 34 | } |
| 35 | |
| 36 | #if defined(CONFIG_MULTI_DTB_FIT) |
| 37 | int 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) |
| 47 | int embedded_dtb_select(void) |
| 48 | { |
| 49 | do_board_detect(); |
| 50 | fdtdec_setup(); |
| 51 | |
| 52 | return 0; |
| 53 | } |
| 54 | #endif |