Skip to content

Commit 7a1d839

Browse files
atenartdavem330
authored andcommitted
net: phy: micrel: make sure the factory test bit is cleared
The KSZ8081 PHY has a factory test mode which is set at the de-assertion of the reset line based on the RXER (KSZ8081RNA/RND) or TXC (KSZ8081MNX/RNB) pin. If a pull-down is missing, or if the pin has a pull-up, the factory test mode should be cleared by manually writing a 0 (according to the datasheet). This patch makes sure this factory test bit is cleared in config_init(). Tested-by: Alexandre Belloni <[email protected]> Signed-off-by: Antoine Tenart <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 88d6272 commit 7a1d839

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/net/phy/micrel.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
/* Operation Mode Strap Override */
3030
#define MII_KSZPHY_OMSO 0x16
31+
#define KSZPHY_OMSO_FACTORY_TEST BIT(15)
3132
#define KSZPHY_OMSO_B_CAST_OFF BIT(9)
3233
#define KSZPHY_OMSO_NAND_TREE_ON BIT(5)
3334
#define KSZPHY_OMSO_RMII_OVERRIDE BIT(1)
@@ -340,6 +341,18 @@ static int ksz8041_config_aneg(struct phy_device *phydev)
340341
return genphy_config_aneg(phydev);
341342
}
342343

344+
static int ksz8081_config_init(struct phy_device *phydev)
345+
{
346+
/* KSZPHY_OMSO_FACTORY_TEST is set at de-assertion of the reset line
347+
* based on the RXER (KSZ8081RNA/RND) or TXC (KSZ8081MNX/RNB) pin. If a
348+
* pull-down is missing, the factory test mode should be cleared by
349+
* manually writing a 0.
350+
*/
351+
phy_clear_bits(phydev, MII_KSZPHY_OMSO, KSZPHY_OMSO_FACTORY_TEST);
352+
353+
return kszphy_config_init(phydev);
354+
}
355+
343356
static int ksz8061_config_init(struct phy_device *phydev)
344357
{
345358
int ret;
@@ -1038,7 +1051,7 @@ static struct phy_driver ksphy_driver[] = {
10381051
/* PHY_BASIC_FEATURES */
10391052
.driver_data = &ksz8081_type,
10401053
.probe = kszphy_probe,
1041-
.config_init = kszphy_config_init,
1054+
.config_init = ksz8081_config_init,
10421055
.ack_interrupt = kszphy_ack_interrupt,
10431056
.config_intr = kszphy_config_intr,
10441057
.get_sset_count = kszphy_get_sset_count,

0 commit comments

Comments
 (0)