#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)
{ … }
static int aq_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
{ … }
static int aq_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
{ … }
static int aq_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
{ … }
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)
{ … }
static int aq_ptp_gpio_feature_enable(struct ptp_clock_info *ptp,
struct ptp_clock_request *rq, int on)
{ … }
static int aq_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin,
enum ptp_pin_function func, unsigned int chan)
{ … }
void aq_ptp_tx_hwtstamp(struct aq_nic_s *aq_nic, u64 timestamp)
{ … }
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)
{ … }
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