Lines Matching full:cpsw

18 #include "cpsw.h"
159 struct cpsw_common *cpsw = ndev_to_cpsw(ndev); in cpsw_get_coalesce() local
161 coal->rx_coalesce_usecs = cpsw->coal_intvl; in cpsw_get_coalesce()
175 struct cpsw_common *cpsw = priv->cpsw; in cpsw_set_coalesce() local
179 int_ctrl = readl(&cpsw->wr_regs->int_control); in cpsw_set_coalesce()
180 prescale = cpsw->bus_freq_mhz * 4; 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()
226 struct cpsw_common *cpsw = ndev_to_cpsw(ndev); in cpsw_get_sset_count() local
231 (cpsw->rx_ch_num + cpsw->tx_ch_num) * in cpsw_get_sset_count()
257 struct cpsw_common *cpsw = ndev_to_cpsw(ndev); in cpsw_get_strings() local
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()
279 struct cpsw_common *cpsw = ndev_to_cpsw(ndev); in cpsw_get_ethtool_stats() local
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()
320 struct cpsw_common *cpsw = priv->cpsw; in cpsw_get_wol() local
321 int slave_no = cpsw_slave_index(cpsw, priv); 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() local
334 int slave_no = cpsw_slave_index(cpsw, priv); 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()
344 struct cpsw_common *cpsw = ndev_to_cpsw(ndev); in cpsw_get_regs_len() local
346 return cpsw_ale_get_num_entries(cpsw->ale) * in cpsw_get_regs_len()
353 struct cpsw_common *cpsw = ndev_to_cpsw(ndev); in cpsw_get_regs() local
355 /* update CPSW IP version */ in cpsw_get_regs()
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() local
367 ret = pm_runtime_resume_and_get(cpsw->dev); in cpsw_ethtool_op_begin()
379 ret = pm_runtime_put(priv->cpsw->dev); in cpsw_ethtool_op_complete()
386 struct cpsw_common *cpsw = ndev_to_cpsw(ndev); in cpsw_get_channels() local
388 ch->max_rx = cpsw->quirk_irq ? 1 : CPSW_MAX_QUEUES; in cpsw_get_channels()
389 ch->max_tx = cpsw->quirk_irq ? 1 : CPSW_MAX_QUEUES; in cpsw_get_channels()
393 ch->rx_count = cpsw->rx_ch_num; in cpsw_get_channels()
394 ch->tx_count = cpsw->tx_ch_num; in cpsw_get_channels()
402 struct cpsw_common *cpsw = priv->cpsw; in cpsw_get_link_ksettings() local
403 int slave_no = cpsw_slave_index(cpsw, priv); in cpsw_get_link_ksettings()
405 if (!cpsw->slaves[slave_no].phy) in cpsw_get_link_ksettings()
408 phy_ethtool_ksettings_get(cpsw->slaves[slave_no].phy, ecmd); in cpsw_get_link_ksettings()
416 struct cpsw_common *cpsw = priv->cpsw; in cpsw_set_link_ksettings() local
417 int slave_no = cpsw_slave_index(cpsw, priv); in cpsw_set_link_ksettings()
419 if (!cpsw->slaves[slave_no].phy) in cpsw_set_link_ksettings()
422 return phy_ethtool_ksettings_set(cpsw->slaves[slave_no].phy, ecmd); in cpsw_set_link_ksettings()
428 struct cpsw_common *cpsw = priv->cpsw; in cpsw_get_eee() local
429 int slave_no = cpsw_slave_index(cpsw, priv); in cpsw_get_eee()
431 if (cpsw->slaves[slave_no].phy) in cpsw_get_eee()
432 return phy_ethtool_get_eee(cpsw->slaves[slave_no].phy, edata); in cpsw_get_eee()
440 struct cpsw_common *cpsw = priv->cpsw; in cpsw_nway_reset() local
441 int slave_no = cpsw_slave_index(cpsw, priv); in cpsw_nway_reset()
443 if (cpsw->slaves[slave_no].phy) in cpsw_nway_reset()
444 return genphy_restart_aneg(cpsw->slaves[slave_no].phy); in cpsw_nway_reset()
451 struct cpsw_common *cpsw = ndev_to_cpsw(ndev); in cpsw_suspend_data_pass() local
455 cpsw_intr_disable(cpsw); in cpsw_suspend_data_pass()
459 for (i = 0; i < cpsw->data.slaves; i++) { in cpsw_suspend_data_pass()
460 ndev = cpsw->slaves[i].ndev; in cpsw_suspend_data_pass()
471 cpdma_ctlr_stop(cpsw->dma); in cpsw_suspend_data_pass()
477 struct cpsw_common *cpsw = priv->cpsw; in cpsw_resume_data_pass() local
481 if (cpsw->usage_count) { in cpsw_resume_data_pass()
486 cpdma_ctlr_start(cpsw->dma); in cpsw_resume_data_pass()
487 cpsw_intr_enable(cpsw); in cpsw_resume_data_pass()
491 for (i = 0; i < cpsw->data.slaves; i++) { in cpsw_resume_data_pass()
492 ndev = cpsw->slaves[i].ndev; in cpsw_resume_data_pass()
500 static int cpsw_check_ch_settings(struct cpsw_common *cpsw, in cpsw_check_ch_settings() argument
503 if (cpsw->quirk_irq) { in cpsw_check_ch_settings()
504 dev_err(cpsw->dev, "Maximum one tx/rx queue is allowed"); in cpsw_check_ch_settings()
515 if (ch->rx_count > cpsw->data.channels || in cpsw_check_ch_settings()
516 ch->tx_count > cpsw->data.channels) in cpsw_check_ch_settings()
525 struct cpsw_common *cpsw = priv->cpsw; in cpsw_update_channels_res() local
532 ch = &cpsw->rx_ch_num; in cpsw_update_channels_res()
533 vec = cpsw->rxv; in cpsw_update_channels_res()
536 ch = &cpsw->tx_ch_num; in cpsw_update_channels_res()
537 vec = cpsw->txv; in cpsw_update_channels_res()
543 vec[*ch].ch = cpdma_chan_create(cpsw->dma, vch, handler, rx); in cpsw_update_channels_res()
572 static void cpsw_fail(struct cpsw_common *cpsw) in cpsw_fail() argument
577 for (i = 0; i < cpsw->data.slaves; i++) { in cpsw_fail()
578 ndev = cpsw->slaves[i].ndev; in cpsw_fail()
589 struct cpsw_common *cpsw = priv->cpsw; in cpsw_set_channels_common() local
593 ret = cpsw_check_ch_settings(cpsw, chs); in cpsw_set_channels_common()
599 new_pools = (chs->rx_count != cpsw->rx_ch_num) && cpsw->usage_count; in cpsw_set_channels_common()
609 for (i = 0; i < cpsw->data.slaves; i++) { in cpsw_set_channels_common()
610 sl_ndev = cpsw->slaves[i].ndev; in cpsw_set_channels_common()
615 ret = netif_set_real_num_tx_queues(sl_ndev, cpsw->tx_ch_num); in cpsw_set_channels_common()
621 ret = netif_set_real_num_rx_queues(sl_ndev, cpsw->rx_ch_num); in cpsw_set_channels_common()
628 cpsw_split_res(cpsw); in cpsw_set_channels_common()
631 cpsw_destroy_xdp_rxqs(cpsw); in cpsw_set_channels_common()
632 ret = cpsw_create_xdp_rxqs(cpsw); in cpsw_set_channels_common()
642 cpsw_fail(cpsw); in cpsw_set_channels_common()
652 struct cpsw_common *cpsw = priv->cpsw; in cpsw_get_ringparam() local
655 ering->tx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES; in cpsw_get_ringparam()
656 ering->tx_pending = cpdma_get_num_tx_descs(cpsw->dma); in cpsw_get_ringparam()
657 ering->rx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES; in cpsw_get_ringparam()
658 ering->rx_pending = cpdma_get_num_rx_descs(cpsw->dma); in cpsw_get_ringparam()
666 struct cpsw_common *cpsw = ndev_to_cpsw(ndev); in cpsw_set_ringparam() local
673 ering->rx_pending > (cpsw->descs_pool_size - CPSW_MAX_QUEUES)) in cpsw_set_ringparam()
676 descs_num = cpdma_get_num_rx_descs(cpsw->dma); in cpsw_set_ringparam()
682 ret = cpdma_set_num_rx_descs(cpsw->dma, ering->rx_pending); in cpsw_set_ringparam()
690 if (cpsw->usage_count) { in cpsw_set_ringparam()
691 cpsw_destroy_xdp_rxqs(cpsw); in cpsw_set_ringparam()
692 ret = cpsw_create_xdp_rxqs(cpsw); in cpsw_set_ringparam()
701 cpdma_set_num_rx_descs(cpsw->dma, descs_num); in cpsw_set_ringparam()
702 dev_err(cpsw->dev, "cannot set ring params, closing device\n"); in cpsw_set_ringparam()
703 cpsw_fail(cpsw); in cpsw_set_ringparam()
710 struct cpsw_common *cpsw = ndev_to_cpsw(ndev); in cpsw_get_ts_info() local
717 info->phc_index = cpsw->cpts->phc_index; in cpsw_get_ts_info()