netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@grandegger.com>
To: Richard Cochran <richardcochran@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 0/3] [RFC] ptp: IEEE 1588 clock support
Date: Thu, 29 Apr 2010 14:02:59 +0200	[thread overview]
Message-ID: <4BD97573.5050101@grandegger.com> (raw)
In-Reply-To: <20100427091344.GA5086@riccoc20.at.omicron.at>

Richard Cochran wrote:
> Now and again there has been some talk on this list of adding PTP
> support into Linux. One part of the picture is already in place, the
> SO_TIMESTAMPING API for hardware time stamping. It has been pointed
> out that this API is not perfect, however, it is good enough for many
> real world uses of IEEE 1588. The second needed part has not, AFAICT,
> ever been addressed.
> 
> Here I offer an early draft of an idea how to bring the missing
> functionality into Linux. I don't yet have all of the features
> implemented, as described below. Still I would like to get your
> feedback concerning this idea before getting too far into it. I do
> have all of the hardware mentioned at hand, so I have a good idea that
> the proposed API covers the features of those clocks.
> 
> Thanks in advance for your comments,
> 
> Richard
> 
> * PTP infrastructure for Linux
> 
>   This patch set introduces support for IEEE 1588 PTP clocks in
>   Linux. Together with the SO_TIMESTAMPING socket options, this
>   presents standardized method for developing PTP user space programs,
>   synchronizing Linux with external clocks, and using the ancillary
>   features of PTP hardware clocks.
> 
>   A new class driver exports a kernel interface for specific clock
>   drivers and a user space interface. The infrastructure supports a
>   complete set of PTP functionality.
> 
>   + Basic clock operations
>     - Set time
>     - Get time
>     - Shift the clock by a given offset atomically
>     - Adjust clock frequency
> 
>   + Ancillary clock features
>     - One short or periodic alarms, with signal delivery to user program
>     - Time stamp external events
>     - Period output signals configurable from user space
>     - Synchronization of the Linux system time via the PPS subsystem
> 
> ** PTP kernel API
> 
>    A PTP clock driver registers itself with the class driver. The
>    class driver handles all of the dealings with user space. The
>    author of a clock driver need only implement the details of
>    programming the clock hardware. The clock driver notifies the class
>    driver of asynchronous events (alarms and external time stamps) via
>    a simple message passing interface.
> 
>    The class driver supports multiple PTP clock drivers. In normal use
>    cases, only one PTP clock is needed. However, for testing and
>    development, it can be useful to have more than one clock in a
>    single system, in order to allow performance comparisons.
> 
> ** PTP user space API
> 
>    The class driver creates a character device for each registered PTP
>    clock. User space programs may control the clock via standardized
>    ioctls. A program may query, enable, configure, and disable the
>    ancillary clock features. User space can receive time stamped
>    events via blocking read() and poll(). One shot and periodic
>    signals may be configured via an ioctl API with similar semantics
>    to the POSIX timer_settime() system call.
> 
> ** Supported hardware
> 
>    + Standard Linux system timer
>      - No special PTP features
>      - For use with software time stamping
> 
>    + Freescale eTSEC gianfar
>      - 2 Time stamp external triggers, programmable polarity (opt. interrupt)
>      - 2 Alarm registers (optional interrupt)
>      - 3 Periodic signals (optional interrupt)
> 
>    + National DP83640
>      - 6 GPIOs programmable as inputs or outputs
>      - 6 GPIOs with dedicated functions (LED/JTAG/clock) can also be
>        used as general inputs or outputs
>      - GPIO inputs can time stamp external triggers
>      - GPIO outputs can produce periodic signals
>      - 1 interrupt pin
> 
>    + Intel IXP465
>      - Auxiliary Slave/Master Mode Snapshot (optional interrupt)
>      - Target Time (optional interrupt)

I realized two other netdev drivers already supporting PTP timestamping:
igb and bfin_mac. From the PTP developer point of view, the interface
looks rather complete to me and it works fine on my MPC8313 setup. The
only thing I stumbled over was that PTP clock registration failed when
PTP support is statically linked into the kernel.

Thanks,

Wolfgang.


  parent reply	other threads:[~2010-04-30 18:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-27  9:13 [PATCH 0/3] [RFC] ptp: IEEE 1588 clock support Richard Cochran
2010-04-27 10:20 ` Richard Cochran
2010-04-27 13:35   ` Wolfgang Grandegger
2010-04-27 16:20     ` Wolfgang Grandegger
2010-04-28  5:47       ` Richard Cochran
2010-04-28 13:50         ` Wolfgang Grandegger
2010-04-28 14:31           ` Wolfgang Grandegger
2010-04-29  6:54             ` Richard Cochran
     [not found]               ` <20100429065422.GA5803-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2010-04-29  8:08                 ` Wolfgang Grandegger
2010-04-29  8:38             ` Richard Cochran
2010-04-29  9:24               ` Wolfgang Grandegger
2010-04-29  9:42                 ` Richard Cochran
2010-04-29 11:31                   ` Wolfgang Grandegger
2010-04-29 12:02 ` Wolfgang Grandegger [this message]
2010-04-29 15:34   ` Richard Cochran
2010-04-29 20:30     ` Wolfgang Grandegger
2010-05-02 11:51     ` Wolfgang Grandegger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BD97573.5050101@grandegger.com \
    --to=wg@grandegger.com \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).