6
6
*/
7
7
8
8
#include <linux/net_tstamp.h>
9
- #include <linux/phy .h>
9
+ #include <linux/phylink .h>
10
10
#include <linux/platform_device.h>
11
11
#include <linux/pm_runtime.h>
12
12
@@ -471,63 +471,39 @@ static void am65_cpsw_get_pauseparam(struct net_device *ndev,
471
471
{
472
472
struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
473
473
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 );
477
475
}
478
476
479
477
static int am65_cpsw_set_pauseparam (struct net_device * ndev ,
480
478
struct ethtool_pauseparam * pause )
481
479
{
482
480
struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
483
481
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 );
496
483
}
497
484
498
485
static void am65_cpsw_get_wol (struct net_device * ndev ,
499
486
struct ethtool_wolinfo * wol )
500
487
{
501
488
struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
502
489
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 );
508
491
}
509
492
510
493
static int am65_cpsw_set_wol (struct net_device * ndev ,
511
494
struct ethtool_wolinfo * wol )
512
495
{
513
496
struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
514
497
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 );
519
499
}
520
500
521
501
static int am65_cpsw_get_link_ksettings (struct net_device * ndev ,
522
502
struct ethtool_link_ksettings * ecmd )
523
503
{
524
504
struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
525
505
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 );
531
507
}
532
508
533
509
static int
@@ -536,40 +512,28 @@ am65_cpsw_set_link_ksettings(struct net_device *ndev,
536
512
{
537
513
struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
538
514
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 );
543
516
}
544
517
545
518
static int am65_cpsw_get_eee (struct net_device * ndev , struct ethtool_eee * edata )
546
519
{
547
520
struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
548
521
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 );
553
523
}
554
524
555
525
static int am65_cpsw_set_eee (struct net_device * ndev , struct ethtool_eee * edata )
556
526
{
557
527
struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
558
528
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 );
563
530
}
564
531
565
532
static int am65_cpsw_nway_reset (struct net_device * ndev )
566
533
{
567
534
struct am65_cpsw_slave_data * salve = am65_ndev_to_slave (ndev );
568
535
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 );
573
537
}
574
538
575
539
static int am65_cpsw_get_regs_len (struct net_device * ndev )
0 commit comments