1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2019 SiFive, Inc
6 * Pragnesh Patel <pragnesh.patel@sifive.com>
13 #include <linux/delay.h>
15 #include <asm/arch/gpio.h>
16 #include <asm/arch/spl.h>
18 #define GEM_PHY_RESET SIFIVE_GENERIC_GPIO_NR(0, 12)
20 int init_clk_and_ddr(void)
26 debug("FU540 SPL init failed: %d\n", ret);
31 * GEMGXL init VSC8541 PHY reset sequence;
32 * leave pull-down active for 2ms
35 ret = gpio_request(GEM_PHY_RESET, "gem_phy_reset");
37 debug("gem_phy_reset gpio request failed: %d\n", ret);
41 /* Set GPIO 12 (PHY NRESET) */
42 ret = gpio_direction_output(GEM_PHY_RESET, 1);
44 debug("gem_phy_reset gpio direction set failed: %d\n", ret);
50 /* Reset PHY again to enter unmanaged mode */
51 gpio_set_value(GEM_PHY_RESET, 0);
53 gpio_set_value(GEM_PHY_RESET, 1);
59 void board_init_f(ulong dummy)
63 ret = spl_early_init();
65 panic("spl_early_init() failed: %d\n", ret);
69 preloader_console_init();
71 ret = init_clk_and_ddr();
73 panic("init_clk_and_ddr() failed: %d\n", ret);