linux/drivers/net/ethernet/ti/icssg/icss_iep.c

// SPDX-License-Identifier: GPL-2.0

/* Texas Instruments ICSSG Industrial Ethernet Peripheral (IEP) Driver
 *
 * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com
 *
 */

#include <linux/bitops.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/timekeeping.h>
#include <linux/interrupt.h>
#include <linux/of_irq.h>
#include <linux/workqueue.h>

#include "icss_iep.h"

#define IEP_MAX_DEF_INC
#define IEP_MAX_COMPEN_INC
#define IEP_MAX_COMPEN_COUNT

#define IEP_GLOBAL_CFG_CNT_ENABLE
#define IEP_GLOBAL_CFG_DEFAULT_INC_MASK
#define IEP_GLOBAL_CFG_DEFAULT_INC_SHIFT
#define IEP_GLOBAL_CFG_COMPEN_INC_MASK
#define IEP_GLOBAL_CFG_COMPEN_INC_SHIFT

#define IEP_GLOBAL_STATUS_CNT_OVF

#define IEP_CMP_CFG_SHADOW_EN
#define IEP_CMP_CFG_CMP0_RST_CNT_EN
#define IEP_CMP_CFG_CMP_EN(cmp)

#define IEP_CMP_STATUS(cmp)

#define IEP_SYNC_CTRL_SYNC_EN
#define IEP_SYNC_CTRL_SYNC_N_EN(n)

#define IEP_MIN_CMP
#define IEP_MAX_CMP

#define ICSS_IEP_64BIT_COUNTER_SUPPORT
#define ICSS_IEP_SLOW_COMPEN_REG_SUPPORT
#define ICSS_IEP_SHADOW_MODE_SUPPORT

#define LATCH_INDEX(ts_index)
#define IEP_CAP_CFG_CAPNR_1ST_EVENT_EN(n)
#define IEP_CAP_CFG_CAP_ASYNC_EN(n)

/**
 * icss_iep_get_count_hi() - Get the upper 32 bit IEP counter
 * @iep: Pointer to structure representing IEP.
 *
 * Return: upper 32 bit IEP counter
 */
int icss_iep_get_count_hi(struct icss_iep *iep)
{}
EXPORT_SYMBOL_GPL();

/**
 * icss_iep_get_count_low() - Get the lower 32 bit IEP counter
 * @iep: Pointer to structure representing IEP.
 *
 * Return: lower 32 bit IEP counter
 */
int icss_iep_get_count_low(struct icss_iep *iep)
{}
EXPORT_SYMBOL_GPL();

/**
 * icss_iep_get_ptp_clock_idx() - Get PTP clock index using IEP driver
 * @iep: Pointer to structure representing IEP.
 *
 * Return: PTP clock index, -1 if not registered
 */
int icss_iep_get_ptp_clock_idx(struct icss_iep *iep)
{}
EXPORT_SYMBOL_GPL();

static void icss_iep_set_counter(struct icss_iep *iep, u64 ns)
{}

static void icss_iep_update_to_next_boundary(struct icss_iep *iep, u64 start_ns);

/**
 * icss_iep_settime() - Set time of the PTP clock using IEP driver
 * @iep: Pointer to structure representing IEP.
 * @ns: Time to be set in nanoseconds
 *
 * This API uses writel() instead of regmap_write() for write operations as
 * regmap_write() is too slow and this API is time sensitive.
 */
static void icss_iep_settime(struct icss_iep *iep, u64 ns)
{}

/**
 * icss_iep_gettime() - Get time of the PTP clock using IEP driver
 * @iep: Pointer to structure representing IEP.
 * @sts: Pointer to structure representing PTP system timestamp.
 *
 * This API uses readl() instead of regmap_read() for read operations as
 * regmap_read() is too slow and this API is time sensitive.
 *
 * Return: The current timestamp of the PTP clock using IEP driver
 */
static u64 icss_iep_gettime(struct icss_iep *iep,
			    struct ptp_system_timestamp *sts)
{}

static void icss_iep_enable(struct icss_iep *iep)
{}

static void icss_iep_disable(struct icss_iep *iep)
{}

static void icss_iep_enable_shadow_mode(struct icss_iep *iep)
{}

static void icss_iep_set_default_inc(struct icss_iep *iep, u8 def_inc)
{}

static void icss_iep_set_compensation_inc(struct icss_iep *iep, u16 compen_inc)
{}

static void icss_iep_set_compensation_count(struct icss_iep *iep,
					    u32 compen_count)
{}

static void icss_iep_set_slow_compensation_count(struct icss_iep *iep,
						 u32 compen_count)
{}

/* PTP PHC operations */
static int icss_iep_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
{}

static int icss_iep_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
{}

static int icss_iep_ptp_gettimeex(struct ptp_clock_info *ptp,
				  struct timespec64 *ts,
				  struct ptp_system_timestamp *sts)
{}

static int icss_iep_ptp_settime(struct ptp_clock_info *ptp,
				const struct timespec64 *ts)
{}

static void icss_iep_update_to_next_boundary(struct icss_iep *iep, u64 start_ns)
{}

static int icss_iep_perout_enable_hw(struct icss_iep *iep,
				     struct ptp_perout_request *req, int on)
{}

static int icss_iep_perout_enable(struct icss_iep *iep,
				  struct ptp_perout_request *req, int on)
{}

static void icss_iep_cap_cmp_work(struct work_struct *work)
{}

static irqreturn_t icss_iep_cap_cmp_irq(int irq, void *dev_id)
{}

static int icss_iep_pps_enable(struct icss_iep *iep, int on)
{}

static int icss_iep_extts_enable(struct icss_iep *iep, u32 index, int on)
{}

static int icss_iep_ptp_enable(struct ptp_clock_info *ptp,
			       struct ptp_clock_request *rq, int on)
{}

static struct ptp_clock_info icss_iep_ptp_info =;

struct icss_iep *icss_iep_get_idx(struct device_node *np, int idx)
{}
EXPORT_SYMBOL_GPL();

struct icss_iep *icss_iep_get(struct device_node *np)
{}
EXPORT_SYMBOL_GPL();

void icss_iep_put(struct icss_iep *iep)
{}
EXPORT_SYMBOL_GPL();

void icss_iep_init_fw(struct icss_iep *iep)
{}
EXPORT_SYMBOL_GPL();

void icss_iep_exit_fw(struct icss_iep *iep)
{}
EXPORT_SYMBOL_GPL();

int icss_iep_init(struct icss_iep *iep, const struct icss_iep_clockops *clkops,
		  void *clockops_data, u32 cycle_time_ns)
{}
EXPORT_SYMBOL_GPL();

int icss_iep_exit(struct icss_iep *iep)
{}
EXPORT_SYMBOL_GPL();

static int icss_iep_probe(struct platform_device *pdev)
{}

static bool am654_icss_iep_valid_reg(struct device *dev, unsigned int reg)
{}

static int icss_iep_regmap_write(void *context, unsigned int reg,
				 unsigned int val)
{}

static int icss_iep_regmap_read(void *context, unsigned int reg,
				unsigned int *val)
{}

static const struct regmap_config am654_icss_iep_regmap_config =;

static const struct icss_iep_plat_data am654_icss_iep_plat_data =;

static const struct of_device_id icss_iep_of_match[] =;
MODULE_DEVICE_TABLE(of, icss_iep_of_match);

static struct platform_driver icss_iep_driver =;
module_platform_driver();

MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_AUTHOR();