Lines Matching +full:m +full:- +full:phy
1 // SPDX-License-Identifier: GPL-2.0
14 #include <linux/phy.h>
75 #define CPSW_STAT(m) CPSW_STATS, \ argument
76 sizeof_field(struct cpsw_hw_stats, m), \
77 offsetof(struct cpsw_hw_stats, m)
78 #define CPDMA_RX_STAT(m) CPDMA_RX_STATS, \ argument
79 sizeof_field(struct cpdma_chan_stats, m), \
80 offsetof(struct cpdma_chan_stats, m)
81 #define CPDMA_TX_STAT(m) CPDMA_TX_STATS, \ argument
82 sizeof_field(struct cpdma_chan_stats, m), \
83 offsetof(struct cpdma_chan_stats, m)
111 { "Rx + Tx 65-127 Octet Frames", CPSW_STAT(octetframes65t127) },
112 { "Rx + Tx 128-255 Octet Frames", CPSW_STAT(octetframes128t255) },
113 { "Rx + Tx 256-511 Octet Frames", CPSW_STAT(octetframes256t511) },
114 { "Rx + Tx 512-1023 Octet Frames", CPSW_STAT(octetframes512t1023) },
115 { "Rx + Tx 1024-Up Octet Frames", CPSW_STAT(octetframes1024tup) },
145 return priv->msg_enable; in cpsw_get_msglevel()
152 priv->msg_enable = value; in cpsw_set_msglevel()
161 coal->rx_coalesce_usecs = cpsw->coal_intvl; in cpsw_get_coalesce()
175 struct cpsw_common *cpsw = priv->cpsw; in cpsw_set_coalesce()
177 coal_intvl = coal->rx_coalesce_usecs; in cpsw_set_coalesce()
179 int_ctrl = readl(&cpsw->wr_regs->int_control); in cpsw_set_coalesce()
180 prescale = cpsw->bus_freq_mhz * 4; in cpsw_set_coalesce()
182 if (!coal->rx_coalesce_usecs) { in cpsw_set_coalesce()
208 writel(num_interrupts, &cpsw->wr_regs->rx_imax); in cpsw_set_coalesce()
209 writel(num_interrupts, &cpsw->wr_regs->tx_imax); in cpsw_set_coalesce()
216 writel(int_ctrl, &cpsw->wr_regs->int_control); in cpsw_set_coalesce()
219 cpsw->coal_intvl = coal_intvl; in cpsw_set_coalesce()
231 (cpsw->rx_ch_num + cpsw->tx_ch_num) * in cpsw_get_sset_count()
234 return -EOPNOTSUPP; in cpsw_get_sset_count()
269 cpsw_add_ch_strings(&p, cpsw->rx_ch_num, 1); in cpsw_get_strings()
270 cpsw_add_ch_strings(&p, cpsw->tx_ch_num, 0); in cpsw_get_strings()
285 data[l] = readl(cpsw->hw_stats + in cpsw_get_ethtool_stats()
288 for (ch = 0; ch < cpsw->rx_ch_num; ch++) { in cpsw_get_ethtool_stats()
289 cpdma_chan_get_stats(cpsw->rxv[ch].ch, &ch_stats); in cpsw_get_ethtool_stats()
297 for (ch = 0; ch < cpsw->tx_ch_num; ch++) { in cpsw_get_ethtool_stats()
298 cpdma_chan_get_stats(cpsw->txv[ch].ch, &ch_stats); in cpsw_get_ethtool_stats()
312 pause->autoneg = AUTONEG_DISABLE; in cpsw_get_pauseparam()
313 pause->rx_pause = priv->rx_pause ? true : false; in cpsw_get_pauseparam()
314 pause->tx_pause = priv->tx_pause ? true : false; in cpsw_get_pauseparam()
320 struct cpsw_common *cpsw = priv->cpsw; in cpsw_get_wol()
323 wol->supported = 0; in cpsw_get_wol()
324 wol->wolopts = 0; in cpsw_get_wol()
326 if (cpsw->slaves[slave_no].phy) in cpsw_get_wol()
327 phy_ethtool_get_wol(cpsw->slaves[slave_no].phy, wol); in cpsw_get_wol()
333 struct cpsw_common *cpsw = priv->cpsw; in cpsw_set_wol()
336 if (cpsw->slaves[slave_no].phy) in cpsw_set_wol()
337 return phy_ethtool_set_wol(cpsw->slaves[slave_no].phy, wol); in cpsw_set_wol()
339 return -EOPNOTSUPP; in cpsw_set_wol()
346 return cpsw_ale_get_num_entries(cpsw->ale) * in cpsw_get_regs_len()
356 regs->version = cpsw->version; in cpsw_get_regs()
358 cpsw_ale_dump(cpsw->ale, reg); in cpsw_get_regs()
364 struct cpsw_common *cpsw = priv->cpsw; in cpsw_ethtool_op_begin()
367 ret = pm_runtime_get_sync(cpsw->dev); in cpsw_ethtool_op_begin()
370 pm_runtime_put_noidle(cpsw->dev); in cpsw_ethtool_op_begin()
381 ret = pm_runtime_put(priv->cpsw->dev); in cpsw_ethtool_op_complete()
390 ch->max_rx = cpsw->quirk_irq ? 1 : CPSW_MAX_QUEUES; in cpsw_get_channels()
391 ch->max_tx = cpsw->quirk_irq ? 1 : CPSW_MAX_QUEUES; in cpsw_get_channels()
392 ch->max_combined = 0; in cpsw_get_channels()
393 ch->max_other = 0; in cpsw_get_channels()
394 ch->other_count = 0; in cpsw_get_channels()
395 ch->rx_count = cpsw->rx_ch_num; in cpsw_get_channels()
396 ch->tx_count = cpsw->tx_ch_num; in cpsw_get_channels()
397 ch->combined_count = 0; in cpsw_get_channels()
404 struct cpsw_common *cpsw = priv->cpsw; in cpsw_get_link_ksettings()
407 if (!cpsw->slaves[slave_no].phy) in cpsw_get_link_ksettings()
408 return -EOPNOTSUPP; in cpsw_get_link_ksettings()
410 phy_ethtool_ksettings_get(cpsw->slaves[slave_no].phy, ecmd); in cpsw_get_link_ksettings()
418 struct cpsw_common *cpsw = priv->cpsw; in cpsw_set_link_ksettings()
421 if (!cpsw->slaves[slave_no].phy) in cpsw_set_link_ksettings()
422 return -EOPNOTSUPP; in cpsw_set_link_ksettings()
424 return phy_ethtool_ksettings_set(cpsw->slaves[slave_no].phy, ecmd); in cpsw_set_link_ksettings()
430 struct cpsw_common *cpsw = priv->cpsw; in cpsw_get_eee()
433 if (cpsw->slaves[slave_no].phy) in cpsw_get_eee()
434 return phy_ethtool_get_eee(cpsw->slaves[slave_no].phy, edata); in cpsw_get_eee()
436 return -EOPNOTSUPP; in cpsw_get_eee()
442 struct cpsw_common *cpsw = priv->cpsw; in cpsw_set_eee()
445 if (cpsw->slaves[slave_no].phy) in cpsw_set_eee()
446 return phy_ethtool_set_eee(cpsw->slaves[slave_no].phy, edata); in cpsw_set_eee()
448 return -EOPNOTSUPP; in cpsw_set_eee()
454 struct cpsw_common *cpsw = priv->cpsw; in cpsw_nway_reset()
457 if (cpsw->slaves[slave_no].phy) in cpsw_nway_reset()
458 return genphy_restart_aneg(cpsw->slaves[slave_no].phy); in cpsw_nway_reset()
460 return -EOPNOTSUPP; in cpsw_nway_reset()
473 for (i = 0; i < cpsw->data.slaves; i++) { in cpsw_suspend_data_pass()
474 ndev = cpsw->slaves[i].ndev; in cpsw_suspend_data_pass()
485 cpdma_ctlr_stop(cpsw->dma); in cpsw_suspend_data_pass()
491 struct cpsw_common *cpsw = priv->cpsw; in cpsw_resume_data_pass()
495 if (cpsw->usage_count) { in cpsw_resume_data_pass()
500 cpdma_ctlr_start(cpsw->dma); in cpsw_resume_data_pass()
505 for (i = 0; i < cpsw->data.slaves; i++) { in cpsw_resume_data_pass()
506 ndev = cpsw->slaves[i].ndev; in cpsw_resume_data_pass()
517 if (cpsw->quirk_irq) { in cpsw_check_ch_settings()
518 dev_err(cpsw->dev, "Maximum one tx/rx queue is allowed"); in cpsw_check_ch_settings()
519 return -EOPNOTSUPP; in cpsw_check_ch_settings()
522 if (ch->combined_count) in cpsw_check_ch_settings()
523 return -EINVAL; in cpsw_check_ch_settings()
526 if (!ch->rx_count || !ch->tx_count) in cpsw_check_ch_settings()
527 return -EINVAL; in cpsw_check_ch_settings()
529 if (ch->rx_count > cpsw->data.channels || in cpsw_check_ch_settings()
530 ch->tx_count > cpsw->data.channels) in cpsw_check_ch_settings()
531 return -EINVAL; in cpsw_check_ch_settings()
539 struct cpsw_common *cpsw = priv->cpsw; in cpsw_update_channels_res()
546 ch = &cpsw->rx_ch_num; in cpsw_update_channels_res()
547 vec = cpsw->rxv; in cpsw_update_channels_res()
550 ch = &cpsw->tx_ch_num; in cpsw_update_channels_res()
551 vec = cpsw->txv; in cpsw_update_channels_res()
556 vch = rx ? *ch : 7 - *ch; in cpsw_update_channels_res()
557 vec[*ch].ch = cpdma_chan_create(cpsw->dma, vch, handler, rx); in cpsw_update_channels_res()
558 queue = netdev_get_tx_queue(priv->ndev, *ch); in cpsw_update_channels_res()
559 queue->tx_maxrate = 0; in cpsw_update_channels_res()
565 return -EINVAL; in cpsw_update_channels_res()
573 (*ch)--; in cpsw_update_channels_res()
591 for (i = 0; i < cpsw->data.slaves; i++) { in cpsw_fail()
592 ndev = cpsw->slaves[i].ndev; in cpsw_fail()
603 struct cpsw_common *cpsw = priv->cpsw; in cpsw_set_channels_common()
613 new_pools = (chs->rx_count != cpsw->rx_ch_num) && cpsw->usage_count; in cpsw_set_channels_common()
615 ret = cpsw_update_channels_res(priv, chs->rx_count, 1, rx_handler); in cpsw_set_channels_common()
619 ret = cpsw_update_channels_res(priv, chs->tx_count, 0, rx_handler); in cpsw_set_channels_common()
623 for (i = 0; i < cpsw->data.slaves; i++) { in cpsw_set_channels_common()
624 sl_ndev = cpsw->slaves[i].ndev; in cpsw_set_channels_common()
629 ret = netif_set_real_num_tx_queues(sl_ndev, cpsw->tx_ch_num); in cpsw_set_channels_common()
631 dev_err(priv->dev, "cannot set real number of tx queues\n"); in cpsw_set_channels_common()
635 ret = netif_set_real_num_rx_queues(sl_ndev, cpsw->rx_ch_num); in cpsw_set_channels_common()
637 dev_err(priv->dev, "cannot set real number of rx queues\n"); in cpsw_set_channels_common()
655 dev_err(priv->dev, "cannot update channels number, closing device\n"); in cpsw_set_channels_common()
664 struct cpsw_common *cpsw = priv->cpsw; in cpsw_get_ringparam()
667 ering->tx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES; in cpsw_get_ringparam()
668 ering->tx_pending = cpdma_get_num_tx_descs(cpsw->dma); in cpsw_get_ringparam()
669 ering->rx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES; in cpsw_get_ringparam()
670 ering->rx_pending = cpdma_get_num_rx_descs(cpsw->dma); in cpsw_get_ringparam()
679 /* ignore ering->tx_pending - only rx_pending adjustment is supported */ in cpsw_set_ringparam()
681 if (ering->rx_mini_pending || ering->rx_jumbo_pending || in cpsw_set_ringparam()
682 ering->rx_pending < CPSW_MAX_QUEUES || in cpsw_set_ringparam()
683 ering->rx_pending > (cpsw->descs_pool_size - CPSW_MAX_QUEUES)) in cpsw_set_ringparam()
684 return -EINVAL; in cpsw_set_ringparam()
686 descs_num = cpdma_get_num_rx_descs(cpsw->dma); in cpsw_set_ringparam()
687 if (ering->rx_pending == descs_num) in cpsw_set_ringparam()
692 ret = cpdma_set_num_rx_descs(cpsw->dma, ering->rx_pending); in cpsw_set_ringparam()
700 if (cpsw->usage_count) { in cpsw_set_ringparam()
711 cpdma_set_num_rx_descs(cpsw->dma, descs_num); in cpsw_set_ringparam()
712 dev_err(cpsw->dev, "cannot set ring params, closing device\n"); in cpsw_set_ringparam()
722 info->so_timestamping = in cpsw_get_ts_info()
729 info->phc_index = cpsw->cpts->phc_index; in cpsw_get_ts_info()
730 info->tx_types = in cpsw_get_ts_info()
733 info->rx_filters = in cpsw_get_ts_info()
741 info->so_timestamping = in cpsw_get_ts_info()
745 info->phc_index = -1; in cpsw_get_ts_info()
746 info->tx_types = 0; in cpsw_get_ts_info()
747 info->rx_filters = 0; in cpsw_get_ts_info()