Lines Matching refs:ptp
81 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_tx_ts_enqueue_ts() local
83 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_tx_ts_enqueue_ts()
84 if (ptp->tx_ts_queue_size < LAN743X_PTP_NUMBER_OF_TX_TIMESTAMPS) { in lan743x_ptp_tx_ts_enqueue_ts()
85 ptp->tx_ts_seconds_queue[ptp->tx_ts_queue_size] = seconds; in lan743x_ptp_tx_ts_enqueue_ts()
86 ptp->tx_ts_nseconds_queue[ptp->tx_ts_queue_size] = nano_seconds; in lan743x_ptp_tx_ts_enqueue_ts()
87 ptp->tx_ts_header_queue[ptp->tx_ts_queue_size] = header; in lan743x_ptp_tx_ts_enqueue_ts()
88 ptp->tx_ts_queue_size++; in lan743x_ptp_tx_ts_enqueue_ts()
93 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_tx_ts_enqueue_ts()
98 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_tx_ts_complete() local
105 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_tx_ts_complete()
106 c = ptp->tx_ts_skb_queue_size; in lan743x_ptp_tx_ts_complete()
108 if (c > ptp->tx_ts_queue_size) in lan743x_ptp_tx_ts_complete()
109 c = ptp->tx_ts_queue_size; in lan743x_ptp_tx_ts_complete()
114 ignore_sync = ((ptp->tx_ts_ignore_sync_queue & in lan743x_ptp_tx_ts_complete()
116 skb = ptp->tx_ts_skb_queue[i]; in lan743x_ptp_tx_ts_complete()
117 nseconds = ptp->tx_ts_nseconds_queue[i]; in lan743x_ptp_tx_ts_complete()
118 seconds = ptp->tx_ts_seconds_queue[i]; in lan743x_ptp_tx_ts_complete()
119 header = ptp->tx_ts_header_queue[i]; in lan743x_ptp_tx_ts_complete()
130 ptp->tx_ts_skb_queue[i] = NULL; in lan743x_ptp_tx_ts_complete()
131 ptp->tx_ts_seconds_queue[i] = 0; in lan743x_ptp_tx_ts_complete()
132 ptp->tx_ts_nseconds_queue[i] = 0; in lan743x_ptp_tx_ts_complete()
133 ptp->tx_ts_header_queue[i] = 0; in lan743x_ptp_tx_ts_complete()
137 ptp->tx_ts_ignore_sync_queue >>= c; in lan743x_ptp_tx_ts_complete()
139 ptp->tx_ts_skb_queue[i - c] = ptp->tx_ts_skb_queue[i]; in lan743x_ptp_tx_ts_complete()
140 ptp->tx_ts_seconds_queue[i - c] = ptp->tx_ts_seconds_queue[i]; in lan743x_ptp_tx_ts_complete()
141 ptp->tx_ts_nseconds_queue[i - c] = ptp->tx_ts_nseconds_queue[i]; in lan743x_ptp_tx_ts_complete()
142 ptp->tx_ts_header_queue[i - c] = ptp->tx_ts_header_queue[i]; in lan743x_ptp_tx_ts_complete()
144 ptp->tx_ts_skb_queue[i] = NULL; in lan743x_ptp_tx_ts_complete()
145 ptp->tx_ts_seconds_queue[i] = 0; in lan743x_ptp_tx_ts_complete()
146 ptp->tx_ts_nseconds_queue[i] = 0; in lan743x_ptp_tx_ts_complete()
147 ptp->tx_ts_header_queue[i] = 0; in lan743x_ptp_tx_ts_complete()
149 ptp->tx_ts_skb_queue_size -= c; in lan743x_ptp_tx_ts_complete()
150 ptp->tx_ts_queue_size -= c; in lan743x_ptp_tx_ts_complete()
152 ptp->pending_tx_timestamps -= c; in lan743x_ptp_tx_ts_complete()
153 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_tx_ts_complete()
159 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_reserve_event_ch() local
162 mutex_lock(&ptp->command_lock); in lan743x_ptp_reserve_event_ch()
163 if (!(test_bit(event_channel, &ptp->used_event_ch))) { in lan743x_ptp_reserve_event_ch()
164 ptp->used_event_ch |= BIT(event_channel); in lan743x_ptp_reserve_event_ch()
171 mutex_unlock(&ptp->command_lock); in lan743x_ptp_reserve_event_ch()
178 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_release_event_ch() local
180 mutex_lock(&ptp->command_lock); in lan743x_ptp_release_event_ch()
181 if (test_bit(event_channel, &ptp->used_event_ch)) { in lan743x_ptp_release_event_ch()
182 ptp->used_event_ch &= ~BIT(event_channel); in lan743x_ptp_release_event_ch()
188 mutex_unlock(&ptp->command_lock); in lan743x_ptp_release_event_ch()
202 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_led_mux_enable() local
204 if (ptp->leds_multiplexed && in lan743x_led_mux_enable()
205 ptp->led_enabled[pin]) { in lan743x_led_mux_enable()
219 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_led_mux_save() local
229 ptp->led_enabled[i] = led_enabled; in lan743x_led_mux_save()
231 ptp->leds_multiplexed = true; in lan743x_led_mux_save()
233 ptp->leds_multiplexed = false; in lan743x_led_mux_save()
337 struct lan743x_ptp *ptp = in lan743x_ptpci_adjfine() local
340 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_adjfine()
363 struct lan743x_ptp *ptp = in lan743x_ptpci_adjtime() local
366 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_adjtime()
376 struct lan743x_ptp *ptp = in lan743x_ptpci_gettime64() local
379 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_gettime64()
397 struct lan743x_ptp *ptp = in lan743x_ptpci_settime64() local
400 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_settime64()
433 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_perout_off() local
435 struct lan743x_ptp_perout *perout = &ptp->perout[index]; in lan743x_ptp_perout_off()
463 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_perout() local
470 struct lan743x_ptp_perout *perout = &ptp->perout[index]; in lan743x_ptp_perout()
478 perout_pin = ptp_find_pin(ptp->ptp_clock, PTP_PF_PEROUT, in lan743x_ptp_perout()
654 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_perout_off() local
660 event_ch = ptp->ptp_io_perout[index]; in lan743x_ptp_io_perout_off()
683 ptp->ptp_io_perout[index] = -1; in lan743x_ptp_io_perout_off()
686 perout_pin = ptp_find_pin(ptp->ptp_clock, PTP_PF_PEROUT, index); in lan743x_ptp_io_perout_off()
706 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_perout() local
718 event_ch = ptp->ptp_io_perout[index]; in lan743x_ptp_io_perout()
721 perout_pin = ptp_find_pin(ptp->ptp_clock, PTP_PF_PEROUT, index); in lan743x_ptp_io_perout()
741 ptp->ptp_io_perout[index] = event_ch; in lan743x_ptp_io_perout()
863 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_extts_off() local
867 extts = &ptp->extts[index]; in lan743x_ptp_io_extts_off()
899 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_event_cap_en() local
905 mutex_lock(&ptp->command_lock); in lan743x_ptp_io_event_cap_en()
935 mutex_unlock(&ptp->command_lock); in lan743x_ptp_io_event_cap_en()
943 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_extts() local
950 extts = &ptp->extts[index]; in lan743x_ptp_io_extts()
953 extts_pin = ptp_find_pin(ptp->ptp_clock, PTP_PF_EXTTS, index); in lan743x_ptp_io_extts()
970 struct lan743x_ptp *ptp = in lan743x_ptpci_enable() local
973 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_enable()
1006 static int lan743x_ptpci_verify_pin_config(struct ptp_clock_info *ptp, in lan743x_ptpci_verify_pin_config() argument
1012 container_of(ptp, struct lan743x_ptp, ptp_clock_info); in lan743x_ptpci_verify_pin_config()
1014 container_of(lan_ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_verify_pin_config()
1040 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_event_clock_get() local
1044 mutex_lock(&ptp->command_lock); in lan743x_ptp_io_event_clock_get()
1053 mutex_unlock(&ptp->command_lock); in lan743x_ptp_io_event_clock_get()
1056 extts = &ptp->extts[channel]; in lan743x_ptp_io_event_clock_get()
1065 struct lan743x_ptp *ptp = in lan743x_ptpci_do_aux_work() local
1068 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_do_aux_work()
1135 ptp_clock_event(ptp->ptp_clock, in lan743x_ptpci_do_aux_work()
1168 ptp_clock_event(ptp->ptp_clock, in lan743x_ptpci_do_aux_work()
1200 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_clock_get() local
1202 mutex_lock(&ptp->command_lock); in lan743x_ptp_clock_get()
1217 mutex_unlock(&ptp->command_lock); in lan743x_ptp_clock_get()
1223 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_clock_get() local
1225 mutex_lock(&ptp->command_lock); in lan743x_ptp_io_clock_get()
1239 mutex_unlock(&ptp->command_lock); in lan743x_ptp_io_clock_get()
1245 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_clock_step() local
1328 mutex_lock(&ptp->command_lock); in lan743x_ptp_clock_step()
1351 mutex_unlock(&ptp->command_lock); in lan743x_ptp_clock_step()
1354 mutex_lock(&ptp->command_lock); in lan743x_ptp_clock_step()
1363 mutex_unlock(&ptp->command_lock); in lan743x_ptp_clock_step()
1370 struct lan743x_ptp *ptp = NULL; in lan743x_ptp_isr() local
1374 ptp = &adapter->ptp; in lan743x_ptp_isr()
1382 ptp_schedule_worker(ptp->ptp_clock, 0); in lan743x_ptp_isr()
1412 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_tx_ts_enqueue_skb() local
1414 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_tx_ts_enqueue_skb()
1415 if (ptp->tx_ts_skb_queue_size < LAN743X_PTP_NUMBER_OF_TX_TIMESTAMPS) { in lan743x_ptp_tx_ts_enqueue_skb()
1416 ptp->tx_ts_skb_queue[ptp->tx_ts_skb_queue_size] = skb; in lan743x_ptp_tx_ts_enqueue_skb()
1418 ptp->tx_ts_ignore_sync_queue |= in lan743x_ptp_tx_ts_enqueue_skb()
1419 BIT(ptp->tx_ts_skb_queue_size); in lan743x_ptp_tx_ts_enqueue_skb()
1420 ptp->tx_ts_skb_queue_size++; in lan743x_ptp_tx_ts_enqueue_skb()
1430 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_tx_ts_enqueue_skb()
1466 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_init() local
1469 mutex_init(&ptp->command_lock); in lan743x_ptp_init()
1470 spin_lock_init(&ptp->tx_ts_lock); in lan743x_ptp_init()
1471 ptp->used_event_ch = 0; in lan743x_ptp_init()
1474 ptp->perout[i].event_ch = -1; in lan743x_ptp_init()
1475 ptp->perout[i].gpio_pin = -1; in lan743x_ptp_init()
1485 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_open() local
1500 ptp->flags |= PTP_FLAG_ISR_ENABLED; in lan743x_ptp_open()
1526 struct ptp_pin_desc *ptp_pin = &ptp->pin_config[i]; in lan743x_ptp_open()
1534 ptp->ptp_clock_info.owner = THIS_MODULE; in lan743x_ptp_open()
1535 snprintf(ptp->ptp_clock_info.name, 16, "%pm", in lan743x_ptp_open()
1537 ptp->ptp_clock_info.max_adj = LAN743X_PTP_MAX_FREQ_ADJ_IN_PPB; in lan743x_ptp_open()
1538 ptp->ptp_clock_info.n_alarm = 0; in lan743x_ptp_open()
1539 ptp->ptp_clock_info.n_ext_ts = LAN743X_PTP_N_EXTTS; in lan743x_ptp_open()
1540 ptp->ptp_clock_info.n_per_out = LAN743X_PTP_N_EVENT_CHAN; in lan743x_ptp_open()
1541 ptp->ptp_clock_info.n_pins = n_pins; in lan743x_ptp_open()
1542 ptp->ptp_clock_info.pps = LAN743X_PTP_N_PPS; in lan743x_ptp_open()
1543 ptp->ptp_clock_info.pin_config = ptp->pin_config; in lan743x_ptp_open()
1544 ptp->ptp_clock_info.adjfine = lan743x_ptpci_adjfine; in lan743x_ptp_open()
1545 ptp->ptp_clock_info.adjtime = lan743x_ptpci_adjtime; in lan743x_ptp_open()
1546 ptp->ptp_clock_info.gettime64 = lan743x_ptpci_gettime64; in lan743x_ptp_open()
1547 ptp->ptp_clock_info.getcrosststamp = NULL; in lan743x_ptp_open()
1548 ptp->ptp_clock_info.settime64 = lan743x_ptpci_settime64; in lan743x_ptp_open()
1549 ptp->ptp_clock_info.enable = lan743x_ptpci_enable; in lan743x_ptp_open()
1550 ptp->ptp_clock_info.do_aux_work = lan743x_ptpci_do_aux_work; in lan743x_ptp_open()
1551 ptp->ptp_clock_info.verify = lan743x_ptpci_verify_pin_config; in lan743x_ptp_open()
1553 ptp->ptp_clock = ptp_clock_register(&ptp->ptp_clock_info, in lan743x_ptp_open()
1556 if (IS_ERR(ptp->ptp_clock)) { in lan743x_ptp_open()
1561 ptp->flags |= PTP_FLAG_PTP_CLOCK_REGISTERED; in lan743x_ptp_open()
1573 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_close() local
1577 (ptp->flags & PTP_FLAG_PTP_CLOCK_REGISTERED)) { in lan743x_ptp_close()
1578 ptp_clock_unregister(ptp->ptp_clock); in lan743x_ptp_close()
1579 ptp->ptp_clock = NULL; in lan743x_ptp_close()
1580 ptp->flags &= ~PTP_FLAG_PTP_CLOCK_REGISTERED; in lan743x_ptp_close()
1585 if (ptp->flags & PTP_FLAG_ISR_ENABLED) { in lan743x_ptp_close()
1590 ptp->flags &= ~PTP_FLAG_ISR_ENABLED; in lan743x_ptp_close()
1595 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_close()
1599 struct sk_buff *skb = ptp->tx_ts_skb_queue[index]; in lan743x_ptp_close()
1602 ptp->tx_ts_skb_queue[index] = NULL; in lan743x_ptp_close()
1603 ptp->tx_ts_seconds_queue[index] = 0; in lan743x_ptp_close()
1604 ptp->tx_ts_nseconds_queue[index] = 0; in lan743x_ptp_close()
1606 ptp->tx_ts_skb_queue_size = 0; in lan743x_ptp_close()
1607 ptp->tx_ts_queue_size = 0; in lan743x_ptp_close()
1608 ptp->pending_tx_timestamps = 0; in lan743x_ptp_close()
1609 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_close()
1638 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_enable() local
1640 mutex_lock(&ptp->command_lock); in lan743x_ptp_enable()
1649 mutex_unlock(&ptp->command_lock); in lan743x_ptp_enable()
1654 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_disable() local
1656 mutex_lock(&ptp->command_lock); in lan743x_ptp_disable()
1665 mutex_unlock(&ptp->command_lock); in lan743x_ptp_disable()
1670 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_reset() local
1672 mutex_lock(&ptp->command_lock); in lan743x_ptp_reset()
1683 mutex_unlock(&ptp->command_lock); in lan743x_ptp_reset()
1690 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_clock_set() local
1692 mutex_lock(&ptp->command_lock); in lan743x_ptp_clock_set()
1700 mutex_unlock(&ptp->command_lock); in lan743x_ptp_clock_set()
1705 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_request_tx_timestamp() local
1708 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_request_tx_timestamp()
1709 if (ptp->pending_tx_timestamps < LAN743X_PTP_NUMBER_OF_TX_TIMESTAMPS) { in lan743x_ptp_request_tx_timestamp()
1711 ptp->pending_tx_timestamps++; in lan743x_ptp_request_tx_timestamp()
1714 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_request_tx_timestamp()
1720 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_unrequest_tx_timestamp() local
1722 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_unrequest_tx_timestamp()
1723 if (ptp->pending_tx_timestamps > 0) in lan743x_ptp_unrequest_tx_timestamp()
1724 ptp->pending_tx_timestamps--; in lan743x_ptp_unrequest_tx_timestamp()
1728 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_unrequest_tx_timestamp()