aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/qt202x_phy.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-05-04 20:36:50 -0400
committerBen Hutchings <bhutchings@solarflare.com>2012-05-09 22:10:54 -0400
commitba62b2a8608ca52234fc8bea27bfebbdc4f98c2e (patch)
treeff80e67314ffae101dfdbeda300085dad1b343b7 /drivers/net/ethernet/sfc/qt202x_phy.c
parentc087bd2cfdaf334d7d0c32bd1fcc1a23d5b88973 (diff)
sfc: Implement module EEPROM access for SFE4002 and SFN4112F
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/sfc/qt202x_phy.c')
-rw-r--r--drivers/net/ethernet/sfc/qt202x_phy.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sfc/qt202x_phy.c b/drivers/net/ethernet/sfc/qt202x_phy.c
index 8a7caf88ffb6..326a28637f3c 100644
--- a/drivers/net/ethernet/sfc/qt202x_phy.c
+++ b/drivers/net/ethernet/sfc/qt202x_phy.c
@@ -449,6 +449,37 @@ static void qt202x_phy_remove(struct efx_nic *efx)
449 efx->phy_data = NULL; 449 efx->phy_data = NULL;
450} 450}
451 451
452static int qt202x_phy_get_module_info(struct efx_nic *efx,
453 struct ethtool_modinfo *modinfo)
454{
455 modinfo->type = ETH_MODULE_SFF_8079;
456 modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
457 return 0;
458}
459
460static int qt202x_phy_get_module_eeprom(struct efx_nic *efx,
461 struct ethtool_eeprom *ee, u8 *data)
462{
463 int mmd, reg_base, rc, i;
464
465 if (efx->phy_type == PHY_TYPE_QT2025C) {
466 mmd = MDIO_MMD_PCS;
467 reg_base = 0xd000;
468 } else {
469 mmd = MDIO_MMD_PMAPMD;
470 reg_base = 0x8007;
471 }
472
473 for (i = 0; i < ee->len; i++) {
474 rc = efx_mdio_read(efx, mmd, reg_base + ee->offset + i);
475 if (rc < 0)
476 return rc;
477 data[i] = rc;
478 }
479
480 return 0;
481}
482
452const struct efx_phy_operations falcon_qt202x_phy_ops = { 483const struct efx_phy_operations falcon_qt202x_phy_ops = {
453 .probe = qt202x_phy_probe, 484 .probe = qt202x_phy_probe,
454 .init = qt202x_phy_init, 485 .init = qt202x_phy_init,
@@ -459,4 +490,6 @@ const struct efx_phy_operations falcon_qt202x_phy_ops = {
459 .get_settings = qt202x_phy_get_settings, 490 .get_settings = qt202x_phy_get_settings,
460 .set_settings = efx_mdio_set_settings, 491 .set_settings = efx_mdio_set_settings,
461 .test_alive = efx_mdio_test_alive, 492 .test_alive = efx_mdio_test_alive,
493 .get_module_eeprom = qt202x_phy_get_module_eeprom,
494 .get_module_info = qt202x_phy_get_module_info,
462}; 495};