linux/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c

// SPDX-License-Identifier: GPL-2.0-only
/* Atlantic Network Driver
 *
 * Copyright (C) 2014-2019 aQuantia Corporation
 * Copyright (C) 2019-2020 Marvell International Ltd.
 */

/* File aq_ptp.c:
 * Definition of functions for Linux PTP support.
 */

#include <linux/ptp_clock_kernel.h>
#include <linux/ptp_classify.h>
#include <linux/interrupt.h>
#include <linux/clocksource.h>

#include "aq_nic.h"
#include "aq_ptp.h"
#include "aq_ring.h"
#include "aq_phy.h"
#include "aq_filters.h"

#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)

#define AQ_PTP_TX_TIMEOUT

#define POLL_SYNC_TIMER_MS

enum ptp_speed_offsets {};

struct ptp_skb_ring {};

struct ptp_tx_timeout {};

struct aq_ptp_s {};

struct ptp_tm_offset {};

static struct ptp_tm_offset ptp_offset[6];

void aq_ptp_tm_offset_set(struct aq_nic_s *aq_nic, unsigned int mbps)
{}

static int __aq_ptp_skb_put(struct ptp_skb_ring *ring, struct sk_buff *skb)
{}

static int aq_ptp_skb_put(struct ptp_skb_ring *ring, struct sk_buff *skb)
{}

static struct sk_buff *__aq_ptp_skb_get(struct ptp_skb_ring *ring)
{}

static struct sk_buff *aq_ptp_skb_get(struct ptp_skb_ring *ring)
{}

static unsigned int aq_ptp_skb_buf_len(struct ptp_skb_ring *ring)
{}

static int aq_ptp_skb_ring_init(struct ptp_skb_ring *ring, unsigned int size)
{}

static void aq_ptp_skb_ring_clean(struct ptp_skb_ring *ring)
{}

static void aq_ptp_skb_ring_release(struct ptp_skb_ring *ring)
{}

static void aq_ptp_tx_timeout_init(struct ptp_tx_timeout *timeout)
{}

static void aq_ptp_tx_timeout_start(struct aq_ptp_s *aq_ptp)
{}

static void aq_ptp_tx_timeout_update(struct aq_ptp_s *aq_ptp)
{}

static void aq_ptp_tx_timeout_check(struct aq_ptp_s *aq_ptp)
{}

/* aq_ptp_adjfine
 * @ptp: the ptp clock structure
 * @ppb: parts per billion adjustment from base
 *
 * adjust the frequency of the ptp cycle counter by the
 * indicated ppb from the base frequency.
 */
static int aq_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
{}

/* aq_ptp_adjtime
 * @ptp: the ptp clock structure
 * @delta: offset to adjust the cycle counter by
 *
 * adjust the timer by resetting the timecounter structure.
 */
static int aq_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
{}

/* aq_ptp_gettime
 * @ptp: the ptp clock structure
 * @ts: timespec structure to hold the current time value
 *
 * read the timecounter and return the correct value on ns,
 * after converting it into a struct timespec.
 */
static int aq_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
{}

/* aq_ptp_settime
 * @ptp: the ptp clock structure
 * @ts: the timespec containing the new time for the cycle counter
 *
 * reset the timecounter to use a new base value instead of the kernel
 * wall timer value.
 */
static int aq_ptp_settime(struct ptp_clock_info *ptp,
			  const struct timespec64 *ts)
{}

static void aq_ptp_convert_to_hwtstamp(struct aq_ptp_s *aq_ptp,
				       struct skb_shared_hwtstamps *hwtstamp,
				       u64 timestamp)
{}

static int aq_ptp_hw_pin_conf(struct aq_nic_s *aq_nic, u32 pin_index, u64 start,
			      u64 period)
{}

static int aq_ptp_perout_pin_configure(struct ptp_clock_info *ptp,
				       struct ptp_clock_request *rq, int on)
{}

static int aq_ptp_pps_pin_configure(struct ptp_clock_info *ptp,
				    struct ptp_clock_request *rq, int on)
{}

static void aq_ptp_extts_pin_ctrl(struct aq_ptp_s *aq_ptp)
{}

static int aq_ptp_extts_pin_configure(struct ptp_clock_info *ptp,
				      struct ptp_clock_request *rq, int on)
{}

/* aq_ptp_gpio_feature_enable
 * @ptp: the ptp clock structure
 * @rq: the requested feature to change
 * @on: whether to enable or disable the feature
 */
static int aq_ptp_gpio_feature_enable(struct ptp_clock_info *ptp,
				      struct ptp_clock_request *rq, int on)
{}

/* aq_ptp_verify
 * @ptp: the ptp clock structure
 * @pin: index of the pin in question
 * @func: the desired function to use
 * @chan: the function channel index to use
 */
