2018-12-14 15:16:50 +00:00
|
|
|
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2018 Microsemi Corporation
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2020-05-10 17:40:01 +00:00
|
|
|
#include <image.h>
|
2019-11-14 19:57:46 +00:00
|
|
|
#include <init.h>
|
2020-10-31 03:38:53 +00:00
|
|
|
#include <asm/global_data.h>
|
2018-12-14 15:16:50 +00:00
|
|
|
#include <asm/io.h>
|
2019-01-02 08:52:24 +00:00
|
|
|
#include <led.h>
|
2019-05-01 11:16:59 +00:00
|
|
|
#include <miiphy.h>
|
2018-12-14 15:16:50 +00:00
|
|
|
|
2018-12-20 08:56:05 +00:00
|
|
|
enum {
|
|
|
|
BOARD_TYPE_PCB090 = 0xAABBCD00,
|
|
|
|
BOARD_TYPE_PCB091,
|
|
|
|
};
|
|
|
|
|
2018-12-14 15:16:50 +00:00
|
|
|
void board_debug_uart_init(void)
|
|
|
|
{
|
|
|
|
/* too early for the pinctrl driver, so configure the UART pins here */
|
2018-12-20 08:56:05 +00:00
|
|
|
mscc_gpio_set_alternate(30, 1);
|
|
|
|
mscc_gpio_set_alternate(31, 1);
|
2018-12-14 15:16:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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 */
|
2022-11-16 18:10:37 +00:00
|
|
|
gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE;
|
2019-01-02 08:52:24 +00:00
|
|
|
|
2018-12-14 15:16:50 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2018-12-20 08:56:05 +00:00
|
|
|
|
2019-05-01 11:16:59 +00:00
|
|
|
int board_phy_config(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
phy_write(phydev, 0, 31, 0x10);
|
|
|
|
phy_write(phydev, 0, 18, 0x80A0);
|
|
|
|
while (phy_read(phydev, 0, 18) & 0x8000)
|
|
|
|
;
|
|
|
|
phy_write(phydev, 0, 31, 0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-12-20 08:56:05 +00:00
|
|
|
static void do_board_detect(void)
|
|
|
|
{
|
|
|
|
u32 chipid = (readl(BASE_DEVCPU_GCB + CHIP_ID) >> 12) & 0xFFFF;
|
|
|
|
|
|
|
|
if (chipid == 0x7428 || chipid == 0x7424)
|
|
|
|
gd->board_type = BOARD_TYPE_PCB091; // Lu10
|
|
|
|
else
|
|
|
|
gd->board_type = BOARD_TYPE_PCB090; // Lu26
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(CONFIG_MULTI_DTB_FIT)
|
|
|
|
int board_fit_config_name_match(const char *name)
|
|
|
|
{
|
|
|
|
if (gd->board_type == BOARD_TYPE_PCB090 &&
|
|
|
|
strcmp(name, "luton_pcb090") == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (gd->board_type == BOARD_TYPE_PCB091 &&
|
|
|
|
strcmp(name, "luton_pcb091") == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(CONFIG_DTB_RESELECT)
|
|
|
|
int embedded_dtb_select(void)
|
|
|
|
{
|
|
|
|
do_board_detect();
|
|
|
|
fdtdec_setup();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|