Lines Matching full:ptp
69 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_tx_ts_enqueue_ts() local
71 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_tx_ts_enqueue_ts()
72 if (ptp->tx_ts_queue_size < LAN743X_PTP_NUMBER_OF_TX_TIMESTAMPS) { in lan743x_ptp_tx_ts_enqueue_ts()
73 ptp->tx_ts_seconds_queue[ptp->tx_ts_queue_size] = seconds; in lan743x_ptp_tx_ts_enqueue_ts()
74 ptp->tx_ts_nseconds_queue[ptp->tx_ts_queue_size] = nano_seconds; in lan743x_ptp_tx_ts_enqueue_ts()
75 ptp->tx_ts_header_queue[ptp->tx_ts_queue_size] = header; in lan743x_ptp_tx_ts_enqueue_ts()
76 ptp->tx_ts_queue_size++; in lan743x_ptp_tx_ts_enqueue_ts()
81 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_tx_ts_enqueue_ts()
86 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_tx_ts_complete() local
93 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_tx_ts_complete()
94 c = ptp->tx_ts_skb_queue_size; in lan743x_ptp_tx_ts_complete()
96 if (c > ptp->tx_ts_queue_size) in lan743x_ptp_tx_ts_complete()
97 c = ptp->tx_ts_queue_size; in lan743x_ptp_tx_ts_complete()
102 ignore_sync = ((ptp->tx_ts_ignore_sync_queue & in lan743x_ptp_tx_ts_complete()
104 skb = ptp->tx_ts_skb_queue[i]; in lan743x_ptp_tx_ts_complete()
105 nseconds = ptp->tx_ts_nseconds_queue[i]; in lan743x_ptp_tx_ts_complete()
106 seconds = ptp->tx_ts_seconds_queue[i]; in lan743x_ptp_tx_ts_complete()
107 header = ptp->tx_ts_header_queue[i]; in lan743x_ptp_tx_ts_complete()
118 ptp->tx_ts_skb_queue[i] = NULL; in lan743x_ptp_tx_ts_complete()
119 ptp->tx_ts_seconds_queue[i] = 0; in lan743x_ptp_tx_ts_complete()
120 ptp->tx_ts_nseconds_queue[i] = 0; in lan743x_ptp_tx_ts_complete()
121 ptp->tx_ts_header_queue[i] = 0; in lan743x_ptp_tx_ts_complete()
125 ptp->tx_ts_ignore_sync_queue >>= c; in lan743x_ptp_tx_ts_complete()
127 ptp->tx_ts_skb_queue[i - c] = ptp->tx_ts_skb_queue[i]; in lan743x_ptp_tx_ts_complete()
128 ptp->tx_ts_seconds_queue[i - c] = ptp->tx_ts_seconds_queue[i]; in lan743x_ptp_tx_ts_complete()
129 ptp->tx_ts_nseconds_queue[i - c] = ptp->tx_ts_nseconds_queue[i]; in lan743x_ptp_tx_ts_complete()
130 ptp->tx_ts_header_queue[i - c] = ptp->tx_ts_header_queue[i]; in lan743x_ptp_tx_ts_complete()
132 ptp->tx_ts_skb_queue[i] = NULL; in lan743x_ptp_tx_ts_complete()
133 ptp->tx_ts_seconds_queue[i] = 0; in lan743x_ptp_tx_ts_complete()
134 ptp->tx_ts_nseconds_queue[i] = 0; in lan743x_ptp_tx_ts_complete()
135 ptp->tx_ts_header_queue[i] = 0; in lan743x_ptp_tx_ts_complete()
137 ptp->tx_ts_skb_queue_size -= c; in lan743x_ptp_tx_ts_complete()
138 ptp->tx_ts_queue_size -= c; in lan743x_ptp_tx_ts_complete()
140 ptp->pending_tx_timestamps -= c; in lan743x_ptp_tx_ts_complete()
141 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_tx_ts_complete()
147 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_reserve_event_ch() local
150 mutex_lock(&ptp->command_lock); in lan743x_ptp_reserve_event_ch()
151 if (!(test_bit(event_channel, &ptp->used_event_ch))) { in lan743x_ptp_reserve_event_ch()
152 ptp->used_event_ch |= BIT(event_channel); in lan743x_ptp_reserve_event_ch()
159 mutex_unlock(&ptp->command_lock); in lan743x_ptp_reserve_event_ch()
166 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_release_event_ch() local
168 mutex_lock(&ptp->command_lock); in lan743x_ptp_release_event_ch()
169 if (test_bit(event_channel, &ptp->used_event_ch)) { in lan743x_ptp_release_event_ch()
170 ptp->used_event_ch &= ~BIT(event_channel); in lan743x_ptp_release_event_ch()
176 mutex_unlock(&ptp->command_lock); in lan743x_ptp_release_event_ch()
188 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_led_mux_enable() local
190 if (ptp->leds_multiplexed && in lan743x_led_mux_enable()
191 ptp->led_enabled[pin]) { in lan743x_led_mux_enable()
205 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_led_mux_save() local
215 ptp->led_enabled[i] = led_enabled; in lan743x_led_mux_save()
217 ptp->leds_multiplexed = true; in lan743x_led_mux_save()
219 ptp->leds_multiplexed = false; in lan743x_led_mux_save()
297 /* disable ptp output */ in lan743x_gpio_release()
323 struct lan743x_ptp *ptp = in lan743x_ptpci_adjfine() local
326 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_adjfine()
356 struct lan743x_ptp *ptp = in lan743x_ptpci_adjfreq() local
359 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_adjfreq()
390 struct lan743x_ptp *ptp = in lan743x_ptpci_adjtime() local
393 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_adjtime()
403 struct lan743x_ptp *ptp = in lan743x_ptpci_gettime64() local
406 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_gettime64()
420 struct lan743x_ptp *ptp = in lan743x_ptpci_settime64() local
423 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_settime64()
456 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_perout_off() local
458 struct lan743x_ptp_perout *perout = &ptp->perout[index]; in lan743x_ptp_perout_off()
486 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_perout() local
493 struct lan743x_ptp_perout *perout = &ptp->perout[index]; in lan743x_ptp_perout()
500 perout_pin = ptp_find_pin(ptp->ptp_clock, PTP_PF_PEROUT, in lan743x_ptp_perout()
608 struct lan743x_ptp *ptp = in lan743x_ptpci_enable() local
611 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_enable()
636 static int lan743x_ptpci_verify_pin_config(struct ptp_clock_info *ptp, in lan743x_ptpci_verify_pin_config() argument
661 struct lan743x_ptp *ptp = in lan743x_ptpci_do_aux_work() local
664 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_do_aux_work()
716 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_clock_get() local
718 mutex_lock(&ptp->command_lock); in lan743x_ptp_clock_get()
733 mutex_unlock(&ptp->command_lock); in lan743x_ptp_clock_get()
739 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_clock_step() local
813 mutex_lock(&ptp->command_lock); in lan743x_ptp_clock_step()
836 mutex_unlock(&ptp->command_lock); in lan743x_ptp_clock_step()
839 mutex_lock(&ptp->command_lock); in lan743x_ptp_clock_step()
848 mutex_unlock(&ptp->command_lock); in lan743x_ptp_clock_step()
855 struct lan743x_ptp *ptp = NULL; in lan743x_ptp_isr() local
859 ptp = &adapter->ptp; in lan743x_ptp_isr()
867 ptp_schedule_worker(ptp->ptp_clock, 0); in lan743x_ptp_isr()
872 "PTP TX Software Timestamp Error\n"); in lan743x_ptp_isr()
897 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_tx_ts_enqueue_skb() local
899 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_tx_ts_enqueue_skb()
900 if (ptp->tx_ts_skb_queue_size < LAN743X_PTP_NUMBER_OF_TX_TIMESTAMPS) { in lan743x_ptp_tx_ts_enqueue_skb()
901 ptp->tx_ts_skb_queue[ptp->tx_ts_skb_queue_size] = skb; in lan743x_ptp_tx_ts_enqueue_skb()
903 ptp->tx_ts_ignore_sync_queue |= in lan743x_ptp_tx_ts_enqueue_skb()
904 BIT(ptp->tx_ts_skb_queue_size); in lan743x_ptp_tx_ts_enqueue_skb()
905 ptp->tx_ts_skb_queue_size++; in lan743x_ptp_tx_ts_enqueue_skb()
915 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_tx_ts_enqueue_skb()
951 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_init() local
954 mutex_init(&ptp->command_lock); in lan743x_ptp_init()
955 spin_lock_init(&ptp->tx_ts_lock); in lan743x_ptp_init()
956 ptp->used_event_ch = 0; in lan743x_ptp_init()
959 ptp->perout[i].event_ch = -1; in lan743x_ptp_init()
960 ptp->perout[i].gpio_pin = -1; in lan743x_ptp_init()
970 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_open() local
985 ptp->flags |= PTP_FLAG_ISR_ENABLED; in lan743x_ptp_open()
1009 struct ptp_pin_desc *ptp_pin = &ptp->pin_config[i]; in lan743x_ptp_open()
1017 ptp->ptp_clock_info.owner = THIS_MODULE; in lan743x_ptp_open()
1018 snprintf(ptp->ptp_clock_info.name, 16, "%pm", in lan743x_ptp_open()
1020 ptp->ptp_clock_info.max_adj = LAN743X_PTP_MAX_FREQ_ADJ_IN_PPB; in lan743x_ptp_open()
1021 ptp->ptp_clock_info.n_alarm = 0; in lan743x_ptp_open()
1022 ptp->ptp_clock_info.n_ext_ts = 0; in lan743x_ptp_open()
1023 ptp->ptp_clock_info.n_per_out = LAN743X_PTP_N_EVENT_CHAN; in lan743x_ptp_open()
1024 ptp->ptp_clock_info.n_pins = n_pins; in lan743x_ptp_open()
1025 ptp->ptp_clock_info.pps = 0; in lan743x_ptp_open()
1026 ptp->ptp_clock_info.pin_config = ptp->pin_config; in lan743x_ptp_open()
1027 ptp->ptp_clock_info.adjfine = lan743x_ptpci_adjfine; in lan743x_ptp_open()
1028 ptp->ptp_clock_info.adjfreq = lan743x_ptpci_adjfreq; in lan743x_ptp_open()
1029 ptp->ptp_clock_info.adjtime = lan743x_ptpci_adjtime; in lan743x_ptp_open()
1030 ptp->ptp_clock_info.gettime64 = lan743x_ptpci_gettime64; in lan743x_ptp_open()
1031 ptp->ptp_clock_info.getcrosststamp = NULL; in lan743x_ptp_open()
1032 ptp->ptp_clock_info.settime64 = lan743x_ptpci_settime64; in lan743x_ptp_open()
1033 ptp->ptp_clock_info.enable = lan743x_ptpci_enable; in lan743x_ptp_open()
1034 ptp->ptp_clock_info.do_aux_work = lan743x_ptpci_do_aux_work; in lan743x_ptp_open()
1035 ptp->ptp_clock_info.verify = lan743x_ptpci_verify_pin_config; in lan743x_ptp_open()
1037 ptp->ptp_clock = ptp_clock_register(&ptp->ptp_clock_info, in lan743x_ptp_open()
1040 if (IS_ERR(ptp->ptp_clock)) { in lan743x_ptp_open()
1045 ptp->flags |= PTP_FLAG_PTP_CLOCK_REGISTERED; in lan743x_ptp_open()
1047 "successfully registered ptp clock\n"); in lan743x_ptp_open()
1057 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_close() local
1061 (ptp->flags & PTP_FLAG_PTP_CLOCK_REGISTERED)) { in lan743x_ptp_close()
1062 ptp_clock_unregister(ptp->ptp_clock); in lan743x_ptp_close()
1063 ptp->ptp_clock = NULL; in lan743x_ptp_close()
1064 ptp->flags &= ~PTP_FLAG_PTP_CLOCK_REGISTERED; in lan743x_ptp_close()
1066 "ptp clock unregister\n"); in lan743x_ptp_close()
1069 if (ptp->flags & PTP_FLAG_ISR_ENABLED) { in lan743x_ptp_close()
1074 ptp->flags &= ~PTP_FLAG_ISR_ENABLED; in lan743x_ptp_close()
1079 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_close()
1083 struct sk_buff *skb = ptp->tx_ts_skb_queue[index]; in lan743x_ptp_close()
1086 ptp->tx_ts_skb_queue[index] = NULL; in lan743x_ptp_close()
1087 ptp->tx_ts_seconds_queue[index] = 0; in lan743x_ptp_close()
1088 ptp->tx_ts_nseconds_queue[index] = 0; in lan743x_ptp_close()
1090 ptp->tx_ts_skb_queue_size = 0; in lan743x_ptp_close()
1091 ptp->tx_ts_queue_size = 0; in lan743x_ptp_close()
1092 ptp->pending_tx_timestamps = 0; in lan743x_ptp_close()
1093 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_close()
1122 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_enable() local
1124 mutex_lock(&ptp->command_lock); in lan743x_ptp_enable()
1128 "PTP already enabled\n"); in lan743x_ptp_enable()
1133 mutex_unlock(&ptp->command_lock); in lan743x_ptp_enable()
1138 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_disable() local
1140 mutex_lock(&ptp->command_lock); in lan743x_ptp_disable()
1143 "PTP already disabled\n"); in lan743x_ptp_disable()
1149 mutex_unlock(&ptp->command_lock); in lan743x_ptp_disable()
1154 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_reset() local
1156 mutex_lock(&ptp->command_lock); in lan743x_ptp_reset()
1167 mutex_unlock(&ptp->command_lock); in lan743x_ptp_reset()
1174 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_clock_set() local
1176 mutex_lock(&ptp->command_lock); in lan743x_ptp_clock_set()
1184 mutex_unlock(&ptp->command_lock); in lan743x_ptp_clock_set()
1189 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_request_tx_timestamp() local
1192 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_request_tx_timestamp()
1193 if (ptp->pending_tx_timestamps < LAN743X_PTP_NUMBER_OF_TX_TIMESTAMPS) { in lan743x_ptp_request_tx_timestamp()
1195 ptp->pending_tx_timestamps++; in lan743x_ptp_request_tx_timestamp()
1198 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_request_tx_timestamp()
1204 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_unrequest_tx_timestamp() local
1206 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_unrequest_tx_timestamp()
1207 if (ptp->pending_tx_timestamps > 0) in lan743x_ptp_unrequest_tx_timestamp()
1208 ptp->pending_tx_timestamps--; in lan743x_ptp_unrequest_tx_timestamp()
1212 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_unrequest_tx_timestamp()