linux/drivers/net/ethernet/ti/cpts.h

/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * TI Common Platform Time Sync
 *
 * Copyright (C) 2012 Richard Cochran <[email protected]>
 *
 */
#ifndef _TI_CPTS_H_
#define _TI_CPTS_H_

#if IS_ENABLED(CONFIG_TI_CPTS)

#include <linux/clk.h>
#include <linux/clkdev.h>
#include <linux/clocksource.h>
#include <linux/device.h>
#include <linux/list.h>
#include <linux/of.h>
#include <linux/ptp_clock_kernel.h>
#include <linux/skbuff.h>
#include <linux/ptp_classify.h>
#include <linux/timecounter.h>

struct cpsw_cpts {};

/* Bit definitions for the IDVER register */
#define TX_IDENT_SHIFT
#define TX_IDENT_MASK
#define RTL_VER_SHIFT
#define RTL_VER_MASK
#define MAJOR_VER_SHIFT
#define MAJOR_VER_MASK
#define MINOR_VER_SHIFT
#define MINOR_VER_MASK

/* Bit definitions for the CONTROL register */
#define HW4_TS_PUSH_EN
#define HW3_TS_PUSH_EN
#define HW2_TS_PUSH_EN
#define HW1_TS_PUSH_EN
#define INT_TEST
#define CPTS_EN

/*
 * Definitions for the single bit resisters:
 * TS_PUSH TS_LOAD_EN  INTSTAT_RAW INTSTAT_MASKED INT_ENABLE EVENT_POP
 */
#define TS_PUSH
#define TS_LOAD_EN
#define TS_PEND_RAW
#define TS_PEND
#define TS_PEND_EN
#define EVENT_POP

/* Bit definitions for the EVENT_HIGH register */
#define PORT_NUMBER_SHIFT
#define PORT_NUMBER_MASK
#define EVENT_TYPE_SHIFT
#define EVENT_TYPE_MASK
#define MESSAGE_TYPE_SHIFT
#define MESSAGE_TYPE_MASK
#define SEQUENCE_ID_SHIFT
#define SEQUENCE_ID_MASK

enum {};

#define CPTS_FIFO_DEPTH
#define CPTS_MAX_EVENTS

struct cpts_event {};

struct cpts {};

void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb);
void cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb);
int cpts_register(struct cpts *cpts);
void cpts_unregister(struct cpts *cpts);
struct cpts *cpts_create(struct device *dev, void __iomem *regs,
			 struct device_node *node, u32 n_ext_ts);
void cpts_release(struct cpts *cpts);
void cpts_misc_interrupt(struct cpts *cpts);

static inline bool cpts_can_timestamp(struct cpts *cpts, struct sk_buff *skb)
{}

static inline void cpts_set_irqpoll(struct cpts *cpts, bool en)
{}

#else
struct cpts;

static inline void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb)
{
}
static inline void cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb)
{
}

static inline
struct cpts *cpts_create(struct device *dev, void __iomem *regs,
			 struct device_node *node, u32 n_ext_ts)
{
	return NULL;
}

static inline void cpts_release(struct cpts *cpts)
{
}

static inline int
cpts_register(struct cpts *cpts)
{
	return 0;
}

static inline void cpts_unregister(struct cpts *cpts)
{
}

static inline bool cpts_can_timestamp(struct cpts *cpts, struct sk_buff *skb)
{
	return false;
}

static inline void cpts_misc_interrupt(struct cpts *cpts)
{
}

static inline void cpts_set_irqpoll(struct cpts *cpts, bool en)
{
}
#endif


#endif