aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy
diff options
context:
space:
mode:
authorRichard Cochran <richardcochran@gmail.com>2010-07-17 04:49:36 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-18 22:15:26 -0400
commitc1f19b51d1d87f3e3bb7e6648f43f7d57ed2da6b (patch)
treed9525359409e3493b48e8676717cc11ed69b640a /drivers/net/phy
parent15f0127d1d189fda3294b7823e3e654afca54055 (diff)
net: support time stamping in phy devices.
This patch adds a new networking option to allow hardware time stamps from PHY devices. When enabled, likely candidates among incoming and outgoing network packets are offered to the PHY driver for possible time stamping. When accepted by the PHY driver, incoming packets are deferred for later delivery by the driver. The patch also adds phylib driver methods for the SIOCSHWTSTAMP ioctl and callbacks for transmit and receive time stamping. Drivers may optionally implement these functions. Signed-off-by: Richard Cochran <richard.cochran@omicron.at> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/phy.c5
-rw-r--r--drivers/net/phy/phy_device.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index bd88d818f082..5130db8f5c4e 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -361,6 +361,11 @@ int phy_mii_ioctl(struct phy_device *phydev,
361 } 361 }
362 break; 362 break;
363 363
364 case SIOCSHWTSTAMP:
365 if (phydev->drv->hwtstamp)
366 return phydev->drv->hwtstamp(phydev, ifr);
367 /* fall through */
368
364 default: 369 default:
365 return -EOPNOTSUPP; 370 return -EOPNOTSUPP;
366 } 371 }
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 1a99bb244106..c0761197c07e 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -460,6 +460,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
460 } 460 }
461 461
462 phydev->attached_dev = dev; 462 phydev->attached_dev = dev;
463 dev->phydev = phydev;
463 464
464 phydev->dev_flags = flags; 465 phydev->dev_flags = flags;
465 466
@@ -513,6 +514,7 @@ EXPORT_SYMBOL(phy_attach);
513 */ 514 */
514void phy_detach(struct phy_device *phydev) 515void phy_detach(struct phy_device *phydev)
515{ 516{
517 phydev->attached_dev->phydev = NULL;
516 phydev->attached_dev = NULL; 518 phydev->attached_dev = NULL;
517 519
518 /* If the device had no specific driver before (i.e. - it 520 /* If the device had no specific driver before (i.e. - it