From 43a49765f1783348f2d5186d13c5dfa9cb8ee962 Mon Sep 17 00:00:00 2001 From: Daniel Palmer Date: Wed, 16 Jun 2021 21:43:46 +0900 Subject: Add phy reset code --- board/olimex/am335x_som/board.c | 15 +++++++++++++++ board/olimex/am335x_som/mux.c | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/board/olimex/am335x_som/board.c b/board/olimex/am335x_som/board.c index 5413cca6b4..c828d6c7c5 100644 --- a/board/olimex/am335x_som/board.c +++ b/board/olimex/am335x_som/board.c @@ -151,8 +151,23 @@ int board_init(void) } #ifdef CONFIG_BOARD_LATE_INIT + +#define GPIO_PHY_RST 29 + +static void board_phy_init(void) +{ + puts("phy reset\n"); + gpio_request(GPIO_PHY_RST, "phy_rst"); + gpio_direction_output(GPIO_PHY_RST, 0); + mdelay(2); + gpio_set_value(GPIO_PHY_RST, 1); + mdelay(2); +} + int board_late_init(void) { + board_phy_init(); + return 0; } #endif diff --git a/board/olimex/am335x_som/mux.c b/board/olimex/am335x_som/mux.c index c2beb3ad19..ff14121a2e 100644 --- a/board/olimex/am335x_som/mux.c +++ b/board/olimex/am335x_som/mux.c @@ -59,6 +59,11 @@ static struct module_pin_mux nand_pin_mux[] = { }; #endif +static struct module_pin_mux gpio0_29_pin_mux[] = { + {OFFSET(rmii1_refclk), (MODE(7) | PULLUP_EN | PULLUDEN)}, /* GPIO0_29 */ + {-1}, +}; + void enable_uart0_pin_mux(void) { configure_module_pin_mux(uart0_pin_mux); @@ -70,4 +75,5 @@ void enable_board_pin_mux() #if defined(CONFIG_NAND) configure_module_pin_mux(nand_pin_mux); #endif + configure_module_pin_mux(gpio0_29_pin_mux); } -- cgit