Lines Matching +full:cpsw +full:- +full:switch

1 // SPDX-License-Identifier: GPL-2.0
2 /* Texas Instruments K3 AM65 Ethernet Switch SubSystem Driver ethtool ops
4 * Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
13 #include "am65-cpsw-nuss.h"
15 #include "am65-cpts.h"
33 * struct am65_cpsw_regdump_hdr - regdump record header
35 * @module_id: CPSW module ID
36 * @len: CPSW module registers space length in u32
45 * struct am65_cpsw_regdump_item - regdump module description
47 * @hdr: CPSW module header
48 * @start_ofs: CPSW module registers start addr
49 * @end_ofs: CPSW module registers end addr
64 .hdr.len = (((u32 *)(end)) - ((u32 *)(start)) + 1) * sizeof(u32) * 2 + \
375 "p0-rx-ptype-rrobin",
383 ret = pm_runtime_get_sync(common->dev); in am65_cpsw_ethtool_op_begin()
385 dev_err(common->dev, "ethtool begin failed %d\n", ret); in am65_cpsw_ethtool_op_begin()
386 pm_runtime_put_noidle(common->dev); in am65_cpsw_ethtool_op_begin()
397 ret = pm_runtime_put(common->dev); in am65_cpsw_ethtool_op_complete()
398 if (ret < 0 && ret != -EBUSY) in am65_cpsw_ethtool_op_complete()
399 dev_err(common->dev, "ethtool complete failed %d\n", ret); in am65_cpsw_ethtool_op_complete()
407 strlcpy(info->driver, dev_driver_string(common->dev), in am65_cpsw_get_drvinfo()
408 sizeof(info->driver)); in am65_cpsw_get_drvinfo()
409 strlcpy(info->bus_info, dev_name(common->dev), sizeof(info->bus_info)); in am65_cpsw_get_drvinfo()
416 return priv->msg_enable; in am65_cpsw_get_msglevel()
423 priv->msg_enable = value; in am65_cpsw_set_msglevel()
431 ch->max_rx = AM65_CPSW_MAX_RX_QUEUES; in am65_cpsw_get_channels()
432 ch->max_tx = AM65_CPSW_MAX_TX_QUEUES; in am65_cpsw_get_channels()
433 ch->rx_count = AM65_CPSW_MAX_RX_QUEUES; in am65_cpsw_get_channels()
434 ch->tx_count = common->tx_ch_num; in am65_cpsw_get_channels()
442 if (!chs->rx_count || !chs->tx_count) in am65_cpsw_set_channels()
443 return -EINVAL; in am65_cpsw_set_channels()
448 if (common->usage_count) in am65_cpsw_set_channels()
449 return -EBUSY; in am65_cpsw_set_channels()
453 return am65_cpsw_nuss_update_tx_chns(common, chs->tx_count); in am65_cpsw_set_channels()
462 ering->tx_pending = common->tx_chns[0].descs_num; in am65_cpsw_get_ringparam()
463 ering->rx_pending = common->rx_chns.descs_num; in am65_cpsw_get_ringparam()
471 pause->autoneg = AUTONEG_DISABLE; in am65_cpsw_get_pauseparam()
472 pause->rx_pause = salve->rx_pause ? true : false; in am65_cpsw_get_pauseparam()
473 pause->tx_pause = salve->tx_pause ? true : false; in am65_cpsw_get_pauseparam()
481 if (!salve->phy) in am65_cpsw_set_pauseparam()
482 return -EINVAL; in am65_cpsw_set_pauseparam()
484 if (!phy_validate_pause(salve->phy, pause)) in am65_cpsw_set_pauseparam()
485 return -EINVAL; in am65_cpsw_set_pauseparam()
487 salve->rx_pause = pause->rx_pause ? true : false; in am65_cpsw_set_pauseparam()
488 salve->tx_pause = pause->tx_pause ? true : false; in am65_cpsw_set_pauseparam()
490 phy_set_asym_pause(salve->phy, salve->rx_pause, salve->tx_pause); in am65_cpsw_set_pauseparam()
500 wol->supported = 0; in am65_cpsw_get_wol()
501 wol->wolopts = 0; in am65_cpsw_get_wol()
503 if (salve->phy) in am65_cpsw_get_wol()
504 phy_ethtool_get_wol(salve->phy, wol); in am65_cpsw_get_wol()
512 if (!salve->phy) in am65_cpsw_set_wol()
513 return -EOPNOTSUPP; in am65_cpsw_set_wol()
515 return phy_ethtool_set_wol(salve->phy, wol); in am65_cpsw_set_wol()
523 if (!salve->phy) in am65_cpsw_get_link_ksettings()
524 return -EOPNOTSUPP; in am65_cpsw_get_link_ksettings()
526 phy_ethtool_ksettings_get(salve->phy, ecmd); in am65_cpsw_get_link_ksettings()
536 if (!salve->phy || phy_is_pseudo_fixed_link(salve->phy)) in am65_cpsw_set_link_ksettings()
537 return -EOPNOTSUPP; in am65_cpsw_set_link_ksettings()
539 return phy_ethtool_ksettings_set(salve->phy, ecmd); in am65_cpsw_set_link_ksettings()
546 if (!salve->phy || phy_is_pseudo_fixed_link(salve->phy)) in am65_cpsw_get_eee()
547 return -EOPNOTSUPP; in am65_cpsw_get_eee()
549 return phy_ethtool_get_eee(salve->phy, edata); in am65_cpsw_get_eee()
556 if (!salve->phy || phy_is_pseudo_fixed_link(salve->phy)) in am65_cpsw_set_eee()
557 return -EOPNOTSUPP; in am65_cpsw_set_eee()
559 return phy_ethtool_set_eee(salve->phy, edata); in am65_cpsw_set_eee()
566 if (!salve->phy || phy_is_pseudo_fixed_link(salve->phy)) in am65_cpsw_nway_reset()
567 return -EOPNOTSUPP; in am65_cpsw_nway_reset()
569 return phy_restart_aneg(salve->phy); in am65_cpsw_nway_reset()
577 ale_entries = cpsw_ale_get_num_entries(common->ale); in am65_cpsw_get_regs_len()
598 /* update CPSW IP version */ in am65_cpsw_get_regs()
599 regs->version = AM65_CPSW_REGDUMP_VER; in am65_cpsw_get_regs()
600 ale_entries = cpsw_ale_get_num_entries(common->ale); in am65_cpsw_get_regs()
612 cpsw_ale_dump(common->ale, &reg[pos]); in am65_cpsw_get_regs()
622 reg[pos++] = readl_relaxed(common->ss_base + j); in am65_cpsw_get_regs()
630 switch (sset) { in am65_cpsw_get_sset_count()
637 return -EOPNOTSUPP; in am65_cpsw_get_sset_count()
648 switch (stringset) { in am65_cpsw_get_strings()
690 *data++ = readl_relaxed(host_p->stat_base + in am65_cpsw_get_ethtool_stats()
696 *data++ = readl_relaxed(port->stat_base + in am65_cpsw_get_ethtool_stats()
708 info->so_timestamping = in am65_cpsw_get_ethtool_ts_info()
715 info->phc_index = am65_cpts_phc_index(common->cpts); in am65_cpsw_get_ethtool_ts_info()
716 info->tx_types = BIT(HWTSTAMP_TX_OFF) | BIT(HWTSTAMP_TX_ON); in am65_cpsw_get_ethtool_ts_info()
717 info->rx_filters = BIT(HWTSTAMP_FILTER_NONE) | BIT(HWTSTAMP_FILTER_ALL); in am65_cpsw_get_ethtool_ts_info()
726 if (common->pf_p0_rx_ptype_rrobin) in am65_cpsw_get_ethtool_priv_flags()
739 if (common->usage_count) in am65_cpsw_set_ethtool_priv_flags()
740 return -EBUSY; in am65_cpsw_set_ethtool_priv_flags()
742 if (common->est_enabled && rrobin) { in am65_cpsw_set_ethtool_priv_flags()
744 "p0-rx-ptype-rrobin flag conflicts with QOS\n"); in am65_cpsw_set_ethtool_priv_flags()
745 return -EINVAL; in am65_cpsw_set_ethtool_priv_flags()
748 common->pf_p0_rx_ptype_rrobin = rrobin; in am65_cpsw_set_ethtool_priv_flags()