File Index
Files and directories
Sign in
FILE

hellcreek_hwtstamp.h

File preview with syntax highlighting.

linux-6.19.14/drivers/net/dsa/hirschmann/hellcreek_hwtstamp.h C
 1/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
 2/*
 3 * DSA driver for:
 4 * Hirschmann Hellcreek TSN switch.
 5 *
 6 * Copyright (C) 2019,2020 Hochschule Offenburg
 7 * Copyright (C) 2019,2020 Linutronix GmbH
 8 * Authors: Kurt Kanzenbach <kurt@linutronix.de>
 9 *	    Kamil Alkhouri <kamil.alkhouri@hs-offenburg.de>
10 */
11
12#ifndef _HELLCREEK_HWTSTAMP_H_
13#define _HELLCREEK_HWTSTAMP_H_
14
15#include <net/dsa.h>
16#include "hellcreek.h"
17
18/* Timestamp Register */
19#define PR_TS_RX_P1_STATUS_C	(0x1d * 2)
20#define PR_TS_RX_P1_DATA_C	(0x1e * 2)
21#define PR_TS_TX_P1_STATUS_C	(0x1f * 2)
22#define PR_TS_TX_P1_DATA_C	(0x20 * 2)
23#define PR_TS_RX_P2_STATUS_C	(0x25 * 2)
24#define PR_TS_RX_P2_DATA_C	(0x26 * 2)
25#define PR_TS_TX_P2_STATUS_C	(0x27 * 2)
26#define PR_TS_TX_P2_DATA_C	(0x28 * 2)
27
28#define PR_TS_STATUS_TS_AVAIL	BIT(2)
29#define PR_TS_STATUS_TS_LOST	BIT(3)
30
31#define SKB_PTP_TYPE(__skb) (*(unsigned int *)((__skb)->cb))
32
33/* TX_TSTAMP_TIMEOUT: This limits the time spent polling for a TX
34 * timestamp. When working properly, hardware will produce a timestamp
35 * within 1ms. Software may enounter delays, so the timeout is set
36 * accordingly.
37 */
38#define TX_TSTAMP_TIMEOUT	msecs_to_jiffies(40)
39
40int hellcreek_port_hwtstamp_set(struct dsa_switch *ds, int port,
41				struct kernel_hwtstamp_config *config,
42				struct netlink_ext_ack *extack);
43int hellcreek_port_hwtstamp_get(struct dsa_switch *ds, int port,
44				struct kernel_hwtstamp_config *config);
45
46bool hellcreek_port_rxtstamp(struct dsa_switch *ds, int port,
47			     struct sk_buff *clone, unsigned int type);
48void hellcreek_port_txtstamp(struct dsa_switch *ds, int port,
49			     struct sk_buff *skb);
50
51int hellcreek_get_ts_info(struct dsa_switch *ds, int port,
52			  struct kernel_ethtool_ts_info *info);
53
54long hellcreek_hwtstamp_work(struct ptp_clock_info *ptp);
55
56int hellcreek_hwtstamp_setup(struct hellcreek *chip);
57void hellcreek_hwtstamp_free(struct hellcreek *chip);
58
59#endif /* _HELLCREEK_HWTSTAMP_H_ */
~/ Read-only file preview.