Lines Matching +full:probe +full:- +full:reset

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright 2006-2012 Solarflare Communications Inc.
27 /* Quake-specific MDIO registers */
85 ((1 << PCS_FW_HEARTB_WIDTH) - 1)); in qt2025c_wait_heartbeat()
92 * PHY's on-board EEPROM so it cannot load firmware */ in qt2025c_wait_heartbeat()
93 netif_err(efx, hw, efx->net_dev, in qt2025c_wait_heartbeat()
97 return -ETIMEDOUT; in qt2025c_wait_heartbeat()
116 ((1 << PCS_UC_STATUS_WIDTH) - 1) << PCS_UC_STATUS_LBN) >= in qt2025c_wait_fw_status_good()
120 return -ETIMEDOUT; in qt2025c_wait_fw_status_good()
144 if (rc == -ETIMEDOUT) { in qt2025c_wait_reset()
148 netif_dbg(efx, hw, efx->net_dev, in qt2025c_wait_reset()
162 struct qt202x_phy_data *phy_data = efx->phy_data; in qt2025c_firmware_id()
169 netif_info(efx, probe, efx->net_dev, in qt2025c_firmware_id()
170 "QT2025C firmware %xr%d v%d.%d.%d.%d [20%02d-%02d-%02d]\n", in qt2025c_firmware_id()
175 phy_data->firmware_ver = ((firmware_id[3] & 0xf0) << 20) | in qt2025c_firmware_id()
182 struct qt202x_phy_data *phy_data = efx->phy_data; in qt2025c_bug17190_workaround()
190 if (efx->link_state.up || in qt2025c_bug17190_workaround()
192 phy_data->bug17190_in_bad_state = false; in qt2025c_bug17190_workaround()
196 if (!phy_data->bug17190_in_bad_state) { in qt2025c_bug17190_workaround()
197 phy_data->bug17190_in_bad_state = true; in qt2025c_bug17190_workaround()
198 phy_data->bug17190_timer = jiffies + BUG17190_INTERVAL; in qt2025c_bug17190_workaround()
202 if (time_after_eq(jiffies, phy_data->bug17190_timer)) { in qt2025c_bug17190_workaround()
203 netif_dbg(efx, hw, efx->net_dev, "bashing QT2025C PMA/PMD\n"); in qt2025c_bug17190_workaround()
209 phy_data->bug17190_timer = jiffies + BUG17190_INTERVAL; in qt2025c_bug17190_workaround()
215 struct qt202x_phy_data *phy_data = efx->phy_data; in qt2025c_select_phy_mode()
221 * Self-Configure mode. Don't attempt any switching if we encounter in qt2025c_select_phy_mode()
223 if (phy_data->firmware_ver < 0x02000100) in qt2025c_select_phy_mode()
226 /* In general we will get optimal behaviour in "SFP+ Self-Configure" in qt2025c_select_phy_mode()
230 phy_op_mode = (efx->loopback_mode == LOOPBACK_NONE) ? 0x0038 : 0x0020; in qt2025c_select_phy_mode()
236 netif_dbg(efx, hw, efx->net_dev, "Switching PHY to mode 0x%04x\n", in qt2025c_select_phy_mode()
244 /* (Note: this portion of the boot EEPROM sequence, which bit-bashes 9 in qt2025c_select_phy_mode()
245 * STOPs onto the firmware/module I2C bus to reset it, varies across in qt2025c_select_phy_mode()
248 if (board->major == 0 && board->minor < 2) { in qt2025c_select_phy_mode()
282 * memory is not affected by the microcontroller reset). */ in qt2025c_select_phy_mode()
285 * restart doesn't reset it. We need to do that ourselves. */ in qt2025c_select_phy_mode()
297 netif_err(efx, hw, efx->net_dev, in qt2025c_select_phy_mode()
298 "PHY microcontroller reset during mode switch " in qt2025c_select_phy_mode()
310 if (efx->phy_type == PHY_TYPE_QT2025C) { in qt202x_reset_phy()
311 /* Wait for the reset triggered by falcon_reset_hw() in qt202x_reset_phy()
317 /* Reset the PHYXS MMD. This is documented as doing in qt202x_reset_phy()
318 * a complete soft reset. */ in qt202x_reset_phy()
330 falcon_board(efx)->type->init_phy(efx); in qt202x_reset_phy()
335 netif_err(efx, hw, efx->net_dev, "PHY reset timed out\n"); in qt202x_reset_phy()
345 return -ENOMEM; in qt202x_phy_probe()
346 efx->phy_data = phy_data; in qt202x_phy_probe()
347 phy_data->phy_mode = efx->phy_mode; in qt202x_phy_probe()
348 phy_data->bug17190_in_bad_state = false; in qt202x_phy_probe()
349 phy_data->bug17190_timer = 0; in qt202x_phy_probe()
351 efx->mdio.mmds = QT202X_REQUIRED_DEVS; in qt202x_phy_probe()
352 efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; in qt202x_phy_probe()
353 efx->loopback_modes = QT202X_LOOPBACKS | FALCON_XMAC_LOOPBACKS; in qt202x_phy_probe()
364 netif_err(efx, probe, efx->net_dev, "PHY init failed\n"); in qt202x_phy_init()
369 netif_info(efx, probe, efx->net_dev, in qt202x_phy_init()
374 if (efx->phy_type == PHY_TYPE_QT2025C) in qt202x_phy_init()
387 bool was_up = efx->link_state.up; in qt202x_phy_poll()
389 efx->link_state.up = qt202x_link_ok(efx); in qt202x_phy_poll()
390 efx->link_state.speed = 10000; in qt202x_phy_poll()
391 efx->link_state.fd = true; in qt202x_phy_poll()
392 efx->link_state.fc = efx->wanted_fc; in qt202x_phy_poll()
394 if (efx->phy_type == PHY_TYPE_QT2025C) in qt202x_phy_poll()
397 return efx->link_state.up != was_up; in qt202x_phy_poll()
402 struct qt202x_phy_data *phy_data = efx->phy_data; in qt202x_phy_reconfigure()
404 if (efx->phy_type == PHY_TYPE_QT2025C) { in qt202x_phy_reconfigure()
410 * disable TX (and save power) on direct-attach cables in qt202x_phy_reconfigure()
415 &efx->mdio, efx->mdio.prtad, MDIO_MMD_PMAPMD, in qt202x_phy_reconfigure()
417 efx->phy_mode & PHY_MODE_TX_DISABLED || in qt202x_phy_reconfigure()
418 efx->phy_mode & PHY_MODE_LOW_POWER || in qt202x_phy_reconfigure()
419 efx->loopback_mode == LOOPBACK_PCS || in qt202x_phy_reconfigure()
420 efx->loopback_mode == LOOPBACK_PMAPMD); in qt202x_phy_reconfigure()
422 /* Reset the PHY when moving from tx off to tx on */ in qt202x_phy_reconfigure()
423 if (!(efx->phy_mode & PHY_MODE_TX_DISABLED) && in qt202x_phy_reconfigure()
424 (phy_data->phy_mode & PHY_MODE_TX_DISABLED)) in qt202x_phy_reconfigure()
432 phy_data->phy_mode = efx->phy_mode; in qt202x_phy_reconfigure()
440 mdio45_ethtool_ksettings_get(&efx->mdio, cmd); in qt202x_phy_get_link_ksettings()
446 kfree(efx->phy_data); in qt202x_phy_remove()
447 efx->phy_data = NULL; in qt202x_phy_remove()
453 modinfo->type = ETH_MODULE_SFF_8079; in qt202x_phy_get_module_info()
454 modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN; in qt202x_phy_get_module_info()
463 if (efx->phy_type == PHY_TYPE_QT2025C) { in qt202x_phy_get_module_eeprom()
471 for (i = 0; i < ee->len; i++) { in qt202x_phy_get_module_eeprom()
472 rc = ef4_mdio_read(efx, mmd, reg_base + ee->offset + i); in qt202x_phy_get_module_eeprom()
482 .probe = qt202x_phy_probe,