Lines Matching refs:p_hwfn
26 static enum qed_resc_lock qed_ptcdev_to_resc(struct qed_hwfn *p_hwfn) in qed_ptcdev_to_resc() argument
28 switch (MFW_PORT(p_hwfn)) { in qed_ptcdev_to_resc()
42 static int qed_ptp_res_lock(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) in qed_ptp_res_lock() argument
48 resource = qed_ptcdev_to_resc(p_hwfn); in qed_ptp_res_lock()
54 rc = qed_mcp_resc_lock(p_hwfn, p_ptt, ¶ms); in qed_ptp_res_lock()
61 if (p_hwfn->abs_pf_id < p_hwfn->cdev->num_ports_in_engine) in qed_ptp_res_lock()
64 DP_INFO(p_hwfn, "PF doesn't have lock ownership\n"); in qed_ptp_res_lock()
67 DP_INFO(p_hwfn, "Failed to acquire ptp resource lock\n"); in qed_ptp_res_lock()
74 static int qed_ptp_res_unlock(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) in qed_ptp_res_unlock() argument
80 resource = qed_ptcdev_to_resc(p_hwfn); in qed_ptp_res_unlock()
86 rc = qed_mcp_resc_unlock(p_hwfn, p_ptt, ¶ms); in qed_ptp_res_unlock()
89 if (p_hwfn->abs_pf_id < p_hwfn->cdev->num_ports_in_engine) { in qed_ptp_res_unlock()
92 DP_INFO(p_hwfn, "PF doesn't have lock ownership\n"); in qed_ptp_res_unlock()
96 DP_INFO(p_hwfn, "Failed to release the ptp resource lock\n"); in qed_ptp_res_unlock()
105 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_ptp_hw_read_rx_ts() local
106 struct qed_ptt *p_ptt = p_hwfn->p_ptp_ptt; in qed_ptp_hw_read_rx_ts()
110 val = qed_rd(p_hwfn, p_ptt, NIG_REG_LLH_PTP_HOST_BUF_SEQID); in qed_ptp_hw_read_rx_ts()
112 DP_INFO(p_hwfn, "Invalid Rx timestamp, buf_seqid = %d\n", val); in qed_ptp_hw_read_rx_ts()
116 val = qed_rd(p_hwfn, p_ptt, NIG_REG_LLH_PTP_HOST_BUF_TS_LSB); in qed_ptp_hw_read_rx_ts()
117 *timestamp = qed_rd(p_hwfn, p_ptt, NIG_REG_LLH_PTP_HOST_BUF_TS_MSB); in qed_ptp_hw_read_rx_ts()
122 qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_PTP_HOST_BUF_SEQID, in qed_ptp_hw_read_rx_ts()
131 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_ptp_hw_read_tx_ts() local
132 struct qed_ptt *p_ptt = p_hwfn->p_ptp_ptt; in qed_ptp_hw_read_tx_ts()
136 val = qed_rd(p_hwfn, p_ptt, NIG_REG_TX_LLH_PTP_BUF_SEQID); in qed_ptp_hw_read_tx_ts()
138 DP_VERBOSE(p_hwfn, QED_MSG_DEBUG, in qed_ptp_hw_read_tx_ts()
143 val = qed_rd(p_hwfn, p_ptt, NIG_REG_TX_LLH_PTP_BUF_TS_LSB); in qed_ptp_hw_read_tx_ts()
144 *timestamp = qed_rd(p_hwfn, p_ptt, NIG_REG_TX_LLH_PTP_BUF_TS_MSB); in qed_ptp_hw_read_tx_ts()
149 qed_wr(p_hwfn, p_ptt, NIG_REG_TX_LLH_PTP_BUF_SEQID, QED_TIMESTAMP_MASK); in qed_ptp_hw_read_tx_ts()
157 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_ptp_hw_read_cc() local
158 struct qed_ptt *p_ptt = p_hwfn->p_ptp_ptt; in qed_ptp_hw_read_cc()
161 temp = qed_rd(p_hwfn, p_ptt, NIG_REG_TSGEN_SYNC_TIME_LSB); in qed_ptp_hw_read_cc()
162 *phc_cycles = qed_rd(p_hwfn, p_ptt, NIG_REG_TSGEN_SYNC_TIME_MSB); in qed_ptp_hw_read_cc()
174 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_ptp_hw_cfg_filters() local
175 struct qed_ptt *p_ptt = p_hwfn->p_ptp_ptt; in qed_ptp_hw_cfg_filters()
220 DP_INFO(p_hwfn, "Invalid PTP filter type %d\n", rx_type); in qed_ptp_hw_cfg_filters()
224 qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_PTP_PARAM_MASK, in qed_ptp_hw_cfg_filters()
226 qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_PTP_RULE_MASK, rule_mask); in qed_ptp_hw_cfg_filters()
227 qed_wr(p_hwfn, p_ptt, NIG_REG_RX_PTP_EN, enable_cfg); in qed_ptp_hw_cfg_filters()
230 qed_wr(p_hwfn, p_ptt, NIG_REG_TX_PTP_EN, 0x0); in qed_ptp_hw_cfg_filters()
231 qed_wr(p_hwfn, p_ptt, NIG_REG_TX_LLH_PTP_PARAM_MASK, 0x7FF); in qed_ptp_hw_cfg_filters()
232 qed_wr(p_hwfn, p_ptt, NIG_REG_TX_LLH_PTP_RULE_MASK, 0x3FFF); in qed_ptp_hw_cfg_filters()
234 qed_wr(p_hwfn, p_ptt, NIG_REG_TX_PTP_EN, enable_cfg); in qed_ptp_hw_cfg_filters()
235 qed_wr(p_hwfn, p_ptt, NIG_REG_TX_LLH_PTP_PARAM_MASK, in qed_ptp_hw_cfg_filters()
237 qed_wr(p_hwfn, p_ptt, NIG_REG_TX_LLH_PTP_RULE_MASK, rule_mask); in qed_ptp_hw_cfg_filters()
241 qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_PTP_HOST_BUF_SEQID, in qed_ptp_hw_cfg_filters()
257 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_ptp_hw_adjfreq() local
258 struct qed_ptt *p_ptt = p_hwfn->p_ptp_ptt; in qed_ptp_hw_adjfreq()
323 qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_RST_DRIFT_CNTR, 0x1); in qed_ptp_hw_adjfreq()
325 drift_state = qed_rd(p_hwfn, p_ptt, NIG_REG_TSGEN_RST_DRIFT_CNTR); in qed_ptp_hw_adjfreq()
327 qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_DRIFT_CNTR_CONF, in qed_ptp_hw_adjfreq()
330 DP_INFO(p_hwfn, "Drift counter is not reset\n"); in qed_ptp_hw_adjfreq()
334 qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_RST_DRIFT_CNTR, 0x0); in qed_ptp_hw_adjfreq()
341 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_ptp_hw_enable() local
345 p_ptt = qed_ptt_acquire(p_hwfn); in qed_ptp_hw_enable()
347 DP_NOTICE(p_hwfn, "Failed to acquire PTT for PTP\n"); in qed_ptp_hw_enable()
351 p_hwfn->p_ptp_ptt = p_ptt; in qed_ptp_hw_enable()
353 rc = qed_ptp_res_lock(p_hwfn, p_ptt); in qed_ptp_hw_enable()
355 DP_INFO(p_hwfn, in qed_ptp_hw_enable()
357 qed_ptt_release(p_hwfn, p_ptt); in qed_ptp_hw_enable()
358 p_hwfn->p_ptp_ptt = NULL; in qed_ptp_hw_enable()
363 qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_PTP_PARAM_MASK, 0x7FF); in qed_ptp_hw_enable()
364 qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_PTP_RULE_MASK, 0x3FFF); in qed_ptp_hw_enable()
365 qed_wr(p_hwfn, p_ptt, NIG_REG_TX_LLH_PTP_PARAM_MASK, 0x7FF); in qed_ptp_hw_enable()
366 qed_wr(p_hwfn, p_ptt, NIG_REG_TX_LLH_PTP_RULE_MASK, 0x3FFF); in qed_ptp_hw_enable()
368 qed_wr(p_hwfn, p_ptt, NIG_REG_TX_PTP_EN, 7); in qed_ptp_hw_enable()
369 qed_wr(p_hwfn, p_ptt, NIG_REG_RX_PTP_EN, 7); in qed_ptp_hw_enable()
371 qed_wr(p_hwfn, p_ptt, NIG_REG_TS_OUTPUT_ENABLE_PDA, 0x1); in qed_ptp_hw_enable()
374 if (QED_IS_BB_B0(p_hwfn->cdev)) in qed_ptp_hw_enable()
375 qed_wr(p_hwfn, p_ptt, NIG_REG_TIMESYNC_GEN_REG_BB, 2); in qed_ptp_hw_enable()
376 if (QED_IS_AH(p_hwfn->cdev)) in qed_ptp_hw_enable()
377 qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_FREECNT_UPDATE_K2, 2); in qed_ptp_hw_enable()
379 qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_FREE_CNT_VALUE_LSB, 0); in qed_ptp_hw_enable()
380 qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_FREE_CNT_VALUE_MSB, 0); in qed_ptp_hw_enable()
382 if (QED_IS_BB_B0(p_hwfn->cdev)) in qed_ptp_hw_enable()
383 qed_wr(p_hwfn, p_ptt, NIG_REG_TIMESYNC_GEN_REG_BB, 4); in qed_ptp_hw_enable()
384 if (QED_IS_AH(p_hwfn->cdev)) { in qed_ptp_hw_enable()
385 qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_FREECNT_UPDATE_K2, 4); in qed_ptp_hw_enable()
386 qed_wr(p_hwfn, p_ptt, NIG_REG_PTP_LATCH_OSTS_PKT_TIME, 1); in qed_ptp_hw_enable()
390 qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_DRIFT_CNTR_CONF, 0x0); in qed_ptp_hw_enable()
391 qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_RST_DRIFT_CNTR, 0x0); in qed_ptp_hw_enable()
394 qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_PTP_HOST_BUF_SEQID, in qed_ptp_hw_enable()
396 qed_wr(p_hwfn, p_ptt, NIG_REG_TX_LLH_PTP_BUF_SEQID, QED_TIMESTAMP_MASK); in qed_ptp_hw_enable()
403 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_ptp_hw_disable() local
404 struct qed_ptt *p_ptt = p_hwfn->p_ptp_ptt; in qed_ptp_hw_disable()
406 qed_ptp_res_unlock(p_hwfn, p_ptt); in qed_ptp_hw_disable()
409 qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_PTP_PARAM_MASK, 0x7FF); in qed_ptp_hw_disable()
410 qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_PTP_RULE_MASK, 0x3FFF); in qed_ptp_hw_disable()
412 qed_wr(p_hwfn, p_ptt, NIG_REG_TX_LLH_PTP_PARAM_MASK, 0x7FF); in qed_ptp_hw_disable()
413 qed_wr(p_hwfn, p_ptt, NIG_REG_TX_LLH_PTP_RULE_MASK, 0x3FFF); in qed_ptp_hw_disable()
416 qed_wr(p_hwfn, p_ptt, NIG_REG_RX_PTP_EN, 0x0); in qed_ptp_hw_disable()
417 qed_wr(p_hwfn, p_ptt, NIG_REG_TX_PTP_EN, 0x0); in qed_ptp_hw_disable()
419 qed_ptt_release(p_hwfn, p_ptt); in qed_ptp_hw_disable()
420 p_hwfn->p_ptp_ptt = NULL; in qed_ptp_hw_disable()