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 = CONFIG_SYS_SDRAM_BASE;
28 if (IS_ENABLED(CONFIG_LED))
34 int board_phy_config(struct phy_device *phydev)
36 phy_write(phydev, 0, 31, 0x10);
37 phy_write(phydev, 0, 18, 0x80F0);
38 while (phy_read(phydev, 0, 18) & 0x8000)
40 phy_write(phydev, 0, 14, 0x800);
41 phy_write(phydev, 0, 31, 0);
45 static void do_board_detect(void)
49 /* Set MDIO and MDC */
50 mscc_gpio_set_alternate(9, 2);
51 mscc_gpio_set_alternate(10, 2);
54 mscc_phy_wr(1, 16, 31, 0x10);
55 if (!mscc_phy_rd(1, 16, 15, &gpio_in_reg)) {
56 if (gpio_in_reg & 0x200)
57 gd->board_type = BOARD_TYPE_PCB106;
59 gd->board_type = BOARD_TYPE_PCB105;
61 gd->board_type = BOARD_TYPE_PCB105;
63 mscc_phy_wr(1, 16, 31, 0x0);
66 #if defined(CONFIG_MULTI_DTB_FIT)
67 int board_fit_config_name_match(const char *name)
69 if (gd->board_type == BOARD_TYPE_PCB106 &&
70 strcmp(name, "serval_pcb106") == 0)
73 if (gd->board_type == BOARD_TYPE_PCB105 &&
74 strcmp(name, "serval_pcb105") == 0)
81 #if defined(CONFIG_DTB_RESELECT)
82 int embedded_dtb_select(void)