Commit 60942c39 authored by Raju Lakkaraju's avatar Raju Lakkaraju Committed by David S. Miller

net: lan743x: Add support for PTP-IO Event Input External Timestamp (extts)

PTP-IOs block provides for time stamping PTP-IO input events.
PTP-IOs are numbered from 0 to 11.
When a PTP-IO is enabled by the corresponding bit in the PTP-IO
Capture Configuration Register, a rising or falling edge,
respectively, will capture the 1588 Local Time Counter
Signed-off-by: default avatarRaju Lakkaraju <Raju.Lakkaraju@microchip.com>
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d808f7ca
......@@ -358,8 +358,18 @@
#define PTP_GENERAL_CONFIG_RELOAD_ADD_X_(channel) (BIT((channel) << 2))
#define PTP_INT_STS (0x0A08)
#define PTP_INT_IO_FE_MASK_ GENMASK(31, 24)
#define PTP_INT_IO_FE_SHIFT_ (24)
#define PTP_INT_IO_FE_SET_(channel) BIT(24 + (channel))
#define PTP_INT_IO_RE_MASK_ GENMASK(23, 16)
#define PTP_INT_IO_RE_SHIFT_ (16)
#define PTP_INT_IO_RE_SET_(channel) BIT(16 + (channel))
#define PTP_INT_EN_SET (0x0A0C)
#define PTP_INT_EN_FE_EN_SET_(channel) BIT(24 + (channel))
#define PTP_INT_EN_RE_EN_SET_(channel) BIT(16 + (channel))
#define PTP_INT_EN_CLR (0x0A10)
#define PTP_INT_EN_FE_EN_CLR_(channel) BIT(24 + (channel))
#define PTP_INT_EN_RE_EN_CLR_(channel) BIT(16 + (channel))
#define PTP_INT_BIT_TX_SWTS_ERR_ BIT(13)
#define PTP_INT_BIT_TX_TS_ BIT(12)
#define PTP_INT_BIT_TIMER_B_ BIT(1)
......@@ -377,6 +387,16 @@
#define PTP_CLOCK_TARGET_NS_X(channel) (0x0A34 + ((channel) << 4))
#define PTP_CLOCK_TARGET_RELOAD_SEC_X(channel) (0x0A38 + ((channel) << 4))
#define PTP_CLOCK_TARGET_RELOAD_NS_X(channel) (0x0A3C + ((channel) << 4))
#define PTP_LTC_SET_SEC_HI (0x0A50)
#define PTP_LTC_SET_SEC_HI_SEC_47_32_MASK_ GENMASK(15, 0)
#define PTP_VERSION (0x0A54)
#define PTP_VERSION_TX_UP_MASK_ GENMASK(31, 24)
#define PTP_VERSION_TX_LO_MASK_ GENMASK(23, 16)
#define PTP_VERSION_RX_UP_MASK_ GENMASK(15, 8)
#define PTP_VERSION_RX_LO_MASK_ GENMASK(7, 0)
#define PTP_IO_SEL (0x0A58)
#define PTP_IO_SEL_MASK_ GENMASK(10, 8)
#define PTP_IO_SEL_SHIFT_ (8)
#define PTP_LATENCY (0x0A5C)
#define PTP_LATENCY_TX_SET_(tx_latency) (((u32)(tx_latency)) << 16)
#define PTP_LATENCY_RX_SET_(rx_latency) \
......@@ -401,6 +421,59 @@
#define PTP_TX_MSG_HEADER_MSG_TYPE_ (0x000F0000)
#define PTP_TX_MSG_HEADER_MSG_TYPE_SYNC_ (0x00000000)
#define PTP_TX_CAP_INFO (0x0AB8)
#define PTP_TX_CAP_INFO_TX_CH_MASK_ GENMASK(1, 0)
#define PTP_TX_DOMAIN (0x0ABC)
#define PTP_TX_DOMAIN_MASK_ GENMASK(23, 16)
#define PTP_TX_DOMAIN_RANGE_EN_ BIT(15)
#define PTP_TX_DOMAIN_RANGE_MASK_ GENMASK(7, 0)
#define PTP_TX_SDOID (0x0AC0)
#define PTP_TX_SDOID_MASK_ GENMASK(23, 16)
#define PTP_TX_SDOID_RANGE_EN_ BIT(15)
#define PTP_TX_SDOID_11_0_MASK_ GENMASK(7, 0)
#define PTP_IO_CAP_CONFIG (0x0AC4)
#define PTP_IO_CAP_CONFIG_LOCK_FE_(channel) BIT(24 + (channel))
#define PTP_IO_CAP_CONFIG_LOCK_RE_(channel) BIT(16 + (channel))
#define PTP_IO_CAP_CONFIG_FE_CAP_EN_(channel) BIT(8 + (channel))
#define PTP_IO_CAP_CONFIG_RE_CAP_EN_(channel) BIT(0 + (channel))
#define PTP_IO_RE_LTC_SEC_CAP_X (0x0AC8)
#define PTP_IO_RE_LTC_NS_CAP_X (0x0ACC)
#define PTP_IO_FE_LTC_SEC_CAP_X (0x0AD0)
#define PTP_IO_FE_LTC_NS_CAP_X (0x0AD4)
#define PTP_IO_EVENT_OUTPUT_CFG (0x0AD8)
#define PTP_IO_EVENT_OUTPUT_CFG_SEL_(channel) BIT(16 + (channel))
#define PTP_IO_EVENT_OUTPUT_CFG_EN_(channel) BIT(0 + (channel))
#define PTP_IO_PIN_CFG (0x0ADC)
#define PTP_IO_PIN_CFG_OBUF_TYPE_(channel) BIT(0 + (channel))
#define PTP_LTC_RD_SEC_HI (0x0AF0)
#define PTP_LTC_RD_SEC_HI_SEC_47_32_MASK_ GENMASK(15, 0)
#define PTP_LTC_RD_SEC_LO (0x0AF4)
#define PTP_LTC_RD_NS (0x0AF8)
#define PTP_LTC_RD_NS_29_0_MASK_ GENMASK(29, 0)
#define PTP_LTC_RD_SUBNS (0x0AFC)
#define PTP_RX_USER_MAC_HI (0x0B00)
#define PTP_RX_USER_MAC_HI_47_32_MASK_ GENMASK(15, 0)
#define PTP_RX_USER_MAC_LO (0x0B04)
#define PTP_RX_USER_IP_ADDR_0 (0x0B20)
#define PTP_RX_USER_IP_ADDR_1 (0x0B24)
#define PTP_RX_USER_IP_ADDR_2 (0x0B28)
#define PTP_RX_USER_IP_ADDR_3 (0x0B2C)
#define PTP_RX_USER_IP_MASK_0 (0x0B30)
#define PTP_RX_USER_IP_MASK_1 (0x0B34)
#define PTP_RX_USER_IP_MASK_2 (0x0B38)
#define PTP_RX_USER_IP_MASK_3 (0x0B3C)
#define PTP_TX_USER_MAC_HI (0x0B40)
#define PTP_TX_USER_MAC_HI_47_32_MASK_ GENMASK(15, 0)
#define PTP_TX_USER_MAC_LO (0x0B44)
#define PTP_TX_USER_IP_ADDR_0 (0x0B60)
#define PTP_TX_USER_IP_ADDR_1 (0x0B64)
#define PTP_TX_USER_IP_ADDR_2 (0x0B68)
#define PTP_TX_USER_IP_ADDR_3 (0x0B6C)
#define PTP_TX_USER_IP_MASK_0 (0x0B70)
#define PTP_TX_USER_IP_MASK_1 (0x0B74)
#define PTP_TX_USER_IP_MASK_2 (0x0B78)
#define PTP_TX_USER_IP_MASK_3 (0x0B7C)
#define DMAC_CFG (0xC00)
#define DMAC_CFG_COAL_EN_ BIT(16)
#define DMAC_CFG_CH_ARB_SEL_RX_HIGH_ (0x00000000)
......
......@@ -18,6 +18,9 @@
*/
#define LAN743X_PTP_N_EVENT_CHAN 2
#define LAN743X_PTP_N_PEROUT LAN743X_PTP_N_EVENT_CHAN
#define LAN743X_PTP_N_EXTTS 4
#define LAN743X_PTP_N_PPS 0
#define PCI11X1X_PTP_IO_MAX_CHANNELS 8
struct lan743x_adapter;
......@@ -60,6 +63,11 @@ struct lan743x_ptp_perout {
int gpio_pin; /* GPIO pin where output appears */
};
struct lan743x_extts {
int flags;
struct timespec64 ts;
};
struct lan743x_ptp {
int flags;
......@@ -72,6 +80,7 @@ struct lan743x_ptp {
unsigned long used_event_ch;
struct lan743x_ptp_perout perout[LAN743X_PTP_N_PEROUT];
struct lan743x_extts extts[LAN743X_PTP_N_EXTTS];
bool leds_multiplexed;
bool led_enabled[LAN7430_N_LED];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment