• Home
  • Raw
  • Download

Lines Matching refs:efx

76 static int qt2025c_wait_heartbeat(struct efx_nic *efx)  in qt2025c_wait_heartbeat()  argument
84 reg = efx_mdio_read(efx, MDIO_MMD_PCS, PCS_FW_HEARTBEAT_REG); in qt2025c_wait_heartbeat()
96 netif_err(efx, hw, efx->net_dev, in qt2025c_wait_heartbeat()
108 static int qt2025c_wait_fw_status_good(struct efx_nic *efx) in qt2025c_wait_fw_status_good() argument
115 reg = efx_mdio_read(efx, MDIO_MMD_PCS, PCS_UC8051_STATUS_REG); in qt2025c_wait_fw_status_good()
130 static void qt2025c_restart_firmware(struct efx_nic *efx) in qt2025c_restart_firmware() argument
133 efx_mdio_write(efx, 3, 0xe854, 0x00c0); in qt2025c_restart_firmware()
134 efx_mdio_write(efx, 3, 0xe854, 0x0040); in qt2025c_restart_firmware()
138 static int qt2025c_wait_reset(struct efx_nic *efx) in qt2025c_wait_reset() argument
142 rc = qt2025c_wait_heartbeat(efx); in qt2025c_wait_reset()
146 rc = qt2025c_wait_fw_status_good(efx); in qt2025c_wait_reset()
151 netif_dbg(efx, hw, efx->net_dev, in qt2025c_wait_reset()
153 qt2025c_restart_firmware(efx); in qt2025c_wait_reset()
154 rc = qt2025c_wait_heartbeat(efx); in qt2025c_wait_reset()
157 rc = qt2025c_wait_fw_status_good(efx); in qt2025c_wait_reset()
163 static void qt2025c_firmware_id(struct efx_nic *efx) in qt2025c_firmware_id() argument
165 struct qt202x_phy_data *phy_data = efx->phy_data; in qt2025c_firmware_id()
170 firmware_id[i] = efx_mdio_read(efx, MDIO_MMD_PCS, in qt2025c_firmware_id()
172 netif_info(efx, probe, efx->net_dev, in qt2025c_firmware_id()
183 static void qt2025c_bug17190_workaround(struct efx_nic *efx) in qt2025c_bug17190_workaround() argument
185 struct qt202x_phy_data *phy_data = efx->phy_data; in qt2025c_bug17190_workaround()
193 if (efx->link_state.up || in qt2025c_bug17190_workaround()
194 !efx_mdio_links_ok(efx, MDIO_DEVS_PMAPMD | MDIO_DEVS_PHYXS)) { in qt2025c_bug17190_workaround()
206 netif_dbg(efx, hw, efx->net_dev, "bashing QT2025C PMA/PMD\n"); in qt2025c_bug17190_workaround()
207 efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_CTRL1, in qt2025c_bug17190_workaround()
210 efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_CTRL1, in qt2025c_bug17190_workaround()
216 static int qt2025c_select_phy_mode(struct efx_nic *efx) in qt2025c_select_phy_mode() argument
218 struct qt202x_phy_data *phy_data = efx->phy_data; in qt2025c_select_phy_mode()
219 struct falcon_board *board = falcon_board(efx); in qt2025c_select_phy_mode()
233 phy_op_mode = (efx->loopback_mode == LOOPBACK_NONE) ? 0x0038 : 0x0020; in qt2025c_select_phy_mode()
236 reg = efx_mdio_read(efx, 1, 0xc319); in qt2025c_select_phy_mode()
239 netif_dbg(efx, hw, efx->net_dev, "Switching PHY to mode 0x%04x\n", in qt2025c_select_phy_mode()
246 efx_mdio_write(efx, 1, 0xc300, 0x0000); in qt2025c_select_phy_mode()
252 efx_mdio_write(efx, 1, 0xc303, 0x4498); in qt2025c_select_phy_mode()
254 efx_mdio_write(efx, 1, 0xc303, 0x4488); in qt2025c_select_phy_mode()
255 efx_mdio_write(efx, 1, 0xc303, 0x4480); in qt2025c_select_phy_mode()
256 efx_mdio_write(efx, 1, 0xc303, 0x4490); in qt2025c_select_phy_mode()
257 efx_mdio_write(efx, 1, 0xc303, 0x4498); in qt2025c_select_phy_mode()
260 efx_mdio_write(efx, 1, 0xc303, 0x0920); in qt2025c_select_phy_mode()
261 efx_mdio_write(efx, 1, 0xd008, 0x0004); in qt2025c_select_phy_mode()
263 efx_mdio_write(efx, 1, 0xc303, 0x0900); in qt2025c_select_phy_mode()
264 efx_mdio_write(efx, 1, 0xd008, 0x0005); in qt2025c_select_phy_mode()
265 efx_mdio_write(efx, 1, 0xc303, 0x0920); in qt2025c_select_phy_mode()
266 efx_mdio_write(efx, 1, 0xd008, 0x0004); in qt2025c_select_phy_mode()
268 efx_mdio_write(efx, 1, 0xc303, 0x4900); in qt2025c_select_phy_mode()
270 efx_mdio_write(efx, 1, 0xc303, 0x4900); in qt2025c_select_phy_mode()
271 efx_mdio_write(efx, 1, 0xc302, 0x0004); in qt2025c_select_phy_mode()
272 efx_mdio_write(efx, 1, 0xc316, 0x0013); in qt2025c_select_phy_mode()
273 efx_mdio_write(efx, 1, 0xc318, 0x0054); in qt2025c_select_phy_mode()
274 efx_mdio_write(efx, 1, 0xc319, phy_op_mode); in qt2025c_select_phy_mode()
275 efx_mdio_write(efx, 1, 0xc31a, 0x0098); in qt2025c_select_phy_mode()
276 efx_mdio_write(efx, 3, 0x0026, 0x0e00); in qt2025c_select_phy_mode()
277 efx_mdio_write(efx, 3, 0x0027, 0x0013); in qt2025c_select_phy_mode()
278 efx_mdio_write(efx, 3, 0x0028, 0xa528); in qt2025c_select_phy_mode()
279 efx_mdio_write(efx, 1, 0xd006, 0x000a); in qt2025c_select_phy_mode()
280 efx_mdio_write(efx, 1, 0xd007, 0x0009); in qt2025c_select_phy_mode()
281 efx_mdio_write(efx, 1, 0xd008, 0x0004); in qt2025c_select_phy_mode()
286 efx_mdio_write(efx, 1, 0xc317, 0x00ff); in qt2025c_select_phy_mode()
289 efx_mdio_set_flag(efx, 1, PMA_PMD_MODE_REG, in qt2025c_select_phy_mode()
291 efx_mdio_write(efx, 1, 0xc300, 0x0002); in qt2025c_select_phy_mode()
295 qt2025c_restart_firmware(efx); in qt2025c_select_phy_mode()
298 rc = qt2025c_wait_reset(efx); in qt2025c_select_phy_mode()
300 netif_err(efx, hw, efx->net_dev, in qt2025c_select_phy_mode()
309 static int qt202x_reset_phy(struct efx_nic *efx) in qt202x_reset_phy() argument
313 if (efx->phy_type == PHY_TYPE_QT2025C) { in qt202x_reset_phy()
316 rc = qt2025c_wait_reset(efx); in qt202x_reset_phy()
322 rc = efx_mdio_reset_mmd(efx, MDIO_MMD_PHYXS, in qt202x_reset_phy()
333 falcon_board(efx)->type->init_phy(efx); in qt202x_reset_phy()
338 netif_err(efx, hw, efx->net_dev, "PHY reset timed out\n"); in qt202x_reset_phy()
342 static int qt202x_phy_probe(struct efx_nic *efx) in qt202x_phy_probe() argument
349 efx->phy_data = phy_data; in qt202x_phy_probe()
350 phy_data->phy_mode = efx->phy_mode; in qt202x_phy_probe()
354 efx->mdio.mmds = QT202X_REQUIRED_DEVS; in qt202x_phy_probe()
355 efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; in qt202x_phy_probe()
356 efx->loopback_modes = QT202X_LOOPBACKS | FALCON_XMAC_LOOPBACKS; in qt202x_phy_probe()
360 static int qt202x_phy_init(struct efx_nic *efx) in qt202x_phy_init() argument
365 rc = qt202x_reset_phy(efx); in qt202x_phy_init()
367 netif_err(efx, probe, efx->net_dev, "PHY init failed\n"); in qt202x_phy_init()
371 devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS); in qt202x_phy_init()
372 netif_info(efx, probe, efx->net_dev, in qt202x_phy_init()
377 if (efx->phy_type == PHY_TYPE_QT2025C) in qt202x_phy_init()
378 qt2025c_firmware_id(efx); in qt202x_phy_init()
383 static int qt202x_link_ok(struct efx_nic *efx) in qt202x_link_ok() argument
385 return efx_mdio_links_ok(efx, QT202X_REQUIRED_DEVS); in qt202x_link_ok()
388 static bool qt202x_phy_poll(struct efx_nic *efx) in qt202x_phy_poll() argument
390 bool was_up = efx->link_state.up; in qt202x_phy_poll()
392 efx->link_state.up = qt202x_link_ok(efx); in qt202x_phy_poll()
393 efx->link_state.speed = 10000; in qt202x_phy_poll()
394 efx->link_state.fd = true; in qt202x_phy_poll()
395 efx->link_state.fc = efx->wanted_fc; in qt202x_phy_poll()
397 if (efx->phy_type == PHY_TYPE_QT2025C) in qt202x_phy_poll()
398 qt2025c_bug17190_workaround(efx); in qt202x_phy_poll()
400 return efx->link_state.up != was_up; in qt202x_phy_poll()
403 static int qt202x_phy_reconfigure(struct efx_nic *efx) in qt202x_phy_reconfigure() argument
405 struct qt202x_phy_data *phy_data = efx->phy_data; in qt202x_phy_reconfigure()
407 if (efx->phy_type == PHY_TYPE_QT2025C) { in qt202x_phy_reconfigure()
408 int rc = qt2025c_select_phy_mode(efx); in qt202x_phy_reconfigure()
418 &efx->mdio, efx->mdio.prtad, MDIO_MMD_PMAPMD, in qt202x_phy_reconfigure()
420 efx->phy_mode & PHY_MODE_TX_DISABLED || in qt202x_phy_reconfigure()
421 efx->phy_mode & PHY_MODE_LOW_POWER || in qt202x_phy_reconfigure()
422 efx->loopback_mode == LOOPBACK_PCS || in qt202x_phy_reconfigure()
423 efx->loopback_mode == LOOPBACK_PMAPMD); in qt202x_phy_reconfigure()
426 if (!(efx->phy_mode & PHY_MODE_TX_DISABLED) && in qt202x_phy_reconfigure()
428 qt202x_reset_phy(efx); in qt202x_phy_reconfigure()
430 efx_mdio_transmit_disable(efx); in qt202x_phy_reconfigure()
433 efx_mdio_phy_reconfigure(efx); in qt202x_phy_reconfigure()
435 phy_data->phy_mode = efx->phy_mode; in qt202x_phy_reconfigure()
440 static void qt202x_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) in qt202x_phy_get_settings() argument
442 mdio45_ethtool_gset(&efx->mdio, ecmd); in qt202x_phy_get_settings()
445 static void qt202x_phy_remove(struct efx_nic *efx) in qt202x_phy_remove() argument
448 kfree(efx->phy_data); in qt202x_phy_remove()
449 efx->phy_data = NULL; in qt202x_phy_remove()
452 static int qt202x_phy_get_module_info(struct efx_nic *efx, in qt202x_phy_get_module_info() argument
460 static int qt202x_phy_get_module_eeprom(struct efx_nic *efx, in qt202x_phy_get_module_eeprom() argument
465 if (efx->phy_type == PHY_TYPE_QT2025C) { in qt202x_phy_get_module_eeprom()
474 rc = efx_mdio_read(efx, mmd, reg_base + ee->offset + i); in qt202x_phy_get_module_eeprom()