]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: phy: marvell: use phy_write_paged() to set MSCR
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 4 Jan 2022 16:38:13 +0000 (16:38 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 5 Jan 2022 18:30:29 +0000 (10:30 -0800)
Use phy_write_paged() in m88e1118_config_init() to set the MSCR value.
We leave the other paged write for the LEDs in case the DT register
parsing is relying on this page.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/marvell.c

index 4fcfca4e170216cb8b01955b8a9474a757d3bc61..64e7874c95f4c84f459b52036e23a376d791fa13 100644 (file)
@@ -1225,28 +1225,22 @@ static int m88e1118_config_aneg(struct phy_device *phydev)
 
 static int m88e1118_config_init(struct phy_device *phydev)
 {
+       u16 leds;
        int err;
 
-       /* Change address */
-       err = marvell_set_page(phydev, MII_MARVELL_MSCR_PAGE);
-       if (err < 0)
-               return err;
-
        /* Enable 1000 Mbit */
-       err = phy_write(phydev, 0x15, 0x1070);
-       if (err < 0)
-               return err;
-
-       /* Change address */
-       err = marvell_set_page(phydev, MII_MARVELL_LED_PAGE);
+       err = phy_write_paged(phydev, MII_MARVELL_MSCR_PAGE,
+                             MII_88E1121_PHY_MSCR_REG, 0x1070);
        if (err < 0)
                return err;
 
        /* Adjust LED Control */
        if (phydev->dev_flags & MARVELL_PHY_M1118_DNS323_LEDS)
-               err = phy_write(phydev, 0x10, 0x1100);
+               leds = 0x1100;
        else
-               err = phy_write(phydev, 0x10, 0x021e);
+               leds = 0x021e;
+
+       err = phy_write_paged(phydev, MII_MARVELL_LED_PAGE, 0x10, leds);
        if (err < 0)
                return err;
 
@@ -1254,7 +1248,7 @@ static int m88e1118_config_init(struct phy_device *phydev)
        if (err < 0)
                return err;
 
-       /* Reset address */
+       /* Reset page register */
        err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE);
        if (err < 0)
                return err;