Lines Matching defs:efx

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