0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef _HELLCREEK_HWTSTAMP_H_
0013 #define _HELLCREEK_HWTSTAMP_H_
0014
0015 #include <net/dsa.h>
0016 #include "hellcreek.h"
0017
0018
0019 #define PR_TS_RX_P1_STATUS_C (0x1d * 2)
0020 #define PR_TS_RX_P1_DATA_C (0x1e * 2)
0021 #define PR_TS_TX_P1_STATUS_C (0x1f * 2)
0022 #define PR_TS_TX_P1_DATA_C (0x20 * 2)
0023 #define PR_TS_RX_P2_STATUS_C (0x25 * 2)
0024 #define PR_TS_RX_P2_DATA_C (0x26 * 2)
0025 #define PR_TS_TX_P2_STATUS_C (0x27 * 2)
0026 #define PR_TS_TX_P2_DATA_C (0x28 * 2)
0027
0028 #define PR_TS_STATUS_TS_AVAIL BIT(2)
0029 #define PR_TS_STATUS_TS_LOST BIT(3)
0030
0031 #define SKB_PTP_TYPE(__skb) (*(unsigned int *)((__skb)->cb))
0032
0033
0034
0035
0036
0037
0038 #define TX_TSTAMP_TIMEOUT msecs_to_jiffies(40)
0039
0040 int hellcreek_port_hwtstamp_set(struct dsa_switch *ds, int port,
0041 struct ifreq *ifr);
0042 int hellcreek_port_hwtstamp_get(struct dsa_switch *ds, int port,
0043 struct ifreq *ifr);
0044
0045 bool hellcreek_port_rxtstamp(struct dsa_switch *ds, int port,
0046 struct sk_buff *clone, unsigned int type);
0047 void hellcreek_port_txtstamp(struct dsa_switch *ds, int port,
0048 struct sk_buff *skb);
0049
0050 int hellcreek_get_ts_info(struct dsa_switch *ds, int port,
0051 struct ethtool_ts_info *info);
0052
0053 long hellcreek_hwtstamp_work(struct ptp_clock_info *ptp);
0054
0055 int hellcreek_hwtstamp_setup(struct hellcreek *chip);
0056 void hellcreek_hwtstamp_free(struct hellcreek *chip);
0057
0058 #endif