OpenWrt – Diff between revs 2 and 3
?pathlinks?
Rev 2 | Rev 3 | |||
---|---|---|---|---|
Line 276... | Line 276... | |||
276 | - phy_stop(ndev->phydev); |
276 | - phy_stop(ndev->phydev); |
|
277 | + phylink_stop(pp->phylink); |
277 | + phylink_stop(pp->phylink); |
|
Line 278... | Line 278... | |||
278 | |
278 | |
|
279 | if (!pp->neta_armada3700) { |
279 | if (!pp->neta_armada3700) { |
|
280 | for_each_online_cpu(cpu) { |
280 | for_each_online_cpu(cpu) { |
|
281 | @@ -3251,103 +3208,232 @@ static int mvneta_set_mac_addr(struct ne |
281 | @@ -3252,103 +3209,232 @@ static int mvneta_set_mac_addr(struct ne |
|
282 | return 0; |
282 | return 0; |
|
Line 283... | Line 283... | |||
283 | } |
283 | } |
|
284 | |
284 | |
|
Line 583... | Line 583... | |||
583 | - phy_disconnect(ndev->phydev); |
583 | - phy_disconnect(ndev->phydev); |
|
584 | + phylink_disconnect_phy(pp->phylink); |
584 | + phylink_disconnect_phy(pp->phylink); |
|
585 | } |
585 | } |
|
Line 586... | Line 586... | |||
586 | |
586 | |
|
587 | /* Electing a CPU must be done in an atomic way: it should be done |
587 | /* Electing a CPU must be done in an atomic way: it should be done |
|
Line 588... | Line 588... | |||
588 | @@ -3626,10 +3712,9 @@ static int mvneta_stop(struct net_device |
588 | @@ -3627,10 +3713,9 @@ static int mvneta_stop(struct net_device |
|
589 | |
589 | |
|
590 | static int mvneta_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
590 | static int mvneta_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
|
591 | { |
591 | { |
|
Line 596... | Line 596... | |||
596 | - return phy_mii_ioctl(dev->phydev, ifr, cmd); |
596 | - return phy_mii_ioctl(dev->phydev, ifr, cmd); |
|
597 | + return phylink_mii_ioctl(pp->phylink, ifr, cmd); |
597 | + return phylink_mii_ioctl(pp->phylink, ifr, cmd); |
|
598 | } |
598 | } |
|
Line 599... | Line 599... | |||
599 | |
599 | |
|
600 | /* Ethtool methods */ |
600 | /* Ethtool methods */ |
|
601 | @@ -3640,44 +3725,25 @@ mvneta_ethtool_set_link_ksettings(struct |
601 | @@ -3641,44 +3726,25 @@ mvneta_ethtool_set_link_ksettings(struct |
|
602 | const struct ethtool_link_ksettings *cmd) |
602 | const struct ethtool_link_ksettings *cmd) |
|
603 | { |
603 | { |
|
604 | struct mvneta_port *pp = netdev_priv(ndev); |
604 | struct mvneta_port *pp = netdev_priv(ndev); |
|
Line 655... | Line 655... | |||
655 | - return phy_ethtool_ksettings_set(ndev->phydev, cmd); |
655 | - return phy_ethtool_ksettings_set(ndev->phydev, cmd); |
|
656 | + return phylink_ethtool_nway_reset(pp->phylink); |
656 | + return phylink_ethtool_nway_reset(pp->phylink); |
|
657 | } |
657 | } |
|
Line 658... | Line 658... | |||
658 | |
658 | |
|
659 | /* Set interrupt coalescing for ethtools */ |
659 | /* Set interrupt coalescing for ethtools */ |
|
660 | @@ -3769,6 +3835,22 @@ static int mvneta_ethtool_set_ringparam( |
660 | @@ -3770,6 +3836,22 @@ static int mvneta_ethtool_set_ringparam( |
|
661 | return 0; |
661 | return 0; |
|
Line 662... | Line 662... | |||
662 | } |
662 | } |
|
663 | |
663 | |
|
Line 678... | Line 678... | |||
678 | +} |
678 | +} |
|
679 | + |
679 | + |
|
680 | static void mvneta_ethtool_get_strings(struct net_device *netdev, u32 sset, |
680 | static void mvneta_ethtool_get_strings(struct net_device *netdev, u32 sset, |
|
681 | u8 *data) |
681 | u8 *data) |
|
682 | { |
682 | { |
|
683 | @@ -3785,26 +3867,35 @@ static void mvneta_ethtool_update_stats( |
683 | @@ -3786,26 +3868,35 @@ static void mvneta_ethtool_update_stats( |
|
684 | { |
684 | { |
|
685 | const struct mvneta_statistic *s; |
685 | const struct mvneta_statistic *s; |
|
686 | void __iomem *base = pp->base; |
686 | void __iomem *base = pp->base; |
|
687 | - u32 high, low, val; |
687 | - u32 high, low, val; |
|
688 | - u64 val64; |
688 | - u64 val64; |
|
Line 719... | Line 719... | |||
719 | + |
719 | + |
|
720 | + pp->ethtool_stats[i] += val; |
720 | + pp->ethtool_stats[i] += val; |
|
721 | } |
721 | } |
|
722 | } |
722 | } |
|
Line 723... | Line 723... | |||
723 | |
723 | |
|
724 | @@ -3939,28 +4030,65 @@ static int mvneta_ethtool_get_rxfh(struc |
724 | @@ -3940,28 +4031,65 @@ static int mvneta_ethtool_get_rxfh(struc |
|
725 | static void mvneta_ethtool_get_wol(struct net_device *dev, |
725 | static void mvneta_ethtool_get_wol(struct net_device *dev, |
|
726 | struct ethtool_wolinfo *wol) |
726 | struct ethtool_wolinfo *wol) |
|
727 | { |
727 | { |
|
728 | - wol->supported = 0; |
728 | - wol->supported = 0; |
|
Line 793... | Line 793... | |||
793 | +} |
793 | +} |
|
794 | + |
794 | + |
|
795 | static u16 mvneta_select_queue(struct net_device *dev, struct sk_buff *skb, |
795 | static u16 mvneta_select_queue(struct net_device *dev, struct sk_buff *skb, |
|
796 | void *accel_priv, |
796 | void *accel_priv, |
|
797 | select_queue_fallback_t fallback) |
797 | select_queue_fallback_t fallback) |
|
798 | @@ -3984,13 +4112,15 @@ static const struct net_device_ops mvnet |
798 | @@ -3985,13 +4113,15 @@ static const struct net_device_ops mvnet |
|
799 | }; |
799 | }; |
|
Line 800... | Line 800... | |||
800 | |
800 | |
|
801 | static const struct ethtool_ops mvneta_eth_tool_ops = { |
801 | static const struct ethtool_ops mvneta_eth_tool_ops = { |
|
802 | - .nway_reset = phy_ethtool_nway_reset, |
802 | - .nway_reset = phy_ethtool_nway_reset, |
|
Line 810... | Line 810... | |||
810 | + .get_pauseparam = mvneta_ethtool_get_pauseparam, |
810 | + .get_pauseparam = mvneta_ethtool_get_pauseparam, |
|
811 | + .set_pauseparam = mvneta_ethtool_set_pauseparam, |
811 | + .set_pauseparam = mvneta_ethtool_set_pauseparam, |
|
812 | .get_strings = mvneta_ethtool_get_strings, |
812 | .get_strings = mvneta_ethtool_get_strings, |
|
813 | .get_ethtool_stats = mvneta_ethtool_get_stats, |
813 | .get_ethtool_stats = mvneta_ethtool_get_stats, |
|
814 | .get_sset_count = mvneta_ethtool_get_sset_count, |
814 | .get_sset_count = mvneta_ethtool_get_sset_count, |
|
815 | @@ -3998,10 +4128,12 @@ static const struct ethtool_ops mvneta_e |
815 | @@ -3999,10 +4129,12 @@ static const struct ethtool_ops mvneta_e |
|
816 | .get_rxnfc = mvneta_ethtool_get_rxnfc, |
816 | .get_rxnfc = mvneta_ethtool_get_rxnfc, |
|
817 | .get_rxfh = mvneta_ethtool_get_rxfh, |
817 | .get_rxfh = mvneta_ethtool_get_rxfh, |
|
818 | .set_rxfh = mvneta_ethtool_set_rxfh, |
818 | .set_rxfh = mvneta_ethtool_set_rxfh, |
|
819 | - .get_link_ksettings = phy_ethtool_get_link_ksettings, |
819 | - .get_link_ksettings = phy_ethtool_get_link_ksettings, |
|
820 | + .get_link_ksettings = mvneta_ethtool_get_link_ksettings, |
820 | + .get_link_ksettings = mvneta_ethtool_get_link_ksettings, |
|
Line 824... | Line 824... | |||
824 | + .get_eee = mvneta_ethtool_get_eee, |
824 | + .get_eee = mvneta_ethtool_get_eee, |
|
825 | + .set_eee = mvneta_ethtool_set_eee, |
825 | + .set_eee = mvneta_ethtool_set_eee, |
|
826 | }; |
826 | }; |
|
Line 827... | Line 827... | |||
827 | |
827 | |
|
828 | /* Initialize hw */ |
828 | /* Initialize hw */ |
|
829 | @@ -4146,14 +4278,13 @@ static int mvneta_probe(struct platform_ |
829 | @@ -4147,14 +4279,13 @@ static int mvneta_probe(struct platform_ |
|
830 | { |
830 | { |
|
831 | struct resource *res; |
831 | struct resource *res; |
|
832 | struct device_node *dn = pdev->dev.of_node; |
832 | struct device_node *dn = pdev->dev.of_node; |
|
833 | - struct device_node *phy_node; |
833 | - struct device_node *phy_node; |
|
Line 840... | Line 840... | |||
840 | const char *mac_from; |
840 | const char *mac_from; |
|
841 | - const char *managed; |
841 | - const char *managed; |
|
842 | int tx_csum_limit; |
842 | int tx_csum_limit; |
|
843 | int phy_mode; |
843 | int phy_mode; |
|
844 | int err; |
844 | int err; |
|
845 | @@ -4169,31 +4300,11 @@ static int mvneta_probe(struct platform_ |
845 | @@ -4170,31 +4301,11 @@ static int mvneta_probe(struct platform_ |
|
846 | goto err_free_netdev; |
846 | goto err_free_netdev; |
|
847 | } |
847 | } |
|
Line 848... | Line 848... | |||
848 | |
848 | |
|
849 | - phy_node = of_parse_phandle(dn, "phy", 0); |
849 | - phy_node = of_parse_phandle(dn, "phy", 0); |
|
Line 873... | Line 873... | |||
873 | - goto err_put_phy_node; |
873 | - goto err_put_phy_node; |
|
874 | + goto err_free_irq; |
874 | + goto err_free_irq; |
|
875 | } |
875 | } |
|
Line 876... | Line 876... | |||
876 | |
876 | |
|
877 | dev->tx_queue_len = MVNETA_MAX_TXD; |
877 | dev->tx_queue_len = MVNETA_MAX_TXD; |
|
Line 878... | Line 878... | |||
878 | @@ -4204,12 +4315,7 @@ static int mvneta_probe(struct platform_ |
878 | @@ -4205,12 +4316,7 @@ static int mvneta_probe(struct platform_ |
|
879 | |
879 | |
|
880 | pp = netdev_priv(dev); |
880 | pp = netdev_priv(dev); |
|
881 | spin_lock_init(&pp->lock); |
881 | spin_lock_init(&pp->lock); |
|
Line 887... | Line 887... | |||
887 | - strcmp(managed, "in-band-status") == 0); |
887 | - strcmp(managed, "in-band-status") == 0); |
|
888 | + pp->dn = dn; |
888 | + pp->dn = dn; |
|
Line 889... | Line 889... | |||
889 | |
889 | |
|
Line 890... | Line 890... | |||
890 | pp->rxq_def = rxq_def; |
890 | pp->rxq_def = rxq_def; |
|
891 | |
891 | |
|
892 | @@ -4231,7 +4337,7 @@ static int mvneta_probe(struct platform_ |
892 | @@ -4232,7 +4338,7 @@ static int mvneta_probe(struct platform_ |
|
893 | pp->clk = devm_clk_get(&pdev->dev, NULL); |
893 | pp->clk = devm_clk_get(&pdev->dev, NULL); |
|
894 | if (IS_ERR(pp->clk)) { |
894 | if (IS_ERR(pp->clk)) { |
|
895 | err = PTR_ERR(pp->clk); |
895 | err = PTR_ERR(pp->clk); |
|
896 | - goto err_put_phy_node; |
896 | - goto err_put_phy_node; |
|
Line 897... | Line 897... | |||
897 | + goto err_free_irq; |
897 | + goto err_free_irq; |
|
898 | } |
898 | } |
|
899 | |
899 | |
|
900 | clk_prepare_enable(pp->clk); |
900 | clk_prepare_enable(pp->clk); |
|
Line 901... | Line 901... | |||
901 | @@ -4357,6 +4463,14 @@ static int mvneta_probe(struct platform_ |
901 | @@ -4358,6 +4464,14 @@ static int mvneta_probe(struct platform_ |
|
902 | /* 9676 == 9700 - 20 and rounding to 8 */ |
902 | /* 9676 == 9700 - 20 and rounding to 8 */ |
|
Line 911... | Line 911... | |||
911 | + pp->phylink = phylink; |
911 | + pp->phylink = phylink; |
|
912 | + |
912 | + |
|
913 | err = register_netdev(dev); |
913 | err = register_netdev(dev); |
|
914 | if (err < 0) { |
914 | if (err < 0) { |
|
915 | dev_err(&pdev->dev, "failed to register\n"); |
915 | dev_err(&pdev->dev, "failed to register\n"); |
|
916 | @@ -4368,14 +4482,6 @@ static int mvneta_probe(struct platform_ |
916 | @@ -4369,14 +4483,6 @@ static int mvneta_probe(struct platform_ |
|
Line 917... | Line 917... | |||
917 | |
917 | |
|
Line 918... | Line 918... | |||
918 | platform_set_drvdata(pdev, pp->dev); |
918 | platform_set_drvdata(pdev, pp->dev); |
|
919 | |
919 | |
|
Line 926... | Line 926... | |||
926 | - } |
926 | - } |
|
927 | - |
927 | - |
|
928 | return 0; |
928 | return 0; |
|
Line 929... | Line 929... | |||
929 | |
929 | |
|
930 | err_netdev: |
930 | err_netdev: |
|
931 | @@ -4386,16 +4492,14 @@ err_netdev: |
931 | @@ -4387,16 +4493,14 @@ err_netdev: |
|
932 | 1 << pp->id); |
932 | 1 << pp->id); |
|
933 | } |
933 | } |
|
934 | err_free_stats: |
934 | err_free_stats: |
|
935 | + if (pp->phylink) |
935 | + if (pp->phylink) |
|
Line 945... | Line 945... | |||
945 | - if (of_phy_is_fixed_link(dn)) |
945 | - if (of_phy_is_fixed_link(dn)) |
|
946 | - of_phy_deregister_fixed_link(dn); |
946 | - of_phy_deregister_fixed_link(dn); |
|
947 | err_free_irq: |
947 | err_free_irq: |
|
948 | irq_dispose_mapping(dev->irq); |
948 | irq_dispose_mapping(dev->irq); |
|
949 | err_free_netdev: |
949 | err_free_netdev: |
|
950 | @@ -4407,7 +4511,6 @@ err_free_netdev: |
950 | @@ -4408,7 +4512,6 @@ err_free_netdev: |
|
951 | static int mvneta_remove(struct platform_device *pdev) |
951 | static int mvneta_remove(struct platform_device *pdev) |
|
952 | { |
952 | { |
|
953 | struct net_device *dev = platform_get_drvdata(pdev); |
953 | struct net_device *dev = platform_get_drvdata(pdev); |
|
954 | - struct device_node *dn = pdev->dev.of_node; |
954 | - struct device_node *dn = pdev->dev.of_node; |
|
955 | struct mvneta_port *pp = netdev_priv(dev); |
955 | struct mvneta_port *pp = netdev_priv(dev); |
|
Line 956... | Line 956... | |||
956 | |
956 | |
|
957 | unregister_netdev(dev); |
957 | unregister_netdev(dev); |
|
958 | @@ -4415,10 +4518,8 @@ static int mvneta_remove(struct platform |
958 | @@ -4416,10 +4519,8 @@ static int mvneta_remove(struct platform |
|
959 | clk_disable_unprepare(pp->clk); |
959 | clk_disable_unprepare(pp->clk); |
|
960 | free_percpu(pp->ports); |
960 | free_percpu(pp->ports); |
|
961 | free_percpu(pp->stats); |
961 | free_percpu(pp->stats); |
|
962 | - if (of_phy_is_fixed_link(dn)) |
962 | - if (of_phy_is_fixed_link(dn)) |
|
Line 965... | Line 965... | |||
965 | - of_node_put(pp->phy_node); |
965 | - of_node_put(pp->phy_node); |
|
966 | + phylink_destroy(pp->phylink); |
966 | + phylink_destroy(pp->phylink); |
|
967 | free_netdev(dev); |
967 | free_netdev(dev); |
|
Line 968... | Line 968... | |||
968 | |
968 | |
|
969 | if (pp->bm_priv) { |
969 | if (pp->bm_priv) { |
|
970 | @@ -4470,9 +4571,6 @@ static int mvneta_resume(struct device * |
970 | @@ -4471,9 +4572,6 @@ static int mvneta_resume(struct device * |
|
971 | return err; |
971 | return err; |
|
Line 972... | Line 972... | |||
972 | } |
972 | } |
|
973 | |
973 | |