summaryrefslogtreecommitdiff
path: root/drivers/ptp/ptp_sysfs.c
diff options
context:
space:
mode:
authorGerhard Engleder <gerhard@engleder-embedded.com>2022-05-06 22:01:37 +0200
committerPaolo Abeni <pabeni@redhat.com>2022-05-10 09:48:08 +0200
commit42704b26b0f1d891f6cf4ebc877dbac0d17c690d (patch)
tree283ba260e6ab1b1add2628846ae4cabd657e12ed /drivers/ptp/ptp_sysfs.c
parentb3552d6a3b8bd4260a971f1f70140ed3513cc4f7 (diff)
ptp: Add cycles support for virtual clocks
ptp vclocks require a free running time for their timecounter. Currently only a physical clock forced to free running is supported. If vclocks are used, then the physical clock cannot be synchronized anymore. The synchronized time is not available in hardware in this case. As a result, timed transmission with TAPRIO hardware support is not possible anymore. If hardware would support a free running time additionally to the physical clock, then the physical clock does not need to be forced to free running. Thus, the physical clocks can still be synchronized while vclocks are in use. The physical clock could be used to synchronize the time domain of the TSN network and trigger TAPRIO. In parallel vclocks can be used to synchronize other time domains. Introduce support for a free running cycle counter called cycles to physical clocks. Rework ptp vclocks to use this free running cycle counter. Default implementation is based on time of physical clock. Thus, behavior of ptp vclocks based on physical clocks without free running cycle counter is identical to previous behavior. Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/ptp/ptp_sysfs.c')
-rw-r--r--drivers/ptp/ptp_sysfs.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
index 9233bfedeb17..f30b0a439470 100644
--- a/drivers/ptp/ptp_sysfs.c
+++ b/drivers/ptp/ptp_sysfs.c
@@ -231,10 +231,13 @@ static ssize_t n_vclocks_store(struct device *dev,
*(ptp->vclock_index + ptp->n_vclocks - i) = -1;
}
- if (num == 0)
- dev_info(dev, "only physical clock in use now\n");
- else
- dev_info(dev, "guarantee physical clock free running\n");
+ /* Need to inform about changed physical clock behavior */
+ if (!ptp->has_cycles) {
+ if (num == 0)
+ dev_info(dev, "only physical clock in use now\n");
+ else
+ dev_info(dev, "guarantee physical clock free running\n");
+ }
ptp->n_vclocks = num;
mutex_unlock(&ptp->n_vclocks_mux);