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