Lines Matching defs:cpsw
18 #include "cpsw.h"
157 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
159 coal->rx_coalesce_usecs = cpsw->coal_intvl;
171 struct cpsw_common *cpsw = priv->cpsw;
175 int_ctrl = readl(&cpsw->wr_regs->int_control);
176 prescale = cpsw->bus_freq_mhz * 4;
204 writel(num_interrupts, &cpsw->wr_regs->rx_imax);
205 writel(num_interrupts, &cpsw->wr_regs->tx_imax);
212 writel(int_ctrl, &cpsw->wr_regs->int_control);
215 cpsw->coal_intvl = coal_intvl;
222 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
227 (cpsw->rx_ch_num + cpsw->tx_ch_num) *
253 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
265 cpsw_add_ch_strings(&p, cpsw->rx_ch_num, 1);
266 cpsw_add_ch_strings(&p, cpsw->tx_ch_num, 0);
275 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
281 data[l] = readl(cpsw->hw_stats +
284 for (ch = 0; ch < cpsw->rx_ch_num; ch++) {
285 cpdma_chan_get_stats(cpsw->rxv[ch].ch, &ch_stats);
293 for (ch = 0; ch < cpsw->tx_ch_num; ch++) {
294 cpdma_chan_get_stats(cpsw->txv[ch].ch, &ch_stats);
316 struct cpsw_common *cpsw = priv->cpsw;
317 int slave_no = cpsw_slave_index(cpsw, priv);
322 if (cpsw->slaves[slave_no].phy)
323 phy_ethtool_get_wol(cpsw->slaves[slave_no].phy, wol);
329 struct cpsw_common *cpsw = priv->cpsw;
330 int slave_no = cpsw_slave_index(cpsw, priv);
332 if (cpsw->slaves[slave_no].phy)
333 return phy_ethtool_set_wol(cpsw->slaves[slave_no].phy, wol);
340 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
342 return cpsw_ale_get_num_entries(cpsw->ale) *
349 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
352 regs->version = cpsw->version;
354 cpsw_ale_dump(cpsw->ale, reg);
360 struct cpsw_common *cpsw = priv->cpsw;
363 ret = pm_runtime_get_sync(cpsw->dev);
366 pm_runtime_put_noidle(cpsw->dev);
377 ret = pm_runtime_put(priv->cpsw->dev);
384 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
386 ch->max_rx = cpsw->quirk_irq ? 1 : CPSW_MAX_QUEUES;
387 ch->max_tx = cpsw->quirk_irq ? 1 : CPSW_MAX_QUEUES;
391 ch->rx_count = cpsw->rx_ch_num;
392 ch->tx_count = cpsw->tx_ch_num;
400 struct cpsw_common *cpsw = priv->cpsw;
401 int slave_no = cpsw_slave_index(cpsw, priv);
403 if (!cpsw->slaves[slave_no].phy)
406 phy_ethtool_ksettings_get(cpsw->slaves[slave_no].phy, ecmd);
414 struct cpsw_common *cpsw = priv->cpsw;
415 int slave_no = cpsw_slave_index(cpsw, priv);
417 if (!cpsw->slaves[slave_no].phy)
420 return phy_ethtool_ksettings_set(cpsw->slaves[slave_no].phy, ecmd);
426 struct cpsw_common *cpsw = priv->cpsw;
427 int slave_no = cpsw_slave_index(cpsw, priv);
429 if (cpsw->slaves[slave_no].phy)
430 return phy_ethtool_get_eee(cpsw->slaves[slave_no].phy, edata);
438 struct cpsw_common *cpsw = priv->cpsw;
439 int slave_no = cpsw_slave_index(cpsw, priv);
441 if (cpsw->slaves[slave_no].phy)
442 return phy_ethtool_set_eee(cpsw->slaves[slave_no].phy, edata);
450 struct cpsw_common *cpsw = priv->cpsw;
451 int slave_no = cpsw_slave_index(cpsw, priv);
453 if (cpsw->slaves[slave_no].phy)
454 return genphy_restart_aneg(cpsw->slaves[slave_no].phy);
461 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
465 cpsw_intr_disable(cpsw);
469 for (i = 0; i < cpsw->data.slaves; i++) {
470 ndev = cpsw->slaves[i].ndev;
481 cpdma_ctlr_stop(cpsw->dma);
487 struct cpsw_common *cpsw = priv->cpsw;
491 if (cpsw->usage_count) {
496 cpdma_ctlr_start(cpsw->dma);
497 cpsw_intr_enable(cpsw);
501 for (i = 0; i < cpsw->data.slaves; i++) {
502 ndev = cpsw->slaves[i].ndev;
510 static int cpsw_check_ch_settings(struct cpsw_common *cpsw,
513 if (cpsw->quirk_irq) {
514 dev_err(cpsw->dev, "Maximum one tx/rx queue is allowed");
525 if (ch->rx_count > cpsw->data.channels ||
526 ch->tx_count > cpsw->data.channels)
535 struct cpsw_common *cpsw = priv->cpsw;
542 ch = &cpsw->rx_ch_num;
543 vec = cpsw->rxv;
546 ch = &cpsw->tx_ch_num;
547 vec = cpsw->txv;
553 vec[*ch].ch = cpdma_chan_create(cpsw->dma, vch, handler, rx);
582 static void cpsw_fail(struct cpsw_common *cpsw)
587 for (i = 0; i < cpsw->data.slaves; i++) {
588 ndev = cpsw->slaves[i].ndev;
599 struct cpsw_common *cpsw = priv->cpsw;
603 ret = cpsw_check_ch_settings(cpsw, chs);
609 new_pools = (chs->rx_count != cpsw->rx_ch_num) && cpsw->usage_count;
619 for (i = 0; i < cpsw->data.slaves; i++) {
620 sl_ndev = cpsw->slaves[i].ndev;
625 ret = netif_set_real_num_tx_queues(sl_ndev, cpsw->tx_ch_num);
631 ret = netif_set_real_num_rx_queues(sl_ndev, cpsw->rx_ch_num);
638 cpsw_split_res(cpsw);
641 cpsw_destroy_xdp_rxqs(cpsw);
642 ret = cpsw_create_xdp_rxqs(cpsw);
652 cpsw_fail(cpsw);
660 struct cpsw_common *cpsw = priv->cpsw;
663 ering->tx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES;
664 ering->tx_pending = cpdma_get_num_tx_descs(cpsw->dma);
665 ering->rx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES;
666 ering->rx_pending = cpdma_get_num_rx_descs(cpsw->dma);
672 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
679 ering->rx_pending > (cpsw->descs_pool_size - CPSW_MAX_QUEUES))
682 descs_num = cpdma_get_num_rx_descs(cpsw->dma);
688 ret = cpdma_set_num_rx_descs(cpsw->dma, ering->rx_pending);
696 if (cpsw->usage_count) {
697 cpsw_destroy_xdp_rxqs(cpsw);
698 ret = cpsw_create_xdp_rxqs(cpsw);
707 cpdma_set_num_rx_descs(cpsw->dma, descs_num);
708 dev_err(cpsw->dev, "cannot set ring params, closing device\n");
709 cpsw_fail(cpsw);
716 struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
725 info->phc_index = cpsw->cpts->phc_index;