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()
370 struct lan743x_ptp *ptp = in lan743x_ptpci_adjfreq() local
373 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_adjfreq()
404 struct lan743x_ptp *ptp = in lan743x_ptpci_adjtime() local
407 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_adjtime()
417 struct lan743x_ptp *ptp = in lan743x_ptpci_gettime64() local
420 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_gettime64()
438 struct lan743x_ptp *ptp = in lan743x_ptpci_settime64() local
441 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_settime64()
474 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_perout_off() local
476 struct lan743x_ptp_perout *perout = &ptp->perout[index]; in lan743x_ptp_perout_off()
504 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_perout() local
511 struct lan743x_ptp_perout *perout = &ptp->perout[index]; in lan743x_ptp_perout()
519 perout_pin = ptp_find_pin(ptp->ptp_clock, PTP_PF_PEROUT, in lan743x_ptp_perout()
695 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_perout_off() local
701 event_ch = ptp->ptp_io_perout[index]; in lan743x_ptp_io_perout_off()
724 ptp->ptp_io_perout[index] = -1; in lan743x_ptp_io_perout_off()
727 perout_pin = ptp_find_pin(ptp->ptp_clock, PTP_PF_PEROUT, index); in lan743x_ptp_io_perout_off()
747 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_perout() local
759 event_ch = ptp->ptp_io_perout[index]; in lan743x_ptp_io_perout()
762 perout_pin = ptp_find_pin(ptp->ptp_clock, PTP_PF_PEROUT, index); in lan743x_ptp_io_perout()
782 ptp->ptp_io_perout[index] = event_ch; in lan743x_ptp_io_perout()
904 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_extts_off() local
908 extts = &ptp->extts[index]; in lan743x_ptp_io_extts_off()
940 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_event_cap_en() local
946 mutex_lock(&ptp->command_lock); in lan743x_ptp_io_event_cap_en()
976 mutex_unlock(&ptp->command_lock); in lan743x_ptp_io_event_cap_en()
984 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_extts() local
991 extts = &ptp->extts[index]; in lan743x_ptp_io_extts()
994 extts_pin = ptp_find_pin(ptp->ptp_clock, PTP_PF_EXTTS, index); in lan743x_ptp_io_extts()
1011 struct lan743x_ptp *ptp = in lan743x_ptpci_enable() local
1014 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_enable()
1047 static int lan743x_ptpci_verify_pin_config(struct ptp_clock_info *ptp, in lan743x_ptpci_verify_pin_config() argument
1053 container_of(ptp, struct lan743x_ptp, ptp_clock_info); in lan743x_ptpci_verify_pin_config()
1055 container_of(lan_ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_verify_pin_config()
1081 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_event_clock_get() local
1085 mutex_lock(&ptp->command_lock); in lan743x_ptp_io_event_clock_get()
1094 mutex_unlock(&ptp->command_lock); in lan743x_ptp_io_event_clock_get()
1097 extts = &ptp->extts[channel]; in lan743x_ptp_io_event_clock_get()
1106 struct lan743x_ptp *ptp = in lan743x_ptpci_do_aux_work() local
1109 container_of(ptp, struct lan743x_adapter, ptp); in lan743x_ptpci_do_aux_work()
1176 ptp_clock_event(ptp->ptp_clock, in lan743x_ptpci_do_aux_work()
1209 ptp_clock_event(ptp->ptp_clock, in lan743x_ptpci_do_aux_work()
1241 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_clock_get() local
1243 mutex_lock(&ptp->command_lock); in lan743x_ptp_clock_get()
1258 mutex_unlock(&ptp->command_lock); in lan743x_ptp_clock_get()
1264 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_clock_get() local
1266 mutex_lock(&ptp->command_lock); in lan743x_ptp_io_clock_get()
1280 mutex_unlock(&ptp->command_lock); in lan743x_ptp_io_clock_get()
1286 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_clock_step() local
1369 mutex_lock(&ptp->command_lock); in lan743x_ptp_clock_step()
1392 mutex_unlock(&ptp->command_lock); in lan743x_ptp_clock_step()
1395 mutex_lock(&ptp->command_lock); in lan743x_ptp_clock_step()
1404 mutex_unlock(&ptp->command_lock); in lan743x_ptp_clock_step()
1411 struct lan743x_ptp *ptp = NULL; in lan743x_ptp_isr() local
1415 ptp = &adapter->ptp; in lan743x_ptp_isr()
1423 ptp_schedule_worker(ptp->ptp_clock, 0); in lan743x_ptp_isr()
1453 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_tx_ts_enqueue_skb() local
1455 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_tx_ts_enqueue_skb()
1456 if (ptp->tx_ts_skb_queue_size < LAN743X_PTP_NUMBER_OF_TX_TIMESTAMPS) { in lan743x_ptp_tx_ts_enqueue_skb()
1457 ptp->tx_ts_skb_queue[ptp->tx_ts_skb_queue_size] = skb; in lan743x_ptp_tx_ts_enqueue_skb()
1459 ptp->tx_ts_ignore_sync_queue |= in lan743x_ptp_tx_ts_enqueue_skb()
1460 BIT(ptp->tx_ts_skb_queue_size); in lan743x_ptp_tx_ts_enqueue_skb()
1461 ptp->tx_ts_skb_queue_size++; in lan743x_ptp_tx_ts_enqueue_skb()
1471 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_tx_ts_enqueue_skb()
1507 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_init() local
1510 mutex_init(&ptp->command_lock); in lan743x_ptp_init()
1511 spin_lock_init(&ptp->tx_ts_lock); in lan743x_ptp_init()
1512 ptp->used_event_ch = 0; in lan743x_ptp_init()
1515 ptp->perout[i].event_ch = -1; in lan743x_ptp_init()
1516 ptp->perout[i].gpio_pin = -1; in lan743x_ptp_init()
1526 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_open() local
1541 ptp->flags |= PTP_FLAG_ISR_ENABLED; in lan743x_ptp_open()
1567 struct ptp_pin_desc *ptp_pin = &ptp->pin_config[i]; in lan743x_ptp_open()
1575 ptp->ptp_clock_info.owner = THIS_MODULE; in lan743x_ptp_open()
1576 snprintf(ptp->ptp_clock_info.name, 16, "%pm", in lan743x_ptp_open()
1578 ptp->ptp_clock_info.max_adj = LAN743X_PTP_MAX_FREQ_ADJ_IN_PPB; in lan743x_ptp_open()
1579 ptp->ptp_clock_info.n_alarm = 0; in lan743x_ptp_open()
1580 ptp->ptp_clock_info.n_ext_ts = LAN743X_PTP_N_EXTTS; in lan743x_ptp_open()
1581 ptp->ptp_clock_info.n_per_out = LAN743X_PTP_N_EVENT_CHAN; in lan743x_ptp_open()
1582 ptp->ptp_clock_info.n_pins = n_pins; in lan743x_ptp_open()
1583 ptp->ptp_clock_info.pps = LAN743X_PTP_N_PPS; in lan743x_ptp_open()
1584 ptp->ptp_clock_info.pin_config = ptp->pin_config; in lan743x_ptp_open()
1585 ptp->ptp_clock_info.adjfine = lan743x_ptpci_adjfine; in lan743x_ptp_open()
1586 ptp->ptp_clock_info.adjfreq = lan743x_ptpci_adjfreq; in lan743x_ptp_open()
1587 ptp->ptp_clock_info.adjtime = lan743x_ptpci_adjtime; in lan743x_ptp_open()
1588 ptp->ptp_clock_info.gettime64 = lan743x_ptpci_gettime64; in lan743x_ptp_open()
1589 ptp->ptp_clock_info.getcrosststamp = NULL; in lan743x_ptp_open()
1590 ptp->ptp_clock_info.settime64 = lan743x_ptpci_settime64; in lan743x_ptp_open()
1591 ptp->ptp_clock_info.enable = lan743x_ptpci_enable; in lan743x_ptp_open()
1592 ptp->ptp_clock_info.do_aux_work = lan743x_ptpci_do_aux_work; in lan743x_ptp_open()
1593 ptp->ptp_clock_info.verify = lan743x_ptpci_verify_pin_config; in lan743x_ptp_open()
1595 ptp->ptp_clock = ptp_clock_register(&ptp->ptp_clock_info, in lan743x_ptp_open()
1598 if (IS_ERR(ptp->ptp_clock)) { in lan743x_ptp_open()
1603 ptp->flags |= PTP_FLAG_PTP_CLOCK_REGISTERED; in lan743x_ptp_open()
1615 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_close() local
1619 (ptp->flags & PTP_FLAG_PTP_CLOCK_REGISTERED)) { in lan743x_ptp_close()
1620 ptp_clock_unregister(ptp->ptp_clock); in lan743x_ptp_close()
1621 ptp->ptp_clock = NULL; in lan743x_ptp_close()
1622 ptp->flags &= ~PTP_FLAG_PTP_CLOCK_REGISTERED; in lan743x_ptp_close()
1627 if (ptp->flags & PTP_FLAG_ISR_ENABLED) { in lan743x_ptp_close()
1632 ptp->flags &= ~PTP_FLAG_ISR_ENABLED; in lan743x_ptp_close()
1637 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_close()
1641 struct sk_buff *skb = ptp->tx_ts_skb_queue[index]; in lan743x_ptp_close()
1644 ptp->tx_ts_skb_queue[index] = NULL; in lan743x_ptp_close()
1645 ptp->tx_ts_seconds_queue[index] = 0; in lan743x_ptp_close()
1646 ptp->tx_ts_nseconds_queue[index] = 0; in lan743x_ptp_close()
1648 ptp->tx_ts_skb_queue_size = 0; in lan743x_ptp_close()
1649 ptp->tx_ts_queue_size = 0; in lan743x_ptp_close()
1650 ptp->pending_tx_timestamps = 0; in lan743x_ptp_close()
1651 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_close()
1680 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_enable() local
1682 mutex_lock(&ptp->command_lock); in lan743x_ptp_enable()
1691 mutex_unlock(&ptp->command_lock); in lan743x_ptp_enable()
1696 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_disable() local
1698 mutex_lock(&ptp->command_lock); in lan743x_ptp_disable()
1707 mutex_unlock(&ptp->command_lock); in lan743x_ptp_disable()
1712 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_reset() local
1714 mutex_lock(&ptp->command_lock); in lan743x_ptp_reset()
1725 mutex_unlock(&ptp->command_lock); in lan743x_ptp_reset()
1732 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_clock_set() local
1734 mutex_lock(&ptp->command_lock); in lan743x_ptp_clock_set()
1742 mutex_unlock(&ptp->command_lock); in lan743x_ptp_clock_set()
1747 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_request_tx_timestamp() local
1750 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_request_tx_timestamp()
1751 if (ptp->pending_tx_timestamps < LAN743X_PTP_NUMBER_OF_TX_TIMESTAMPS) { in lan743x_ptp_request_tx_timestamp()
1753 ptp->pending_tx_timestamps++; in lan743x_ptp_request_tx_timestamp()
1756 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_request_tx_timestamp()
1762 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_unrequest_tx_timestamp() local
1764 spin_lock_bh(&ptp->tx_ts_lock); in lan743x_ptp_unrequest_tx_timestamp()
1765 if (ptp->pending_tx_timestamps > 0) in lan743x_ptp_unrequest_tx_timestamp()
1766 ptp->pending_tx_timestamps--; in lan743x_ptp_unrequest_tx_timestamp()
1770 spin_unlock_bh(&ptp->tx_ts_lock); in lan743x_ptp_unrequest_tx_timestamp()