linux/include/linux/fsl/ptp_qoriq.h

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2010 OMICRON electronics GmbH
 * Copyright 2018 NXP
 */
#ifndef __PTP_QORIQ_H__
#define __PTP_QORIQ_H__

#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/ptp_clock_kernel.h>

/*
 * qoriq ptp registers
 */
struct ctrl_regs {};

struct alarm_regs {};

struct fiper_regs {};

struct etts_regs {};

struct ptp_qoriq_registers {};

/* Offset definitions for the four register groups */
#define ETSEC_CTRL_REGS_OFFSET
#define ETSEC_ALARM_REGS_OFFSET
#define ETSEC_FIPER_REGS_OFFSET
#define ETSEC_ETTS_REGS_OFFSET

#define CTRL_REGS_OFFSET
#define ALARM_REGS_OFFSET
#define FIPER_REGS_OFFSET
#define ETTS_REGS_OFFSET


/* Bit definitions for the TMR_CTRL register */
#define ALM1P
#define ALM2P
#define FIPERST
#define PP1L
#define PP2L
#define TCLK_PERIOD_SHIFT
#define TCLK_PERIOD_MASK
#define RTPE
#define FRD
#define ESFDP
#define ESFDE
#define ETEP2
#define ETEP1
#define COPH
#define CIPH
#define TMSR
#define BYP
#define TE
#define CKSEL_SHIFT
#define CKSEL_MASK

/* Bit definitions for the TMR_TEVENT register */
#define ETS2
#define ETS1
#define ALM2
#define ALM1
#define PP1
#define PP2
#define PP3

/* Bit definitions for the TMR_TEMASK register */
#define ETS2EN
#define ETS1EN
#define ALM2EN
#define ALM1EN
#define PP1EN
#define PP2EN

/* Bit definitions for the TMR_PEVENT register */
#define TXP2
#define TXP1
#define RXP

/* Bit definitions for the TMR_PEMASK register */
#define TXP2EN
#define TXP1EN
#define RXPEN

/* Bit definitions for the TMR_STAT register */
#define STAT_VEC_SHIFT
#define STAT_VEC_MASK
#define ETS1_VLD
#define ETS2_VLD

/* Bit definitions for the TMR_PRSC register */
#define PRSC_OCK_SHIFT
#define PRSC_OCK_MASK


#define DRIVER
#define N_EXT_TS

#define DEFAULT_CKSEL
#define DEFAULT_TMR_PRSC
#define DEFAULT_FIPER1_PERIOD
#define DEFAULT_FIPER2_PERIOD
#define DEFAULT_FIPER3_PERIOD

struct ptp_qoriq {};

static inline u32 qoriq_read_be(unsigned __iomem *addr)
{}

static inline void qoriq_write_be(unsigned __iomem *addr, u32 val)
{}

static inline u32 qoriq_read_le(unsigned __iomem *addr)
{}

static inline void qoriq_write_le(unsigned __iomem *addr, u32 val)
{}

irqreturn_t ptp_qoriq_isr(int irq, void *priv);
int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
		   const struct ptp_clock_info *caps);
void ptp_qoriq_free(struct ptp_qoriq *ptp_qoriq);
int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm);
int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta);
int ptp_qoriq_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts);
int ptp_qoriq_settime(struct ptp_clock_info *ptp,
		      const struct timespec64 *ts);
int ptp_qoriq_enable(struct ptp_clock_info *ptp,
		     struct ptp_clock_request *rq, int on);
int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index, bool update_event);
#ifdef CONFIG_DEBUG_FS
void ptp_qoriq_create_debugfs(struct ptp_qoriq *ptp_qoriq);
void ptp_qoriq_remove_debugfs(struct ptp_qoriq *ptp_qoriq);
#else
static inline void ptp_qoriq_create_debugfs(struct ptp_qoriq *ptp_qoriq)
{ }
static inline void ptp_qoriq_remove_debugfs(struct ptp_qoriq *ptp_qoriq)
{ }
#endif

#endif