2020-05-01 23:50:06 +03:00
/* SPDX-License-Identifier: GPL-2.0+ */
/* TI K3 AM65 CPTS driver interface
*
* Copyright ( C ) 2020 Texas Instruments Incorporated - http : //www.ti.com
*/
# ifndef K3_CPTS_H_
# define K3_CPTS_H_
# include <linux/device.h>
# include <linux/of.h>
struct am65_cpts ;
2020-05-13 16:26:14 +03:00
struct am65_cpts_estf_cfg {
u64 ns_period ;
u64 ns_start ;
} ;
2020-05-01 23:50:06 +03:00
# if IS_ENABLED(CONFIG_TI_K3_AM65_CPTS)
struct am65_cpts * am65_cpts_create ( struct device * dev , void __iomem * regs ,
struct device_node * node ) ;
int am65_cpts_phc_index ( struct am65_cpts * cpts ) ;
void am65_cpts_tx_timestamp ( struct am65_cpts * cpts , struct sk_buff * skb ) ;
void am65_cpts_prep_tx_timestamp ( struct am65_cpts * cpts , struct sk_buff * skb ) ;
void am65_cpts_rx_enable ( struct am65_cpts * cpts , bool en ) ;
2020-05-13 16:26:14 +03:00
u64 am65_cpts_ns_gettime ( struct am65_cpts * cpts ) ;
int am65_cpts_estf_enable ( struct am65_cpts * cpts , int idx ,
struct am65_cpts_estf_cfg * cfg ) ;
void am65_cpts_estf_disable ( struct am65_cpts * cpts , int idx ) ;
2020-05-01 23:50:06 +03:00
# else
static inline struct am65_cpts * am65_cpts_create ( struct device * dev ,
void __iomem * regs ,
struct device_node * node )
{
return ERR_PTR ( - EOPNOTSUPP ) ;
}
static inline int am65_cpts_phc_index ( struct am65_cpts * cpts )
{
return - 1 ;
}
static inline void am65_cpts_tx_timestamp ( struct am65_cpts * cpts ,
struct sk_buff * skb )
{
}
static inline void am65_cpts_prep_tx_timestamp ( struct am65_cpts * cpts ,
struct sk_buff * skb )
{
}
static inline void am65_cpts_rx_enable ( struct am65_cpts * cpts , bool en )
{
}
2020-05-13 16:26:14 +03:00
2020-05-16 01:33:18 +03:00
static inline s64 am65_cpts_ns_gettime ( struct am65_cpts * cpts )
2020-05-13 16:26:14 +03:00
{
return 0 ;
}
2020-05-16 01:33:18 +03:00
static inline int am65_cpts_estf_enable ( struct am65_cpts * cpts , int idx ,
struct am65_cpts_estf_cfg * cfg )
2020-05-13 16:26:14 +03:00
{
return 0 ;
}
2020-05-16 01:33:18 +03:00
static inline void am65_cpts_estf_disable ( struct am65_cpts * cpts , int idx )
2020-05-13 16:26:14 +03:00
{
}
2020-05-01 23:50:06 +03:00
# endif
# endif /* K3_CPTS_H_ */