Lines Matching full:adapter
20 static bool lan743x_ptp_is_enabled(struct lan743x_adapter *adapter);
21 static void lan743x_ptp_enable(struct lan743x_adapter *adapter);
22 static void lan743x_ptp_disable(struct lan743x_adapter *adapter);
23 static void lan743x_ptp_reset(struct lan743x_adapter *adapter);
24 static void lan743x_ptp_clock_set(struct lan743x_adapter *adapter,
40 int lan743x_gpio_init(struct lan743x_adapter *adapter) in lan743x_gpio_init() argument
42 struct lan743x_gpio *gpio = &adapter->gpio; in lan743x_gpio_init()
50 lan743x_csr_write(adapter, GPIO_CFG0, gpio->gpio_cfg0); in lan743x_gpio_init()
51 lan743x_csr_write(adapter, GPIO_CFG1, gpio->gpio_cfg1); in lan743x_gpio_init()
52 lan743x_csr_write(adapter, GPIO_CFG2, gpio->gpio_cfg2); in lan743x_gpio_init()
53 lan743x_csr_write(adapter, GPIO_CFG3, gpio->gpio_cfg3); in lan743x_gpio_init()
58 static void lan743x_ptp_wait_till_cmd_done(struct lan743x_adapter *adapter, in lan743x_ptp_wait_till_cmd_done() argument
65 (data = (lan743x_csr_read(adapter, PTP_CMD_CTL) & in lan743x_ptp_wait_till_cmd_done()
71 netif_err(adapter, drv, adapter->netdev, in lan743x_ptp_wait_till_cmd_done()
77 static void lan743x_ptp_tx_ts_enqueue_ts(struct lan743x_adapter *adapter, in lan743x_ptp_tx_ts_enqueue_ts() argument
81 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_tx_ts_enqueue_ts()
90 netif_err(adapter, drv, adapter->netdev, in lan743x_ptp_tx_ts_enqueue_ts()
96 static void lan743x_ptp_tx_ts_complete(struct lan743x_adapter *adapter) in lan743x_ptp_tx_ts_complete() argument
98 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_tx_ts_complete()
156 static int lan743x_ptp_reserve_event_ch(struct lan743x_adapter *adapter, in lan743x_ptp_reserve_event_ch() argument
159 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_reserve_event_ch()
167 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptp_reserve_event_ch()
175 static void lan743x_ptp_release_event_ch(struct lan743x_adapter *adapter, in lan743x_ptp_release_event_ch() argument
178 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_release_event_ch()
184 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptp_release_event_ch()
191 static void lan743x_ptp_clock_get(struct lan743x_adapter *adapter,
194 static void lan743x_ptp_io_clock_get(struct lan743x_adapter *adapter,
196 static void lan743x_ptp_clock_step(struct lan743x_adapter *adapter,
199 static void lan743x_led_mux_enable(struct lan743x_adapter *adapter, in lan743x_led_mux_enable() argument
202 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_led_mux_enable()
206 u32 val = lan743x_csr_read(adapter, HW_CFG); in lan743x_led_mux_enable()
213 lan743x_csr_write(adapter, HW_CFG, val); in lan743x_led_mux_enable()
217 static void lan743x_led_mux_save(struct lan743x_adapter *adapter) in lan743x_led_mux_save() argument
219 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_led_mux_save()
220 u32 id_rev = adapter->csr.id_rev & ID_REV_ID_MASK_; in lan743x_led_mux_save()
224 u32 val = lan743x_csr_read(adapter, HW_CFG); in lan743x_led_mux_save()
237 static void lan743x_led_mux_restore(struct lan743x_adapter *adapter) in lan743x_led_mux_restore() argument
239 u32 id_rev = adapter->csr.id_rev & ID_REV_ID_MASK_; in lan743x_led_mux_restore()
245 lan743x_led_mux_enable(adapter, i, true); in lan743x_led_mux_restore()
249 static int lan743x_gpio_rsrv_ptp_out(struct lan743x_adapter *adapter, in lan743x_gpio_rsrv_ptp_out() argument
252 struct lan743x_gpio *gpio = &adapter->gpio; in lan743x_gpio_rsrv_ptp_out()
265 lan743x_led_mux_enable(adapter, pin, false); in lan743x_gpio_rsrv_ptp_out()
270 lan743x_csr_write(adapter, GPIO_CFG0, gpio->gpio_cfg0); in lan743x_gpio_rsrv_ptp_out()
275 lan743x_csr_write(adapter, GPIO_CFG1, gpio->gpio_cfg1); in lan743x_gpio_rsrv_ptp_out()
279 lan743x_csr_write(adapter, GPIO_CFG2, gpio->gpio_cfg2); in lan743x_gpio_rsrv_ptp_out()
289 lan743x_csr_write(adapter, GPIO_CFG3, gpio->gpio_cfg3); in lan743x_gpio_rsrv_ptp_out()
297 static void lan743x_gpio_release(struct lan743x_adapter *adapter, int pin) in lan743x_gpio_release() argument
299 struct lan743x_gpio *gpio = &adapter->gpio; in lan743x_gpio_release()
313 lan743x_csr_write(adapter, GPIO_CFG3, in lan743x_gpio_release()
321 lan743x_csr_write(adapter, GPIO_CFG1, gpio->gpio_cfg1); in lan743x_gpio_release()
326 lan743x_csr_write(adapter, GPIO_CFG0, gpio->gpio_cfg0); in lan743x_gpio_release()
329 lan743x_led_mux_enable(adapter, pin, true); in lan743x_gpio_release()
339 struct lan743x_adapter *adapter = in lan743x_ptpci_adjfine() local
355 lan743x_csr_write(adapter, PTP_CLOCK_RATE_ADJ, in lan743x_ptpci_adjfine()
365 struct lan743x_adapter *adapter = in lan743x_ptpci_adjtime() local
368 lan743x_ptp_clock_step(adapter, delta); in lan743x_ptpci_adjtime()
378 struct lan743x_adapter *adapter = in lan743x_ptpci_gettime64() local
383 if (adapter->is_pci11x1x) in lan743x_ptpci_gettime64()
384 lan743x_ptp_io_clock_get(adapter, &seconds, &nano_seconds, in lan743x_ptpci_gettime64()
387 lan743x_ptp_clock_get(adapter, &seconds, &nano_seconds, NULL); in lan743x_ptpci_gettime64()
399 struct lan743x_adapter *adapter = in lan743x_ptpci_settime64() local
407 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptpci_settime64()
414 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptpci_settime64()
421 lan743x_ptp_clock_set(adapter, seconds, nano_seconds, 0); in lan743x_ptpci_settime64()
423 netif_warn(adapter, drv, adapter->netdev, "ts == NULL\n"); in lan743x_ptpci_settime64()
430 static void lan743x_ptp_perout_off(struct lan743x_adapter *adapter, in lan743x_ptp_perout_off() argument
433 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_perout_off()
438 lan743x_gpio_release(adapter, perout->gpio_pin); in lan743x_ptp_perout_off()
444 lan743x_csr_write(adapter, in lan743x_ptp_perout_off()
447 lan743x_csr_write(adapter, in lan743x_ptp_perout_off()
451 general_config = lan743x_csr_read(adapter, PTP_GENERAL_CONFIG); in lan743x_ptp_perout_off()
454 lan743x_csr_write(adapter, PTP_GENERAL_CONFIG, general_config); in lan743x_ptp_perout_off()
455 lan743x_ptp_release_event_ch(adapter, perout->event_ch); in lan743x_ptp_perout_off()
460 static int lan743x_ptp_perout(struct lan743x_adapter *adapter, int on, in lan743x_ptp_perout() argument
463 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_perout()
483 lan743x_ptp_perout_off(adapter, index); in lan743x_ptp_perout()
490 lan743x_ptp_perout_off(adapter, index); in lan743x_ptp_perout()
493 perout->event_ch = lan743x_ptp_reserve_event_ch(adapter, index); in lan743x_ptp_perout()
496 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptp_perout()
503 perout->gpio_pin = lan743x_gpio_rsrv_ptp_out(adapter, in lan743x_ptp_perout()
508 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptp_perout()
536 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptp_perout()
542 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptp_perout()
580 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptp_perout()
600 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptp_perout()
612 lan743x_csr_write(adapter, in lan743x_ptp_perout()
615 lan743x_csr_write(adapter, in lan743x_ptp_perout()
619 general_config = lan743x_csr_read(adapter, PTP_GENERAL_CONFIG); in lan743x_ptp_perout()
626 lan743x_csr_write(adapter, PTP_GENERAL_CONFIG, general_config); in lan743x_ptp_perout()
629 lan743x_csr_write(adapter, in lan743x_ptp_perout()
632 lan743x_csr_write(adapter, in lan743x_ptp_perout()
637 lan743x_csr_write(adapter, in lan743x_ptp_perout()
640 lan743x_csr_write(adapter, in lan743x_ptp_perout()
647 lan743x_ptp_perout_off(adapter, index); in lan743x_ptp_perout()
651 static void lan743x_ptp_io_perout_off(struct lan743x_adapter *adapter, in lan743x_ptp_io_perout_off() argument
654 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_perout_off()
663 lan743x_csr_write(adapter, in lan743x_ptp_io_perout_off()
666 lan743x_csr_write(adapter, in lan743x_ptp_io_perout_off()
670 gen_cfg = lan743x_csr_read(adapter, HS_PTP_GENERAL_CONFIG); in lan743x_ptp_io_perout_off()
675 lan743x_csr_write(adapter, HS_PTP_GENERAL_CONFIG, gen_cfg); in lan743x_ptp_io_perout_off()
677 lan743x_csr_write(adapter, PTP_INT_STS, in lan743x_ptp_io_perout_off()
680 lan743x_csr_write(adapter, PTP_INT_STS, in lan743x_ptp_io_perout_off()
682 lan743x_ptp_release_event_ch(adapter, event_ch); in lan743x_ptp_io_perout_off()
689 val = lan743x_csr_read(adapter, PTP_IO_EVENT_OUTPUT_CFG); in lan743x_ptp_io_perout_off()
693 lan743x_csr_write(adapter, PTP_IO_EVENT_OUTPUT_CFG, val); in lan743x_ptp_io_perout_off()
696 val = lan743x_csr_read(adapter, PTP_IO_PIN_CFG); in lan743x_ptp_io_perout_off()
698 lan743x_csr_write(adapter, PTP_IO_PIN_CFG, val); in lan743x_ptp_io_perout_off()
700 val = lan743x_csr_read(adapter, PTP_IO_PIN_CFG); in lan743x_ptp_io_perout_off()
703 static int lan743x_ptp_io_perout(struct lan743x_adapter *adapter, int on, in lan743x_ptp_io_perout() argument
706 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_perout()
725 lan743x_ptp_io_perout_off(adapter, index); in lan743x_ptp_io_perout()
731 lan743x_ptp_io_perout_off(adapter, index); in lan743x_ptp_io_perout()
734 event_ch = lan743x_ptp_reserve_event_ch(adapter, index); in lan743x_ptp_io_perout()
736 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptp_io_perout()
783 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptp_io_perout()
792 lan743x_csr_write(adapter, in lan743x_ptp_io_perout()
795 lan743x_csr_write(adapter, in lan743x_ptp_io_perout()
799 gen_cfg = lan743x_csr_read(adapter, HS_PTP_GENERAL_CONFIG); in lan743x_ptp_io_perout()
805 lan743x_csr_write(adapter, HS_PTP_GENERAL_CONFIG, gen_cfg); in lan743x_ptp_io_perout()
811 lan743x_csr_write(adapter, in lan743x_ptp_io_perout()
814 lan743x_csr_write(adapter, in lan743x_ptp_io_perout()
823 lan743x_csr_write(adapter, in lan743x_ptp_io_perout()
826 lan743x_csr_write(adapter, in lan743x_ptp_io_perout()
831 val = lan743x_csr_read(adapter, PTP_CMD_CTL); in lan743x_ptp_io_perout()
833 lan743x_csr_write(adapter, PTP_CMD_CTL, val); in lan743x_ptp_io_perout()
836 val = lan743x_csr_read(adapter, PTP_IO_PIN_CFG); in lan743x_ptp_io_perout()
838 lan743x_csr_write(adapter, PTP_IO_PIN_CFG, val); in lan743x_ptp_io_perout()
841 val = lan743x_csr_read(adapter, PTP_IO_EVENT_OUTPUT_CFG); in lan743x_ptp_io_perout()
851 lan743x_csr_write(adapter, PTP_IO_EVENT_OUTPUT_CFG, val); in lan743x_ptp_io_perout()
856 lan743x_ptp_io_perout_off(adapter, index); in lan743x_ptp_io_perout()
860 static void lan743x_ptp_io_extts_off(struct lan743x_adapter *adapter, in lan743x_ptp_io_extts_off() argument
863 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_extts_off()
873 lan743x_csr_write(adapter, PTP_INT_EN_CLR, val); in lan743x_ptp_io_extts_off()
876 val = lan743x_csr_read(adapter, PTP_IO_CAP_CONFIG); in lan743x_ptp_io_extts_off()
884 lan743x_csr_write(adapter, PTP_IO_CAP_CONFIG, val); in lan743x_ptp_io_extts_off()
887 val = lan743x_csr_read(adapter, PTP_IO_SEL); in lan743x_ptp_io_extts_off()
889 lan743x_csr_write(adapter, PTP_IO_SEL, val); in lan743x_ptp_io_extts_off()
896 static int lan743x_ptp_io_event_cap_en(struct lan743x_adapter *adapter, in lan743x_ptp_io_event_cap_en() argument
899 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_event_cap_en()
907 val = lan743x_csr_read(adapter, PTP_IO_CAP_CONFIG); in lan743x_ptp_io_event_cap_en()
920 lan743x_csr_write(adapter, PTP_IO_CAP_CONFIG, val); in lan743x_ptp_io_event_cap_en()
923 val = lan743x_csr_read(adapter, PTP_IO_SEL); in lan743x_ptp_io_event_cap_en()
926 lan743x_csr_write(adapter, PTP_IO_SEL, val); in lan743x_ptp_io_event_cap_en()
933 lan743x_csr_write(adapter, PTP_INT_EN_SET, val); in lan743x_ptp_io_event_cap_en()
940 static int lan743x_ptp_io_extts(struct lan743x_adapter *adapter, int on, in lan743x_ptp_io_extts() argument
943 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_extts()
957 ret = lan743x_ptp_io_event_cap_en(adapter, flags, index); in lan743x_ptp_io_extts()
961 lan743x_ptp_io_extts_off(adapter, index); in lan743x_ptp_io_extts()
972 struct lan743x_adapter *adapter = in lan743x_ptpci_enable() local
979 return lan743x_ptp_io_extts(adapter, on, in lan743x_ptpci_enable()
984 if (adapter->is_pci11x1x) in lan743x_ptpci_enable()
985 return lan743x_ptp_io_perout(adapter, on, in lan743x_ptpci_enable()
988 return lan743x_ptp_perout(adapter, on, in lan743x_ptpci_enable()
995 netif_err(adapter, drv, adapter->netdev, in lan743x_ptpci_enable()
1001 netif_err(adapter, drv, adapter->netdev, "request == NULL\n"); in lan743x_ptpci_enable()
1013 struct lan743x_adapter *adapter = in lan743x_ptpci_verify_pin_config() local
1025 if (!adapter->is_pci11x1x) in lan743x_ptpci_verify_pin_config()
1036 static void lan743x_ptp_io_event_clock_get(struct lan743x_adapter *adapter, in lan743x_ptp_io_event_clock_get() argument
1040 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_event_clock_get()
1046 sec = lan743x_csr_read(adapter, PTP_IO_FE_LTC_SEC_CAP_X); in lan743x_ptp_io_event_clock_get()
1047 nsec = lan743x_csr_read(adapter, PTP_IO_FE_LTC_NS_CAP_X); in lan743x_ptp_io_event_clock_get()
1049 sec = lan743x_csr_read(adapter, PTP_IO_RE_LTC_SEC_CAP_X); in lan743x_ptp_io_event_clock_get()
1050 nsec = lan743x_csr_read(adapter, PTP_IO_RE_LTC_NS_CAP_X); in lan743x_ptp_io_event_clock_get()
1067 struct lan743x_adapter *adapter = in lan743x_ptpci_do_aux_work() local
1078 ptp_int_sts = lan743x_csr_read(adapter, PTP_INT_STS); in lan743x_ptpci_do_aux_work()
1083 cap_info = lan743x_csr_read(adapter, PTP_CAP_INFO); in lan743x_ptpci_do_aux_work()
1086 seconds = lan743x_csr_read(adapter, in lan743x_ptpci_do_aux_work()
1088 nsec = lan743x_csr_read(adapter, in lan743x_ptpci_do_aux_work()
1092 header = lan743x_csr_read(adapter, in lan743x_ptpci_do_aux_work()
1098 lan743x_ptp_tx_ts_enqueue_ts(adapter, in lan743x_ptpci_do_aux_work()
1105 netif_err(adapter, drv, adapter->netdev, in lan743x_ptpci_do_aux_work()
1108 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptpci_do_aux_work()
1112 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptpci_do_aux_work()
1115 lan743x_csr_write(adapter, PTP_INT_STS, in lan743x_ptpci_do_aux_work()
1126 lan743x_ptp_io_event_clock_get(adapter, in lan743x_ptpci_do_aux_work()
1137 lan743x_csr_write(adapter, PTP_INT_STS, in lan743x_ptpci_do_aux_work()
1145 lan743x_csr_write(adapter, PTP_INT_STS, in lan743x_ptpci_do_aux_work()
1159 lan743x_ptp_io_event_clock_get(adapter, in lan743x_ptpci_do_aux_work()
1170 lan743x_csr_write(adapter, PTP_INT_STS, in lan743x_ptpci_do_aux_work()
1178 lan743x_csr_write(adapter, PTP_INT_STS, in lan743x_ptpci_do_aux_work()
1185 ptp_int_sts = lan743x_csr_read(adapter, PTP_INT_STS); in lan743x_ptpci_do_aux_work()
1189 lan743x_ptp_tx_ts_complete(adapter); in lan743x_ptpci_do_aux_work()
1191 lan743x_csr_write(adapter, INT_EN_SET, INT_BIT_1588_); in lan743x_ptpci_do_aux_work()
1196 static void lan743x_ptp_clock_get(struct lan743x_adapter *adapter, in lan743x_ptp_clock_get() argument
1200 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_clock_get()
1204 lan743x_csr_write(adapter, PTP_CMD_CTL, PTP_CMD_CTL_PTP_CLOCK_READ_); in lan743x_ptp_clock_get()
1205 lan743x_ptp_wait_till_cmd_done(adapter, PTP_CMD_CTL_PTP_CLOCK_READ_); in lan743x_ptp_clock_get()
1208 (*seconds) = lan743x_csr_read(adapter, PTP_CLOCK_SEC); in lan743x_ptp_clock_get()
1211 (*nano_seconds) = lan743x_csr_read(adapter, PTP_CLOCK_NS); in lan743x_ptp_clock_get()
1215 lan743x_csr_read(adapter, PTP_CLOCK_SUBNS); in lan743x_ptp_clock_get()
1220 static void lan743x_ptp_io_clock_get(struct lan743x_adapter *adapter, in lan743x_ptp_io_clock_get() argument
1223 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_io_clock_get()
1226 lan743x_csr_write(adapter, PTP_CMD_CTL, PTP_CMD_CTL_PTP_CLOCK_READ_); in lan743x_ptp_io_clock_get()
1227 lan743x_ptp_wait_till_cmd_done(adapter, PTP_CMD_CTL_PTP_CLOCK_READ_); in lan743x_ptp_io_clock_get()
1230 (*sec) = lan743x_csr_read(adapter, PTP_LTC_RD_SEC_LO); in lan743x_ptp_io_clock_get()
1233 (*nsec) = lan743x_csr_read(adapter, PTP_LTC_RD_NS); in lan743x_ptp_io_clock_get()
1237 lan743x_csr_read(adapter, PTP_LTC_RD_SUBNS); in lan743x_ptp_io_clock_get()
1242 static void lan743x_ptp_clock_step(struct lan743x_adapter *adapter, in lan743x_ptp_clock_step() argument
1245 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_clock_step()
1255 if (adapter->is_pci11x1x) in lan743x_ptp_clock_step()
1256 lan743x_ptp_io_clock_get(adapter, &unsigned_seconds, in lan743x_ptp_clock_step()
1259 lan743x_ptp_clock_get(adapter, &unsigned_seconds, in lan743x_ptp_clock_step()
1268 lan743x_ptp_clock_set(adapter, unsigned_seconds, in lan743x_ptp_clock_step()
1275 if (adapter->is_pci11x1x) { in lan743x_ptp_clock_step()
1276 lan743x_ptp_io_clock_get(adapter, &unsigned_seconds, in lan743x_ptp_clock_step()
1279 lan743x_ptp_clock_get(adapter, &unsigned_seconds, in lan743x_ptp_clock_step()
1290 lan743x_ptp_clock_set(adapter, unsigned_seconds, in lan743x_ptp_clock_step()
1334 lan743x_csr_write(adapter, PTP_CLOCK_STEP_ADJ, in lan743x_ptp_clock_step()
1343 lan743x_csr_write(adapter, PTP_CLOCK_STEP_ADJ, in lan743x_ptp_clock_step()
1347 lan743x_csr_write(adapter, PTP_CMD_CTL, in lan743x_ptp_clock_step()
1349 lan743x_ptp_wait_till_cmd_done(adapter, in lan743x_ptp_clock_step()
1355 lan743x_csr_write(adapter, PTP_CLOCK_STEP_ADJ, in lan743x_ptp_clock_step()
1359 lan743x_csr_write(adapter, PTP_CMD_CTL, in lan743x_ptp_clock_step()
1361 lan743x_ptp_wait_till_cmd_done(adapter, in lan743x_ptp_clock_step()
1369 struct lan743x_adapter *adapter = (struct lan743x_adapter *)context; in lan743x_ptp_isr() local
1374 ptp = &adapter->ptp; in lan743x_ptp_isr()
1376 lan743x_csr_write(adapter, INT_EN_CLR, INT_BIT_1588_); in lan743x_ptp_isr()
1378 ptp_int_sts = lan743x_csr_read(adapter, PTP_INT_STS); in lan743x_ptp_isr()
1379 ptp_int_sts &= lan743x_csr_read(adapter, PTP_INT_EN_SET); in lan743x_ptp_isr()
1386 netif_err(adapter, drv, adapter->netdev, in lan743x_ptp_isr()
1389 lan743x_csr_write(adapter, PTP_INT_STS, in lan743x_ptp_isr()
1394 lan743x_csr_write(adapter, PTP_INT_STS, in lan743x_ptp_isr()
1399 lan743x_csr_write(adapter, PTP_INT_STS, in lan743x_ptp_isr()
1405 lan743x_csr_write(adapter, INT_EN_SET, INT_BIT_1588_); in lan743x_ptp_isr()
1409 static void lan743x_ptp_tx_ts_enqueue_skb(struct lan743x_adapter *adapter, in lan743x_ptp_tx_ts_enqueue_skb() argument
1412 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_tx_ts_enqueue_skb()
1426 netif_err(adapter, drv, adapter->netdev, in lan743x_ptp_tx_ts_enqueue_skb()
1433 static void lan743x_ptp_sync_to_system_clock(struct lan743x_adapter *adapter) in lan743x_ptp_sync_to_system_clock() argument
1439 lan743x_ptp_clock_set(adapter, ts.tv_sec, ts.tv_nsec, 0); in lan743x_ptp_sync_to_system_clock()
1442 void lan743x_ptp_update_latency(struct lan743x_adapter *adapter, in lan743x_ptp_update_latency() argument
1447 lan743x_csr_write(adapter, PTP_LATENCY, in lan743x_ptp_update_latency()
1452 lan743x_csr_write(adapter, PTP_LATENCY, in lan743x_ptp_update_latency()
1457 lan743x_csr_write(adapter, PTP_LATENCY, in lan743x_ptp_update_latency()
1464 int lan743x_ptp_init(struct lan743x_adapter *adapter) in lan743x_ptp_init() argument
1466 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_init()
1478 lan743x_led_mux_save(adapter); in lan743x_ptp_init()
1483 int lan743x_ptp_open(struct lan743x_adapter *adapter) in lan743x_ptp_open() argument
1485 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_open()
1491 lan743x_ptp_reset(adapter); in lan743x_ptp_open()
1492 lan743x_ptp_sync_to_system_clock(adapter); in lan743x_ptp_open()
1493 temp = lan743x_csr_read(adapter, PTP_TX_MOD2); in lan743x_ptp_open()
1495 lan743x_csr_write(adapter, PTP_TX_MOD2, temp); in lan743x_ptp_open()
1496 lan743x_ptp_enable(adapter); in lan743x_ptp_open()
1497 lan743x_csr_write(adapter, INT_EN_SET, INT_BIT_1588_); in lan743x_ptp_open()
1498 lan743x_csr_write(adapter, PTP_INT_EN_SET, in lan743x_ptp_open()
1505 switch (adapter->csr.id_rev & ID_REV_ID_MASK_) { in lan743x_ptp_open()
1515 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptp_open()
1517 adapter->csr.id_rev); in lan743x_ptp_open()
1536 adapter->netdev->dev_addr); in lan743x_ptp_open()
1554 &adapter->pdev->dev); in lan743x_ptp_open()
1557 netif_err(adapter, ifup, adapter->netdev, in lan743x_ptp_open()
1562 netif_info(adapter, ifup, adapter->netdev, in lan743x_ptp_open()
1567 lan743x_ptp_close(adapter); in lan743x_ptp_open()
1571 void lan743x_ptp_close(struct lan743x_adapter *adapter) in lan743x_ptp_close() argument
1573 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_close()
1581 netif_info(adapter, drv, adapter->netdev, in lan743x_ptp_close()
1586 lan743x_csr_write(adapter, PTP_INT_EN_CLR, in lan743x_ptp_close()
1589 lan743x_csr_write(adapter, INT_EN_CLR, INT_BIT_1588_); in lan743x_ptp_close()
1594 lan743x_ptp_tx_ts_complete(adapter); in lan743x_ptp_close()
1611 lan743x_led_mux_restore(adapter); in lan743x_ptp_close()
1613 lan743x_ptp_disable(adapter); in lan743x_ptp_close()
1616 static void lan743x_ptp_set_sync_ts_insert(struct lan743x_adapter *adapter, in lan743x_ptp_set_sync_ts_insert() argument
1619 u32 ptp_tx_mod = lan743x_csr_read(adapter, PTP_TX_MOD); in lan743x_ptp_set_sync_ts_insert()
1626 lan743x_csr_write(adapter, PTP_TX_MOD, ptp_tx_mod); in lan743x_ptp_set_sync_ts_insert()
1629 static bool lan743x_ptp_is_enabled(struct lan743x_adapter *adapter) in lan743x_ptp_is_enabled() argument
1631 if (lan743x_csr_read(adapter, PTP_CMD_CTL) & PTP_CMD_CTL_PTP_ENABLE_) in lan743x_ptp_is_enabled()
1636 static void lan743x_ptp_enable(struct lan743x_adapter *adapter) in lan743x_ptp_enable() argument
1638 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_enable()
1642 if (lan743x_ptp_is_enabled(adapter)) { in lan743x_ptp_enable()
1643 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptp_enable()
1647 lan743x_csr_write(adapter, PTP_CMD_CTL, PTP_CMD_CTL_PTP_ENABLE_); in lan743x_ptp_enable()
1652 static void lan743x_ptp_disable(struct lan743x_adapter *adapter) in lan743x_ptp_disable() argument
1654 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_disable()
1657 if (!lan743x_ptp_is_enabled(adapter)) { in lan743x_ptp_disable()
1658 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptp_disable()
1662 lan743x_csr_write(adapter, PTP_CMD_CTL, PTP_CMD_CTL_PTP_DISABLE_); in lan743x_ptp_disable()
1663 lan743x_ptp_wait_till_cmd_done(adapter, PTP_CMD_CTL_PTP_ENABLE_); in lan743x_ptp_disable()
1668 static void lan743x_ptp_reset(struct lan743x_adapter *adapter) in lan743x_ptp_reset() argument
1670 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_reset()
1674 if (lan743x_ptp_is_enabled(adapter)) { in lan743x_ptp_reset()
1675 netif_err(adapter, drv, adapter->netdev, in lan743x_ptp_reset()
1680 lan743x_csr_write(adapter, PTP_CMD_CTL, PTP_CMD_CTL_PTP_RESET_); in lan743x_ptp_reset()
1681 lan743x_ptp_wait_till_cmd_done(adapter, PTP_CMD_CTL_PTP_RESET_); in lan743x_ptp_reset()
1686 static void lan743x_ptp_clock_set(struct lan743x_adapter *adapter, in lan743x_ptp_clock_set() argument
1690 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_clock_set()
1694 lan743x_csr_write(adapter, PTP_CLOCK_SEC, seconds); in lan743x_ptp_clock_set()
1695 lan743x_csr_write(adapter, PTP_CLOCK_NS, nano_seconds); in lan743x_ptp_clock_set()
1696 lan743x_csr_write(adapter, PTP_CLOCK_SUBNS, sub_nano_seconds); in lan743x_ptp_clock_set()
1698 lan743x_csr_write(adapter, PTP_CMD_CTL, PTP_CMD_CTL_PTP_CLOCK_LOAD_); in lan743x_ptp_clock_set()
1699 lan743x_ptp_wait_till_cmd_done(adapter, PTP_CMD_CTL_PTP_CLOCK_LOAD_); in lan743x_ptp_clock_set()
1703 bool lan743x_ptp_request_tx_timestamp(struct lan743x_adapter *adapter) in lan743x_ptp_request_tx_timestamp() argument
1705 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_request_tx_timestamp()
1718 void lan743x_ptp_unrequest_tx_timestamp(struct lan743x_adapter *adapter) in lan743x_ptp_unrequest_tx_timestamp() argument
1720 struct lan743x_ptp *ptp = &adapter->ptp; in lan743x_ptp_unrequest_tx_timestamp()
1726 netif_err(adapter, drv, adapter->netdev, in lan743x_ptp_unrequest_tx_timestamp()
1731 void lan743x_ptp_tx_timestamp_skb(struct lan743x_adapter *adapter, in lan743x_ptp_tx_timestamp_skb() argument
1734 lan743x_ptp_tx_ts_enqueue_skb(adapter, skb, ignore_sync); in lan743x_ptp_tx_timestamp_skb()
1736 lan743x_ptp_tx_ts_complete(adapter); in lan743x_ptp_tx_timestamp_skb()
1741 struct lan743x_adapter *adapter = netdev_priv(netdev); in lan743x_ptp_ioctl() local
1747 netif_err(adapter, drv, adapter->netdev, in lan743x_ptp_ioctl()
1757 for (index = 0; index < adapter->used_tx_channels; in lan743x_ptp_ioctl()
1759 lan743x_tx_set_timestamping_mode(&adapter->tx[index], in lan743x_ptp_ioctl()
1761 lan743x_ptp_set_sync_ts_insert(adapter, false); in lan743x_ptp_ioctl()
1764 for (index = 0; index < adapter->used_tx_channels; in lan743x_ptp_ioctl()
1766 lan743x_tx_set_timestamping_mode(&adapter->tx[index], in lan743x_ptp_ioctl()
1768 lan743x_ptp_set_sync_ts_insert(adapter, false); in lan743x_ptp_ioctl()
1771 for (index = 0; index < adapter->used_tx_channels; in lan743x_ptp_ioctl()
1773 lan743x_tx_set_timestamping_mode(&adapter->tx[index], in lan743x_ptp_ioctl()
1776 lan743x_ptp_set_sync_ts_insert(adapter, true); in lan743x_ptp_ioctl()
1782 netif_warn(adapter, drv, adapter->netdev, in lan743x_ptp_ioctl()