diff options
author | Ingo Molnar <mingo@elte.hu> | 2010-03-04 11:51:29 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-04 11:51:29 +0100 |
commit | e02c4fd3142dfb9412531bbfabd510a2a7c6ea46 (patch) | |
tree | 61b64506b2c016e050f940a89d1ffd36b7c00fdf /drivers/net/sfc/mdio_10g.c | |
parent | tracing: Include irqflags headers from trace clock (diff) | |
parent | tracing: Fix warning in s_next of trace file ops (diff) | |
download | linux-e02c4fd3142dfb9412531bbfabd510a2a7c6ea46.tar.xz linux-e02c4fd3142dfb9412531bbfabd510a2a7c6ea46.zip |
Merge branch 'tip/tracing/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/urgent
Diffstat (limited to 'drivers/net/sfc/mdio_10g.c')
-rw-r--r-- | drivers/net/sfc/mdio_10g.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/sfc/mdio_10g.c b/drivers/net/sfc/mdio_10g.c index 1574e52f0594..0548fcbbdcd0 100644 --- a/drivers/net/sfc/mdio_10g.c +++ b/drivers/net/sfc/mdio_10g.c @@ -335,3 +335,27 @@ enum efx_fc_type efx_mdio_get_pause(struct efx_nic *efx) mii_advertise_flowctrl(efx->wanted_fc), efx_mdio_read(efx, MDIO_MMD_AN, MDIO_AN_LPA)); } + +int efx_mdio_test_alive(struct efx_nic *efx) +{ + int rc; + int devad = __ffs(efx->mdio.mmds); + u16 physid1, physid2; + + mutex_lock(&efx->mac_lock); + + physid1 = efx_mdio_read(efx, devad, MDIO_DEVID1); + physid2 = efx_mdio_read(efx, devad, MDIO_DEVID2); + + if ((physid1 == 0x0000) || (physid1 == 0xffff) || + (physid2 == 0x0000) || (physid2 == 0xffff)) { + EFX_ERR(efx, "no MDIO PHY present with ID %d\n", + efx->mdio.prtad); + rc = -EINVAL; + } else { + rc = efx_mdio_check_mmds(efx, efx->mdio.mmds, 0); + } + + mutex_unlock(&efx->mac_lock); + return rc; +} |