/* * cxgb4_ptp.c:Chelsio PTP support for T5/T6 * * Copyright (c) 2003-2017 Chelsio Communications, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Written by: Atul Gupta (atul.gupta@chelsio.com)
*/
/** * cxgb4_ptp_adjfine - Adjust frequency of PHC cycle counter * @ptp: ptp clock structure * @scaled_ppm: Desired frequency in scaled parts per billion * * Adjust the frequency of the PHC cycle counter by the indicated amount from * the base frequency. * * Scaled parts per million is ppm with a 16-bit binary fractional field.
*/ staticint cxgb4_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
{ struct adapter *adapter = (struct adapter *)container_of(ptp, struct adapter, ptp_clock_info);
s32 ppb = scaled_ppm_to_ppb(scaled_ppm); struct fw_ptp_cmd c; int err;
/** * cxgb4_ptp_fineadjtime - Shift the time of the hardware clock * @adapter: board private structure * @delta: Desired change in nanoseconds * * Adjust the timer by resetting the timecounter structure.
*/ staticint cxgb4_ptp_fineadjtime(struct adapter *adapter, s64 delta)
{ struct fw_ptp_cmd c; int err;
/** * cxgb4_ptp_gettime - Reads the current time from the hardware clock * @ptp: ptp clock structure * @ts: timespec structure to hold the current time value * * Read the timecounter and return the correct value in ns after converting * it into a struct timespec.
*/ staticint cxgb4_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
{ struct adapter *adapter = container_of(ptp, struct adapter,
ptp_clock_info);
u64 ns;
/* convert to timespec*/
*ts = ns_to_timespec64(ns); return 0;
}
/** * cxgb4_ptp_settime - Set the current time on the hardware clock * @ptp: ptp clock structure * @ts: timespec containing the new time for the cycle counter * * Reset value to new base value instead of the kernel * wall timer value.
*/ staticint cxgb4_ptp_settime(struct ptp_clock_info *ptp, conststruct timespec64 *ts)
{ struct adapter *adapter = (struct adapter *)container_of(ptp, struct adapter, ptp_clock_info); struct fw_ptp_cmd c;
u64 ns; int err;
/** * cxgb4_ptp_enable - enable or disable an ancillary feature * @ptp: ptp clock structure * @request: Desired resource to enable or disable * @on: Caller passes one to enable or zero to disable * * Enable (or disable) ancillary features of the PHC subsystem. * Currently, no ancillary features are supported.
*/ staticint cxgb4_ptp_enable(struct ptp_clock_info __always_unused *ptp, struct ptp_clock_request __always_unused *request, int __always_unused on)
{ return -ENOTSUPP;
}
/** * cxgb4_ptp_init - initialize PTP for devices which support it * @adapter: board private structure * * This function performs the required steps for enabling PTP support.
*/ void cxgb4_ptp_init(struct adapter *adapter)
{ struct timespec64 now; /* no need to create a clock device if we already have one */ if (!IS_ERR_OR_NULL(adapter->ptp_clock)) return;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.