mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-17 06:08:13 +01:00
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
86 lines
1.6 KiB
C
86 lines
1.6 KiB
C
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
|
/*
|
|
* Copyright (c) 2018 Microsemi Corporation
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <image.h>
|
|
#include <init.h>
|
|
#include <asm/global_data.h>
|
|
#include <asm/io.h>
|
|
#include <led.h>
|
|
#include <miiphy.h>
|
|
|
|
enum {
|
|
BOARD_TYPE_PCB106 = 0xAABBCD00,
|
|
BOARD_TYPE_PCB105,
|
|
};
|
|
|
|
int board_early_init_r(void)
|
|
{
|
|
/* Prepare SPI controller to be used in master mode */
|
|
writel(0, BASE_CFG + ICPU_SW_MODE);
|
|
|
|
/* Address of boot parameters */
|
|
gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE;
|
|
|
|
return 0;
|
|
}
|
|
|
|
int board_phy_config(struct phy_device *phydev)
|
|
{
|
|
phy_write(phydev, 0, 31, 0x10);
|
|
phy_write(phydev, 0, 18, 0x80F0);
|
|
while (phy_read(phydev, 0, 18) & 0x8000)
|
|
;
|
|
phy_write(phydev, 0, 14, 0x800);
|
|
phy_write(phydev, 0, 31, 0);
|
|
return 0;
|
|
}
|
|
|
|
static void do_board_detect(void)
|
|
{
|
|
u16 gpio_in_reg;
|
|
|
|
/* Set MDIO and MDC */
|
|
mscc_gpio_set_alternate(9, 2);
|
|
mscc_gpio_set_alternate(10, 2);
|
|
|
|
/* Set GPIO page */
|
|
mscc_phy_wr(1, 16, 31, 0x10);
|
|
if (!mscc_phy_rd(1, 16, 15, &gpio_in_reg)) {
|
|
if (gpio_in_reg & 0x200)
|
|
gd->board_type = BOARD_TYPE_PCB106;
|
|
else
|
|
gd->board_type = BOARD_TYPE_PCB105;
|
|
} else {
|
|
gd->board_type = BOARD_TYPE_PCB105;
|
|
}
|
|
mscc_phy_wr(1, 16, 31, 0x0);
|
|
}
|
|
|
|
#if defined(CONFIG_MULTI_DTB_FIT)
|
|
int board_fit_config_name_match(const char *name)
|
|
{
|
|
if (gd->board_type == BOARD_TYPE_PCB106 &&
|
|
strcmp(name, "serval_pcb106") == 0)
|
|
return 0;
|
|
|
|
if (gd->board_type == BOARD_TYPE_PCB105 &&
|
|
strcmp(name, "serval_pcb105") == 0)
|
|
return 0;
|
|
|
|
return -1;
|
|
}
|
|
#endif
|
|
|
|
#if defined(CONFIG_DTB_RESELECT)
|
|
int embedded_dtb_select(void)
|
|
{
|
|
do_board_detect();
|
|
fdtdec_setup();
|
|
|
|
return 0;
|
|
}
|
|
#endif
|