Skip to content

Commit e2d861c

Browse files
hkallweitdavem330
authored andcommitted
net: phy: marvell: remove superseded function marvell_set_downshift
Instead of superseded function marvell_set_downshift() we can use new function m88e1111_set_downshift() in m88e1116r_config_init(). For this m88e1116r_config_init() has to be moved in the code. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a3bdfce commit e2d861c

File tree

1 file changed

+35
-53
lines changed

1 file changed

+35
-53
lines changed

drivers/net/phy/marvell.c

Lines changed: 35 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353

5454
#define MII_M1011_PHY_SCR 0x10
5555
#define MII_M1011_PHY_SCR_DOWNSHIFT_EN BIT(11)
56-
#define MII_M1011_PHY_SCR_DOWNSHIFT_SHIFT 12
5756
#define MII_M1011_PHY_SRC_DOWNSHIFT_MASK GENMASK(14, 12)
5857
#define MII_M1011_PHY_SCR_DOWNSHIFT_MAX 8
5958
#define MII_M1011_PHY_SCR_MDI (0x0 << 5)
@@ -277,23 +276,6 @@ static int marvell_set_polarity(struct phy_device *phydev, int polarity)
277276
return val != reg;
278277
}
279278

280-
static int marvell_set_downshift(struct phy_device *phydev, bool enable,
281-
u8 retries)
282-
{
283-
int reg;
284-
285-
reg = phy_read(phydev, MII_M1011_PHY_SCR);
286-
if (reg < 0)
287-
return reg;
288-
289-
reg &= MII_M1011_PHY_SRC_DOWNSHIFT_MASK;
290-
reg |= ((retries - 1) << MII_M1011_PHY_SCR_DOWNSHIFT_SHIFT);
291-
if (enable)
292-
reg |= MII_M1011_PHY_SCR_DOWNSHIFT_EN;
293-
294-
return phy_write(phydev, MII_M1011_PHY_SCR, reg);
295-
}
296-
297279
static int marvell_config_aneg(struct phy_device *phydev)
298280
{
299281
int changed = 0;
@@ -662,41 +644,6 @@ static int marvell_config_init(struct phy_device *phydev)
662644
return marvell_of_reg_init(phydev);
663645
}
664646

665-
static int m88e1116r_config_init(struct phy_device *phydev)
666-
{
667-
int err;
668-
669-
err = genphy_soft_reset(phydev);
670-
if (err < 0)
671-
return err;
672-
673-
msleep(500);
674-
675-
err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE);
676-
if (err < 0)
677-
return err;
678-
679-
err = marvell_set_polarity(phydev, phydev->mdix_ctrl);
680-
if (err < 0)
681-
return err;
682-
683-
err = marvell_set_downshift(phydev, true, 8);
684-
if (err < 0)
685-
return err;
686-
687-
if (phy_interface_is_rgmii(phydev)) {
688-
err = m88e1121_config_aneg_rgmii_delays(phydev);
689-
if (err < 0)
690-
return err;
691-
}
692-
693-
err = genphy_soft_reset(phydev);
694-
if (err < 0)
695-
return err;
696-
697-
return marvell_config_init(phydev);
698-
}
699-
700647
static int m88e3016_config_init(struct phy_device *phydev)
701648
{
702649
int ret;
@@ -910,6 +857,41 @@ static void m88e1111_link_change_notify(struct phy_device *phydev)
910857
phydev_warn(phydev, "Downshift occurred! Cabling may be defective.\n");
911858
}
912859

860+
static int m88e1116r_config_init(struct phy_device *phydev)
861+
{
862+
int err;
863+
864+
err = genphy_soft_reset(phydev);
865+
if (err < 0)
866+
return err;
867+
868+
msleep(500);
869+
870+
err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE);
871+
if (err < 0)
872+
return err;
873+
874+
err = marvell_set_polarity(phydev, phydev->mdix_ctrl);
875+
if (err < 0)
876+
return err;
877+
878+
err = m88e1111_set_downshift(phydev, 8);
879+
if (err < 0)
880+
return err;
881+
882+
if (phy_interface_is_rgmii(phydev)) {
883+
err = m88e1121_config_aneg_rgmii_delays(phydev);
884+
if (err < 0)
885+
return err;
886+
}
887+
888+
err = genphy_soft_reset(phydev);
889+
if (err < 0)
890+
return err;
891+
892+
return marvell_config_init(phydev);
893+
}
894+
913895
static int m88e1318_config_init(struct phy_device *phydev)
914896
{
915897
if (phy_interrupt_is_valid(phydev)) {

0 commit comments

Comments
 (0)