mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-06 05:04:26 +00:00
d6a01704b0
spl_soc_init() seems to be a better name, as all SPL functions names start from the spl_ prefix. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Rick Chen <rick@andestech.com> Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com> Tested-by: Pragnesh Patel <pragnesh.patel@sifive.com>
57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (c) 2019 SiFive, Inc
|
|
*
|
|
* Authors:
|
|
* Pragnesh Patel <pragnesh.patel@sifive.com>
|
|
*/
|
|
|
|
#include <init.h>
|
|
#include <spl.h>
|
|
#include <misc.h>
|
|
#include <log.h>
|
|
#include <linux/delay.h>
|
|
#include <asm/gpio.h>
|
|
#include <asm/arch/gpio.h>
|
|
#include <asm/arch/spl.h>
|
|
|
|
#define GEM_PHY_RESET SIFIVE_GENERIC_GPIO_NR(0, 12)
|
|
|
|
int spl_board_init_f(void)
|
|
{
|
|
int ret;
|
|
|
|
ret = spl_soc_init();
|
|
if (ret) {
|
|
debug("FU540 SPL init failed: %d\n", ret);
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* GEMGXL init VSC8541 PHY reset sequence;
|
|
* leave pull-down active for 2ms
|
|
*/
|
|
udelay(2000);
|
|
ret = gpio_request(GEM_PHY_RESET, "gem_phy_reset");
|
|
if (ret) {
|
|
debug("gem_phy_reset gpio request failed: %d\n", ret);
|
|
return ret;
|
|
}
|
|
|
|
/* Set GPIO 12 (PHY NRESET) */
|
|
ret = gpio_direction_output(GEM_PHY_RESET, 1);
|
|
if (ret) {
|
|
debug("gem_phy_reset gpio direction set failed: %d\n", ret);
|
|
return ret;
|
|
}
|
|
|
|
udelay(1);
|
|
|
|
/* Reset PHY again to enter unmanaged mode */
|
|
gpio_set_value(GEM_PHY_RESET, 0);
|
|
udelay(1);
|
|
gpio_set_value(GEM_PHY_RESET, 1);
|
|
mdelay(15);
|
|
|
|
return 0;
|
|
}
|