diff mbox

[03/12] phylib: add a driver method for the SIOCSHWTSTAMP ioctl.

Message ID 77fe18d640e35dcbfad1e117a4321f935500d5ac.1276615626.git.richard.cochran@omicron.at
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Richard Cochran June 15, 2010, 4:08 p.m. UTC
This patch adds a phy driver method for configuring hardware time stamping.
Drivers may optionally implement this function.

Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
 drivers/net/phy/phy.c |    5 +++++
 include/linux/phy.h   |    3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)

Comments

Grant Likely June 15, 2010, 4:27 p.m. UTC | #1
On Tue, Jun 15, 2010 at 10:08 AM, Richard Cochran
<richardcochran@gmail.com> wrote:
> This patch adds a phy driver method for configuring hardware time stamping.
> Drivers may optionally implement this function.
>
> Signed-off-by: Richard Cochran <richard.cochran@omicron.at>

Adding an ioctl to the userspace ABI.  Make sure you cc: linux-kernel
on the next spin of this series.

g.

> ---
>  drivers/net/phy/phy.c |    5 +++++
>  include/linux/phy.h   |    3 +++
>  2 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index bd88d81..5130db8 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,
>                }
>                break;
>
> +       case SIOCSHWTSTAMP:
> +               if (phydev->drv->hwtstamp)
> +                       return phydev->drv->hwtstamp(phydev, ifr);
> +               /* fall through */
> +
>        default:
>                return -EOPNOTSUPP;
>        }
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index d63736a..a5e9df1 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -402,6 +402,9 @@ struct phy_driver {
>        /* Clears up any memory if needed */
>        void (*remove)(struct phy_device *phydev);
>
> +       /* Handles SIOCSHWTSTAMP ioctl for hardware time stamping. */
> +       int (*hwtstamp)(struct phy_device *phydev, struct ifreq *ifr);
> +
>        struct device_driver driver;
>  };
>  #define to_phy_driver(d) container_of(d, struct phy_driver, driver)
> --
> 1.6.3.3
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
Richard Cochran June 15, 2010, 4:34 p.m. UTC | #2
On Tue, Jun 15, 2010 at 10:27:59AM -0600, Grant Likely wrote:
> On Tue, Jun 15, 2010 at 10:08 AM, Richard Cochran
> <richardcochran@gmail.com> wrote:
> > This patch adds a phy driver method for configuring hardware time stamping.
> > Drivers may optionally implement this function.
> >
> > Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
> 
> Adding an ioctl to the userspace ABI.  Make sure you cc: linux-kernel
> on the next spin of this series.

Not sure what you mean. SIOCSHWTSTAMP is a standard socket option as
of 2.6.30. The patch just makes it possible for PHY drivers to
implement this option.

Richard

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Grant Likely June 15, 2010, 4:49 p.m. UTC | #3
On Tue, Jun 15, 2010 at 10:34 AM, Richard Cochran
<richardcochran@gmail.com> wrote:
> On Tue, Jun 15, 2010 at 10:27:59AM -0600, Grant Likely wrote:
>> On Tue, Jun 15, 2010 at 10:08 AM, Richard Cochran
>> <richardcochran@gmail.com> wrote:
>> > This patch adds a phy driver method for configuring hardware time stamping.
>> > Drivers may optionally implement this function.
>> >
>> > Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
>>
>> Adding an ioctl to the userspace ABI.  Make sure you cc: linux-kernel
>> on the next spin of this series.
>
> Not sure what you mean. SIOCSHWTSTAMP is a standard socket option as
> of 2.6.30. The patch just makes it possible for PHY drivers to
> implement this option.

Ah, sorry.  I didn't go check that first.

g.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Grant Likely June 15, 2010, 4:53 p.m. UTC | #4
On Tue, Jun 15, 2010 at 10:49 AM, Grant Likely
<grant.likely@secretlab.ca> wrote:
> On Tue, Jun 15, 2010 at 10:34 AM, Richard Cochran
> <richardcochran@gmail.com> wrote:
>> On Tue, Jun 15, 2010 at 10:27:59AM -0600, Grant Likely wrote:
>>> On Tue, Jun 15, 2010 at 10:08 AM, Richard Cochran
>>> <richardcochran@gmail.com> wrote:
>>> > This patch adds a phy driver method for configuring hardware time stamping.
>>> > Drivers may optionally implement this function.
>>> >
>>> > Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
>>>
>>> Adding an ioctl to the userspace ABI.  Make sure you cc: linux-kernel
>>> on the next spin of this series.
>>
>> Not sure what you mean. SIOCSHWTSTAMP is a standard socket option as
>> of 2.6.30. The patch just makes it possible for PHY drivers to
>> implement this option.
>
> Ah, sorry.  I didn't go check that first.

Although, now that I'm looking through the PTP patches, you
*definitely* should post this series to the lkml.  It has implications
beyond ppc and arm.

g.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index bd88d81..5130db8 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,
 		}
 		break;
 
+	case SIOCSHWTSTAMP:
+		if (phydev->drv->hwtstamp)
+			return phydev->drv->hwtstamp(phydev, ifr);
+		/* fall through */
+
 	default:
 		return -EOPNOTSUPP;
 	}
diff --git a/include/linux/phy.h b/include/linux/phy.h
index d63736a..a5e9df1 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -402,6 +402,9 @@  struct phy_driver {
 	/* Clears up any memory if needed */
 	void (*remove)(struct phy_device *phydev);
 
+	/* Handles SIOCSHWTSTAMP ioctl for hardware time stamping. */
+	int (*hwtstamp)(struct phy_device *phydev, struct ifreq *ifr);
+
 	struct device_driver driver;
 };
 #define to_phy_driver(d) container_of(d, struct phy_driver, driver)