aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/sfc/qt202x_phy.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/net/sfc/qt202x_phy.c b/drivers/net/sfc/qt202x_phy.c
index 1b174c3e6c12..3d7370e39787 100644
--- a/drivers/net/sfc/qt202x_phy.c
+++ b/drivers/net/sfc/qt202x_phy.c
@@ -138,33 +138,27 @@ static int qt202x_reset_phy(struct efx_nic *efx)
138static int qt202x_phy_init(struct efx_nic *efx) 138static int qt202x_phy_init(struct efx_nic *efx)
139{ 139{
140 struct qt202x_phy_data *phy_data; 140 struct qt202x_phy_data *phy_data;
141 u32 devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS); 141 u32 devid;
142 int rc; 142 int rc;
143 143
144 rc = qt202x_reset_phy(efx);
145 if (rc) {
146 EFX_ERR(efx, "PHY init failed\n");
147 return rc;
148 }
149
144 phy_data = kzalloc(sizeof(struct qt202x_phy_data), GFP_KERNEL); 150 phy_data = kzalloc(sizeof(struct qt202x_phy_data), GFP_KERNEL);
145 if (!phy_data) 151 if (!phy_data)
146 return -ENOMEM; 152 return -ENOMEM;
147 efx->phy_data = phy_data; 153 efx->phy_data = phy_data;
148 154
155 devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS);
149 EFX_INFO(efx, "PHY ID reg %x (OUI %06x model %02x revision %x)\n", 156 EFX_INFO(efx, "PHY ID reg %x (OUI %06x model %02x revision %x)\n",
150 devid, efx_mdio_id_oui(devid), efx_mdio_id_model(devid), 157 devid, efx_mdio_id_oui(devid), efx_mdio_id_model(devid),
151 efx_mdio_id_rev(devid)); 158 efx_mdio_id_rev(devid));
152 159
153 phy_data->phy_mode = efx->phy_mode; 160 phy_data->phy_mode = efx->phy_mode;
154
155 rc = qt202x_reset_phy(efx);
156
157 EFX_INFO(efx, "PHY init %s.\n",
158 rc ? "failed" : "successful");
159 if (rc < 0)
160 goto fail;
161
162 return 0; 161 return 0;
163
164 fail:
165 kfree(efx->phy_data);
166 efx->phy_data = NULL;
167 return rc;
168} 162}
169 163
170static int qt202x_link_ok(struct efx_nic *efx) 164static int qt202x_link_ok(struct efx_nic *efx)