#define pr_fmt(fmt) …
#include <linux/crc32.h>
#include <linux/ethtool.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/mii.h>
#include <linux/module.h>
#include <linux/net_tstamp.h>
#include <linux/netdevice.h>
#include <linux/if_vlan.h>
#include <linux/phy.h>
#include <linux/ptp_classify.h>
#include <linux/ptp_clock_kernel.h>
#include "dp83640_reg.h"
#define DP83640_PHY_ID …
#define PAGESEL …
#define MAX_RXTS …
#define N_EXT_TS …
#define N_PER_OUT …
#define PSF_PTPVER …
#define PSF_EVNT …
#define PSF_RX …
#define PSF_TX …
#define EXT_EVENT …
#define CAL_EVENT …
#define CAL_TRIGGER …
#define DP83640_N_PINS …
#define MII_DP83640_MICR …
#define MII_DP83640_MISR …
#define MII_DP83640_MICR_OE …
#define MII_DP83640_MICR_IE …
#define MII_DP83640_MISR_RHF_INT_EN …
#define MII_DP83640_MISR_FHF_INT_EN …
#define MII_DP83640_MISR_ANC_INT_EN …
#define MII_DP83640_MISR_DUP_INT_EN …
#define MII_DP83640_MISR_SPD_INT_EN …
#define MII_DP83640_MISR_LINK_INT_EN …
#define MII_DP83640_MISR_ED_INT_EN …
#define MII_DP83640_MISR_LQ_INT_EN …
#define MII_DP83640_MISR_ANC_INT …
#define MII_DP83640_MISR_DUP_INT …
#define MII_DP83640_MISR_SPD_INT …
#define MII_DP83640_MISR_LINK_INT …
#define MII_DP83640_MISR_INT_MASK …
#define ADJTIME_FIX …
#define SKB_TIMESTAMP_TIMEOUT …
#if defined(__BIG_ENDIAN)
#define ENDIAN_FLAG …
#elif defined(__LITTLE_ENDIAN)
#define ENDIAN_FLAG …
#endif
struct dp83640_skb_info { … };
struct phy_rxts { … };
struct phy_txts { … };
struct rxts { … };
struct dp83640_clock;
struct dp83640_private { … };
struct dp83640_clock { … };
enum { … };
static int chosen_phy = …;
static ushort gpio_tab[GPIO_TABLE_SIZE] = …;
module_param(chosen_phy, int, 0444);
module_param_array(…);
MODULE_PARM_DESC(…) …;
MODULE_PARM_DESC(…) …;
static void dp83640_gpio_defaults(struct ptp_pin_desc *pd)
{ … }
static LIST_HEAD(phyter_clocks);
static DEFINE_MUTEX(phyter_clocks_lock);
static void rx_timestamp_work(struct work_struct *work);
#define BROADCAST_ADDR …
static inline int broadcast_write(struct phy_device *phydev, u32 regnum,
u16 val)
{ … }
static int ext_read(struct phy_device *phydev, int page, u32 regnum)
{ … }
static void ext_write(int broadcast, struct phy_device *phydev,
int page, u32 regnum, u16 val)
{ … }
static int tdr_write(int bc, struct phy_device *dev,
const struct timespec64 *ts, u16 cmd)
{ … }
static void phy2rxts(struct phy_rxts *p, struct rxts *rxts)
{ … }
static u64 phy2txts(struct phy_txts *p)
{ … }
static int periodic_output(struct dp83640_clock *clock,
struct ptp_clock_request *clkreq, bool on,
int trigger)
{ … }
static int ptp_dp83640_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
{ … }
static int ptp_dp83640_adjtime(struct ptp_clock_info *ptp, s64 delta)
{ … }
static int ptp_dp83640_gettime(struct ptp_clock_info *ptp,
struct timespec64 *ts)
{ … }
static int ptp_dp83640_settime(struct ptp_clock_info *ptp,
const struct timespec64 *ts)
{ … }
static int ptp_dp83640_enable(struct ptp_clock_info *ptp,
struct ptp_clock_request *rq, int on)
{ … }
static int ptp_dp83640_verify(struct ptp_clock_info *ptp, unsigned int pin,
enum ptp_pin_function func, unsigned int chan)
{ … }
static u8 status_frame_dst[6] = …;
static u8 status_frame_src[6] = …;
static void enable_status_frames(struct phy_device *phydev, bool on)
{ … }
static bool is_status_frame(struct sk_buff *skb, int type)
{ … }
static int expired(struct rxts *rxts)
{ … }
static void prune_rx_ts(struct dp83640_private *dp83640)
{ … }
static void enable_broadcast(struct phy_device *phydev, int init_page, int on)
{ … }
static void recalibrate(struct dp83640_clock *clock)
{ … }
static inline u16 exts_chan_to_edata(int ch)
{ … }
static int decode_evnt(struct dp83640_private *dp83640,
void *data, int len, u16 ests)
{ … }
#define DP83640_PACKET_HASH_LEN …
static int match(struct sk_buff *skb, unsigned int type, struct rxts *rxts)
{ … }
static void decode_rxts(struct dp83640_private *dp83640,
struct phy_rxts *phy_rxts)
{ … }
static void decode_txts(struct dp83640_private *dp83640,
struct phy_txts *phy_txts)
{ … }
static void decode_status_frame(struct dp83640_private *dp83640,
struct sk_buff *skb)
{ … }
static void dp83640_free_clocks(void)
{ … }
static void dp83640_clock_init(struct dp83640_clock *clock, struct mii_bus *bus)
{ … }
static int choose_this_phy(struct dp83640_clock *clock,
struct phy_device *phydev)
{ … }
static struct dp83640_clock *dp83640_clock_get(struct dp83640_clock *clock)
{ … }
static struct dp83640_clock *dp83640_clock_get_bus(struct mii_bus *bus)
{ … }
static void dp83640_clock_put(struct dp83640_clock *clock)
{ … }
static int dp83640_soft_reset(struct phy_device *phydev)
{ … }
static int dp83640_config_init(struct phy_device *phydev)
{ … }
static int dp83640_ack_interrupt(struct phy_device *phydev)
{ … }
static int dp83640_config_intr(struct phy_device *phydev)
{ … }
static irqreturn_t dp83640_handle_interrupt(struct phy_device *phydev)
{ … }
static int dp83640_hwtstamp(struct mii_timestamper *mii_ts,
struct kernel_hwtstamp_config *cfg,
struct netlink_ext_ack *extack)
{ … }
static void rx_timestamp_work(struct work_struct *work)
{ … }
static bool dp83640_rxtstamp(struct mii_timestamper *mii_ts,
struct sk_buff *skb, int type)
{ … }
static void dp83640_txtstamp(struct mii_timestamper *mii_ts,
struct sk_buff *skb, int type)
{ … }
static int dp83640_ts_info(struct mii_timestamper *mii_ts,
struct kernel_ethtool_ts_info *info)
{ … }
static int dp83640_probe(struct phy_device *phydev)
{ … }
static void dp83640_remove(struct phy_device *phydev)
{ … }
static struct phy_driver dp83640_driver = …;
static int __init dp83640_init(void)
{ … }
static void __exit dp83640_exit(void)
{ … }
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
module_init(…) …;
module_exit(dp83640_exit);
static struct mdio_device_id __maybe_unused dp83640_tbl[] = …;
MODULE_DEVICE_TABLE(mdio, dp83640_tbl);