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 | |
Simon Glass | 51a8b70 | 2020-07-19 10:15:51 -0600 | [diff] [blame] | 12 | DECLARE_GLOBAL_DATA_PTR; |
| 13 | |
Horatiu Vultur | 8609f2b | 2019-01-17 15:33:28 +0100 | [diff] [blame] | 14 | enum { |
| 15 | BOARD_TYPE_PCB116 = 0xAABBCE00, |
| 16 | }; |
| 17 | |
| 18 | int board_early_init_r(void) |
| 19 | { |
| 20 | /* Prepare SPI controller to be used in master mode */ |
| 21 | writel(0, BASE_CFG + ICPU_SW_MODE); |
| 22 | |
| 23 | /* Address of boot parameters */ |
| 24 | gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE; |
| 25 | |
| 26 | /* LED setup */ |
| 27 | if (IS_ENABLED(CONFIG_LED)) |
| 28 | led_default_state(); |
| 29 | |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | static void do_board_detect(void) |
| 34 | { |
| 35 | gd->board_type = BOARD_TYPE_PCB116; /* ServalT */ |
| 36 | } |
| 37 | |
| 38 | #if defined(CONFIG_MULTI_DTB_FIT) |
| 39 | int board_fit_config_name_match(const char *name) |
| 40 | { |
| 41 | if (gd->board_type == BOARD_TYPE_PCB116 && |
| 42 | strcmp(name, "servalt_pcb116") == 0) |
| 43 | return 0; |
| 44 | return -1; |
| 45 | } |
| 46 | #endif |
| 47 | |
| 48 | #if defined(CONFIG_DTB_RESELECT) |
| 49 | int embedded_dtb_select(void) |
| 50 | { |
| 51 | do_board_detect(); |
| 52 | fdtdec_setup(); |
| 53 | |
| 54 | return 0; |
| 55 | } |
| 56 | #endif |