1 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
3 * Copyright (c) 2018 Microsemi Corporation
9 #include <asm/global_data.h>
15 BOARD_TYPE_PCB106 = 0xAABBCD00,
19 int board_early_init_r(void)
21 /* Prepare SPI controller to be used in master mode */
22 writel(0, BASE_CFG + ICPU_SW_MODE);
24 /* Address of boot parameters */
25 gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE;
30 int board_phy_config(struct phy_device *phydev)
32 phy_write(phydev, 0, 31, 0x10);
33 phy_write(phydev, 0, 18, 0x80F0);
34 while (phy_read(phydev, 0, 18) & 0x8000)
36 phy_write(phydev, 0, 14, 0x800);
37 phy_write(phydev, 0, 31, 0);
41 static void do_board_detect(void)
45 /* Set MDIO and MDC */
46 mscc_gpio_set_alternate(9, 2);
47 mscc_gpio_set_alternate(10, 2);
50 mscc_phy_wr(1, 16, 31, 0x10);
51 if (!mscc_phy_rd(1, 16, 15, &gpio_in_reg)) {
52 if (gpio_in_reg & 0x200)
53 gd->board_type = BOARD_TYPE_PCB106;
55 gd->board_type = BOARD_TYPE_PCB105;
57 gd->board_type = BOARD_TYPE_PCB105;
59 mscc_phy_wr(1, 16, 31, 0x0);
62 #if defined(CONFIG_MULTI_DTB_FIT)
63 int board_fit_config_name_match(const char *name)
65 if (gd->board_type == BOARD_TYPE_PCB106 &&
66 strcmp(name, "serval_pcb106") == 0)
69 if (gd->board_type == BOARD_TYPE_PCB105 &&
70 strcmp(name, "serval_pcb105") == 0)
77 #if defined(CONFIG_DTB_RESELECT)
78 int embedded_dtb_select(void)