Skip to content

Commit 60942c3

Browse files
Raju Lakkarajudavem330
authored andcommitted
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: Raju Lakkaraju <[email protected]> Reported-by: kernel test robot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d808f7c commit 60942c3

File tree

3 files changed

+386
-36
lines changed

3 files changed

+386
-36
lines changed

drivers/net/ethernet/microchip/lan743x_main.h

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,18 @@
358358
#define PTP_GENERAL_CONFIG_RELOAD_ADD_X_(channel) (BIT((channel) << 2))
359359

360360
#define PTP_INT_STS (0x0A08)
361+
#define PTP_INT_IO_FE_MASK_ GENMASK(31, 24)
362+
#define PTP_INT_IO_FE_SHIFT_ (24)
363+
#define PTP_INT_IO_FE_SET_(channel) BIT(24 + (channel))
364+
#define PTP_INT_IO_RE_MASK_ GENMASK(23, 16)
365+
#define PTP_INT_IO_RE_SHIFT_ (16)
366+
#define PTP_INT_IO_RE_SET_(channel) BIT(16 + (channel))
361367
#define PTP_INT_EN_SET (0x0A0C)
368+
#define PTP_INT_EN_FE_EN_SET_(channel) BIT(24 + (channel))
369+
#define PTP_INT_EN_RE_EN_SET_(channel) BIT(16 + (channel))
362370
#define PTP_INT_EN_CLR (0x0A10)
371+
#define PTP_INT_EN_FE_EN_CLR_(channel) BIT(24 + (channel))
372+
#define PTP_INT_EN_RE_EN_CLR_(channel) BIT(16 + (channel))
363373
#define PTP_INT_BIT_TX_SWTS_ERR_ BIT(13)
364374
#define PTP_INT_BIT_TX_TS_ BIT(12)
365375
#define PTP_INT_BIT_TIMER_B_ BIT(1)
@@ -377,6 +387,16 @@
377387
#define PTP_CLOCK_TARGET_NS_X(channel) (0x0A34 + ((channel) << 4))
378388
#define PTP_CLOCK_TARGET_RELOAD_SEC_X(channel) (0x0A38 + ((channel) << 4))
379389
#define PTP_CLOCK_TARGET_RELOAD_NS_X(channel) (0x0A3C + ((channel) << 4))
390+
#define PTP_LTC_SET_SEC_HI (0x0A50)
391+
#define PTP_LTC_SET_SEC_HI_SEC_47_32_MASK_ GENMASK(15, 0)
392+
#define PTP_VERSION (0x0A54)
393+
#define PTP_VERSION_TX_UP_MASK_ GENMASK(31, 24)
394+
#define PTP_VERSION_TX_LO_MASK_ GENMASK(23, 16)
395+
#define PTP_VERSION_RX_UP_MASK_ GENMASK(15, 8)
396+
#define PTP_VERSION_RX_LO_MASK_ GENMASK(7, 0)
397+
#define PTP_IO_SEL (0x0A58)
398+
#define PTP_IO_SEL_MASK_ GENMASK(10, 8)
399+
#define PTP_IO_SEL_SHIFT_ (8)
380400
#define PTP_LATENCY (0x0A5C)
381401
#define PTP_LATENCY_TX_SET_(tx_latency) (((u32)(tx_latency)) << 16)
382402
#define PTP_LATENCY_RX_SET_(rx_latency) \
@@ -401,6 +421,59 @@
401421
#define PTP_TX_MSG_HEADER_MSG_TYPE_ (0x000F0000)
402422
#define PTP_TX_MSG_HEADER_MSG_TYPE_SYNC_ (0x00000000)
403423

