drivers: eth: mcux: Prevent PHY entering factory test mode

Force PHY normal operation in eth_mcux_phy_setup in case strap-in
pins configure the PHY in factory test mode.

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
This commit is contained in:
Armand Ciejak 2020-03-12 09:38:51 +01:00 committed by Maureen Helm
commit c168f45e60

View file

@ -427,20 +427,25 @@ static void eth_mcux_phy_setup(struct eth_context *context)
/* Disable MII interrupts to prevent triggering PHY events. */
ENET_DisableInterrupts(context->base, ENET_EIR_MII_MASK);
/* Prevent PHY entering NAND Tree mode override. */
res = PHY_Read(context->base, context->phy_addr,
PHY_OMS_OVERRIDE_REG, &oms_override);
if (res != kStatus_Success) {
LOG_WRN("Reading PHY reg failed (status 0x%x)", res);
} else {
/* Based on strap-in pins the PHY can be in factory test mode.
* Force normal operation.
*/
oms_override &= ~PHY_OMS_FACTORY_MODE_MASK;
/* Prevent PHY entering NAND Tree mode override. */
if (oms_override & PHY_OMS_NANDTREE_MASK) {
oms_override &= ~PHY_OMS_NANDTREE_MASK;
res = PHY_Write(context->base, context->phy_addr,
PHY_OMS_OVERRIDE_REG, oms_override);
if (res != kStatus_Success) {
LOG_WRN("Writing PHY reg failed (status 0x%x)",
res);
}
}
res = PHY_Write(context->base, context->phy_addr,
PHY_OMS_OVERRIDE_REG, oms_override);
if (res != kStatus_Success) {
LOG_WRN("Writing PHY reg failed (status 0x%x)", res);
}
}