cpts 392 drivers/net/ethernet/ti/cpsw.c cpts_tx_timestamp(ndev_to_cpsw(ndev)->cpts, skb); cpts 764 drivers/net/ethernet/ti/cpsw.c cpts_rx_timestamp(cpsw->cpts, skb); cpts 1733 drivers/net/ethernet/ti/cpsw.c if (cpts_register(cpsw->cpts)) cpts 1779 drivers/net/ethernet/ti/cpsw.c cpts_unregister(cpsw->cpts); cpts 1800 drivers/net/ethernet/ti/cpsw.c struct cpts *cpts = cpsw->cpts; cpts 1812 drivers/net/ethernet/ti/cpsw.c priv->tx_ts_enabled && cpts_can_timestamp(cpts, skb)) cpts 2963 drivers/net/ethernet/ti/cpsw.c cpts_release(cpsw->cpts); cpts 2988 drivers/net/ethernet/ti/cpsw.c cpts_release(cpsw->cpts); cpts 724 drivers/net/ethernet/ti/cpsw_ethtool.c info->phc_index = cpsw->cpts->phc_index; cpts 125 drivers/net/ethernet/ti/cpsw_priv.c cpsw->cpts = cpts_create(cpsw->dev, cpts_regs, cpsw->dev->of_node); cpts 126 drivers/net/ethernet/ti/cpsw_priv.c if (IS_ERR(cpsw->cpts)) { cpts 127 drivers/net/ethernet/ti/cpsw_priv.c ret = PTR_ERR(cpsw->cpts); cpts 346 drivers/net/ethernet/ti/cpsw_priv.h struct cpts *cpts; cpts 45 drivers/net/ethernet/ti/cpts.c static int cpts_fifo_pop(struct cpts *cpts, u32 *high, u32 *low) cpts 47 drivers/net/ethernet/ti/cpts.c u32 r = cpts_read32(cpts, intstat_raw); cpts 50 drivers/net/ethernet/ti/cpts.c *high = cpts_read32(cpts, event_high); cpts 51 drivers/net/ethernet/ti/cpts.c *low = cpts_read32(cpts, event_low); cpts 52 drivers/net/ethernet/ti/cpts.c cpts_write32(cpts, EVENT_POP, event_pop); cpts 58 drivers/net/ethernet/ti/cpts.c static int cpts_purge_events(struct cpts *cpts) cpts 64 drivers/net/ethernet/ti/cpts.c list_for_each_safe(this, next, &cpts->events) { cpts 68 drivers/net/ethernet/ti/cpts.c list_add(&event->list, &cpts->pool); cpts 78 drivers/net/ethernet/ti/cpts.c static void cpts_purge_txq(struct cpts *cpts) cpts 84 drivers/net/ethernet/ti/cpts.c skb_queue_walk_safe(&cpts->txq, skb, tmp) { cpts 87 drivers/net/ethernet/ti/cpts.c __skb_unlink(skb, &cpts->txq); cpts 94 drivers/net/ethernet/ti/cpts.c dev_dbg(cpts->dev, "txq cleaned up %d\n", removed); cpts 97 drivers/net/ethernet/ti/cpts.c static bool cpts_match_tx_ts(struct cpts *cpts, struct cpts_event *event) cpts 108 drivers/net/ethernet/ti/cpts.c skb_queue_walk_safe(&cpts->txq, skb, tmp) { cpts 115 drivers/net/ethernet/ti/cpts.c u64 ns = timecounter_cyc2time(&cpts->tc, event->low); cpts 121 drivers/net/ethernet/ti/cpts.c __skb_unlink(skb, &cpts->txq); cpts 123 drivers/net/ethernet/ti/cpts.c dev_dbg(cpts->dev, "match tx timestamp mtype %u seqid %04x\n", cpts 130 drivers/net/ethernet/ti/cpts.c dev_dbg(cpts->dev, "expiring tx timestamp from txq\n"); cpts 131 drivers/net/ethernet/ti/cpts.c __skb_unlink(skb, &cpts->txq); cpts 142 drivers/net/ethernet/ti/cpts.c static int cpts_fifo_read(struct cpts *cpts, int match) cpts 149 drivers/net/ethernet/ti/cpts.c if (cpts_fifo_pop(cpts, &hi, &lo)) cpts 152 drivers/net/ethernet/ti/cpts.c if (list_empty(&cpts->pool) && cpts_purge_events(cpts)) { cpts 157 drivers/net/ethernet/ti/cpts.c event = list_first_entry(&cpts->pool, struct cpts_event, list); cpts 164 drivers/net/ethernet/ti/cpts.c if (cpts_match_tx_ts(cpts, event)) { cpts 174 drivers/net/ethernet/ti/cpts.c list_add_tail(&event->list, &cpts->events); cpts 195 drivers/net/ethernet/ti/cpts.c struct cpts *cpts = container_of(cc, struct cpts, cc); cpts 197 drivers/net/ethernet/ti/cpts.c cpts_write32(cpts, TS_PUSH, ts_push); cpts 198 drivers/net/ethernet/ti/cpts.c if (cpts_fifo_read(cpts, CPTS_EV_PUSH)) cpts 201 drivers/net/ethernet/ti/cpts.c list_for_each_safe(this, next, &cpts->events) { cpts 205 drivers/net/ethernet/ti/cpts.c list_add(&event->list, &cpts->pool); cpts 222 drivers/net/ethernet/ti/cpts.c struct cpts *cpts = container_of(ptp, struct cpts, info); cpts 228 drivers/net/ethernet/ti/cpts.c mult = cpts->cc_mult; cpts 233 drivers/net/ethernet/ti/cpts.c spin_lock_irqsave(&cpts->lock, flags); cpts 235 drivers/net/ethernet/ti/cpts.c timecounter_read(&cpts->tc); cpts 237 drivers/net/ethernet/ti/cpts.c cpts->cc.mult = neg_adj ? mult - diff : mult + diff; cpts 239 drivers/net/ethernet/ti/cpts.c spin_unlock_irqrestore(&cpts->lock, flags); cpts 247 drivers/net/ethernet/ti/cpts.c struct cpts *cpts = container_of(ptp, struct cpts, info); cpts 249 drivers/net/ethernet/ti/cpts.c spin_lock_irqsave(&cpts->lock, flags); cpts 250 drivers/net/ethernet/ti/cpts.c timecounter_adjtime(&cpts->tc, delta); cpts 251 drivers/net/ethernet/ti/cpts.c spin_unlock_irqrestore(&cpts->lock, flags); cpts 260 drivers/net/ethernet/ti/cpts.c struct cpts *cpts = container_of(ptp, struct cpts, info); cpts 262 drivers/net/ethernet/ti/cpts.c spin_lock_irqsave(&cpts->lock, flags); cpts 263 drivers/net/ethernet/ti/cpts.c ns = timecounter_read(&cpts->tc); cpts 264 drivers/net/ethernet/ti/cpts.c spin_unlock_irqrestore(&cpts->lock, flags); cpts 276 drivers/net/ethernet/ti/cpts.c struct cpts *cpts = container_of(ptp, struct cpts, info); cpts 280 drivers/net/ethernet/ti/cpts.c spin_lock_irqsave(&cpts->lock, flags); cpts 281 drivers/net/ethernet/ti/cpts.c timecounter_init(&cpts->tc, &cpts->cc, ns); cpts 282 drivers/net/ethernet/ti/cpts.c spin_unlock_irqrestore(&cpts->lock, flags); cpts 295 drivers/net/ethernet/ti/cpts.c struct cpts *cpts = container_of(ptp, struct cpts, info); cpts 296 drivers/net/ethernet/ti/cpts.c unsigned long delay = cpts->ov_check_period; cpts 300 drivers/net/ethernet/ti/cpts.c spin_lock_irqsave(&cpts->lock, flags); cpts 301 drivers/net/ethernet/ti/cpts.c ts = ns_to_timespec64(timecounter_read(&cpts->tc)); cpts 303 drivers/net/ethernet/ti/cpts.c if (!skb_queue_empty(&cpts->txq)) { cpts 304 drivers/net/ethernet/ti/cpts.c cpts_purge_txq(cpts); cpts 305 drivers/net/ethernet/ti/cpts.c if (!skb_queue_empty(&cpts->txq)) cpts 308 drivers/net/ethernet/ti/cpts.c spin_unlock_irqrestore(&cpts->lock, flags); cpts 367 drivers/net/ethernet/ti/cpts.c static u64 cpts_find_ts(struct cpts *cpts, struct sk_buff *skb, int ev_type) cpts 380 drivers/net/ethernet/ti/cpts.c spin_lock_irqsave(&cpts->lock, flags); cpts 381 drivers/net/ethernet/ti/cpts.c cpts_fifo_read(cpts, -1); cpts 382 drivers/net/ethernet/ti/cpts.c list_for_each_safe(this, next, &cpts->events) { cpts 386 drivers/net/ethernet/ti/cpts.c list_add(&event->list, &cpts->pool); cpts 393 drivers/net/ethernet/ti/cpts.c ns = timecounter_cyc2time(&cpts->tc, event->low); cpts 395 drivers/net/ethernet/ti/cpts.c list_add(&event->list, &cpts->pool); cpts 409 drivers/net/ethernet/ti/cpts.c __skb_queue_tail(&cpts->txq, skb); cpts 410 drivers/net/ethernet/ti/cpts.c ptp_schedule_worker(cpts->clock, 0); cpts 412 drivers/net/ethernet/ti/cpts.c spin_unlock_irqrestore(&cpts->lock, flags); cpts 417 drivers/net/ethernet/ti/cpts.c void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb) cpts 422 drivers/net/ethernet/ti/cpts.c ns = cpts_find_ts(cpts, skb, CPTS_EV_RX); cpts 431 drivers/net/ethernet/ti/cpts.c void cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb) cpts 438 drivers/net/ethernet/ti/cpts.c ns = cpts_find_ts(cpts, skb, CPTS_EV_TX); cpts 447 drivers/net/ethernet/ti/cpts.c int cpts_register(struct cpts *cpts) cpts 451 drivers/net/ethernet/ti/cpts.c skb_queue_head_init(&cpts->txq); cpts 452 drivers/net/ethernet/ti/cpts.c INIT_LIST_HEAD(&cpts->events); cpts 453 drivers/net/ethernet/ti/cpts.c INIT_LIST_HEAD(&cpts->pool); cpts 455 drivers/net/ethernet/ti/cpts.c list_add(&cpts->pool_data[i].list, &cpts->pool); cpts 457 drivers/net/ethernet/ti/cpts.c clk_enable(cpts->refclk); cpts 459 drivers/net/ethernet/ti/cpts.c cpts_write32(cpts, CPTS_EN, control); cpts 460 drivers/net/ethernet/ti/cpts.c cpts_write32(cpts, TS_PEND_EN, int_enable); cpts 462 drivers/net/ethernet/ti/cpts.c timecounter_init(&cpts->tc, &cpts->cc, ktime_to_ns(ktime_get_real())); cpts 464 drivers/net/ethernet/ti/cpts.c cpts->clock = ptp_clock_register(&cpts->info, cpts->dev); cpts 465 drivers/net/ethernet/ti/cpts.c if (IS_ERR(cpts->clock)) { cpts 466 drivers/net/ethernet/ti/cpts.c err = PTR_ERR(cpts->clock); cpts 467 drivers/net/ethernet/ti/cpts.c cpts->clock = NULL; cpts 470 drivers/net/ethernet/ti/cpts.c cpts->phc_index = ptp_clock_index(cpts->clock); cpts 472 drivers/net/ethernet/ti/cpts.c ptp_schedule_worker(cpts->clock, cpts->ov_check_period); cpts 476 drivers/net/ethernet/ti/cpts.c clk_disable(cpts->refclk); cpts 481 drivers/net/ethernet/ti/cpts.c void cpts_unregister(struct cpts *cpts) cpts 483 drivers/net/ethernet/ti/cpts.c if (WARN_ON(!cpts->clock)) cpts 486 drivers/net/ethernet/ti/cpts.c ptp_clock_unregister(cpts->clock); cpts 487 drivers/net/ethernet/ti/cpts.c cpts->clock = NULL; cpts 489 drivers/net/ethernet/ti/cpts.c cpts_write32(cpts, 0, int_enable); cpts 490 drivers/net/ethernet/ti/cpts.c cpts_write32(cpts, 0, control); cpts 493 drivers/net/ethernet/ti/cpts.c skb_queue_purge(&cpts->txq); cpts 495 drivers/net/ethernet/ti/cpts.c clk_disable(cpts->refclk); cpts 499 drivers/net/ethernet/ti/cpts.c static void cpts_calc_mult_shift(struct cpts *cpts) cpts 504 drivers/net/ethernet/ti/cpts.c freq = clk_get_rate(cpts->refclk); cpts 509 drivers/net/ethernet/ti/cpts.c maxsec = cpts->cc.mask; cpts 518 drivers/net/ethernet/ti/cpts.c cpts->ov_check_period = (HZ * maxsec) / 2; cpts 519 drivers/net/ethernet/ti/cpts.c dev_info(cpts->dev, "cpts: overflow check period %lu (jiffies)\n", cpts 520 drivers/net/ethernet/ti/cpts.c cpts->ov_check_period); cpts 522 drivers/net/ethernet/ti/cpts.c if (cpts->cc.mult || cpts->cc.shift) cpts 525 drivers/net/ethernet/ti/cpts.c clocks_calc_mult_shift(&cpts->cc.mult, &cpts->cc.shift, cpts 529 drivers/net/ethernet/ti/cpts.c ns = cyclecounter_cyc2ns(&cpts->cc, freq, cpts->cc.mask, &frac); cpts 531 drivers/net/ethernet/ti/cpts.c dev_info(cpts->dev, cpts 533 drivers/net/ethernet/ti/cpts.c freq, cpts->cc.mult, cpts->cc.shift, (ns - NSEC_PER_SEC)); cpts 536 drivers/net/ethernet/ti/cpts.c static int cpts_of_mux_clk_setup(struct cpts *cpts, struct device_node *node) cpts 552 drivers/net/ethernet/ti/cpts.c dev_err(cpts->dev, "mux-clock %s must have parents\n", cpts 557 drivers/net/ethernet/ti/cpts.c parent_names = devm_kzalloc(cpts->dev, (sizeof(char *) * num_parents), cpts 560 drivers/net/ethernet/ti/cpts.c mux_table = devm_kzalloc(cpts->dev, sizeof(*mux_table) * num_parents, cpts 575 drivers/net/ethernet/ti/cpts.c clk_hw = clk_hw_register_mux_table(cpts->dev, refclk_np->name, cpts 578 drivers/net/ethernet/ti/cpts.c &cpts->reg->rftclk_sel, 0, 0x1F, cpts 585 drivers/net/ethernet/ti/cpts.c ret = devm_add_action_or_reset(cpts->dev, cpts 589 drivers/net/ethernet/ti/cpts.c dev_err(cpts->dev, "add clkmux unreg action %d", ret); cpts 597 drivers/net/ethernet/ti/cpts.c ret = devm_add_action_or_reset(cpts->dev, cpts 601 drivers/net/ethernet/ti/cpts.c dev_err(cpts->dev, "add clkmux provider unreg action %d", ret); cpts 612 drivers/net/ethernet/ti/cpts.c static int cpts_of_parse(struct cpts *cpts, struct device_node *node) cpts 618 drivers/net/ethernet/ti/cpts.c cpts->cc.mult = prop; cpts 621 drivers/net/ethernet/ti/cpts.c cpts->cc.shift = prop; cpts 623 drivers/net/ethernet/ti/cpts.c if ((cpts->cc.mult && !cpts->cc.shift) || cpts 624 drivers/net/ethernet/ti/cpts.c (!cpts->cc.mult && cpts->cc.shift)) cpts 627 drivers/net/ethernet/ti/cpts.c return cpts_of_mux_clk_setup(cpts, node); cpts 630 drivers/net/ethernet/ti/cpts.c dev_err(cpts->dev, "CPTS: Missing property in the DT.\n"); cpts 634 drivers/net/ethernet/ti/cpts.c struct cpts *cpts_create(struct device *dev, void __iomem *regs, cpts 637 drivers/net/ethernet/ti/cpts.c struct cpts *cpts; cpts 640 drivers/net/ethernet/ti/cpts.c cpts = devm_kzalloc(dev, sizeof(*cpts), GFP_KERNEL); cpts 641 drivers/net/ethernet/ti/cpts.c if (!cpts) cpts 644 drivers/net/ethernet/ti/cpts.c cpts->dev = dev; cpts 645 drivers/net/ethernet/ti/cpts.c cpts->reg = (struct cpsw_cpts __iomem *)regs; cpts 646 drivers/net/ethernet/ti/cpts.c spin_lock_init(&cpts->lock); cpts 648 drivers/net/ethernet/ti/cpts.c ret = cpts_of_parse(cpts, node); cpts 652 drivers/net/ethernet/ti/cpts.c cpts->refclk = devm_get_clk_from_child(dev, node, "cpts"); cpts 653 drivers/net/ethernet/ti/cpts.c if (IS_ERR(cpts->refclk)) cpts 655 drivers/net/ethernet/ti/cpts.c cpts->refclk = devm_clk_get(dev, "cpts"); cpts 657 drivers/net/ethernet/ti/cpts.c if (IS_ERR(cpts->refclk)) { cpts 659 drivers/net/ethernet/ti/cpts.c PTR_ERR(cpts->refclk)); cpts 660 drivers/net/ethernet/ti/cpts.c return ERR_CAST(cpts->refclk); cpts 663 drivers/net/ethernet/ti/cpts.c ret = clk_prepare(cpts->refclk); cpts 667 drivers/net/ethernet/ti/cpts.c cpts->cc.read = cpts_systim_read; cpts 668 drivers/net/ethernet/ti/cpts.c cpts->cc.mask = CLOCKSOURCE_MASK(32); cpts 669 drivers/net/ethernet/ti/cpts.c cpts->info = cpts_info; cpts 671 drivers/net/ethernet/ti/cpts.c cpts_calc_mult_shift(cpts); cpts 675 drivers/net/ethernet/ti/cpts.c cpts->cc_mult = cpts->cc.mult; cpts 677 drivers/net/ethernet/ti/cpts.c return cpts; cpts 681 drivers/net/ethernet/ti/cpts.c void cpts_release(struct cpts *cpts) cpts 683 drivers/net/ethernet/ti/cpts.c if (!cpts) cpts 686 drivers/net/ethernet/ti/cpts.c if (WARN_ON(!cpts->refclk)) cpts 689 drivers/net/ethernet/ti/cpts.c clk_unprepare(cpts->refclk); cpts 119 drivers/net/ethernet/ti/cpts.h void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb); cpts 120 drivers/net/ethernet/ti/cpts.h void cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb); cpts 121 drivers/net/ethernet/ti/cpts.h int cpts_register(struct cpts *cpts); cpts 122 drivers/net/ethernet/ti/cpts.h void cpts_unregister(struct cpts *cpts); cpts 123 drivers/net/ethernet/ti/cpts.h struct cpts *cpts_create(struct device *dev, void __iomem *regs, cpts 125 drivers/net/ethernet/ti/cpts.h void cpts_release(struct cpts *cpts); cpts 127 drivers/net/ethernet/ti/cpts.h static inline bool cpts_can_timestamp(struct cpts *cpts, struct sk_buff *skb) cpts 138 drivers/net/ethernet/ti/cpts.h struct cpts; cpts 140 drivers/net/ethernet/ti/cpts.h static inline void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb) cpts 143 drivers/net/ethernet/ti/cpts.h static inline void cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb) cpts 148 drivers/net/ethernet/ti/cpts.h struct cpts *cpts_create(struct device *dev, void __iomem *regs, cpts 154 drivers/net/ethernet/ti/cpts.h static inline void cpts_release(struct cpts *cpts) cpts 159 drivers/net/ethernet/ti/cpts.h cpts_register(struct cpts *cpts) cpts 164 drivers/net/ethernet/ti/cpts.h static inline void cpts_unregister(struct cpts *cpts) cpts 168 drivers/net/ethernet/ti/cpts.h static inline bool cpts_can_timestamp(struct cpts *cpts, struct sk_buff *skb) cpts 757 drivers/net/ethernet/ti/netcp_ethss.c struct cpts *cpts; cpts 2011 drivers/net/ethernet/ti/netcp_ethss.c if (!gbe_intf || !gbe_intf->gbe_dev->cpts) cpts 2021 drivers/net/ethernet/ti/netcp_ethss.c info->phc_index = gbe_intf->gbe_dev->cpts->phc_index; cpts 2543 drivers/net/ethernet/ti/netcp_ethss.c cpts_tx_timestamp(gbe_dev->cpts, skb); cpts 2551 drivers/net/ethernet/ti/netcp_ethss.c return cpts_can_timestamp(gbe_intf->gbe_dev->cpts, skb); cpts 2596 drivers/net/ethernet/ti/netcp_ethss.c cpts_rx_timestamp(gbe_dev->cpts, p_info->skb); cpts 2606 drivers/net/ethernet/ti/netcp_ethss.c struct cpts *cpts = gbe_dev->cpts; cpts 2609 drivers/net/ethernet/ti/netcp_ethss.c if (!cpts) cpts 2652 drivers/net/ethernet/ti/netcp_ethss.c struct cpts *cpts = gbe_dev->cpts; cpts 2655 drivers/net/ethernet/ti/netcp_ethss.c if (!cpts) cpts 2709 drivers/net/ethernet/ti/netcp_ethss.c if (!gbe_dev->cpts) cpts 2715 drivers/net/ethernet/ti/netcp_ethss.c if (cpts_register(gbe_dev->cpts)) { cpts 2726 drivers/net/ethernet/ti/netcp_ethss.c if (!gbe_dev->cpts || (gbe_dev->cpts_registered <= 0)) cpts 2732 drivers/net/ethernet/ti/netcp_ethss.c cpts_unregister(gbe_dev->cpts); cpts 3720 drivers/net/ethernet/ti/netcp_ethss.c gbe_dev->cpts = cpts_create(gbe_dev->dev, gbe_dev->cpts_reg, cpts_node); cpts 3722 drivers/net/ethernet/ti/netcp_ethss.c if (IS_ENABLED(CONFIG_TI_CPTS) && IS_ERR(gbe_dev->cpts)) { cpts 3723 drivers/net/ethernet/ti/netcp_ethss.c ret = PTR_ERR(gbe_dev->cpts); cpts 3813 drivers/net/ethernet/ti/netcp_ethss.c cpts_release(gbe_dev->cpts);