linux/include/soc/mscc/ocelot_ptp.h

/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
/*
 * Microsemi Ocelot Switch driver
 *
 * License: Dual MIT/GPL
 * Copyright (c) 2017 Microsemi Corporation
 * Copyright 2020 NXP
 */

#ifndef _MSCC_OCELOT_PTP_H_
#define _MSCC_OCELOT_PTP_H_

#include <linux/ptp_clock_kernel.h>
#include <soc/mscc/ocelot.h>

#define OCELOT_MAX_PTP_ID
#define OCELOT_PTP_FIFO_SIZE

#define PTP_PIN_CFG_RSZ
#define PTP_PIN_TOD_SEC_MSB_RSZ
#define PTP_PIN_TOD_SEC_LSB_RSZ
#define PTP_PIN_TOD_NSEC_RSZ
#define PTP_PIN_WF_HIGH_PERIOD_RSZ
#define PTP_PIN_WF_LOW_PERIOD_RSZ

#define PTP_PIN_CFG_DOM
#define PTP_PIN_CFG_SYNC
#define PTP_PIN_CFG_ACTION(x)
#define PTP_PIN_CFG_ACTION_MASK

enum {};

#define PTP_CFG_MISC_PTP_EN

#define PTP_CFG_CLK_ADJ_CFG_ENA
#define PTP_CFG_CLK_ADJ_CFG_DIR

#define PTP_CFG_CLK_ADJ_FREQ_NS

int ocelot_ptp_gettime64(struct ptp_clock_info *ptp, struct timespec64 *ts);
int ocelot_ptp_settime64(struct ptp_clock_info *ptp,
			 const struct timespec64 *ts);
int ocelot_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta);
int ocelot_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm);
int ocelot_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin,
		      enum ptp_pin_function func, unsigned int chan);
int ocelot_ptp_enable(struct ptp_clock_info *ptp,
		      struct ptp_clock_request *rq, int on);
int ocelot_init_timestamp(struct ocelot *ocelot,
			  const struct ptp_clock_info *info);
int ocelot_deinit_timestamp(struct ocelot *ocelot);
#endif