Lines Matching defs:cpsw

18 #include "cpsw.h"
159 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
161 coal->rx_coalesce_usecs = cpsw->coal_intvl;
175 struct cpsw_common *cpsw = priv->cpsw;
179 int_ctrl = readl(&cpsw->wr_regs->int_control);
180 prescale = cpsw->bus_freq_mhz * 4;
208 writel(num_interrupts, &cpsw->wr_regs->rx_imax);
209 writel(num_interrupts, &cpsw->wr_regs->tx_imax);
216 writel(int_ctrl, &cpsw->wr_regs->int_control);
219 cpsw->coal_intvl = coal_intvl;
226 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
231 (cpsw->rx_ch_num + cpsw->tx_ch_num) *
257 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
269 cpsw_add_ch_strings(&p, cpsw->rx_ch_num, 1);
270 cpsw_add_ch_strings(&p, cpsw->tx_ch_num, 0);
279 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
285 data[l] = readl(cpsw->hw_stats +
288 for (ch = 0; ch < cpsw->rx_ch_num; ch++) {
289 cpdma_chan_get_stats(cpsw->rxv[ch].ch, &ch_stats);
297 for (ch = 0; ch < cpsw->tx_ch_num; ch++) {
298 cpdma_chan_get_stats(cpsw->txv[ch].ch, &ch_stats);
320 struct cpsw_common *cpsw = priv->cpsw;
321 int slave_no = cpsw_slave_index(cpsw, priv);
326 if (cpsw->slaves[slave_no].phy)
327 phy_ethtool_get_wol(cpsw->slaves[slave_no].phy, wol);
333 struct cpsw_common *cpsw = priv->cpsw;
334 int slave_no = cpsw_slave_index(cpsw, priv);
336 if (cpsw->slaves[slave_no].phy)
337 return phy_ethtool_set_wol(cpsw->slaves[slave_no].phy, wol);
344 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
346 return cpsw_ale_get_num_entries(cpsw->ale) *
353 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
356 regs->version = cpsw->version;
358 cpsw_ale_dump(cpsw->ale, reg);
364 struct cpsw_common *cpsw = priv->cpsw;
367 ret = pm_runtime_resume_and_get(cpsw->dev);
379 ret = pm_runtime_put(priv->cpsw->dev);
386 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
388 ch->max_rx = cpsw->quirk_irq ? 1 : CPSW_MAX_QUEUES;
389 ch->max_tx = cpsw->quirk_irq ? 1 : CPSW_MAX_QUEUES;
393 ch->rx_count = cpsw->rx_ch_num;
394 ch->tx_count = cpsw->tx_ch_num;
402 struct cpsw_common *cpsw = priv->cpsw;
403 int slave_no = cpsw_slave_index(cpsw, priv);
405 if (!cpsw->slaves[slave_no].phy)
408 phy_ethtool_ksettings_get(cpsw->slaves[slave_no].phy, ecmd);
416 struct cpsw_common *cpsw = priv->cpsw;
417 int slave_no = cpsw_slave_index(cpsw, priv);
419 if (!cpsw->slaves[slave_no].phy)
422 return phy_ethtool_ksettings_set(cpsw->slaves[slave_no].phy, ecmd);
428 struct cpsw_common *cpsw = priv->cpsw;
429 int slave_no = cpsw_slave_index(cpsw, priv);
431 if (cpsw->slaves[slave_no].phy)
432 return phy_ethtool_get_eee(cpsw->slaves[slave_no].phy, edata);
440 struct cpsw_common *cpsw = priv->cpsw;
441 int slave_no = cpsw_slave_index(cpsw, priv);
443 if (cpsw->slaves[slave_no].phy)
444 return phy_ethtool_set_eee(cpsw->slaves[slave_no].phy, edata);
452 struct cpsw_common *cpsw = priv->cpsw;
453 int slave_no = cpsw_slave_index(cpsw, priv);
455 if (cpsw->slaves[slave_no].phy)
456 return genphy_restart_aneg(cpsw->slaves[slave_no].phy);
463 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
467 cpsw_intr_disable(cpsw);
471 for (i = 0; i < cpsw->data.slaves; i++) {
472 ndev = cpsw->slaves[i].ndev;
483 cpdma_ctlr_stop(cpsw->dma);
489 struct cpsw_common *cpsw = priv->cpsw;
493 if (cpsw->usage_count) {
498 cpdma_ctlr_start(cpsw->dma);
499 cpsw_intr_enable(cpsw);
503 for (i = 0; i < cpsw->data.slaves; i++) {
504 ndev = cpsw->slaves[i].ndev;
512 static int cpsw_check_ch_settings(struct cpsw_common *cpsw,
515 if (cpsw->quirk_irq) {
516 dev_err(cpsw->dev, "Maximum one tx/rx queue is allowed");
527 if (ch->rx_count > cpsw->data.channels ||
528 ch->tx_count > cpsw->data.channels)
537 struct cpsw_common *cpsw = priv->cpsw;
544 ch = &cpsw->rx_ch_num;
545 vec = cpsw->rxv;
548 ch = &cpsw->tx_ch_num;
549 vec = cpsw->txv;
555 vec[*ch].ch = cpdma_chan_create(cpsw->dma, vch, handler, rx);
584 static void cpsw_fail(struct cpsw_common *cpsw)
589 for (i = 0; i < cpsw->data.slaves; i++) {
590 ndev = cpsw->slaves[i].ndev;
601 struct cpsw_common *cpsw = priv->cpsw;
605 ret = cpsw_check_ch_settings(cpsw, chs);
611 new_pools = (chs->rx_count != cpsw->rx_ch_num) && cpsw->usage_count;
621 for (i = 0; i < cpsw->data.slaves; i++) {
622 sl_ndev = cpsw->slaves[i].ndev;
627 ret = netif_set_real_num_tx_queues(sl_ndev, cpsw->tx_ch_num);
633 ret = netif_set_real_num_rx_queues(sl_ndev, cpsw->rx_ch_num);
640 cpsw_split_res(cpsw);
643 cpsw_destroy_xdp_rxqs(cpsw);
644 ret = cpsw_create_xdp_rxqs(cpsw);
654 cpsw_fail(cpsw);
664 struct cpsw_common *cpsw = priv->cpsw;
667 ering->tx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES;
668 ering->tx_pending = cpdma_get_num_tx_descs(cpsw->dma);
669 ering->rx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES;
670 ering->rx_pending = cpdma_get_num_rx_descs(cpsw->dma);
678 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
685 ering->rx_pending > (cpsw->descs_pool_size - CPSW_MAX_QUEUES))
688 descs_num = cpdma_get_num_rx_descs(cpsw->dma);
694 ret = cpdma_set_num_rx_descs(cpsw->dma, ering->rx_pending);
702 if (cpsw->usage_count) {
703 cpsw_destroy_xdp_rxqs(cpsw);
704 ret = cpsw_create_xdp_rxqs(cpsw);
713 cpdma_set_num_rx_descs(cpsw->dma, descs_num);
714 dev_err(cpsw->dev, "cannot set ring params, closing device\n");
715 cpsw_fail(cpsw);
722 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
731 info->phc_index = cpsw->cpts->phc_index;