static int aq_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin,
			 enum ptp_pin_function func, unsigned int chan)
{}

/* aq_ptp_tx_hwtstamp - utility function which checks for TX time stamp
 * @adapter: the private adapter struct
 *
 * if the timestamp is valid, we convert it into the timecounter ns
 * value, then store that result into the hwtstamps structure which
 * is passed up the network stack
 */
void aq_ptp_tx_hwtstamp(struct aq_nic_s *aq_nic, u64 timestamp)
{}

/* aq_ptp_rx_hwtstamp - utility function which checks for RX time stamp
 * @adapter: pointer to adapter struct
 * @shhwtstamps: particular skb_shared_hwtstamps to save timestamp
 *
 * if the timestamp is valid, we convert it into the timecounter ns
 * value, then store that result into the hwtstamps structure which
 * is passed up the network stack
 */
static void aq_ptp_rx_hwtstamp(struct aq_ptp_s *aq_ptp, struct skb_shared_hwtstamps *shhwtstamps,
			       u64 timestamp)
{}

void aq_ptp_hwtstamp_config_get(struct aq_ptp_s *aq_ptp,
				struct hwtstamp_config *config)
{}

static void aq_ptp_prepare_filters(struct aq_ptp_s *aq_ptp)
{}

int aq_ptp_hwtstamp_config_set(struct aq_ptp_s *aq_ptp,
			       struct hwtstamp_config *config)
{}

bool aq_ptp_ring(struct aq_nic_s *aq_nic, struct aq_ring_s *ring)
{}

u16 aq_ptp_extract_ts(struct aq_nic_s *aq_nic, struct skb_shared_hwtstamps *shhwtstamps, u8 *p,
		      unsigned int len)
{}

static int aq_ptp_poll(struct napi_struct *napi, int budget)
{}

static irqreturn_t aq_ptp_isr(int irq, void *private)
{}

int aq_ptp_xmit(struct aq_nic_s *aq_nic, struct sk_buff *skb)
{}

void aq_ptp_service_task(struct aq_nic_s *aq_nic)
{}

int aq_ptp_irq_alloc(struct aq_nic_s *aq_nic)
{}

void aq_ptp_irq_free(struct aq_nic_s *aq_nic)
{}

int aq_ptp_ring_init(struct aq_nic_s *aq_nic)
{}

int aq_ptp_ring_start(struct aq_nic_s *aq_nic)
{}

void aq_ptp_ring_stop(struct aq_nic_s *aq_nic)
{}

void aq_ptp_ring_deinit(struct aq_nic_s *aq_nic)
{}

int aq_ptp_ring_alloc(struct aq_nic_s *aq_nic)
{}

void aq_ptp_ring_free(struct aq_nic_s *aq_nic)
{}

#define MAX_PTP_GPIO_COUNT

static struct ptp_clock_info aq_ptp_clock =;

#define ptp_offset_init(__idx, __mbps, __egress, __ingress)

static void aq_ptp_offset_init_from_fw(const struct hw_atl_ptp_offset *offsets)
{}

static void aq_ptp_offset_init(const struct hw_atl_ptp_offset *offsets)
{}

static void aq_ptp_gpio_init(struct ptp_clock_info *info,
			     struct hw_atl_info *hw_info)
{}

void aq_ptp_clock_init(struct aq_nic_s *aq_nic)
{}

static void aq_ptp_poll_sync_work_cb(struct work_struct *w);

int aq_ptp_init(struct aq_nic_s *aq_nic, unsigned int idx_vec)
{}

void aq_ptp_unregister(struct aq_nic_s *aq_nic)
{}

void aq_ptp_free(struct aq_nic_s *aq_nic)
{}

struct ptp_clock *aq_ptp_get_ptp_clock(struct aq_ptp_s *aq_ptp)
{}

/* PTP external GPIO nanoseconds count */
static uint64_t aq_ptp_get_sync1588_ts(struct aq_nic_s *aq_nic)
{}

static void aq_ptp_start_work(struct aq_ptp_s *aq_ptp)
{}

int aq_ptp_link_change(struct aq_nic_s *aq_nic)
{}

static bool aq_ptp_sync_ts_updated(struct aq_ptp_s *aq_ptp, u64 *new_ts)
{}

static int aq_ptp_check_sync1588(struct aq_ptp_s *aq_ptp)
{}

static void aq_ptp_poll_sync_work_cb(struct work_struct *w)
{}

int aq_ptp_get_ring_cnt(struct aq_nic_s *aq_nic, const enum atl_ring_type ring_type)
{}

u64 *aq_ptp_get_stats(struct aq_nic_s *aq_nic, u64 *data)
{}

#endif