1eac1ea20SChristian Eggers /* SPDX-License-Identifier: GPL-2.0 */ 2eac1ea20SChristian Eggers /* Microchip KSZ PTP register definitions 3eac1ea20SChristian Eggers * Copyright (C) 2022 Microchip Technology Inc. 4eac1ea20SChristian Eggers */ 5eac1ea20SChristian Eggers 6eac1ea20SChristian Eggers #ifndef __KSZ_PTP_REGS_H 7eac1ea20SChristian Eggers #define __KSZ_PTP_REGS_H 8eac1ea20SChristian Eggers 9*168a5940SArun Ramadoss #define REG_SW_GLOBAL_LED_OVR__4 0x0120 10*168a5940SArun Ramadoss #define LED_OVR_2 BIT(1) 11*168a5940SArun Ramadoss #define LED_OVR_1 BIT(0) 12*168a5940SArun Ramadoss 13*168a5940SArun Ramadoss #define REG_SW_GLOBAL_LED_SRC__4 0x0128 14*168a5940SArun Ramadoss #define LED_SRC_PTP_GPIO_1 BIT(3) 15*168a5940SArun Ramadoss #define LED_SRC_PTP_GPIO_2 BIT(2) 16*168a5940SArun Ramadoss 17eac1ea20SChristian Eggers /* 5 - PTP Clock */ 18eac1ea20SChristian Eggers #define REG_PTP_CLK_CTRL 0x0500 19eac1ea20SChristian Eggers 20eac1ea20SChristian Eggers #define PTP_STEP_ADJ BIT(6) 21eac1ea20SChristian Eggers #define PTP_STEP_DIR BIT(5) 22eac1ea20SChristian Eggers #define PTP_READ_TIME BIT(4) 23eac1ea20SChristian Eggers #define PTP_LOAD_TIME BIT(3) 24eac1ea20SChristian Eggers #define PTP_CLK_ADJ_ENABLE BIT(2) 25eac1ea20SChristian Eggers #define PTP_CLK_ENABLE BIT(1) 26eac1ea20SChristian Eggers #define PTP_CLK_RESET BIT(0) 27eac1ea20SChristian Eggers 28eac1ea20SChristian Eggers #define REG_PTP_RTC_SUB_NANOSEC__2 0x0502 29eac1ea20SChristian Eggers 30eac1ea20SChristian Eggers #define PTP_RTC_SUB_NANOSEC_M 0x0007 31eac1ea20SChristian Eggers #define PTP_RTC_0NS 0x00 32eac1ea20SChristian Eggers 33eac1ea20SChristian Eggers #define REG_PTP_RTC_NANOSEC 0x0504 34eac1ea20SChristian Eggers 35eac1ea20SChristian Eggers #define REG_PTP_RTC_SEC 0x0508 36eac1ea20SChristian Eggers 37eac1ea20SChristian Eggers #define REG_PTP_SUBNANOSEC_RATE 0x050C 38eac1ea20SChristian Eggers 39eac1ea20SChristian Eggers #define PTP_SUBNANOSEC_M 0x3FFFFFFF 40eac1ea20SChristian Eggers #define PTP_RATE_DIR BIT(31) 41eac1ea20SChristian Eggers #define PTP_TMP_RATE_ENABLE BIT(30) 42eac1ea20SChristian Eggers 43eac1ea20SChristian Eggers #define REG_PTP_SUBNANOSEC_RATE_L 0x050E 44eac1ea20SChristian Eggers 45eac1ea20SChristian Eggers #define REG_PTP_RATE_DURATION 0x0510 46eac1ea20SChristian Eggers #define REG_PTP_RATE_DURATION_H 0x0510 47eac1ea20SChristian Eggers #define REG_PTP_RATE_DURATION_L 0x0512 48eac1ea20SChristian Eggers 49eac1ea20SChristian Eggers #define REG_PTP_MSG_CONF1 0x0514 50eac1ea20SChristian Eggers 51eac1ea20SChristian Eggers #define PTP_802_1AS BIT(7) 52eac1ea20SChristian Eggers #define PTP_ENABLE BIT(6) 53eac1ea20SChristian Eggers #define PTP_ETH_ENABLE BIT(5) 54eac1ea20SChristian Eggers #define PTP_IPV4_UDP_ENABLE BIT(4) 55eac1ea20SChristian Eggers #define PTP_IPV6_UDP_ENABLE BIT(3) 56eac1ea20SChristian Eggers #define PTP_TC_P2P BIT(2) 57eac1ea20SChristian Eggers #define PTP_MASTER BIT(1) 58eac1ea20SChristian Eggers #define PTP_1STEP BIT(0) 59eac1ea20SChristian Eggers 601f12ae5bSChristian Eggers #define REG_PTP_UNIT_INDEX__4 0x0520 611f12ae5bSChristian Eggers 621f12ae5bSChristian Eggers #define PTP_GPIO_INDEX GENMASK(19, 16) 631f12ae5bSChristian Eggers #define PTP_TSI_INDEX BIT(8) 641f12ae5bSChristian Eggers #define PTP_TOU_INDEX GENMASK(1, 0) 651f12ae5bSChristian Eggers 661f12ae5bSChristian Eggers #define REG_PTP_TRIG_STATUS__4 0x0524 671f12ae5bSChristian Eggers 681f12ae5bSChristian Eggers #define TRIG_ERROR_M GENMASK(18, 16) 691f12ae5bSChristian Eggers #define TRIG_DONE_M GENMASK(2, 0) 701f12ae5bSChristian Eggers 711f12ae5bSChristian Eggers #define REG_PTP_INT_STATUS__4 0x0528 721f12ae5bSChristian Eggers 731f12ae5bSChristian Eggers #define TRIG_INT_M GENMASK(18, 16) 741f12ae5bSChristian Eggers #define TS_INT_M GENMASK(1, 0) 751f12ae5bSChristian Eggers 761f12ae5bSChristian Eggers #define REG_PTP_CTRL_STAT__4 0x052C 771f12ae5bSChristian Eggers 781f12ae5bSChristian Eggers #define GPIO_IN BIT(7) 791f12ae5bSChristian Eggers #define GPIO_OUT BIT(6) 801f12ae5bSChristian Eggers #define TS_INT_ENABLE BIT(5) 811f12ae5bSChristian Eggers #define TRIG_ACTIVE BIT(4) 821f12ae5bSChristian Eggers #define TRIG_ENABLE BIT(3) 831f12ae5bSChristian Eggers #define TRIG_RESET BIT(2) 841f12ae5bSChristian Eggers #define TS_ENABLE BIT(1) 851f12ae5bSChristian Eggers #define TS_RESET BIT(0) 861f12ae5bSChristian Eggers 871f12ae5bSChristian Eggers #define REG_TRIG_TARGET_NANOSEC 0x0530 881f12ae5bSChristian Eggers #define REG_TRIG_TARGET_SEC 0x0534 891f12ae5bSChristian Eggers 901f12ae5bSChristian Eggers #define REG_TRIG_CTRL__4 0x0538 911f12ae5bSChristian Eggers 921f12ae5bSChristian Eggers #define TRIG_CASCADE_ENABLE BIT(31) 931f12ae5bSChristian Eggers #define TRIG_CASCADE_TAIL BIT(30) 941f12ae5bSChristian Eggers #define TRIG_CASCADE_UPS_M GENMASK(29, 26) 951f12ae5bSChristian Eggers #define TRIG_NOW BIT(25) 961f12ae5bSChristian Eggers #define TRIG_NOTIFY BIT(24) 971f12ae5bSChristian Eggers #define TRIG_EDGE BIT(23) 981f12ae5bSChristian Eggers #define TRIG_PATTERN_M GENMASK(22, 20) 991f12ae5bSChristian Eggers #define TRIG_NEG_EDGE 0 1001f12ae5bSChristian Eggers #define TRIG_POS_EDGE 1 1011f12ae5bSChristian Eggers #define TRIG_NEG_PULSE 2 1021f12ae5bSChristian Eggers #define TRIG_POS_PULSE 3 1031f12ae5bSChristian Eggers #define TRIG_NEG_PERIOD 4 1041f12ae5bSChristian Eggers #define TRIG_POS_PERIOD 5 1051f12ae5bSChristian Eggers #define TRIG_REG_OUTPUT 6 1061f12ae5bSChristian Eggers #define TRIG_GPO_M GENMASK(19, 16) 1071f12ae5bSChristian Eggers #define TRIG_CASCADE_ITERATE_CNT_M GENMASK(15, 0) 1081f12ae5bSChristian Eggers 1091f12ae5bSChristian Eggers #define REG_TRIG_CYCLE_WIDTH 0x053C 1101f12ae5bSChristian Eggers #define TRIG_CYCLE_WIDTH_M GENMASK(31, 0) 1111f12ae5bSChristian Eggers 1121f12ae5bSChristian Eggers #define REG_TRIG_CYCLE_CNT 0x0540 1131f12ae5bSChristian Eggers 1141f12ae5bSChristian Eggers #define TRIG_CYCLE_CNT_M GENMASK(31, 16) 1151f12ae5bSChristian Eggers #define TRIG_BIT_PATTERN_M GENMASK(15, 0) 1161f12ae5bSChristian Eggers 1171f12ae5bSChristian Eggers #define REG_TRIG_ITERATE_TIME 0x0544 1181f12ae5bSChristian Eggers 1191f12ae5bSChristian Eggers #define REG_TRIG_PULSE_WIDTH__4 0x0548 1201f12ae5bSChristian Eggers 1211f12ae5bSChristian Eggers #define TRIG_PULSE_WIDTH_M GENMASK(23, 0) 1221f12ae5bSChristian Eggers 123cc13ab18SArun Ramadoss /* Port PTP Register */ 124cc13ab18SArun Ramadoss #define REG_PTP_PORT_RX_DELAY__2 0x0C00 125cc13ab18SArun Ramadoss #define REG_PTP_PORT_TX_DELAY__2 0x0C02 126cc13ab18SArun Ramadoss #define REG_PTP_PORT_ASYM_DELAY__2 0x0C04 127cc13ab18SArun Ramadoss 128cc13ab18SArun Ramadoss #define REG_PTP_PORT_XDELAY_TS 0x0C08 129cc13ab18SArun Ramadoss #define REG_PTP_PORT_SYNC_TS 0x0C0C 130cc13ab18SArun Ramadoss #define REG_PTP_PORT_PDRESP_TS 0x0C10 131cc13ab18SArun Ramadoss 132cc13ab18SArun Ramadoss #define REG_PTP_PORT_TX_INT_STATUS__2 0x0C14 133cc13ab18SArun Ramadoss #define REG_PTP_PORT_TX_INT_ENABLE__2 0x0C16 134cc13ab18SArun Ramadoss 135cc13ab18SArun Ramadoss #define PTP_PORT_SYNC_INT BIT(15) 136cc13ab18SArun Ramadoss #define PTP_PORT_XDELAY_REQ_INT BIT(14) 137cc13ab18SArun Ramadoss #define PTP_PORT_PDELAY_RESP_INT BIT(13) 138cc13ab18SArun Ramadoss #define KSZ_SYNC_MSG 2 139cc13ab18SArun Ramadoss #define KSZ_XDREQ_MSG 1 140cc13ab18SArun Ramadoss #define KSZ_PDRES_MSG 0 141cc13ab18SArun Ramadoss 142eac1ea20SChristian Eggers #endif 143