424+
#define PTP_TX_CAP_INFO (0x0AB8)
425+
#define PTP_TX_CAP_INFO_TX_CH_MASK_ GENMASK(1, 0)
426+
#define PTP_TX_DOMAIN (0x0ABC)
427+
#define PTP_TX_DOMAIN_MASK_ GENMASK(23, 16)
428+
#define PTP_TX_DOMAIN_RANGE_EN_ BIT(15)
429+
#define PTP_TX_DOMAIN_RANGE_MASK_ GENMASK(7, 0)
430+
#define PTP_TX_SDOID (0x0AC0)
431+
#define PTP_TX_SDOID_MASK_ GENMASK(23, 16)
432+
#define PTP_TX_SDOID_RANGE_EN_ BIT(15)
433+
#define PTP_TX_SDOID_11_0_MASK_ GENMASK(7, 0)
434+
#define PTP_IO_CAP_CONFIG (0x0AC4)
435+
#define PTP_IO_CAP_CONFIG_LOCK_FE_(channel) BIT(24 + (channel))
436+
#define PTP_IO_CAP_CONFIG_LOCK_RE_(channel) BIT(16 + (channel))
437+
#define PTP_IO_CAP_CONFIG_FE_CAP_EN_(channel) BIT(8 + (channel))
438+
#define PTP_IO_CAP_CONFIG_RE_CAP_EN_(channel) BIT(0 + (channel))
439+
#define PTP_IO_RE_LTC_SEC_CAP_X (0x0AC8)
440+
#define PTP_IO_RE_LTC_NS_CAP_X (0x0ACC)
441+
#define PTP_IO_FE_LTC_SEC_CAP_X (0x0AD0)
442+
#define PTP_IO_FE_LTC_NS_CAP_X (0x0AD4)
443+
#define PTP_IO_EVENT_OUTPUT_CFG (0x0AD8)
444+
#define PTP_IO_EVENT_OUTPUT_CFG_SEL_(channel) BIT(16 + (channel))
445+
#define PTP_IO_EVENT_OUTPUT_CFG_EN_(channel) BIT(0 + (channel))
446+
#define PTP_IO_PIN_CFG (0x0ADC)
447+
#define PTP_IO_PIN_CFG_OBUF_TYPE_(channel) BIT(0 + (channel))
448+
#define PTP_LTC_RD_SEC_HI (0x0AF0)
449+
#define PTP_LTC_RD_SEC_HI_SEC_47_32_MASK_ GENMASK(15, 0)
450+
#define PTP_LTC_RD_SEC_LO (0x0AF4)
451+
#define PTP_LTC_RD_NS (0x0AF8)
452+
#define PTP_LTC_RD_NS_29_0_MASK_ GENMASK(29, 0)
453+
#define PTP_LTC_RD_SUBNS (0x0AFC)
454+
#define PTP_RX_USER_MAC_HI (0x0B00)
455+
#define PTP_RX_USER_MAC_HI_47_32_MASK_ GENMASK(15, 0)
456+
#define PTP_RX_USER_MAC_LO (0x0B04)
457+
#define PTP_RX_USER_IP_ADDR_0 (0x0B20)
458+
#define PTP_RX_USER_IP_ADDR_1 (0x0B24)
459+
#define PTP_RX_USER_IP_ADDR_2 (0x0B28)
460+
#define PTP_RX_USER_IP_ADDR_3 (0x0B2C)
461+
#define PTP_RX_USER_IP_MASK_0 (0x0B30)
462+
#define PTP_RX_USER_IP_MASK_1 (0x0B34)
463+
#define PTP_RX_USER_IP_MASK_2 (0x0B38)
464+
#define PTP_RX_USER_IP_MASK_3 (0x0B3C)
465+
#define PTP_TX_USER_MAC_HI (0x0B40)
466+
#define PTP_TX_USER_MAC_HI_47_32_MASK_ GENMASK(15, 0)
467+
#define PTP_TX_USER_MAC_LO (0x0B44)
468+
#define PTP_TX_USER_IP_ADDR_0 (0x0B60)
469+
#define PTP_TX_USER_IP_ADDR_1 (0x0B64)
470+
#define PTP_TX_USER_IP_ADDR_2 (0x0B68)
471+
#define PTP_TX_USER_IP_ADDR_3 (0x0B6C)
472+
#define PTP_TX_USER_IP_MASK_0 (0x0B70)
473+
#define PTP_TX_USER_IP_MASK_1 (0x0B74)
474+
#define PTP_TX_USER_IP_MASK_2 (0x0B78)
475+
#define PTP_TX_USER_IP_MASK_3 (0x0B7C)
476+
404477
#define DMAC_CFG (0xC00)
405478
#define DMAC_CFG_COAL_EN_ BIT(16)
406479
#define DMAC_CFG_CH_ARB_SEL_RX_HIGH_ (0x00000000)

0 commit comments

Comments
 (0)