Lines Matching refs:clock
6 static int mchp_rds_phy_read_mmd(struct mchp_rds_ptp_clock *clock, in mchp_rds_phy_read_mmd() argument
9 struct phy_device *phydev = clock->phydev; in mchp_rds_phy_read_mmd()
12 addr = (offset + ((base == MCHP_RDS_PTP_PORT) ? BASE_PORT(clock) : in mchp_rds_phy_read_mmd()
13 BASE_CLK(clock))); in mchp_rds_phy_read_mmd()
15 return phy_read_mmd(phydev, PTP_MMD(clock), addr); in mchp_rds_phy_read_mmd()
18 static int mchp_rds_phy_write_mmd(struct mchp_rds_ptp_clock *clock, in mchp_rds_phy_write_mmd() argument
22 struct phy_device *phydev = clock->phydev; in mchp_rds_phy_write_mmd()
25 addr = (offset + ((base == MCHP_RDS_PTP_PORT) ? BASE_PORT(clock) : in mchp_rds_phy_write_mmd()
26 BASE_CLK(clock))); in mchp_rds_phy_write_mmd()
28 return phy_write_mmd(phydev, PTP_MMD(clock), addr, val); in mchp_rds_phy_write_mmd()
31 static int mchp_rds_phy_modify_mmd(struct mchp_rds_ptp_clock *clock, in mchp_rds_phy_modify_mmd() argument
35 struct phy_device *phydev = clock->phydev; in mchp_rds_phy_modify_mmd()
38 addr = (offset + ((base == MCHP_RDS_PTP_PORT) ? BASE_PORT(clock) : in mchp_rds_phy_modify_mmd()
39 BASE_CLK(clock))); in mchp_rds_phy_modify_mmd()
41 return phy_modify_mmd(phydev, PTP_MMD(clock), addr, mask, val); in mchp_rds_phy_modify_mmd()
44 static int mchp_rds_phy_set_bits_mmd(struct mchp_rds_ptp_clock *clock, in mchp_rds_phy_set_bits_mmd() argument
48 struct phy_device *phydev = clock->phydev; in mchp_rds_phy_set_bits_mmd()
51 addr = (offset + ((base == MCHP_RDS_PTP_PORT) ? BASE_PORT(clock) : in mchp_rds_phy_set_bits_mmd()
52 BASE_CLK(clock))); in mchp_rds_phy_set_bits_mmd()
54 return phy_set_bits_mmd(phydev, PTP_MMD(clock), addr, val); in mchp_rds_phy_set_bits_mmd()
105 static int mchp_general_event_config(struct mchp_rds_ptp_clock *clock, in mchp_general_event_config() argument
110 general_config = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_GEN_CFG, in mchp_general_event_config()
120 return mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_GEN_CFG, in mchp_general_event_config()
124 static int mchp_set_clock_reload(struct mchp_rds_ptp_clock *clock, in mchp_set_clock_reload() argument
129 rc = mchp_rds_phy_write_mmd(clock, in mchp_set_clock_reload()
136 rc = mchp_rds_phy_write_mmd(clock, in mchp_set_clock_reload()
143 rc = mchp_rds_phy_write_mmd(clock, in mchp_set_clock_reload()
150 return mchp_rds_phy_write_mmd(clock, in mchp_set_clock_reload()
156 static int mchp_set_clock_target(struct mchp_rds_ptp_clock *clock, in mchp_set_clock_target() argument
162 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_CLK_TRGT_SEC_LO, in mchp_set_clock_target()
168 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_CLK_TRGT_SEC_HI, in mchp_set_clock_target()
174 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_CLK_TRGT_NS_LO, in mchp_set_clock_target()
180 return mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_CLK_TRGT_NS_HI, in mchp_set_clock_target()
185 static int mchp_rds_ptp_perout_off(struct mchp_rds_ptp_clock *clock) in mchp_rds_ptp_perout_off() argument
191 rc = mchp_set_clock_target(clock, 0xFFFFFFFF, 0); in mchp_rds_ptp_perout_off()
195 general_config = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_GEN_CFG, in mchp_rds_ptp_perout_off()
198 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_GEN_CFG, in mchp_rds_ptp_perout_off()
203 clock->mchp_rds_ptp_event = -1; in mchp_rds_ptp_perout_off()
208 static bool mchp_get_event(struct mchp_rds_ptp_clock *clock, int pin) in mchp_get_event() argument
210 if (clock->mchp_rds_ptp_event < 0 && pin == clock->event_pin) { in mchp_get_event()
211 clock->mchp_rds_ptp_event = pin; in mchp_get_event()
221 struct mchp_rds_ptp_clock *clock = container_of(ptpci, in mchp_rds_ptp_perout() local
224 struct phy_device *phydev = clock->phydev; in mchp_rds_ptp_perout()
227 event_pin = ptp_find_pin(clock->ptp_clock, PTP_PF_PEROUT, in mchp_rds_ptp_perout()
229 if (event_pin != clock->event_pin) in mchp_rds_ptp_perout()
233 ret = mchp_rds_ptp_perout_off(clock); in mchp_rds_ptp_perout()
237 if (!mchp_get_event(clock, event_pin)) in mchp_rds_ptp_perout()
245 ret = mchp_general_event_config(clock, pulsewidth); in mchp_rds_ptp_perout()
249 ret = mchp_set_clock_target(clock, perout->start.sec, in mchp_rds_ptp_perout()
254 return mchp_set_clock_reload(clock, perout->period.sec, in mchp_rds_ptp_perout()
272 struct mchp_rds_ptp_clock *clock = container_of(ptpci, in mchp_rds_ptpci_verify() local
276 if (!(pin == clock->event_pin && chan == 0)) in mchp_rds_ptpci_verify()
290 static int mchp_rds_ptp_flush_fifo(struct mchp_rds_ptp_clock *clock, in mchp_rds_ptp_flush_fifo() argument
296 skb_queue_purge(&clock->tx_queue); in mchp_rds_ptp_flush_fifo()
298 skb_queue_purge(&clock->rx_queue); in mchp_rds_ptp_flush_fifo()
301 rc = mchp_rds_phy_read_mmd(clock, in mchp_rds_ptp_flush_fifo()
309 return mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_INT_STS, in mchp_rds_ptp_flush_fifo()
313 static int mchp_rds_ptp_config_intr(struct mchp_rds_ptp_clock *clock, in mchp_rds_ptp_config_intr() argument
317 return mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_INT_EN, in mchp_rds_ptp_config_intr()
325 struct mchp_rds_ptp_clock *clock = container_of(mii_ts, in mchp_rds_ptp_txtstamp() local
329 switch (clock->hwts_tx_type) { in mchp_rds_ptp_txtstamp()
338 skb_queue_tail(&clock->tx_queue, skb); in mchp_rds_ptp_txtstamp()
368 static bool mchp_rds_ptp_match_skb(struct mchp_rds_ptp_clock *clock, in mchp_rds_ptp_match_skb() argument
377 spin_lock_irqsave(&clock->rx_queue.lock, flags); in mchp_rds_ptp_match_skb()
378 skb_queue_walk_safe(&clock->rx_queue, skb, skb_tmp) { in mchp_rds_ptp_match_skb()
385 __skb_unlink(skb, &clock->rx_queue); in mchp_rds_ptp_match_skb()
390 spin_unlock_irqrestore(&clock->rx_queue.lock, flags); in mchp_rds_ptp_match_skb()
401 static void mchp_rds_ptp_match_rx_ts(struct mchp_rds_ptp_clock *clock, in mchp_rds_ptp_match_rx_ts() argument
409 if (!mchp_rds_ptp_match_skb(clock, rx_ts)) { in mchp_rds_ptp_match_rx_ts()
410 spin_lock_irqsave(&clock->rx_ts_lock, flags); in mchp_rds_ptp_match_rx_ts()
411 list_add(&rx_ts->list, &clock->rx_ts_list); in mchp_rds_ptp_match_rx_ts()
412 spin_unlock_irqrestore(&clock->rx_ts_lock, flags); in mchp_rds_ptp_match_rx_ts()
418 static void mchp_rds_ptp_match_rx_skb(struct mchp_rds_ptp_clock *clock, in mchp_rds_ptp_match_rx_skb() argument
430 spin_lock_irqsave(&clock->rx_ts_lock, flags); in mchp_rds_ptp_match_rx_skb()
431 list_for_each_entry_safe(rx_ts, tmp, &clock->rx_ts_list, list) { in mchp_rds_ptp_match_rx_skb()
444 spin_unlock_irqrestore(&clock->rx_ts_lock, flags); in mchp_rds_ptp_match_rx_skb()
450 skb_queue_tail(&clock->rx_queue, skb); in mchp_rds_ptp_match_rx_skb()
457 struct mchp_rds_ptp_clock *clock = container_of(mii_ts, in mchp_rds_ptp_rxtstamp() local
461 if (clock->rx_filter == HWTSTAMP_FILTER_NONE || in mchp_rds_ptp_rxtstamp()
465 if ((type & clock->version) == 0 || (type & clock->layer) == 0) in mchp_rds_ptp_rxtstamp()
474 mchp_rds_ptp_match_rx_skb(clock, skb); in mchp_rds_ptp_rxtstamp()
483 struct mchp_rds_ptp_clock *clock = in mchp_rds_ptp_hwtstamp() local
491 clock->hwts_tx_type = config->tx_type; in mchp_rds_ptp_hwtstamp()
492 clock->rx_filter = config->rx_filter; in mchp_rds_ptp_hwtstamp()
496 clock->layer = 0; in mchp_rds_ptp_hwtstamp()
497 clock->version = 0; in mchp_rds_ptp_hwtstamp()
502 clock->layer = PTP_CLASS_L4; in mchp_rds_ptp_hwtstamp()
503 clock->version = PTP_CLASS_V2; in mchp_rds_ptp_hwtstamp()
508 clock->layer = PTP_CLASS_L2; in mchp_rds_ptp_hwtstamp()
509 clock->version = PTP_CLASS_V2; in mchp_rds_ptp_hwtstamp()
514 clock->layer = PTP_CLASS_L4 | PTP_CLASS_L2; in mchp_rds_ptp_hwtstamp()
515 clock->version = PTP_CLASS_V2; in mchp_rds_ptp_hwtstamp()
524 if (clock->layer & PTP_CLASS_L2) { in mchp_rds_ptp_hwtstamp()
528 if (clock->layer & PTP_CLASS_L4) { in mchp_rds_ptp_hwtstamp()
534 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_RX_PARSE_CONFIG, in mchp_rds_ptp_hwtstamp()
539 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_TX_PARSE_CONFIG, in mchp_rds_ptp_hwtstamp()
544 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_RX_TIMESTAMP_EN, in mchp_rds_ptp_hwtstamp()
550 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_TX_TIMESTAMP_EN, in mchp_rds_ptp_hwtstamp()
556 if (clock->hwts_tx_type == HWTSTAMP_TX_ONESTEP_SYNC) in mchp_rds_ptp_hwtstamp()
558 rc = mchp_rds_phy_modify_mmd(clock, MCHP_RDS_PTP_TX_MOD, in mchp_rds_ptp_hwtstamp()
563 rc = mchp_rds_phy_modify_mmd(clock, MCHP_RDS_PTP_TX_MOD, in mchp_rds_ptp_hwtstamp()
572 spin_lock_irqsave(&clock->rx_ts_lock, flags); in mchp_rds_ptp_hwtstamp()
573 list_for_each_entry_safe(rx_ts, tmp, &clock->rx_ts_list, list) { in mchp_rds_ptp_hwtstamp()
577 spin_unlock_irqrestore(&clock->rx_ts_lock, flags); in mchp_rds_ptp_hwtstamp()
579 rc = mchp_rds_ptp_flush_fifo(clock, MCHP_RDS_PTP_INGRESS_FIFO); in mchp_rds_ptp_hwtstamp()
583 rc = mchp_rds_ptp_flush_fifo(clock, MCHP_RDS_PTP_EGRESS_FIFO); in mchp_rds_ptp_hwtstamp()
588 rc = mchp_rds_ptp_config_intr(clock, in mchp_rds_ptp_hwtstamp()
597 struct mchp_rds_ptp_clock *clock = container_of(mii_ts, in mchp_rds_ptp_ts_info() local
601 info->phc_index = ptp_clock_index(clock->ptp_clock); in mchp_rds_ptp_ts_info()
620 struct mchp_rds_ptp_clock *clock = container_of(info, in mchp_rds_ptp_ltc_adjtime() local
672 mutex_lock(&clock->ptp_lock); in mchp_rds_ptp_ltc_adjtime()
676 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_STEP_ADJ_LO, in mchp_rds_ptp_ltc_adjtime()
681 rc = mchp_rds_phy_set_bits_mmd(clock, MCHP_RDS_PTP_STEP_ADJ_HI, in mchp_rds_ptp_ltc_adjtime()
690 rc = mchp_rds_phy_set_bits_mmd(clock, MCHP_RDS_PTP_CMD_CTL, in mchp_rds_ptp_ltc_adjtime()
698 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_STEP_ADJ_LO, in mchp_rds_ptp_ltc_adjtime()
704 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_STEP_ADJ_HI, in mchp_rds_ptp_ltc_adjtime()
710 rc = mchp_rds_phy_set_bits_mmd(clock, MCHP_RDS_PTP_CMD_CTL, in mchp_rds_ptp_ltc_adjtime()
715 mutex_unlock(&clock->ptp_lock); in mchp_rds_ptp_ltc_adjtime()
717 mutex_lock(&clock->ptp_lock); in mchp_rds_ptp_ltc_adjtime()
722 if (clock->mchp_rds_ptp_event >= 0) in mchp_rds_ptp_ltc_adjtime()
723 mchp_set_clock_target(clock, in mchp_rds_ptp_ltc_adjtime()
726 mutex_unlock(&clock->ptp_lock); in mchp_rds_ptp_ltc_adjtime()
734 struct mchp_rds_ptp_clock *clock = container_of(info, in mchp_rds_ptp_ltc_adjfine() local
759 mutex_lock(&clock->ptp_lock); in mchp_rds_ptp_ltc_adjfine()
760 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_LTC_RATE_ADJ_HI, in mchp_rds_ptp_ltc_adjfine()
765 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_LTC_RATE_ADJ_LO, in mchp_rds_ptp_ltc_adjfine()
770 mutex_unlock(&clock->ptp_lock); in mchp_rds_ptp_ltc_adjfine()
778 struct mchp_rds_ptp_clock *clock = container_of(info, in mchp_rds_ptp_ltc_gettime64() local
785 mutex_lock(&clock->ptp_lock); in mchp_rds_ptp_ltc_gettime64()
789 rc = mchp_rds_phy_set_bits_mmd(clock, MCHP_RDS_PTP_CMD_CTL, in mchp_rds_ptp_ltc_gettime64()
796 rc = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_LTC_READ_SEC_HI, in mchp_rds_ptp_ltc_gettime64()
802 rc = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_LTC_READ_SEC_MID, in mchp_rds_ptp_ltc_gettime64()
809 rc = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_LTC_READ_SEC_LO, in mchp_rds_ptp_ltc_gettime64()
815 rc = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_LTC_READ_NS_HI, in mchp_rds_ptp_ltc_gettime64()
822 rc = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_LTC_READ_NS_LO, in mchp_rds_ptp_ltc_gettime64()
833 mutex_unlock(&clock->ptp_lock); in mchp_rds_ptp_ltc_gettime64()
841 struct mchp_rds_ptp_clock *clock = container_of(info, in mchp_rds_ptp_ltc_settime64() local
846 mutex_lock(&clock->ptp_lock); in mchp_rds_ptp_ltc_settime64()
847 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_LTC_SEC_LO, in mchp_rds_ptp_ltc_settime64()
853 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_LTC_SEC_MID, in mchp_rds_ptp_ltc_settime64()
859 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_LTC_SEC_HI, in mchp_rds_ptp_ltc_settime64()
865 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_LTC_NS_LO, in mchp_rds_ptp_ltc_settime64()
871 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_LTC_NS_HI, in mchp_rds_ptp_ltc_settime64()
880 rc = mchp_rds_phy_set_bits_mmd(clock, MCHP_RDS_PTP_CMD_CTL, in mchp_rds_ptp_ltc_settime64()
886 mutex_unlock(&clock->ptp_lock); in mchp_rds_ptp_ltc_settime64()
909 static void mchp_rds_ptp_match_tx_skb(struct mchp_rds_ptp_clock *clock, in mchp_rds_ptp_match_tx_skb() argument
918 spin_lock_irqsave(&clock->tx_queue.lock, flags); in mchp_rds_ptp_match_tx_skb()
919 skb_queue_walk_safe(&clock->tx_queue, skb, skb_tmp) { in mchp_rds_ptp_match_tx_skb()
926 __skb_unlink(skb, &clock->tx_queue); in mchp_rds_ptp_match_tx_skb()
930 spin_unlock_irqrestore(&clock->tx_queue.lock, flags); in mchp_rds_ptp_match_tx_skb()
939 *mchp_rds_ptp_get_rx_ts(struct mchp_rds_ptp_clock *clock) in mchp_rds_ptp_get_rx_ts() argument
941 struct phy_device *phydev = clock->phydev; in mchp_rds_ptp_get_rx_ts()
946 rc = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_RX_INGRESS_NS_HI, in mchp_rds_ptp_get_rx_ts()
956 rc = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_RX_INGRESS_NS_LO, in mchp_rds_ptp_get_rx_ts()
962 rc = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_RX_INGRESS_SEC_HI, in mchp_rds_ptp_get_rx_ts()
968 rc = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_RX_INGRESS_SEC_LO, in mchp_rds_ptp_get_rx_ts()
974 rc = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_RX_MSG_HDR2, in mchp_rds_ptp_get_rx_ts()
991 static void mchp_rds_ptp_process_rx_ts(struct mchp_rds_ptp_clock *clock) in mchp_rds_ptp_process_rx_ts() argument
998 rx_ts = mchp_rds_ptp_get_rx_ts(clock); in mchp_rds_ptp_process_rx_ts()
1000 mchp_rds_ptp_match_rx_ts(clock, rx_ts); in mchp_rds_ptp_process_rx_ts()
1002 caps = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_CAP_INFO, in mchp_rds_ptp_process_rx_ts()
1009 static bool mchp_rds_ptp_get_tx_ts(struct mchp_rds_ptp_clock *clock, in mchp_rds_ptp_get_tx_ts() argument
1014 rc = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_TX_EGRESS_NS_HI, in mchp_rds_ptp_get_tx_ts()
1022 rc = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_TX_EGRESS_NS_LO, in mchp_rds_ptp_get_tx_ts()
1028 rc = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_TX_EGRESS_SEC_HI, in mchp_rds_ptp_get_tx_ts()
1034 rc = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_TX_EGRESS_SEC_LO, in mchp_rds_ptp_get_tx_ts()
1040 rc = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_TX_MSG_HDR2, in mchp_rds_ptp_get_tx_ts()
1050 static void mchp_rds_ptp_process_tx_ts(struct mchp_rds_ptp_clock *clock) in mchp_rds_ptp_process_tx_ts() argument
1058 if (mchp_rds_ptp_get_tx_ts(clock, &sec, &nsec, &seq)) in mchp_rds_ptp_process_tx_ts()
1059 mchp_rds_ptp_match_tx_skb(clock, sec, nsec, seq); in mchp_rds_ptp_process_tx_ts()
1061 caps = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_CAP_INFO, in mchp_rds_ptp_process_tx_ts()
1068 int mchp_rds_ptp_top_config_intr(struct mchp_rds_ptp_clock *clock, in mchp_rds_ptp_top_config_intr() argument
1072 return phy_clear_bits_mmd(clock->phydev, PTP_MMD(clock), reg, in mchp_rds_ptp_top_config_intr()
1075 return phy_set_bits_mmd(clock->phydev, PTP_MMD(clock), reg, in mchp_rds_ptp_top_config_intr()
1080 irqreturn_t mchp_rds_ptp_handle_interrupt(struct mchp_rds_ptp_clock *clock) in mchp_rds_ptp_handle_interrupt() argument
1085 if (!clock) in mchp_rds_ptp_handle_interrupt()
1089 irq_sts = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_INT_STS, in mchp_rds_ptp_handle_interrupt()
1095 mchp_rds_ptp_process_rx_ts(clock); in mchp_rds_ptp_handle_interrupt()
1098 mchp_rds_ptp_process_tx_ts(clock); in mchp_rds_ptp_handle_interrupt()
1101 mchp_rds_ptp_flush_fifo(clock, in mchp_rds_ptp_handle_interrupt()
1105 mchp_rds_ptp_flush_fifo(clock, in mchp_rds_ptp_handle_interrupt()
1116 static int mchp_rds_ptp_init(struct mchp_rds_ptp_clock *clock) in mchp_rds_ptp_init() argument
1121 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_CMD_CTL, in mchp_rds_ptp_init()
1128 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_TSU_GEN_CONFIG, in mchp_rds_ptp_init()
1134 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_TSU_HARD_RESET, in mchp_rds_ptp_init()
1141 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_LATENCY_CORRECTION_CTL, in mchp_rds_ptp_init()
1148 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_OP_MODE, in mchp_rds_ptp_init()
1155 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_REF_CLK_CFG, in mchp_rds_ptp_init()
1162 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_RX_PARSE_CONFIG, in mchp_rds_ptp_init()
1167 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_TX_PARSE_CONFIG, in mchp_rds_ptp_init()
1172 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_TX_PARSE_L2_ADDR_EN, in mchp_rds_ptp_init()
1177 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_RX_PARSE_L2_ADDR_EN, in mchp_rds_ptp_init()
1182 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_RX_PARSE_IPV4_ADDR_EN, in mchp_rds_ptp_init()
1187 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_TX_PARSE_IPV4_ADDR_EN, in mchp_rds_ptp_init()
1192 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_RX_VERSION, in mchp_rds_ptp_init()
1199 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_TX_VERSION, in mchp_rds_ptp_init()
1207 rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_TSU_GEN_CONFIG, in mchp_rds_ptp_init()
1214 return mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_CMD_CTL, in mchp_rds_ptp_init()
1223 struct mchp_rds_ptp_clock *clock; in mchp_rds_ptp_probe() local
1226 clock = devm_kzalloc(&phydev->mdio.dev, sizeof(*clock), GFP_KERNEL); in mchp_rds_ptp_probe()
1227 if (!clock) in mchp_rds_ptp_probe()
1230 clock->port_base_addr = port_base_addr; in mchp_rds_ptp_probe()
1231 clock->clk_base_addr = clk_base_addr; in mchp_rds_ptp_probe()
1232 clock->mmd = mmd; in mchp_rds_ptp_probe()
1234 mutex_init(&clock->ptp_lock); in mchp_rds_ptp_probe()
1235 clock->pin_config = devm_kmalloc_array(&phydev->mdio.dev, in mchp_rds_ptp_probe()
1237 sizeof(*clock->pin_config), in mchp_rds_ptp_probe()
1239 if (!clock->pin_config) in mchp_rds_ptp_probe()
1243 struct ptp_pin_desc *p = &clock->pin_config[i]; in mchp_rds_ptp_probe()
1251 clock->caps.owner = THIS_MODULE; in mchp_rds_ptp_probe()
1252 snprintf(clock->caps.name, 30, "%s", phydev->drv->name); in mchp_rds_ptp_probe()
1253 clock->caps.max_adj = MCHP_RDS_PTP_MAX_ADJ; in mchp_rds_ptp_probe()
1254 clock->caps.n_ext_ts = 0; in mchp_rds_ptp_probe()
1255 clock->caps.pps = 0; in mchp_rds_ptp_probe()
1256 clock->caps.n_pins = MCHP_RDS_PTP_N_PIN; in mchp_rds_ptp_probe()
1257 clock->caps.n_per_out = MCHP_RDS_PTP_N_PEROUT; in mchp_rds_ptp_probe()
1258 clock->caps.supported_perout_flags = PTP_PEROUT_DUTY_CYCLE; in mchp_rds_ptp_probe()
1259 clock->caps.pin_config = clock->pin_config; in mchp_rds_ptp_probe()
1260 clock->caps.adjfine = mchp_rds_ptp_ltc_adjfine; in mchp_rds_ptp_probe()
1261 clock->caps.adjtime = mchp_rds_ptp_ltc_adjtime; in mchp_rds_ptp_probe()
1262 clock->caps.gettime64 = mchp_rds_ptp_ltc_gettime64; in mchp_rds_ptp_probe()
1263 clock->caps.settime64 = mchp_rds_ptp_ltc_settime64; in mchp_rds_ptp_probe()
1264 clock->caps.enable = mchp_rds_ptpci_enable; in mchp_rds_ptp_probe()
1265 clock->caps.verify = mchp_rds_ptpci_verify; in mchp_rds_ptp_probe()
1266 clock->caps.getcrosststamp = NULL; in mchp_rds_ptp_probe()
1267 clock->ptp_clock = ptp_clock_register(&clock->caps, in mchp_rds_ptp_probe()
1269 if (IS_ERR(clock->ptp_clock)) in mchp_rds_ptp_probe()
1273 if (!clock->ptp_clock) in mchp_rds_ptp_probe()
1277 skb_queue_head_init(&clock->tx_queue); in mchp_rds_ptp_probe()
1278 skb_queue_head_init(&clock->rx_queue); in mchp_rds_ptp_probe()
1279 INIT_LIST_HEAD(&clock->rx_ts_list); in mchp_rds_ptp_probe()
1280 spin_lock_init(&clock->rx_ts_lock); in mchp_rds_ptp_probe()
1282 clock->mii_ts.rxtstamp = mchp_rds_ptp_rxtstamp; in mchp_rds_ptp_probe()
1283 clock->mii_ts.txtstamp = mchp_rds_ptp_txtstamp; in mchp_rds_ptp_probe()
1284 clock->mii_ts.hwtstamp = mchp_rds_ptp_hwtstamp; in mchp_rds_ptp_probe()
1285 clock->mii_ts.ts_info = mchp_rds_ptp_ts_info; in mchp_rds_ptp_probe()
1287 phydev->mii_ts = &clock->mii_ts; in mchp_rds_ptp_probe()
1289 clock->mchp_rds_ptp_event = -1; in mchp_rds_ptp_probe()
1294 clock->phydev = phydev; in mchp_rds_ptp_probe()
1296 rc = mchp_rds_ptp_init(clock); in mchp_rds_ptp_probe()
1300 return clock; in mchp_rds_ptp_probe()