aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/mdio_10g.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-11-04 15:34:56 -0500
committerJeff Garzik <jgarzik@redhat.com>2008-11-06 00:50:09 -0500
commit3e133c44d24a094118caee182200462d46c55b56 (patch)
treecabc1821bef090abedd1891c3d16137dea8f2ef3 /drivers/net/sfc/mdio_10g.c
parentf41507245ef8b079685aba8da5b5b2b5e87e70bc (diff)
sfc: Use lm87 and lm90 drivers for board temperature/power monitoring
Add board monitoring to periodic work whenever link is down. For SFE4001, report when a fault has caused the PHY to turn off. For SFE4002, switch XFP PHY into low-power state in case of a fault. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/sfc/mdio_10g.c')
-rw-r--r--drivers/net/sfc/mdio_10g.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/net/sfc/mdio_10g.c b/drivers/net/sfc/mdio_10g.c
index 003e48dcb2f3..19e25210b687 100644
--- a/drivers/net/sfc/mdio_10g.c
+++ b/drivers/net/sfc/mdio_10g.c
@@ -260,6 +260,41 @@ void mdio_clause45_phy_reconfigure(struct efx_nic *efx)
260 MDIO_MMDREG_CTRL1, ctrl2); 260 MDIO_MMDREG_CTRL1, ctrl2);
261} 261}
262 262
263static void mdio_clause45_set_mmd_lpower(struct efx_nic *efx,
264 int lpower, int mmd)
265{
266 int phy = efx->mii.phy_id;
267 int stat = mdio_clause45_read(efx, phy, mmd, MDIO_MMDREG_STAT1);
268 int ctrl1, ctrl2;
269
270 EFX_TRACE(efx, "Setting low power mode for MMD %d to %d\n",
271 mmd, lpower);
272
273 if (stat & (1 << MDIO_MMDREG_STAT1_LPABLE_LBN)) {
274 ctrl1 = ctrl2 = mdio_clause45_read(efx, phy,
275 mmd, MDIO_MMDREG_CTRL1);
276 if (lpower)
277 ctrl2 |= (1 << MDIO_MMDREG_CTRL1_LPOWER_LBN);
278 else
279 ctrl2 &= ~(1 << MDIO_MMDREG_CTRL1_LPOWER_LBN);
280 if (ctrl1 != ctrl2)
281 mdio_clause45_write(efx, phy, mmd,
282 MDIO_MMDREG_CTRL1, ctrl2);
283 }
284}
285
286void mdio_clause45_set_mmds_lpower(struct efx_nic *efx,
287 int low_power, unsigned int mmd_mask)
288{
289 int mmd = 0;
290 while (mmd_mask) {
291 if (mmd_mask & 1)
292 mdio_clause45_set_mmd_lpower(efx, low_power, mmd);
293 mmd_mask = (mmd_mask >> 1);
294 mmd++;
295 }
296}
297
263/** 298/**
264 * mdio_clause45_get_settings - Read (some of) the PHY settings over MDIO. 299 * mdio_clause45_get_settings - Read (some of) the PHY settings over MDIO.
265 * @efx: Efx NIC 300 * @efx: Efx NIC