66 */
77
88#include <linux/net_tstamp.h>
9- #include <linux/phy .h>
9+ #include <linux/phylink .h>
1010#include <linux/platform_device.h>
1111#include <linux/pm_runtime.h>
1212
@@ -471,63 +471,39 @@ static void am65_cpsw_get_pauseparam(struct net_device *ndev,
471471{
472472 struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
473473
474- pause -> autoneg = AUTONEG_DISABLE ;
475- pause -> rx_pause = salve -> rx_pause ? true : false;
476- pause -> tx_pause = salve -> tx_pause ? true : false;
474+ phylink_ethtool_get_pauseparam (salve -> phylink , pause );
477475}
478476
479477static int am65_cpsw_set_pauseparam (struct net_device * ndev ,
480478 struct ethtool_pauseparam * pause )
481479{
482480 struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
483481
484- if (!salve -> phy )
485- return - EINVAL ;
486-
487- if (!phy_validate_pause (salve -> phy , pause ))
488- return - EINVAL ;
489-
490- salve -> rx_pause = pause -> rx_pause ? true : false;
491- salve -> tx_pause = pause -> tx_pause ? true : false;
492-
493- phy_set_asym_pause (salve -> phy , salve -> rx_pause , salve -> tx_pause );
494-
495- return 0 ;
482+ return phylink_ethtool_set_pauseparam (salve -> phylink , pause );
496483}
497484
498485static void am65_cpsw_get_wol (struct net_device * ndev ,
499486 struct ethtool_wolinfo * wol )
500487{
501488 struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
502489
503- wol -> supported = 0 ;
504- wol -> wolopts = 0 ;
505-
506- if (salve -> phy )
507- phy_ethtool_get_wol (salve -> phy , wol );
490+ phylink_ethtool_get_wol (salve -> phylink , wol );
508491}
509492
510493static int am65_cpsw_set_wol (struct net_device * ndev ,
511494 struct ethtool_wolinfo * wol )
512495{
513496 struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
514497
515- if (!salve -> phy )
516- return - EOPNOTSUPP ;
517-
518- return phy_ethtool_set_wol (salve -> phy , wol );
498+ return phylink_ethtool_set_wol (salve -> phylink , wol );
519499}
520500
521501static int am65_cpsw_get_link_ksettings (struct net_device * ndev ,
522502 struct ethtool_link_ksettings * ecmd )
523503{
524504 struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
525505
526- if (!salve -> phy )
527- return - EOPNOTSUPP ;
528-
529- phy_ethtool_ksettings_get (salve -> phy , ecmd );
530- return 0 ;
506+ return phylink_ethtool_ksettings_get (salve -> phylink , ecmd );
531507}
532508
533509static int
@@ -536,40 +512,28 @@ am65_cpsw_set_link_ksettings(struct net_device *ndev,
536512{
537513 struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
538514
539- if (!salve -> phy || phy_is_pseudo_fixed_link (salve -> phy ))
540- return - EOPNOTSUPP ;
541-
542- return phy_ethtool_ksettings_set (salve -> phy , ecmd );
515+ return phylink_ethtool_ksettings_set (salve -> phylink , ecmd );
543516}
544517
545518static int am65_cpsw_get_eee (struct net_device * ndev , struct ethtool_eee * edata )
546519{
547520 struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
548521
549- if (!salve -> phy || phy_is_pseudo_fixed_link (salve -> phy ))
550- return - EOPNOTSUPP ;
551-
552- return phy_ethtool_get_eee (salve -> phy , edata );
522+ return phylink_ethtool_get_eee (salve -> phylink , edata );
553523}
554524
555525static int am65_cpsw_set_eee (struct net_device * ndev , struct ethtool_eee * edata )
556526{
557527 struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
558528
559- if (!salve -> phy || phy_is_pseudo_fixed_link (salve -> phy ))
560- return - EOPNOTSUPP ;
561-
562- return phy_ethtool_set_eee (salve -> phy , edata );
529+ return phylink_ethtool_set_eee (salve -> phylink , edata );
563530}
564531
565532static int am65_cpsw_nway_reset (struct net_device * ndev )
566533{
567534 struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
568535
569- if (!salve -> phy || phy_is_pseudo_fixed_link (salve -> phy ))
570- return - EOPNOTSUPP ;
571-
572- return phy_restart_aneg (salve -> phy );
536+ return phylink_ethtool_nway_reset (salve -> phylink );
573537}
574538
575539static int am65_cpsw_get_regs_len (struct net_device * ndev )
0 commit comments