diff options
author | Brandon Streiff <brandon.streiff@ni.com> | 2018-02-14 01:07:45 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-14 14:33:36 -0500 |
commit | 2fa8d3af4badc40a39092140a01101119988faf6 (patch) | |
tree | fbf8e5e99514e423f57031c2029d935b948139d6 /drivers/net/dsa/mv88e6xxx/chip.h | |
parent | 0d632c3d6fe3b909fa481ddd51b5cb76ad18f921 (diff) | |
download | lwn-2fa8d3af4badc40a39092140a01101119988faf6.tar.gz lwn-2fa8d3af4badc40a39092140a01101119988faf6.zip |
net: dsa: mv88e6xxx: expose switch time as a PTP hardware clock
This patch adds basic support for exposing the 32-bit timestamp counter
inside the mv88e6xxx switch as a ptp_clock.
Adjfine implemented by Richard Cochran.
Andrew Lunn: fix return value of PTP stub function.
Signed-off-by: Brandon Streiff <brandon.streiff@ni.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mv88e6xxx/chip.h')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/chip.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index 5467c86f38a1..92e5fd6e2318 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -16,6 +16,8 @@ #include <linux/irq.h> #include <linux/gpio/consumer.h> #include <linux/phy.h> +#include <linux/ptp_clock_kernel.h> +#include <linux/timecounter.h> #include <net/dsa.h> #ifndef UINT64_MAX @@ -126,6 +128,9 @@ struct mv88e6xxx_info { */ u8 atu_move_port_mask; const struct mv88e6xxx_ops *ops; + + /* Supports PTP */ + bool ptp_support; }; struct mv88e6xxx_atu_entry { @@ -210,6 +215,16 @@ struct mv88e6xxx_chip { int watchdog_irq; int atu_prob_irq; int vtu_prob_irq; + + /* This cyclecounter abstracts the switch PTP time. + * reg_lock must be held for any operation that read()s. + */ + struct cyclecounter tstamp_cc; + struct timecounter tstamp_tc; + struct delayed_work overflow_work; + + struct ptp_clock *ptp_clock; + struct ptp_clock_info ptp_clock_info; }; struct mv88e6xxx_bus_ops { |