net: dsa: mv88e6xxx: extend PTP gettime function to read system clock
Subsystems (4)
PATCH 1/1 net: dsa: mv88e6xxx: extend PTP gettime function to read system clock
This adds support for the PTP_SYS_OFFSET_EXTENDED ioctl.
Signed-off-by Hubert Feurstein <[email protected]>
--- drivers/net/dsa/mv88e6xxx/ptp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/dsa/mv88e6xxx/ptp.c +7 -4
@@ -230,14 +230,17 @@ static int mv88e6xxx_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)return 0 ; } -static int mv88e6xxx_ptp_gettime (struct ptp_clock_info *ptp, -struct timespec64 *ts) +static int mv88e6xxx_ptp_gettimex (struct ptp_clock_info *ptp, +struct timespec64 *ts, +struct ptp_system_timestamp *sts) {struct mv88e6xxx_chip *chip =ptp_to_chip (ptp);u64 ns;mv88e6xxx_reg_lock (chip); +ptp_read_system_prets (sts); ns =timecounter_read (&chip->tstamp_tc); +ptp_read_system_postts (sts);mv88e6xxx_reg_unlock (chip); *ts =ns_to_timespec64 (ns);
@@ -386,7 +389,7 @@ static void mv88e6xxx_ptp_overflow_check(struct work_struct *work)struct mv88e6xxx_chip *chip =dw_overflow_to_chip (dw);struct timespec64 ts; -mv88e6xxx_ptp_gettime (&chip->ptp_clock_info, &ts); +mv88e6xxx_ptp_gettimex (&chip->ptp_clock_info, &ts,NULL );schedule_delayed_work (&chip->overflow_work,MV88E6XXX_TAI_OVERFLOW_PERIOD );
@@ -444,7 +447,7 @@ int mv88e6xxx_ptp_setup(struct mv88e6xxx_chip *chip) chip->ptp_clock_info.max_adj =MV88E6XXX_MAX_ADJ_PPB ; chip->ptp_clock_info.adjfine = mv88e6xxx_ptp_adjfine; chip->ptp_clock_info.adjtime = mv88e6xxx_ptp_adjtime; - chip->ptp_clock_info.gettime64 = mv88e6xxx_ptp_gettime; + chip->ptp_clock_info.gettimex64 = mv88e6xxx_ptp_gettimex; chip->ptp_clock_info.settime64 = mv88e6xxx_ptp_settime; chip->ptp_clock_info.enable = ptp_ops->ptp_enable; chip->ptp_clock_info.verify = ptp_ops->ptp_verify;
Signature · 1 line
2.22.0
Andrew Lunn
maintainerQuoted 3 lines · Hubert Feurstein
This adds support for the
PTP_SYS_OFFSET_EXTENDEDioctl.Signed-off-by Hubert Feurstein <[email protected]>
Please include the PTP maintainer for patches like this. Richard also wrote this PTP code.
Andrew
Quoted 49 lines
--- drivers/net/dsa/mv88e6xxx/ptp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)drivers/net/dsa/mv88e6xxx/ptp.c +7
-4@@ -230,14 +230,17 @@ static int mv88e6xxx_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)return 0 ; } -static int mv88e6xxx_ptp_gettime (struct ptp_clock_info *ptp, -struct timespec64 *ts) +static int mv88e6xxx_ptp_gettimex (struct ptp_clock_info *ptp, +struct timespec64 *ts, +struct ptp_system_timestamp *sts) {struct mv88e6xxx_chip *chip =ptp_to_chip (ptp);u64 ns;mv88e6xxx_reg_lock (chip); +ptp_read_system_prets (sts); ns =timecounter_read (&chip->tstamp_tc); +ptp_read_system_postts (sts);mv88e6xxx_reg_unlock (chip); *ts =ns_to_timespec64 (ns);@@ -386,7 +389,7 @@ static void mv88e6xxx_ptp_overflow_check(struct work_struct *work)struct mv88e6xxx_chip *chip =dw_overflow_to_chip (dw);struct timespec64 ts; -mv88e6xxx_ptp_gettime (&chip->ptp_clock_info, &ts); +mv88e6xxx_ptp_gettimex (&chip->ptp_clock_info, &ts,NULL );schedule_delayed_work (&chip->overflow_work,MV88E6XXX_TAI_OVERFLOW_PERIOD );@@ -444,7 +447,7 @@ int mv88e6xxx_ptp_setup(struct mv88e6xxx_chip *chip) chip->ptp_clock_info.max_adj =MV88E6XXX_MAX_ADJ_PPB ; chip->ptp_clock_info.adjfine = mv88e6xxx_ptp_adjfine; chip->ptp_clock_info.adjtime = mv88e6xxx_ptp_adjtime; - chip->ptp_clock_info.gettime64 = mv88e6xxx_ptp_gettime; + chip->ptp_clock_info.gettimex64 = mv88e6xxx_ptp_gettimex; chip->ptp_clock_info.settime64 = mv88e6xxx_ptp_settime; chip->ptp_clock_info.enable = ptp_ops->ptp_enable; chip->ptp_clock_info.verify = ptp_ops->ptp_verify;Signature · 1 line
2.22.0
David Miller
maintainerFrom: Hubert Feurstein <[email protected]>
Date: Tue, 30 Jul 2019 12:10:07 +0200
Quoted 3 lines
This adds support for the
PTP_SYS_OFFSET_EXTENDEDioctl.Signed-off-by Hubert Feurstein <[email protected]>
This patch applies neither to net nor net-next.