Lines Matching refs:ptp_data
59 container_of((d), struct sja1105_private, ptp_data)
117 struct sja1105_ptp_data *ptp_data = &priv->ptp_data; in sja1105_get_ts_info() local
120 if (!ptp_data->clock) in sja1105_get_ts_info()
130 info->phc_index = ptp_clock_index(ptp_data->clock); in sja1105_get_ts_info()
314 struct sja1105_ptp_data *ptp_data = &priv->ptp_data; in sja1105_extts_poll() local
326 if (ptpsyncts && ptp_data->ptpsyncts != ptpsyncts) { in sja1105_extts_poll()
330 ptp_clock_event(ptp_data->clock, &event); in sja1105_extts_poll()
332 ptp_data->ptpsyncts = ptpsyncts; in sja1105_extts_poll()
338 struct sja1105_ptp_data *ptp_data = ptp_caps_to_data(ptp); in sja1105_rxtstamp_work() local
339 struct sja1105_private *priv = ptp_data_to_sja1105(ptp_data); in sja1105_rxtstamp_work()
343 mutex_lock(&ptp_data->lock); in sja1105_rxtstamp_work()
345 while ((skb = skb_dequeue(&ptp_data->skb_rxtstamp_queue)) != NULL) { in sja1105_rxtstamp_work()
366 if (ptp_data->extts_enabled) in sja1105_rxtstamp_work()
369 mutex_unlock(&ptp_data->lock); in sja1105_rxtstamp_work()
378 struct sja1105_ptp_data *ptp_data = &priv->ptp_data; in sja1105_rxtstamp() local
386 skb_queue_tail(&ptp_data->skb_rxtstamp_queue, skb); in sja1105_rxtstamp()
387 ptp_schedule_worker(ptp_data->clock, 0); in sja1105_rxtstamp()
417 struct sja1105_ptp_data *ptp_data = &priv->ptp_data; in sja1110_process_meta_tstamp() local
425 spin_lock(&ptp_data->skb_txtstamp_queue.lock); in sja1110_process_meta_tstamp()
427 skb_queue_walk_safe(&ptp_data->skb_txtstamp_queue, skb, skb_tmp) { in sja1110_process_meta_tstamp()
431 __skb_unlink(skb, &ptp_data->skb_txtstamp_queue); in sja1110_process_meta_tstamp()
437 spin_unlock(&ptp_data->skb_txtstamp_queue.lock); in sja1110_process_meta_tstamp()
454 struct sja1105_ptp_data *ptp_data = &priv->ptp_data; in sja1110_txtstamp() local
469 skb_queue_tail(&ptp_data->skb_txtstamp_queue, clone); in sja1110_txtstamp()
497 struct sja1105_ptp_data *ptp_data = &priv->ptp_data; in sja1105_ptp_reset() local
498 struct sja1105_ptp_cmd cmd = ptp_data->cmd; in sja1105_ptp_reset()
501 mutex_lock(&ptp_data->lock); in sja1105_ptp_reset()
510 mutex_unlock(&ptp_data->lock); in sja1105_ptp_reset()
538 struct sja1105_ptp_data *ptp_data = ptp_caps_to_data(ptp); in sja1105_ptp_gettimex() local
539 struct sja1105_private *priv = ptp_data_to_sja1105(ptp_data); in sja1105_ptp_gettimex()
543 mutex_lock(&ptp_data->lock); in sja1105_ptp_gettimex()
548 mutex_unlock(&ptp_data->lock); in sja1105_ptp_gettimex()
557 struct sja1105_ptp_data *ptp_data = &priv->ptp_data; in sja1105_ptp_mode_set() local
559 if (ptp_data->cmd.ptpclkadd == mode) in sja1105_ptp_mode_set()
562 ptp_data->cmd.ptpclkadd = mode; in sja1105_ptp_mode_set()
564 return sja1105_ptp_commit(priv->ds, &ptp_data->cmd, SPI_WRITE); in sja1105_ptp_mode_set()
591 struct sja1105_ptp_data *ptp_data = ptp_caps_to_data(ptp); in sja1105_ptp_settime() local
592 struct sja1105_private *priv = ptp_data_to_sja1105(ptp_data); in sja1105_ptp_settime()
596 mutex_lock(&ptp_data->lock); in sja1105_ptp_settime()
600 mutex_unlock(&ptp_data->lock); in sja1105_ptp_settime()
607 struct sja1105_ptp_data *ptp_data = ptp_caps_to_data(ptp); in sja1105_ptp_adjfine() local
608 struct sja1105_private *priv = ptp_data_to_sja1105(ptp_data); in sja1105_ptp_adjfine()
622 mutex_lock(&ptp_data->lock); in sja1105_ptp_adjfine()
629 mutex_unlock(&ptp_data->lock); in sja1105_ptp_adjfine()
656 struct sja1105_ptp_data *ptp_data = ptp_caps_to_data(ptp); in sja1105_ptp_adjtime() local
657 struct sja1105_private *priv = ptp_data_to_sja1105(ptp_data); in sja1105_ptp_adjtime()
660 mutex_lock(&ptp_data->lock); in sja1105_ptp_adjtime()
664 mutex_unlock(&ptp_data->lock); in sja1105_ptp_adjtime()
669 static void sja1105_ptp_extts_setup_timer(struct sja1105_ptp_data *ptp_data) in sja1105_ptp_extts_setup_timer() argument
674 mod_timer(&ptp_data->extts_timer, expires); in sja1105_ptp_extts_setup_timer()
679 struct sja1105_ptp_data *ptp_data = extts_to_data(t); in sja1105_ptp_extts_timer() local
681 ptp_schedule_worker(ptp_data->clock, 0); in sja1105_ptp_extts_timer()
683 sja1105_ptp_extts_setup_timer(ptp_data); in sja1105_ptp_extts_timer()
721 struct sja1105_ptp_data *ptp_data = &priv->ptp_data; in sja1105_per_out_enable() local
723 struct sja1105_ptp_cmd cmd = ptp_data->cmd; in sja1105_per_out_enable()
734 mutex_lock(&ptp_data->lock); in sja1105_per_out_enable()
798 mutex_unlock(&ptp_data->lock); in sja1105_per_out_enable()
830 priv->ptp_data.extts_enabled = on; in sja1105_extts_enable()
833 sja1105_ptp_extts_setup_timer(&priv->ptp_data); in sja1105_extts_enable()
835 del_timer_sync(&priv->ptp_data.extts_timer); in sja1105_extts_enable()
843 struct sja1105_ptp_data *ptp_data = ptp_caps_to_data(ptp); in sja1105_ptp_enable() local
844 struct sja1105_private *priv = ptp_data_to_sja1105(ptp_data); in sja1105_ptp_enable()
858 struct sja1105_ptp_data *ptp_data = ptp_caps_to_data(ptp); in sja1105_ptp_verify_pin() local
859 struct sja1105_private *priv = ptp_data_to_sja1105(ptp_data); in sja1105_ptp_verify_pin()
888 struct sja1105_ptp_data *ptp_data = &priv->ptp_data; in sja1105_ptp_clock_register() local
890 ptp_data->caps = (struct ptp_clock_info) { in sja1105_ptp_clock_register()
908 skb_queue_head_init(&ptp_data->skb_rxtstamp_queue); in sja1105_ptp_clock_register()
910 skb_queue_head_init(&ptp_data->skb_txtstamp_queue); in sja1105_ptp_clock_register()
912 ptp_data->clock = ptp_clock_register(&ptp_data->caps, ds->dev); in sja1105_ptp_clock_register()
913 if (IS_ERR_OR_NULL(ptp_data->clock)) in sja1105_ptp_clock_register()
914 return PTR_ERR(ptp_data->clock); in sja1105_ptp_clock_register()
916 ptp_data->cmd.corrclk4ts = true; in sja1105_ptp_clock_register()
917 ptp_data->cmd.ptpclkadd = PTP_SET_MODE; in sja1105_ptp_clock_register()
919 timer_setup(&ptp_data->extts_timer, sja1105_ptp_extts_timer, 0); in sja1105_ptp_clock_register()
927 struct sja1105_ptp_data *ptp_data = &priv->ptp_data; in sja1105_ptp_clock_unregister() local
929 if (IS_ERR_OR_NULL(ptp_data->clock)) in sja1105_ptp_clock_unregister()
932 del_timer_sync(&ptp_data->extts_timer); in sja1105_ptp_clock_unregister()
933 ptp_cancel_worker_sync(ptp_data->clock); in sja1105_ptp_clock_unregister()
934 skb_queue_purge(&ptp_data->skb_txtstamp_queue); in sja1105_ptp_clock_unregister()
935 skb_queue_purge(&ptp_data->skb_rxtstamp_queue); in sja1105_ptp_clock_unregister()
936 ptp_clock_unregister(ptp_data->clock); in sja1105_ptp_clock_unregister()
937 ptp_data->clock = NULL; in sja1105_ptp_clock_unregister()
944 struct sja1105_ptp_data *ptp_data = &priv->ptp_data; in sja1105_ptp_txtstamp_skb() local
951 mutex_lock(&ptp_data->lock); in sja1105_ptp_txtstamp_skb()
973 mutex_unlock(&ptp_data->lock); in sja1105_ptp_txtstamp_skb()