Skip to content

Commit 8b46595

Browse files
atenartcristibirsan
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 hard reset based on the TXC 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 <alexandre.belloni@bootlin.com> Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com> [nicolas.ferre@microchip.com: backport to 4.19] Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
1 parent 473d9ba commit 8b46595

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

drivers/net/phy/micrel.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
/* Operation Mode Strap Override */
3434
#define MII_KSZPHY_OMSO 0x16
35+
#define KSZPHY_OMSO_FACTORY_TEST BIT(15)
3536
#define KSZPHY_OMSO_B_CAST_OFF BIT(9)
3637
#define KSZPHY_OMSO_NAND_TREE_ON BIT(5)
3738
#define KSZPHY_OMSO_RMII_OVERRIDE BIT(1)
@@ -339,6 +340,17 @@ static int ksz8041_config_aneg(struct phy_device *phydev)
339340
return genphy_config_aneg(phydev);
340341
}
341342

343+
static int ksz8081_config_init(struct phy_device *phydev)
344+
{
345+
/* KSZPHY_OMSO_FACTORY_TEST is set at de-assertion of the reset line
346+
* based on the TXC pin. If a pull-down is missing, the factory test
347+
* mode should be cleared by manually writing a 0.
348+
*/
349+
phy_clear_bits(phydev, MII_KSZPHY_OMSO, KSZPHY_OMSO_FACTORY_TEST);
350+
351+
return kszphy_config_init(phydev);
352+
}
353+
342354
static int ksz9021_load_values_from_of(struct phy_device *phydev,
343355
const struct device_node *of_node,
344356
u16 reg,
@@ -920,7 +932,7 @@ static struct phy_driver ksphy_driver[] = {
920932
.flags = PHY_HAS_INTERRUPT,
921933
.driver_data = &ksz8081_type,
922934
.probe = kszphy_probe,
923-
.config_init = kszphy_config_init,
935+
.config_init = ksz8081_config_init,
924936
.ack_interrupt = kszphy_ack_interrupt,
925937
.config_intr = kszphy_config_intr,
926938
.get_sset_count = kszphy_get_sset_count,

0 commit comments

Comments
 (0)