mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
nvidia-oot: add nvpps and ptp driver
Using this patch we are adding support for ptp and nvpps driver in oot kernel. JIRA ESLC-6885 Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com> Change-Id: Id47ac5602d11ce417f9d421b4f672578922ca94f Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2785318 Reviewed-by: Bitan Biswas <bbiswas@nvidia.com> Reviewed-by: David Tao <tehyut@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
77001d121e
commit
a2fdb986b0
20
include/linux/nvpps.h
Normal file
20
include/linux/nvpps.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __NVPPS_H__
|
||||
#define __NVPPS_H__
|
||||
|
||||
/*
|
||||
* Get PTP time
|
||||
* Clients may call the API every and anytime PTP time is needed.
|
||||
* If PTP time source is not registered, returns -EINVAL
|
||||
*
|
||||
* This API is available irrespective of nvpps dt availablity
|
||||
* When nvpps dt node is not present, interface name will
|
||||
* default to "eth0".
|
||||
*/
|
||||
int nvpps_get_ptp_ts(void *ts);
|
||||
|
||||
#endif /* __NVPPS_H__ */
|
||||
50
include/linux/platform/tegra/ptp-notifier.h
Normal file
50
include/linux/platform/tegra/ptp-notifier.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __PTP_NOTIFIER_H
|
||||
#define __PTP_NOTIFIER_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/etherdevice.h>
|
||||
|
||||
#define PTP_HWTIME 1
|
||||
#define PTP_TSC_HWTIME 2
|
||||
#define TSC_HIGH_SHIFT 32U
|
||||
|
||||
/** Max of 5 interfaces created per IP multiply by number of IP */
|
||||
#define MAX_MAC_INSTANCES 25
|
||||
|
||||
/**
|
||||
* @brief ptp_tsc_data - Struture used to store TSC and PTP time
|
||||
* information.
|
||||
*/
|
||||
struct ptp_tsc_data {
|
||||
/** PTP TimeStamp in nSec*/
|
||||
u64 ptp_ts;
|
||||
/** TSC TimeStamp in nSec*/
|
||||
u64 tsc_ts;
|
||||
};
|
||||
|
||||
/* register / unregister HW time source */
|
||||
void tegra_register_hwtime_source(int (*func)(struct net_device *, void *, int),
|
||||
struct net_device *dev);
|
||||
void tegra_unregister_hwtime_source(struct net_device *dev);
|
||||
|
||||
/* clients registering / unregistering for time update events */
|
||||
int tegra_register_hwtime_notifier(struct notifier_block *nb);
|
||||
int tegra_unregister_hwtime_notifier(struct notifier_block *nb);
|
||||
|
||||
/* Notify time updates to registered clients */
|
||||
int tegra_hwtime_notifier_call_chain(unsigned int val, void *v);
|
||||
|
||||
/*
|
||||
* Get HW time counter.
|
||||
* Clients may call the API every anytime PTP/TSC time is needed.
|
||||
* If HW time source is not registered, returns -EINVAL
|
||||
*/
|
||||
int tegra_get_hwtime(const char *intf_name, void *ts, int ts_type);
|
||||
|
||||
#endif /* __PTP_NOTIFIER_H */
|
||||
96
include/linux/tegra-gte.h
Normal file
96
include/linux/tegra-gte.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_TEGRA_GTE_ENGINE_H
|
||||
#define _LINUX_TEGRA_GTE_ENGINE_H
|
||||
|
||||
#include <linux/device.h>
|
||||
|
||||
struct tegra_gte_ev_desc {
|
||||
int id;
|
||||
u32 ev_bit;
|
||||
u32 slice;
|
||||
};
|
||||
|
||||
/* GTE hardware timestamping event details */
|
||||
struct tegra_gte_ev_detail {
|
||||
u64 ts_raw; /* raw counter value */
|
||||
u64 ts_ns; /* counter value converted into nano seconds */
|
||||
int dir; /* direction of the event */
|
||||
};
|
||||
|
||||
#ifdef CONFIG_TEGRA_HTS_GTE
|
||||
/*
|
||||
* GTE event registration function
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* Input:
|
||||
* @np: device node of the interested GTE device
|
||||
* @ev_id: event id
|
||||
*
|
||||
* Returns:
|
||||
* Returns ERR_PTR in case of failure or valid
|
||||
* struct tegra_gte_ev_desc for success.
|
||||
*
|
||||
* Note: API is not stable and subject to change.
|
||||
*/
|
||||
struct tegra_gte_ev_desc *tegra_gte_register_event(struct device_node *np,
|
||||
u32 ev_id);
|
||||
|
||||
/*
|
||||
* GTE event un-registration function
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* Input:
|
||||
* @desc: This parameter should be the same as returned from register
|
||||
*
|
||||
* Returns:
|
||||
* Returns 0 for success and any other value for the failure
|
||||
*
|
||||
* Note: API is not stable and subject to change.
|
||||
*/
|
||||
int tegra_gte_unregister_event(struct tegra_gte_ev_desc *desc);
|
||||
|
||||
/*
|
||||
* GTE event retrieval function
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* Input:
|
||||
* @desc: This parameter should be the same as returned from register
|
||||
*
|
||||
* Output:
|
||||
* @hts: hts event details
|
||||
*
|
||||
* Returns:
|
||||
* Returns 0 for success and any other value for the failure
|
||||
*
|
||||
* Note: API is not stable and subject to change.
|
||||
*/
|
||||
int tegra_gte_retrieve_event(const struct tegra_gte_ev_desc *desc,
|
||||
struct tegra_gte_ev_detail *hts);
|
||||
|
||||
#else /* ! CONFIG_TEGRA_HTS_GTE */
|
||||
static inline struct tegra_gte_ev_desc *tegra_gte_register_event(
|
||||
struct device_node *np, u32 ev_id)
|
||||
{
|
||||
return ERR_PTR(-ENOSYS);
|
||||
}
|
||||
|
||||
static inline int tegra_gte_unregister_event(struct tegra_gte_ev_desc *desc)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static inline int tegra_gte_retrieve_event(const struct tegra_gte_ev_desc *desc,
|
||||
struct tegra_gte_ev_detail *hts)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
#endif /* ! CONFIG_TEGRA_HTS_GTE */
|
||||
#endif
|
||||
Reference in New Issue
Block a user