Lines Matching refs:efx
171 static void txc_reset_logic(struct efx_nic *efx);
174 void falcon_txc_set_gpio_val(struct efx_nic *efx, int pin, int on) in falcon_txc_set_gpio_val() argument
176 efx_mdio_set_flag(efx, MDIO_MMD_PHYXS, TXC_GPIO_OUTPUT, 1 << pin, on); in falcon_txc_set_gpio_val()
180 void falcon_txc_set_gpio_dir(struct efx_nic *efx, int pin, int dir) in falcon_txc_set_gpio_dir() argument
182 efx_mdio_set_flag(efx, MDIO_MMD_PHYXS, TXC_GPIO_DIR, 1 << pin, dir); in falcon_txc_set_gpio_dir()
187 static int txc_reset_phy(struct efx_nic *efx) in txc_reset_phy() argument
189 int rc = efx_mdio_reset_mmd(efx, MDIO_MMD_PMAPMD, in txc_reset_phy()
196 rc = efx_mdio_check_mmds(efx, TXC_REQUIRED_DEVS); in txc_reset_phy()
203 netif_err(efx, hw, efx->net_dev, TXCNAME ": reset timed out!\n"); in txc_reset_phy()
208 static int txc_bist_one(struct efx_nic *efx, int mmd, int test) in txc_bist_one() argument
215 ctrl = efx_mdio_read(efx, MDIO_MMD_PCS, TXC_MTDIABLO_CTRL); in txc_bist_one()
217 efx_mdio_write(efx, MDIO_MMD_PCS, TXC_MTDIABLO_CTRL, ctrl); in txc_bist_one()
222 efx_mdio_write(efx, mmd, TXC_BIST_CTL, bctl); in txc_bist_one()
226 efx_mdio_write(efx, mmd, TXC_BIST_CTL, bctl); in txc_bist_one()
229 efx_mdio_write(efx, mmd, TXC_BIST_CTL, in txc_bist_one()
237 efx_mdio_write(efx, mmd, TXC_BIST_CTL, bctl); in txc_bist_one()
241 bctl = efx_mdio_read(efx, mmd, TXC_BIST_CTL); in txc_bist_one()
246 int count = efx_mdio_read(efx, mmd, TXC_BIST_RX0ERRCNT + lane); in txc_bist_one()
248 netif_err(efx, hw, efx->net_dev, TXCNAME": BIST error. " in txc_bist_one()
252 count = efx_mdio_read(efx, mmd, TXC_BIST_RX0FRMCNT + lane); in txc_bist_one()
254 netif_err(efx, hw, efx->net_dev, TXCNAME": BIST error. " in txc_bist_one()
261 netif_info(efx, hw, efx->net_dev, TXCNAME": BIST pass\n"); in txc_bist_one()
264 efx_mdio_write(efx, mmd, TXC_BIST_CTL, 0); in txc_bist_one()
268 efx_mdio_write(efx, MDIO_MMD_PCS, TXC_MTDIABLO_CTRL, ctrl); in txc_bist_one()
273 static int txc_bist(struct efx_nic *efx) in txc_bist() argument
275 return txc_bist_one(efx, MDIO_MMD_PCS, TXC_BIST_CTRL_TYPE_TSD); in txc_bist()
280 static void txc_apply_defaults(struct efx_nic *efx) in txc_apply_defaults() argument
290 efx_mdio_write(efx, MDIO_MMD_PHYXS, TXC_ALRGS_ATXPRE0, TXC_ATXPRE_NONE); in txc_apply_defaults()
291 efx_mdio_write(efx, MDIO_MMD_PHYXS, TXC_ALRGS_ATXPRE1, TXC_ATXPRE_NONE); in txc_apply_defaults()
294 efx_mdio_write(efx, MDIO_MMD_PHYXS, in txc_apply_defaults()
296 efx_mdio_write(efx, MDIO_MMD_PHYXS, in txc_apply_defaults()
302 efx_mdio_write(efx, MDIO_MMD_PMAPMD, in txc_apply_defaults()
304 efx_mdio_write(efx, MDIO_MMD_PMAPMD, in txc_apply_defaults()
306 efx_mdio_write(efx, MDIO_MMD_PMAPMD, in txc_apply_defaults()
308 efx_mdio_write(efx, MDIO_MMD_PMAPMD, in txc_apply_defaults()
312 mctrl = efx_mdio_read(efx, MDIO_MMD_PHYXS, TXC_MRGS_CTL); in txc_apply_defaults()
316 efx_mdio_write(efx, MDIO_MMD_PHYXS, TXC_MRGS_CTL, mctrl); in txc_apply_defaults()
319 txc_reset_logic(efx); in txc_apply_defaults()
321 falcon_board(efx)->type->init_phy(efx); in txc_apply_defaults()
324 static int txc43128_phy_probe(struct efx_nic *efx) in txc43128_phy_probe() argument
332 efx->phy_data = phy_data; in txc43128_phy_probe()
333 phy_data->phy_mode = efx->phy_mode; in txc43128_phy_probe()
335 efx->mdio.mmds = TXC_REQUIRED_DEVS; in txc43128_phy_probe()
336 efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; in txc43128_phy_probe()
338 efx->loopback_modes = TXC_LOOPBACKS | FALCON_XMAC_LOOPBACKS; in txc43128_phy_probe()
344 static int txc43128_phy_init(struct efx_nic *efx) in txc43128_phy_init() argument
348 rc = txc_reset_phy(efx); in txc43128_phy_init()
352 rc = txc_bist(efx); in txc43128_phy_init()
356 txc_apply_defaults(efx); in txc43128_phy_init()
362 static void txc_glrgs_lane_power(struct efx_nic *efx, int mmd) in txc_glrgs_lane_power() argument
365 int ctl = efx_mdio_read(efx, mmd, TXC_GLRGS_GLCMD); in txc_glrgs_lane_power()
367 if (!(efx->phy_mode & PHY_MODE_LOW_POWER)) in txc_glrgs_lane_power()
372 efx_mdio_write(efx, mmd, TXC_GLRGS_GLCMD, ctl); in txc_glrgs_lane_power()
376 static void txc_analog_lane_power(struct efx_nic *efx, int mmd) in txc_analog_lane_power() argument
382 int txctl = efx_mdio_read(efx, mmd, TXC_ALRGS_ATXCTL); in txc_analog_lane_power()
383 int rxctl = efx_mdio_read(efx, mmd, TXC_ALRGS_ARXCTL); in txc_analog_lane_power()
385 if (!(efx->phy_mode & PHY_MODE_LOW_POWER)) { in txc_analog_lane_power()
393 efx_mdio_write(efx, mmd, TXC_ALRGS_ATXCTL, txctl); in txc_analog_lane_power()
394 efx_mdio_write(efx, mmd, TXC_ALRGS_ARXCTL, rxctl); in txc_analog_lane_power()
397 static void txc_set_power(struct efx_nic *efx) in txc_set_power() argument
400 efx_mdio_set_mmds_lpower(efx, in txc_set_power()
401 !!(efx->phy_mode & PHY_MODE_LOW_POWER), in txc_set_power()
406 txc_glrgs_lane_power(efx, MDIO_MMD_PCS); in txc_set_power()
407 txc_glrgs_lane_power(efx, MDIO_MMD_PHYXS); in txc_set_power()
410 txc_analog_lane_power(efx, MDIO_MMD_PMAPMD); in txc_set_power()
411 txc_analog_lane_power(efx, MDIO_MMD_PHYXS); in txc_set_power()
414 static void txc_reset_logic_mmd(struct efx_nic *efx, int mmd) in txc_reset_logic_mmd() argument
416 int val = efx_mdio_read(efx, mmd, TXC_GLRGS_GLCMD); in txc_reset_logic_mmd()
420 efx_mdio_write(efx, mmd, TXC_GLRGS_GLCMD, val); in txc_reset_logic_mmd()
422 val = efx_mdio_read(efx, mmd, TXC_GLRGS_GLCMD); in txc_reset_logic_mmd()
428 netif_info(efx, hw, efx->net_dev, in txc_reset_logic_mmd()
434 static void txc_reset_logic(struct efx_nic *efx) in txc_reset_logic() argument
439 txc_reset_logic_mmd(efx, MDIO_MMD_PCS); in txc_reset_logic()
442 static bool txc43128_phy_read_link(struct efx_nic *efx) in txc43128_phy_read_link() argument
444 return efx_mdio_links_ok(efx, TXC_REQUIRED_DEVS); in txc43128_phy_read_link()
447 static int txc43128_phy_reconfigure(struct efx_nic *efx) in txc43128_phy_reconfigure() argument
449 struct txc43128_data *phy_data = efx->phy_data; in txc43128_phy_reconfigure()
450 enum efx_phy_mode mode_change = efx->phy_mode ^ phy_data->phy_mode; in txc43128_phy_reconfigure()
451 bool loop_change = LOOPBACK_CHANGED(phy_data, efx, TXC_LOOPBACKS); in txc43128_phy_reconfigure()
453 if (efx->phy_mode & mode_change & PHY_MODE_TX_DISABLED) { in txc43128_phy_reconfigure()
454 txc_reset_phy(efx); in txc43128_phy_reconfigure()
455 txc_apply_defaults(efx); in txc43128_phy_reconfigure()
456 falcon_reset_xaui(efx); in txc43128_phy_reconfigure()
460 efx_mdio_transmit_disable(efx); in txc43128_phy_reconfigure()
461 efx_mdio_phy_reconfigure(efx); in txc43128_phy_reconfigure()
463 txc_set_power(efx); in txc43128_phy_reconfigure()
470 txc_reset_logic(efx); in txc43128_phy_reconfigure()
472 phy_data->phy_mode = efx->phy_mode; in txc43128_phy_reconfigure()
473 phy_data->loopback_mode = efx->loopback_mode; in txc43128_phy_reconfigure()
478 static void txc43128_phy_fini(struct efx_nic *efx) in txc43128_phy_fini() argument
481 efx_mdio_write(efx, MDIO_MMD_PMAPMD, MDIO_PMA_LASI_CTRL, 0); in txc43128_phy_fini()
484 static void txc43128_phy_remove(struct efx_nic *efx) in txc43128_phy_remove() argument
486 kfree(efx->phy_data); in txc43128_phy_remove()
487 efx->phy_data = NULL; in txc43128_phy_remove()
492 static bool txc43128_phy_poll(struct efx_nic *efx) in txc43128_phy_poll() argument
494 struct txc43128_data *data = efx->phy_data; in txc43128_phy_poll()
495 bool was_up = efx->link_state.up; in txc43128_phy_poll()
497 efx->link_state.up = txc43128_phy_read_link(efx); in txc43128_phy_poll()
498 efx->link_state.speed = 10000; in txc43128_phy_poll()
499 efx->link_state.fd = true; in txc43128_phy_poll()
500 efx->link_state.fc = efx->wanted_fc; in txc43128_phy_poll()
502 if (efx->link_state.up || (efx->loopback_mode != LOOPBACK_NONE)) { in txc43128_phy_poll()
508 txc_reset_logic(efx); in txc43128_phy_poll()
512 return efx->link_state.up != was_up; in txc43128_phy_poll()
519 static const char *txc43128_test_name(struct efx_nic *efx, unsigned int index) in txc43128_test_name() argument
526 static int txc43128_run_tests(struct efx_nic *efx, int *results, unsigned flags) in txc43128_run_tests() argument
533 rc = txc_reset_phy(efx); in txc43128_run_tests()
537 rc = txc_bist(efx); in txc43128_run_tests()
538 txc_apply_defaults(efx); in txc43128_run_tests()
543 static void txc43128_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) in txc43128_get_settings() argument
545 mdio45_ethtool_gset(&efx->mdio, ecmd); in txc43128_get_settings()