From 243558d8cf4a797ede09784f45d74a3158df1ebd Mon Sep 17 00:00:00 2001 From: Alexander Herfurtner Date: Thu, 7 Apr 2022 01:00:44 +0200 Subject: [PATCH] mx7dvar_som: Add support for Analog Devices ADIN1300 PHY Include the following: - Allow 20ms delay for the PHY to recover from hard reset - Conditionally initialize ADIN1300 or AR8033 based on phy id Signed-off-by: Alexander Herfurtner --- board/variscite/mx7dvar_som/mx7dvar_som.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/board/variscite/mx7dvar_som/mx7dvar_som.c b/board/variscite/mx7dvar_som/mx7dvar_som.c index 0b934f96252..d906452d839 100644 --- a/board/variscite/mx7dvar_som/mx7dvar_som.c +++ b/board/variscite/mx7dvar_som/mx7dvar_som.c @@ -653,17 +653,32 @@ static int setup_fec(int fec_id) gpio_direction_output(phy_rst_gpio, 0); mdelay(10); gpio_direction_output(phy_rst_gpio, 1); + mdelay(20); return 0; } +#define AR8033_PHY_ID 0x004dd074 +#define ADIN1300_PHY_ID 0x0283bc30 + int board_phy_config(struct phy_device *phydev) { + switch (phydev->phy_id) { + case AR8033_PHY_ID: + printf("AR8033 PHY detected at addr %d\n", phydev->addr); #ifndef CONFIG_DM_ETH - /* Enable RGMII Tx clock delay */ - phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05); - phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x100); + /* Enable RGMII Tx clock delay */ + phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05); + phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x100); #endif + break; + case ADIN1300_PHY_ID: + printf("ADIN1300 PHY detected at addr %d\n", phydev->addr); + break; + default: + printf("%s: unknown phy_id 0x%x at addr %d\n", __func__, phydev->phy_id, phydev->addr); + break; + } if (phydev->drv->config) phydev->drv->config(phydev);