1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2021, Intel Corporation. */
15 /* Increment value to generate nanoseconds in the GLTSYN_TIME_L register for
16 * the E810 devices. Based off of a PLL with an 812.5 MHz frequency.
18 #define ICE_PTP_NOMINAL_INCVAL_E810 0x13b13b13bULL
20 /* Device agnostic functions */
21 u8 ice_get_ptp_src_clock_index(struct ice_hw *hw);
22 bool ice_ptp_lock(struct ice_hw *hw);
23 void ice_ptp_unlock(struct ice_hw *hw);
24 int ice_ptp_init_time(struct ice_hw *hw, u64 time);
25 int ice_ptp_write_incval(struct ice_hw *hw, u64 incval);
26 int ice_ptp_write_incval_locked(struct ice_hw *hw, u64 incval);
27 int ice_ptp_adj_clock(struct ice_hw *hw, s32 adj);
28 int ice_read_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx, u64 *tstamp);
29 int ice_clear_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx);
31 /* E810 family functions */
32 int ice_ptp_init_phy_e810(struct ice_hw *hw);
34 #define PFTSYN_SEM_BYTES 4
36 /* PHY timer commands */
39 /* Time Sync command Definitions */
40 #define GLTSYN_CMD_INIT_TIME BIT(0)
41 #define GLTSYN_CMD_INIT_INCVAL BIT(1)
42 #define GLTSYN_CMD_ADJ_TIME BIT(2)
43 #define GLTSYN_CMD_ADJ_INIT_TIME (BIT(2) | BIT(3))
44 #define GLTSYN_CMD_READ_TIME BIT(7)
46 #define TS_CMD_MASK_E810 0xFF
47 #define SYNC_EXEC_CMD 0x3
49 /* E810 timesync enable register */
50 #define ETH_GLTSYN_ENA(_i) (0x03000348 + ((_i) * 4))
52 /* E810 shadow init time registers */
53 #define ETH_GLTSYN_SHTIME_0(i) (0x03000368 + ((i) * 32))
54 #define ETH_GLTSYN_SHTIME_L(i) (0x0300036C + ((i) * 32))
56 /* E810 shadow time adjust registers */
57 #define ETH_GLTSYN_SHADJ_L(_i) (0x03000378 + ((_i) * 32))
58 #define ETH_GLTSYN_SHADJ_H(_i) (0x0300037C + ((_i) * 32))
60 /* E810 timer command register */
61 #define ETH_GLTSYN_CMD 0x03000344
63 /* Source timer incval macros */
64 #define INCVAL_HIGH_M 0xFF
66 /* Timestamp block macros */
67 #define TS_LOW_M 0xFFFFFFFF
70 #define BYTES_PER_IDX_ADDR_L_U 8
72 /* External PHY timestamp address */
73 #define TS_EXT(a, port, idx) ((a) + (0x1000 * (port)) + \
74 ((idx) * BYTES_PER_IDX_ADDR_L_U))
76 #define LOW_TX_MEMORY_BANK_START 0x03090000
77 #define HIGH_TX_MEMORY_BANK_START 0x03090004
79 #endif /* _ICE_PTP_HW_H_ */