drivers/net/dsa/hirschmann/hellcreek_hwtstamp.h

Source file repositories/reference/linux-study-clean/drivers/net/dsa/hirschmann/hellcreek_hwtstamp.h

File Facts

System
Linux kernel
Corpus path
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.h
Extension
.h
Size
1931 bytes
Lines
60
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

#ifndef _HELLCREEK_HWTSTAMP_H_
#define _HELLCREEK_HWTSTAMP_H_

#include <net/dsa.h>
#include "hellcreek.h"

/* Timestamp Register */
#define PR_TS_RX_P1_STATUS_C	(0x1d * 2)
#define PR_TS_RX_P1_DATA_C	(0x1e * 2)
#define PR_TS_TX_P1_STATUS_C	(0x1f * 2)
#define PR_TS_TX_P1_DATA_C	(0x20 * 2)
#define PR_TS_RX_P2_STATUS_C	(0x25 * 2)
#define PR_TS_RX_P2_DATA_C	(0x26 * 2)
#define PR_TS_TX_P2_STATUS_C	(0x27 * 2)
#define PR_TS_TX_P2_DATA_C	(0x28 * 2)

#define PR_TS_STATUS_TS_AVAIL	BIT(2)
#define PR_TS_STATUS_TS_LOST	BIT(3)

#define SKB_PTP_TYPE(__skb) (*(unsigned int *)((__skb)->cb))

/* TX_TSTAMP_TIMEOUT: This limits the time spent polling for a TX
 * timestamp. When working properly, hardware will produce a timestamp
 * within 1ms. Software may enounter delays, so the timeout is set
 * accordingly.
 */
#define TX_TSTAMP_TIMEOUT	msecs_to_jiffies(40)

int hellcreek_port_hwtstamp_set(struct dsa_switch *ds, int port,
				struct kernel_hwtstamp_config *config,
				struct netlink_ext_ack *extack);
int hellcreek_port_hwtstamp_get(struct dsa_switch *ds, int port,
				struct kernel_hwtstamp_config *config);

bool hellcreek_port_rxtstamp(struct dsa_switch *ds, int port,
			     struct sk_buff *clone, unsigned int type);
void hellcreek_port_txtstamp(struct dsa_switch *ds, int port,
			     struct sk_buff *skb);

int hellcreek_get_ts_info(struct dsa_switch *ds, int port,
			  struct kernel_ethtool_ts_info *info);

long hellcreek_hwtstamp_work(struct ptp_clock_info *ptp);

int hellcreek_hwtstamp_setup(struct hellcreek *chip);
void hellcreek_hwtstamp_free(struct hellcreek *chip);

#endif /* _HELLCREEK_HWTSTAMP_H_ */

Annotation

Implementation Notes