aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/mcdi_phy.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2010-02-03 04:30:50 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-03 22:12:44 -0500
commit4f16c0739145476ba37a7fa9eea0c33850efc2ce (patch)
tree3ba72c3d44a3d7ca4814cdb83caf2ca4aa608a85 /drivers/net/sfc/mcdi_phy.c
parent7a6b8f6f7f74085a1330b0f9765d81bcea8c58b7 (diff)
sfc: Replace PHY MDIO test with an 'alive' test
SFC9000-family boards do not all use MDIO PHYs, so we need a different test for PHY aliveness. Introduce a PHY operation test_alive(). For PHYs attached to Falcon, use a common implementation based on the existing PHY MDIO test. For PHYs managed through MCDI, use the appropriate MCDI request. Change test name in ethtool from 'core mdio' to 'phy alive'. Rename test_results::mdio to phy_alive and test_results::phy to phy_ext. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/mcdi_phy.c')
-rw-r--r--drivers/net/sfc/mcdi_phy.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/sfc/mcdi_phy.c b/drivers/net/sfc/mcdi_phy.c
index d87e74d3994..34c22fa986e 100644
--- a/drivers/net/sfc/mcdi_phy.c
+++ b/drivers/net/sfc/mcdi_phy.c
@@ -572,6 +572,27 @@ static int efx_mcdi_phy_set_settings(struct efx_nic *efx, struct ethtool_cmd *ec
572 return 0; 572 return 0;
573} 573}
574 574
575static int efx_mcdi_phy_test_alive(struct efx_nic *efx)
576{
577 u8 outbuf[MC_CMD_GET_PHY_STATE_OUT_LEN];
578 size_t outlen;
579 int rc;
580
581 BUILD_BUG_ON(MC_CMD_GET_PHY_STATE_IN_LEN != 0);
582
583 rc = efx_mcdi_rpc(efx, MC_CMD_GET_PHY_STATE, NULL, 0,
584 outbuf, sizeof(outbuf), &outlen);
585 if (rc)
586 return rc;
587
588 if (outlen < MC_CMD_GET_PHY_STATE_OUT_LEN)
589 return -EMSGSIZE;
590 if (MCDI_DWORD(outbuf, GET_PHY_STATE_STATE) != MC_CMD_PHY_STATE_OK)
591 return -EINVAL;
592
593 return 0;
594}
595
575struct efx_phy_operations efx_mcdi_phy_ops = { 596struct efx_phy_operations efx_mcdi_phy_ops = {
576 .probe = efx_mcdi_phy_probe, 597 .probe = efx_mcdi_phy_probe,
577 .init = efx_port_dummy_op_int, 598 .init = efx_port_dummy_op_int,
@@ -581,6 +602,7 @@ struct efx_phy_operations efx_mcdi_phy_ops = {
581 .remove = efx_mcdi_phy_remove, 602 .remove = efx_mcdi_phy_remove,
582 .get_settings = efx_mcdi_phy_get_settings, 603 .get_settings = efx_mcdi_phy_get_settings,
583 .set_settings = efx_mcdi_phy_set_settings, 604 .set_settings = efx_mcdi_phy_set_settings,
605 .test_alive = efx_mcdi_phy_test_alive,
584 .run_tests = NULL, 606 .run_tests = NULL,
585 .test_name = NULL, 607 .test_name = NULL,
586}; 608};