aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/qt202x_phy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sfc/qt202x_phy.c')
-rw-r--r--drivers/net/sfc/qt202x_phy.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/drivers/net/sfc/qt202x_phy.c b/drivers/net/sfc/qt202x_phy.c
index e077bef08a50..68813d1d85f3 100644
--- a/drivers/net/sfc/qt202x_phy.c
+++ b/drivers/net/sfc/qt202x_phy.c
@@ -91,9 +91,10 @@ static int qt2025c_wait_heartbeat(struct efx_nic *efx)
91 if (time_after(jiffies, timeout)) { 91 if (time_after(jiffies, timeout)) {
92 /* Some cables have EEPROMs that conflict with the 92 /* Some cables have EEPROMs that conflict with the
93 * PHY's on-board EEPROM so it cannot load firmware */ 93 * PHY's on-board EEPROM so it cannot load firmware */
94 EFX_ERR(efx, "If an SFP+ direct attach cable is" 94 netif_err(efx, hw, efx->net_dev,
95 " connected, please check that it complies" 95 "If an SFP+ direct attach cable is"
96 " with the SFP+ specification\n"); 96 " connected, please check that it complies"
97 " with the SFP+ specification\n");
97 return -ETIMEDOUT; 98 return -ETIMEDOUT;
98 } 99 }
99 msleep(QT2025C_HEARTB_WAIT); 100 msleep(QT2025C_HEARTB_WAIT);
@@ -145,7 +146,8 @@ static int qt2025c_wait_reset(struct efx_nic *efx)
145 /* Bug 17689: occasionally heartbeat starts but firmware status 146 /* Bug 17689: occasionally heartbeat starts but firmware status
146 * code never progresses beyond 0x00. Try again, once, after 147 * code never progresses beyond 0x00. Try again, once, after
147 * restarting execution of the firmware image. */ 148 * restarting execution of the firmware image. */
148 EFX_LOG(efx, "bashing QT2025C microcontroller\n"); 149 netif_dbg(efx, hw, efx->net_dev,
150 "bashing QT2025C microcontroller\n");
149 qt2025c_restart_firmware(efx); 151 qt2025c_restart_firmware(efx);
150 rc = qt2025c_wait_heartbeat(efx); 152 rc = qt2025c_wait_heartbeat(efx);
151 if (rc != 0) 153 if (rc != 0)
@@ -165,11 +167,12 @@ static void qt2025c_firmware_id(struct efx_nic *efx)
165 for (i = 0; i < sizeof(firmware_id); i++) 167 for (i = 0; i < sizeof(firmware_id); i++)
166 firmware_id[i] = efx_mdio_read(efx, MDIO_MMD_PCS, 168 firmware_id[i] = efx_mdio_read(efx, MDIO_MMD_PCS,
167 PCS_FW_PRODUCT_CODE_1 + i); 169 PCS_FW_PRODUCT_CODE_1 + i);
168 EFX_INFO(efx, "QT2025C firmware %xr%d v%d.%d.%d.%d [20%02d-%02d-%02d]\n", 170 netif_info(efx, probe, efx->net_dev,
169 (firmware_id[0] << 8) | firmware_id[1], firmware_id[2], 171 "QT2025C firmware %xr%d v%d.%d.%d.%d [20%02d-%02d-%02d]\n",
170 firmware_id[3] >> 4, firmware_id[3] & 0xf, 172 (firmware_id[0] << 8) | firmware_id[1], firmware_id[2],
171 firmware_id[4], firmware_id[5], 173 firmware_id[3] >> 4, firmware_id[3] & 0xf,
172 firmware_id[6], firmware_id[7], firmware_id[8]); 174 firmware_id[4], firmware_id[5],
175 firmware_id[6], firmware_id[7], firmware_id[8]);
173 phy_data->firmware_ver = ((firmware_id[3] & 0xf0) << 20) | 176 phy_data->firmware_ver = ((firmware_id[3] & 0xf0) << 20) |
174 ((firmware_id[3] & 0x0f) << 16) | 177 ((firmware_id[3] & 0x0f) << 16) |
175 (firmware_id[4] << 8) | firmware_id[5]; 178 (firmware_id[4] << 8) | firmware_id[5];
@@ -198,7 +201,7 @@ static void qt2025c_bug17190_workaround(struct efx_nic *efx)
198 } 201 }
199 202
200 if (time_after_eq(jiffies, phy_data->bug17190_timer)) { 203 if (time_after_eq(jiffies, phy_data->bug17190_timer)) {
201 EFX_LOG(efx, "bashing QT2025C PMA/PMD\n"); 204 netif_dbg(efx, hw, efx->net_dev, "bashing QT2025C PMA/PMD\n");
202 efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_CTRL1, 205 efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_CTRL1,
203 MDIO_PMA_CTRL1_LOOPBACK, true); 206 MDIO_PMA_CTRL1_LOOPBACK, true);
204 msleep(100); 207 msleep(100);
@@ -231,7 +234,8 @@ static int qt2025c_select_phy_mode(struct efx_nic *efx)
231 reg = efx_mdio_read(efx, 1, 0xc319); 234 reg = efx_mdio_read(efx, 1, 0xc319);
232 if ((reg & 0x0038) == phy_op_mode) 235 if ((reg & 0x0038) == phy_op_mode)
233 return 0; 236 return 0;
234 EFX_LOG(efx, "Switching PHY to mode 0x%04x\n", phy_op_mode); 237 netif_dbg(efx, hw, efx->net_dev, "Switching PHY to mode 0x%04x\n",
238 phy_op_mode);
235 239
236 /* This sequence replicates the register writes configured in the boot 240 /* This sequence replicates the register writes configured in the boot
237 * EEPROM (including the differences between board revisions), except 241 * EEPROM (including the differences between board revisions), except
@@ -287,8 +291,9 @@ static int qt2025c_select_phy_mode(struct efx_nic *efx)
287 /* Wait for the microcontroller to be ready again */ 291 /* Wait for the microcontroller to be ready again */
288 rc = qt2025c_wait_reset(efx); 292 rc = qt2025c_wait_reset(efx);
289 if (rc < 0) { 293 if (rc < 0) {
290 EFX_ERR(efx, "PHY microcontroller reset during mode switch " 294 netif_err(efx, hw, efx->net_dev,
291 "timed out\n"); 295 "PHY microcontroller reset during mode switch "
296 "timed out\n");
292 return rc; 297 return rc;
293 } 298 }
294 299
@@ -324,7 +329,7 @@ static int qt202x_reset_phy(struct efx_nic *efx)
324 return 0; 329 return 0;
325 330
326 fail: 331 fail:
327 EFX_ERR(efx, "PHY reset timed out\n"); 332 netif_err(efx, hw, efx->net_dev, "PHY reset timed out\n");
328 return rc; 333 return rc;
329} 334}
330 335
@@ -353,14 +358,15 @@ static int qt202x_phy_init(struct efx_nic *efx)
353 358
354 rc = qt202x_reset_phy(efx); 359 rc = qt202x_reset_phy(efx);
355 if (rc) { 360 if (rc) {
356 EFX_ERR(efx, "PHY init failed\n"); 361 netif_err(efx, probe, efx->net_dev, "PHY init failed\n");
357 return rc; 362 return rc;
358 } 363 }
359 364
360 devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS); 365 devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS);
361 EFX_INFO(efx, "PHY ID reg %x (OUI %06x model %02x revision %x)\n", 366 netif_info(efx, probe, efx->net_dev,
362 devid, efx_mdio_id_oui(devid), efx_mdio_id_model(devid), 367 "PHY ID reg %x (OUI %06x model %02x revision %x)\n",
363 efx_mdio_id_rev(devid)); 368 devid, efx_mdio_id_oui(devid), efx_mdio_id_model(devid),
369 efx_mdio_id_rev(devid));
364 370
365 if (efx->phy_type == PHY_TYPE_QT2025C) 371 if (efx->phy_type == PHY_TYPE_QT2025C)
366 qt2025c_firmware_id(efx); 372 qt2025c_firmware_id(efx);