/linux/drivers/net/ethernet/qlogic/qede/ |
H A D | qede_ptp.c | 21 /* ptp spinlock is used for protecting the cycle/time counter fields 22 * and, also for serializing the qed PTP API invocations. 31 * qede_ptp_adjfine() - Adjust the frequency of the PTP cycle counter. 33 * @info: The PTP clock info structure. 42 struct qede_ptp *ptp = container_of(info, struct qede_ptp, clock_info); in qede_ptp_adjfine() local 44 struct qede_dev *edev = ptp->edev; in qede_ptp_adjfine() 49 spin_lock_bh(&ptp->lock); in qede_ptp_adjfine() 50 rc = ptp->ops->adjfreq(edev->cdev, ppb); in qede_ptp_adjfine() 51 spin_unlock_bh(&ptp->lock); in qede_ptp_adjfine() 53 DP_ERR(edev, "PTP adjfine called while interface is down\n"); in qede_ptp_adjfine() [all …]
|
/linux/drivers/ptp/ |
H A D | ptp_clock.c | 3 * PTP 1588 clock support 29 .name = "ptp", 96 struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); in ptp_clock_settime() local 98 if (ptp_clock_freerun(ptp)) { in ptp_clock_settime() 99 pr_err("ptp: physical clock is free running\n"); in ptp_clock_settime() 103 return ptp->info->settime64(ptp->info, tp); in ptp_clock_settime() 108 struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); in ptp_clock_gettime() local 111 if (ptp->info->gettimex64) in ptp_clock_gettime() 112 err = ptp->info->gettimex64(ptp->info, tp, NULL); in ptp_clock_gettime() 114 err = ptp->info->gettime64(ptp->info, tp); in ptp_clock_gettime() [all …]
|
H A D | ptp_sysfs.c | 3 * PTP 1588 clock support - sysfs interface. 16 struct ptp_clock *ptp = dev_get_drvdata(dev); in clock_name_show() local 17 return sysfs_emit(page, "%s\n", ptp->info->name); in clock_name_show() 25 struct ptp_clock *ptp = dev_get_drvdata(dev); in max_phase_adjustment_show() local 27 return sysfs_emit(page, "%d\n", ptp->info->getmaxphase(ptp->info)); in max_phase_adjustment_show() 35 struct ptp_clock *ptp = dev_get_drvdata(dev); \ 36 return sysfs_emit(page, "%d\n", ptp->info->var); \ 51 struct ptp_clock *ptp = dev_get_drvdata(dev); in extts_enable_store() local 52 struct ptp_clock_info *ops = ptp->info; in extts_enable_store() 76 struct ptp_clock *ptp = dev_get_drvdata(dev); in extts_fifo_show() local [all …]
|
H A D | ptp_vclock.c | 3 * PTP virtual clock driver 43 static int ptp_vclock_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) in ptp_vclock_adjfine() argument 45 struct ptp_vclock *vclock = info_to_vclock(ptp); in ptp_vclock_adjfine() 60 static int ptp_vclock_adjtime(struct ptp_clock_info *ptp, s64 delta) in ptp_vclock_adjtime() argument 62 struct ptp_vclock *vclock = info_to_vclock(ptp); in ptp_vclock_adjtime() 72 static int ptp_vclock_gettime(struct ptp_clock_info *ptp, in ptp_vclock_gettime() argument 75 struct ptp_vclock *vclock = info_to_vclock(ptp); in ptp_vclock_gettime() 87 static int ptp_vclock_gettimex(struct ptp_clock_info *ptp, in ptp_vclock_gettimex() argument 91 struct ptp_vclock *vclock = info_to_vclock(ptp); in ptp_vclock_gettimex() 111 static int ptp_vclock_settime(struct ptp_clock_info *ptp, in ptp_vclock_settime() argument [all …]
|
H A D | ptp_private.h | 3 * PTP 1588 clock support - private declarations for the core module. 98 /* Check if ptp virtual clock is in use */ 99 static inline bool ptp_vclock_in_use(struct ptp_clock *ptp) in ptp_vclock_in_use() argument 110 if (ptp->is_virtual_clock) in ptp_vclock_in_use() 113 if (mutex_lock_interruptible(&ptp->n_vclocks_mux)) in ptp_vclock_in_use() 116 if (ptp->n_vclocks) in ptp_vclock_in_use() 119 mutex_unlock(&ptp->n_vclocks_mux); in ptp_vclock_in_use() 124 /* Check if ptp clock shall be free running */ 125 static inline bool ptp_clock_freerun(struct ptp_clock *ptp) in ptp_clock_freerun() argument 127 if (ptp->has_cycles) in ptp_clock_freerun() [all …]
|
/linux/drivers/net/ethernet/broadcom/bnxt/ |
H A D | bnxt_ptp.c | 62 struct bnxt_ptp_cfg *ptp = container_of(ptp_info, struct bnxt_ptp_cfg, in bnxt_ptp_settime() local 67 if (BNXT_PTP_USE_RTC(ptp->bp)) in bnxt_ptp_settime() 68 return bnxt_ptp_cfg_settime(ptp->bp, ns); in bnxt_ptp_settime() 70 write_seqlock_irqsave(&ptp->ptp_lock, flags); in bnxt_ptp_settime() 71 timecounter_init(&ptp->tc, &ptp->cc, ns); in bnxt_ptp_settime() 72 write_sequnlock_irqrestore(&ptp->ptp_lock, flags); in bnxt_ptp_settime() 80 struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; in __bnxt_refclk_read() local 86 high_before = readl(bp->bar0 + ptp->refclk_mapped_regs[1]); in __bnxt_refclk_read() 88 low = readl(bp->bar0 + ptp->refclk_mapped_regs[0]); in __bnxt_refclk_read() 90 high_now = readl(bp->bar0 + ptp->refclk_mapped_regs[1]); in __bnxt_refclk_read() [all …]
|
H A D | bnxt_ptp.h | 151 #define BNXT_PTP_INC_TX_AVAIL(ptp) \ argument 153 spin_lock_bh(&(ptp)->ptp_tx_lock); \ 154 (ptp)->tx_avail++; \ 155 spin_unlock_bh(&(ptp)->ptp_tx_lock); \ 165 void bnxt_ptp_free_txts_skbs(struct bnxt_ptp_cfg *ptp); 166 int bnxt_ptp_get_txts_prod(struct bnxt_ptp_cfg *ptp, u16 *prod); 171 void bnxt_ptp_rtc_timecounter_init(struct bnxt_ptp_cfg *ptp, u64 ns); 175 static inline u64 bnxt_timecounter_cyc2time(struct bnxt_ptp_cfg *ptp, u64 ts) in bnxt_timecounter_cyc2time() argument 181 seq = read_seqbegin(&ptp->ptp_lock); in bnxt_timecounter_cyc2time() 182 ns = timecounter_cyc2time(&ptp->tc, ts); in bnxt_timecounter_cyc2time() [all …]
|
/linux/drivers/net/ethernet/marvell/octeontx2/nic/ |
H A D | otx2_ptp.c | 13 static bool is_tstmp_atomic_update_supported(struct otx2_ptp *ptp) in is_tstmp_atomic_update_supported() argument 19 if (!ptp->nic) in is_tstmp_atomic_update_supported() 22 mutex_lock(&ptp->nic->mbox.lock); in is_tstmp_atomic_update_supported() 23 req = otx2_mbox_alloc_msg_ptp_get_cap(&ptp->nic->mbox); in is_tstmp_atomic_update_supported() 25 mutex_unlock(&ptp->nic->mbox.lock); in is_tstmp_atomic_update_supported() 29 err = otx2_sync_mbox_msg(&ptp->nic->mbox); in is_tstmp_atomic_update_supported() 31 mutex_unlock(&ptp->nic->mbox.lock); in is_tstmp_atomic_update_supported() 34 rsp = (struct ptp_get_cap_rsp *)otx2_mbox_get_rsp(&ptp->nic->mbox.mbox, 0, in is_tstmp_atomic_update_supported() 36 mutex_unlock(&ptp->nic->mbox.lock); in is_tstmp_atomic_update_supported() 49 struct otx2_ptp *ptp = container_of(ptp_info, struct otx2_ptp, in otx2_ptp_hw_adjtime() local [all …]
|
/linux/drivers/net/ethernet/hisilicon/hns3/hns3pf/ |
H A D | hclge_ptp.c | 11 struct hclge_ptp *ptp = hdev->ptp; in hclge_ptp_get_cycle() local 13 ptp->cycle.quo = readl(hdev->ptp->io_base + HCLGE_PTP_CYCLE_QUO_REG) & in hclge_ptp_get_cycle() 15 ptp->cycle.numer = readl(hdev->ptp->io_base + HCLGE_PTP_CYCLE_NUM_REG); in hclge_ptp_get_cycle() 16 ptp->cycle.den = readl(hdev->ptp->io_base + HCLGE_PTP_CYCLE_DEN_REG); in hclge_ptp_get_cycle() 18 if (ptp->cycle.den == 0) { in hclge_ptp_get_cycle() 19 dev_err(&hdev->pdev->dev, "invalid ptp cycle denominator!\n"); in hclge_ptp_get_cycle() 26 static int hclge_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) in hclge_ptp_adjfine() argument 28 struct hclge_dev *hdev = hclge_ptp_get_hdev(ptp); in hclge_ptp_adjfine() 29 struct hclge_ptp_cycle *cycle = &hdev->ptp->cycle; in hclge_ptp_adjfine() 39 * denominator is fixed to ptp->cycle.den, and numerator in hclge_ptp_adjfine() [all …]
|
/linux/Documentation/ABI/testing/ |
H A D | sysfs-ptp | 1 What: /sys/class/ptp/ 7 features of PTP hardware clocks. 9 What: /sys/class/ptp/ptp<N>/ 13 This directory contains the attributes of the Nth PTP 14 hardware clock registered into the PTP class driver 17 What: /sys/class/ptp/ptp<N>/clock_name 21 This file contains the name of the PTP hardware clock 28 What: /sys/class/ptp/ptp<N>/max_adjustment 32 This file contains the PTP hardware clock's maximum 36 What: /sys/class/ptp/ptp<N>/max_vclocks [all …]
|
/linux/drivers/net/ethernet/sfc/siena/ |
H A D | ptp.c | 9 * PTP support is assisted by firmware running on the MC, which provides 11 * PTP event packets are queued onto internal queues for subsequent processing; 17 * with the hardware timestamp. The PTP receive packet queue is searched 21 * It is important for the operation of the PTP protocol that the ordering 47 #include "nic.h" /* indirectly includes ptp.h */ 49 /* Maximum number of events expected to make up a PTP event */ 76 /* Offsets into PTP packet for identification. These offsets are from the 77 * start of the IP header, not the MAC header. Note that neither PTP V1 nor 78 * PTP V2 permit the use of IPV4 options. 91 /* The minimum length of a PTP V1 packet for offsets, etc. to be valid: [all …]
|
/linux/drivers/net/ethernet/sfc/ |
H A D | ptp.c | 9 * PTP support is assisted by firmware running on the MC, which provides 11 * PTP event packets are queued onto internal queues for subsequent processing; 17 * with the hardware timestamp. The PTP receive packet queue is searched 21 * It is important for the operation of the PTP protocol that the ordering 47 #include "nic.h" /* indirectly includes ptp.h */ 50 /* Maximum number of events expected to make up a PTP event */ 80 /* Offsets into PTP packet for identification. These offsets are from the 81 * start of the IP header, not the MAC header. Note that neither PTP V1 nor 82 * PTP V2 permit the use of IPV4 options. 92 /* The minimum length of a PTP V1 packet for offsets, etc. to be valid: [all …]
|
/linux/drivers/net/phy/ |
H A D | dp83640_reg.h | 12 #define PTP_CTL 0x0014 /* PTP Control Register */ 13 #define PTP_TDR 0x0015 /* PTP Time Data Register */ 14 #define PTP_STS 0x0016 /* PTP Status Register */ 15 #define PTP_TSTS 0x0017 /* PTP Trigger Status Register */ 16 #define PTP_RATEL 0x0018 /* PTP Rate Low Register */ 17 #define PTP_RATEH 0x0019 /* PTP Rate High Register */ 18 #define PTP_RDCKSUM 0x001a /* PTP Read Checksum */ 19 #define PTP_WRCKSUM 0x001b /* PTP Write Checksum */ 20 #define PTP_TXTS 0x001c /* PTP Transmit Timestamp Register, in four 16-bit reads */ 21 #define PTP_RXTS 0x001d /* PTP Receive Timestamp Register, in six? 16-bit reads */ [all …]
|
/linux/drivers/net/ethernet/intel/iavf/ |
H A D | iavf_ptp.c | 8 container_of_const(info, struct iavf_adapter, ptp.info) 99 adapter->ptp.hwtstamp_config = *config; in iavf_ptp_set_ts_config() 105 * iavf_ptp_cap_supported - Check if a PTP capability is supported 118 return (adapter->ptp.hw_caps.caps & cap) == cap; in iavf_ptp_cap_supported() 122 * iavf_allocate_ptp_cmd - Allocate a PTP command message structure 126 * Allocates a PTP command message and pre-fills it with the provided message 129 * Return: allocated PTP command. 147 * iavf_queue_ptp_cmd - Queue PTP command for sending over virtchnl 151 * Queue the given command structure into the PTP virtchnl command queue tos 157 mutex_lock(&adapter->ptp.aq_cmd_lock); in iavf_queue_ptp_cmd() [all …]
|
/linux/drivers/virtio/ |
H A D | virtio_rtc_ptp.c | 3 * Expose virtio_rtc clocks as PTP clocks. 8 * Derived from ptp_kvm_common.c, virtual PTP 1588 clock for use with KVM 23 * struct viortc_ptp_clock - PTP clock abstraction 24 * @ptp_clock: PTP clock handle for unregistering 26 * @ptp_info: PTP clock description 78 * @vio_ptp: virtio_rtc PTP clock 113 * PTP clock operations 117 * viortc_ptp_getcrosststamp() - PTP clock getcrosststamp op 118 * @ptp: PTP clock info 124 static int viortc_ptp_getcrosststamp(struct ptp_clock_info *ptp, in viortc_ptp_getcrosststamp() argument [all …]
|
/linux/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ |
H A D | base.c | 44 const int slot = pt->base >> pt->ptp->shift; in nvkm_mmu_ptp_put() 45 struct nvkm_mmu_ptp *ptp = pt->ptp; in nvkm_mmu_ptp_put() local 48 * there will be now, so return PTP to the cache. in nvkm_mmu_ptp_put() 50 if (!ptp->free) in nvkm_mmu_ptp_put() 51 list_add(&ptp->head, &mmu->ptp.list); in nvkm_mmu_ptp_put() 52 ptp->free |= BIT(slot); in nvkm_mmu_ptp_put() 54 /* If there's no more sub-allocations, destroy PTP. */ in nvkm_mmu_ptp_put() 55 if (ptp->free == ptp->mask) { in nvkm_mmu_ptp_put() 56 nvkm_mmu_ptc_put(mmu, force, &ptp->pt); in nvkm_mmu_ptp_put() 57 list_del(&ptp->head); in nvkm_mmu_ptp_put() [all …]
|
/linux/drivers/net/ethernet/intel/ice/ |
H A D | ice_ptp.c | 69 return !ctrl_pf ? NULL : &ctrl_pf->ptp; in ice_get_ctrl_ptp() 83 const struct ptp_clock_info *info = &pf->ptp.info; in ice_ptp_find_pin_idx() 158 const struct ice_ptp_pin_desc *ice_pins = pf->ptp.ice_pin_desc; in ice_ptp_set_sma_cfg() 159 struct ptp_pin_desc *pins = pf->ptp.pin_desc; in ice_ptp_set_sma_cfg() 170 for (int i = 0; i < pf->ptp.info.n_pins; i++) in ice_ptp_set_sma_cfg() 203 switch (pf->ptp.tx_interrupt_mode) { in ice_ptp_cfg_tx_interrupt() 216 enable = pf->ptp.tstamp_config.tx_type == HWTSTAMP_TX_ON; in ice_ptp_cfg_tx_interrupt() 285 enable_rx = pf->ptp.tstamp_config.rx_filter == HWTSTAMP_FILTER_ALL; in ice_ptp_restore_timestamp_mode() 433 * time stored in the device private PTP structure as the basis for timestamp 445 discard_time = pf->ptp.cached_phc_jiffies + msecs_to_jiffies(2000); in ice_ptp_extend_40b_ts() [all …]
|
/linux/drivers/net/ethernet/renesas/ |
H A D | rcar_gen4_ptp.c | 15 #define ptp_to_priv(ptp) container_of(ptp, struct rcar_gen4_ptp_private, info) argument 29 static int rcar_gen4_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) in rcar_gen4_ptp_adjfine() argument 31 struct rcar_gen4_ptp_private *ptp_priv = ptp_to_priv(ptp); in rcar_gen4_ptp_adjfine() 47 static void _rcar_gen4_ptp_gettime(struct ptp_clock_info *ptp, in _rcar_gen4_ptp_gettime() argument 50 struct rcar_gen4_ptp_private *ptp_priv = ptp_to_priv(ptp); in _rcar_gen4_ptp_gettime() 57 static int rcar_gen4_ptp_gettime(struct ptp_clock_info *ptp, in rcar_gen4_ptp_gettime() argument 60 struct rcar_gen4_ptp_private *ptp_priv = ptp_to_priv(ptp); in rcar_gen4_ptp_gettime() 64 _rcar_gen4_ptp_gettime(ptp, ts); in rcar_gen4_ptp_gettime() 71 static void _rcar_gen4_ptp_settime(struct ptp_clock_info *ptp, in _rcar_gen4_ptp_settime() argument 74 struct rcar_gen4_ptp_private *ptp_priv = ptp_to_priv(ptp); in _rcar_gen4_ptp_settime() [all …]
|
/linux/drivers/net/ethernet/chelsio/cxgb4/ |
H A D | cxgb4_ptp.c | 2 * cxgb4_ptp.c:Chelsio PTP support for T5/T6 54 * cxgb4_ptp_is_ptp_tx - determine whether TX packet is PTP or not 55 * @skb: skb of outgoing ptp request 80 * cxgb4_ptp_is_ptp_rx - determine whether RX packet is PTP or not 81 * @skb: skb of incoming ptp request 94 * cxgb4_ptp_read_hwstamp - read timestamp for TX event PTP message 121 * cxgb4_ptprx_timestamping - Enable Timestamp for RX PTP event message 145 "PTP: %s error %d\n", __func__, -err); in cxgb4_ptprx_timestamping() 166 "PTP: %s error %d\n", __func__, -err); in cxgb4_ptp_txtype() 192 "PTP: %s error %d\n", __func__, -err); in cxgb4_ptp_redirect_rx_packet() [all …]
|
/linux/drivers/net/ethernet/intel/e1000e/ |
H A D | ptp.c | 4 /* PTP 1588 Hardware Clock (PHC) 5 * Derived from PTP Hardware Clock driver for Intel 82576 and 82580 (igb) 19 * @ptp: ptp clock structure 27 static int e1000e_phc_adjfine(struct ptp_clock_info *ptp, long delta) in e1000e_phc_adjfine() argument 29 struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter, in e1000e_phc_adjfine() 61 * @ptp: ptp clock structure 66 static int e1000e_phc_adjtime(struct ptp_clock_info *ptp, s64 delta) in e1000e_phc_adjtime() argument 68 struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter, in e1000e_phc_adjtime() 135 * @ptp: ptp clock structure 141 static int e1000e_phc_getcrosststamp(struct ptp_clock_info *ptp, in e1000e_phc_getcrosststamp() argument [all …]
|
/linux/drivers/net/ethernet/stmicro/stmmac/ |
H A D | stmmac_ptp.c | 3 PTP 1588 clock using the STMMAC. 16 * @ptp: pointer to ptp_clock_info structure 23 static int stmmac_adjust_freq(struct ptp_clock_info *ptp, long scaled_ppm) in stmmac_adjust_freq() argument 26 container_of(ptp, struct stmmac_priv, ptp_clock_ops); in stmmac_adjust_freq() 42 * @ptp: pointer to ptp_clock_info structure 47 static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta) in stmmac_adjust_time() argument 50 container_of(ptp, struct stmmac_priv, ptp_clock_ops); in stmmac_adjust_time() 69 /* If EST is enabled, disabled it before adjust ptp time. */ in stmmac_adjust_time() 83 /* Calculate new basetime and re-configured EST after PTP time adjust. */ in stmmac_adjust_time() 117 * @ptp: pointer to ptp_clock_info structure [all …]
|
/linux/drivers/net/ethernet/mellanox/mlx4/ |
H A D | en_clock.c | 83 * mlx4_en_remove_timestamp - disable PTP device 86 * Stop the PTP support. 120 * @ptp: ptp clock structure 128 static int mlx4_en_phc_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) in mlx4_en_phc_adjfine() argument 132 struct mlx4_en_dev *mdev = container_of(ptp, struct mlx4_en_dev, in mlx4_en_phc_adjfine() 147 * @ptp: ptp clock structure 152 static int mlx4_en_phc_adjtime(struct ptp_clock_info *ptp, s64 delta) in mlx4_en_phc_adjtime() argument 154 struct mlx4_en_dev *mdev = container_of(ptp, struct mlx4_en_dev, in mlx4_en_phc_adjtime() 167 * @ptp: ptp clock structure 173 static int mlx4_en_phc_gettime(struct ptp_clock_info *ptp, in mlx4_en_phc_gettime() argument [all …]
|
/linux/include/linux/ |
H A D | ptp_classify.h | 3 * PTP 1588 support 5 * This file implements a BPF that recognizes PTP event messages. 20 #define PTP_CLASS_NONE 0x00 /* not a PTP event message */ 50 /* PTP header flag fields */ 85 * ptp_classify_raw - classify a PTP packet 89 * determine the PTP class. In case the skb does not contain any 90 * PTP protocol data, PTP_CLASS_NONE will be returned, otherwise 97 * ptp_parse_header - Get pointer to the PTP v2 header 107 * Return: Pointer to the ptp v2 header or NULL if not found 112 * ptp_get_msgtype - Extract ptp message type from given header [all …]
|
/linux/Documentation/devicetree/bindings/pinctrl/ |
H A D | marvell,kirkwood-pinctrl.txt | 28 mpp4 4 gpio, nand(io6), uart0(rxd), ptp(clk) 29 mpp5 5 gpo, nand(io7), uart0(txd), ptp(trig) 30 mpp6 6 sysrst(out), spi(mosi), ptp(trig) 31 mpp7 7 gpo, pex(rsto), spi(cs), ptp(trig) 32 mpp8 8 gpio, twsi0(sda), uart0(rts), uart1(rts), ptp(clk), 34 mpp9 9 gpio, twsi(sck), uart0(cts), uart1(cts), ptp(evreq), 36 mpp10 10 gpo, spi(sck), uart0(txd), ptp(trig) 37 mpp11 11 gpio, spi(miso), uart0(rxd), ptp(clk), ptp-1(evreq), 38 ptp-2(trig) 66 mpp4 4 gpio, nand(io6), uart0(rxd), ptp(clk) [all …]
|
/linux/drivers/net/dsa/mv88e6xxx/ |
H A D | ptp.h | 3 * Marvell 88E6xxx Switch PTP support 66 /* Offset 0x0E/0x0F: PTP Global Time */ 112 /* Offset 0x01/0x02: PTP Arrival 0 Time */ 116 /* Offset 0x03: PTP Arrival 0 Sequence ID */ 119 /* Offset 0x04: PTP Arrival 1 Status */ 122 /* Offset 0x05/0x6E: PTP Arrival 1 Time */ 126 /* Offset 0x07: PTP Arrival 1 Sequence ID */ 129 /* Offset 0x08: PTP Departure Status */ 132 /* Offset 0x09/0x0a: PTP Deperture Time */ 136 /* Offset 0x0b: PTP Departure Sequence ID */ [all …]
|