net: ethernet: ti: introduce am654 common platform time sync driver

The CPTS module is used to facilitate host control of time sync operations.
Main features of CPTS module are:
- selection of multiple external clock sources
- control of time sync events via interrupt or polling
- 64-bit timestamp mode in ns with HW PPM and nudge adjustment.
- hardware timestamp ext. inputs (HWx_TS_PUSH)
- timestamp Generator function outputs (TS_GENFx)
Depending on integration it enables compliance with the IEEE 1588-2008
standard for a precision clock synchronization protocol, Ethernet Enhanced
Scheduled Traffic Operations (CPTS_ESTFn) and PCIe Subsystem Precision Time
Measurement (PTM).

Introduced driver provides Linux PTP hardware clock for each CPTS device
and network packets timestamping where applicable. CPTS PTP hardware clock
supports following operations:
    - Set time
    - Get time
    - Shift the clock by a given offset atomically
    - Adjust clock frequency
    - Time stamp external events
    - Periodic output signals

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Grygorii Strashko 2020-05-01 23:50:06 +03:00 committed by David S. Miller
parent 6e87ac748e
commit f6bd59526c
4 changed files with 1106 additions and 0 deletions

View File

@ -110,6 +110,20 @@ config TI_K3_AM65_CPSW_NUSS
To compile this driver as a module, choose M here: the module
will be called ti-am65-cpsw-nuss.
config TI_K3_AM65_CPTS
tristate "TI K3 AM65x CPTS"
depends on ARCH_K3 && OF && PTP_1588_CLOCK
depends on PTP_1588_CLOCK
select NET_PTP_CLASSIFY
help
Say y here to support the TI K3 AM65x CPTS with 1588 features such as
PTP hardware clock for each CPTS device and network packets
timestamping where applicable.
Depending on integration CPTS blocks enable compliance with
the IEEE 1588-2008 standard for a precision clock synchronization
protocol, Ethernet Enhanced Scheduled Traffic Operations (CPTS_ESTFn)
and PCIe Subsystem Precision Time Measurement (PTM).
config TI_KEYSTONE_NETCP
tristate "TI Keystone NETCP Core Support"
select TI_DAVINCI_MDIO

View File

@ -26,3 +26,4 @@ keystone_netcp_ethss-y := netcp_ethss.o netcp_sgmii.o netcp_xgbepcsr.o cpsw_ale.
obj-$(CONFIG_TI_K3_AM65_CPSW_NUSS) += ti-am65-cpsw-nuss.o
ti-am65-cpsw-nuss-y := am65-cpsw-nuss.o cpsw_sl.o am65-cpsw-ethtool.o cpsw_ale.o k3-cppi-desc-pool.o
obj-$(CONFIG_TI_K3_AM65_CPTS) += am65-cpts.o

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,50 @@
/* 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;
#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);
#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)
{
}
#endif
#endif /* K3_CPTS_H_ */