提交 47c3d19f 编写于 作者: S Steve Hodgson 提交者: David S. Miller

sfc: QT202x: Reset before reading PHY id

Reading standard registers on the QT2025C before its firmware has
booted may cause the boot process to fail.  Therefore, follow the
recommended reset sequence before reading its id registers.  Either
order works for the QT2022C2, so don't differentiate.
Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 fdaa9aed
...@@ -138,33 +138,27 @@ static int qt202x_reset_phy(struct efx_nic *efx) ...@@ -138,33 +138,27 @@ static int qt202x_reset_phy(struct efx_nic *efx)
static int qt202x_phy_init(struct efx_nic *efx) static int qt202x_phy_init(struct efx_nic *efx)
{ {
struct qt202x_phy_data *phy_data; struct qt202x_phy_data *phy_data;
u32 devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS); u32 devid;
int rc; int rc;
rc = qt202x_reset_phy(efx);
if (rc) {
EFX_ERR(efx, "PHY init failed\n");
return rc;
}
phy_data = kzalloc(sizeof(struct qt202x_phy_data), GFP_KERNEL); phy_data = kzalloc(sizeof(struct qt202x_phy_data), GFP_KERNEL);
if (!phy_data) if (!phy_data)
return -ENOMEM; return -ENOMEM;
efx->phy_data = phy_data; efx->phy_data = phy_data;
devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS);
EFX_INFO(efx, "PHY ID reg %x (OUI %06x model %02x revision %x)\n", EFX_INFO(efx, "PHY ID reg %x (OUI %06x model %02x revision %x)\n",
devid, efx_mdio_id_oui(devid), efx_mdio_id_model(devid), devid, efx_mdio_id_oui(devid), efx_mdio_id_model(devid),
efx_mdio_id_rev(devid)); efx_mdio_id_rev(devid));
phy_data->phy_mode = efx->phy_mode; phy_data->phy_mode = efx->phy_mode;
rc = qt202x_reset_phy(efx);
EFX_INFO(efx, "PHY init %s.\n",
rc ? "failed" : "successful");
if (rc < 0)
goto fail;
return 0; return 0;
fail:
kfree(efx->phy_data);
efx->phy_data = NULL;
return rc;
} }
static int qt202x_link_ok(struct efx_nic *efx) static int qt202x_link_ok(struct efx_nic *efx)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册