From: Fabio Estevam Date: Wed, 12 Jul 2017 21:31:45 +0000 (-0300) Subject: mx6sabreauto: Make Ethernet functional again X-Git-Tag: v2017.09-rc1~190^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3f0a1042bb4eae00eae1e9bb9aa4dca4f3b987f8;p=u-boot mx6sabreauto: Make Ethernet functional again Since commit ce412b79e7255770 ("drivers: net: phy: atheros: add separate config for AR8031") Ethernet does not work on mx6sabreauto. This commit correctly assigns ar8031_config() as the configuration function for AR8031 in the same way as done in the Linux kernel. However, on mx6sabreauto design we need some additional configurations, such as enabling the 125 MHz AR8031 output and setting the TX clock delay that need to be done in the board file. This is the equivalent fix from commit 4b6035da482c ("mx6sabresd: Make Ethernet functional again"). Reported-by: Miquel RAYNAL Signed-off-by: Fabio Estevam --- diff --git a/board/freescale/mx6sabreauto/mx6sabreauto.c b/board/freescale/mx6sabreauto/mx6sabreauto.c index a8fe251134..a5703a35b1 100644 --- a/board/freescale/mx6sabreauto/mx6sabreauto.c +++ b/board/freescale/mx6sabreauto/mx6sabreauto.c @@ -433,6 +433,39 @@ u32 get_board_rev(void) return (get_cpu_rev() & ~(0xF << 8)) | rev; } +static int ar8031_phy_fixup(struct phy_device *phydev) +{ + unsigned short val; + + /* To enable AR8031 ouput a 125MHz clk from CLK_25M */ + phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x7); + phy_write(phydev, MDIO_DEVAD_NONE, 0xe, 0x8016); + phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x4007); + + val = phy_read(phydev, MDIO_DEVAD_NONE, 0xe); + val &= 0xffe3; + val |= 0x18; + phy_write(phydev, MDIO_DEVAD_NONE, 0xe, val); + + /* introduce tx clock delay */ + phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x5); + val = phy_read(phydev, MDIO_DEVAD_NONE, 0x1e); + val |= 0x0100; + phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, val); + + return 0; +} + +int board_phy_config(struct phy_device *phydev) +{ + ar8031_phy_fixup(phydev); + + if (phydev->drv->config) + phydev->drv->config(phydev); + + return 0; +} + #if defined(CONFIG_VIDEO_IPUV3) static void disable_lvds(struct display_info_t const *dev) {