diff options
-rw-r--r-- | drivers/net/ethernet/marvell/pxa168_eth.c | 4 | ||||
-rw-r--r-- | drivers/net/phy/aquantia.c | 12 | ||||
-rw-r--r-- | drivers/net/phy/bcm63xx.c | 9 | ||||
-rw-r--r-- | drivers/net/phy/marvell.c | 2 | ||||
-rw-r--r-- | drivers/net/phy/marvell10g.c | 11 | ||||
-rw-r--r-- | drivers/net/phy/microchip_t1.c | 2 | ||||
-rw-r--r-- | drivers/net/phy/phy_device.c | 164 | ||||
-rw-r--r-- | include/linux/linkmode.h | 9 | ||||
-rw-r--r-- | include/linux/phy.h | 24 |
9 files changed, 198 insertions, 39 deletions
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c index ff2fea0f8b75..0bd4351b2a49 100644 --- a/drivers/net/ethernet/marvell/pxa168_eth.c +++ b/drivers/net/ethernet/marvell/pxa168_eth.c | |||
@@ -988,8 +988,8 @@ static int pxa168_init_phy(struct net_device *dev) | |||
988 | cmd.base.phy_address = pep->phy_addr; | 988 | cmd.base.phy_address = pep->phy_addr; |
989 | cmd.base.speed = pep->phy_speed; | 989 | cmd.base.speed = pep->phy_speed; |
990 | cmd.base.duplex = pep->phy_duplex; | 990 | cmd.base.duplex = pep->phy_duplex; |
991 | ethtool_convert_legacy_u32_to_link_mode(cmd.link_modes.advertising, | 991 | bitmap_copy(cmd.link_modes.advertising, PHY_BASIC_FEATURES, |
992 | PHY_BASIC_FEATURES); | 992 | __ETHTOOL_LINK_MODE_MASK_NBITS); |
993 | cmd.base.autoneg = AUTONEG_ENABLE; | 993 | cmd.base.autoneg = AUTONEG_ENABLE; |
994 | 994 | ||
995 | if (cmd.base.speed != 0) | 995 | if (cmd.base.speed != 0) |
diff --git a/drivers/net/phy/aquantia.c b/drivers/net/phy/aquantia.c index 319edc9c8ec7..632472cab3bb 100644 --- a/drivers/net/phy/aquantia.c +++ b/drivers/net/phy/aquantia.c | |||
@@ -115,7 +115,7 @@ static struct phy_driver aquantia_driver[] = { | |||
115 | .phy_id = PHY_ID_AQ1202, | 115 | .phy_id = PHY_ID_AQ1202, |
116 | .phy_id_mask = 0xfffffff0, | 116 | .phy_id_mask = 0xfffffff0, |
117 | .name = "Aquantia AQ1202", | 117 | .name = "Aquantia AQ1202", |
118 | .features = PHY_AQUANTIA_FEATURES, | 118 | .features = PHY_10GBIT_FULL_FEATURES, |
119 | .flags = PHY_HAS_INTERRUPT, | 119 | .flags = PHY_HAS_INTERRUPT, |
120 | .aneg_done = genphy_c45_aneg_done, | 120 | .aneg_done = genphy_c45_aneg_done, |
121 | .config_aneg = aquantia_config_aneg, | 121 | .config_aneg = aquantia_config_aneg, |
@@ -127,7 +127,7 @@ static struct phy_driver aquantia_driver[] = { | |||
127 | .phy_id = PHY_ID_AQ2104, | 127 | .phy_id = PHY_ID_AQ2104, |
128 | .phy_id_mask = 0xfffffff0, | 128 | .phy_id_mask = 0xfffffff0, |
129 | .name = "Aquantia AQ2104", | 129 | .name = "Aquantia AQ2104", |
130 | .features = PHY_AQUANTIA_FEATURES, | 130 | .features = PHY_10GBIT_FULL_FEATURES, |
131 | .flags = PHY_HAS_INTERRUPT, | 131 | .flags = PHY_HAS_INTERRUPT, |
132 | .aneg_done = genphy_c45_aneg_done, | 132 | .aneg_done = genphy_c45_aneg_done, |
133 | .config_aneg = aquantia_config_aneg, | 133 | .config_aneg = aquantia_config_aneg, |
@@ -139,7 +139,7 @@ static struct phy_driver aquantia_driver[] = { | |||
139 | .phy_id = PHY_ID_AQR105, | 139 | .phy_id = PHY_ID_AQR105, |
140 | .phy_id_mask = 0xfffffff0, | 140 | .phy_id_mask = 0xfffffff0, |
141 | .name = "Aquantia AQR105", | 141 | .name = "Aquantia AQR105", |
142 | .features = PHY_AQUANTIA_FEATURES, | 142 | .features = PHY_10GBIT_FULL_FEATURES, |
143 | .flags = PHY_HAS_INTERRUPT, | 143 | .flags = PHY_HAS_INTERRUPT, |
144 | .aneg_done = genphy_c45_aneg_done, | 144 | .aneg_done = genphy_c45_aneg_done, |
145 | .config_aneg = aquantia_config_aneg, | 145 | .config_aneg = aquantia_config_aneg, |
@@ -151,7 +151,7 @@ static struct phy_driver aquantia_driver[] = { | |||
151 | .phy_id = PHY_ID_AQR106, | 151 | .phy_id = PHY_ID_AQR106, |
152 | .phy_id_mask = 0xfffffff0, | 152 | .phy_id_mask = 0xfffffff0, |
153 | .name = "Aquantia AQR106", | 153 | .name = "Aquantia AQR106", |
154 | .features = PHY_AQUANTIA_FEATURES, | 154 | .features = PHY_10GBIT_FULL_FEATURES, |
155 | .flags = PHY_HAS_INTERRUPT, | 155 | .flags = PHY_HAS_INTERRUPT, |
156 | .aneg_done = genphy_c45_aneg_done, | 156 | .aneg_done = genphy_c45_aneg_done, |
157 | .config_aneg = aquantia_config_aneg, | 157 | .config_aneg = aquantia_config_aneg, |
@@ -163,7 +163,7 @@ static struct phy_driver aquantia_driver[] = { | |||
163 | .phy_id = PHY_ID_AQR107, | 163 | .phy_id = PHY_ID_AQR107, |
164 | .phy_id_mask = 0xfffffff0, | 164 | .phy_id_mask = 0xfffffff0, |
165 | .name = "Aquantia AQR107", | 165 | .name = "Aquantia AQR107", |
166 | .features = PHY_AQUANTIA_FEATURES, | 166 | .features = PHY_10GBIT_FULL_FEATURES, |
167 | .flags = PHY_HAS_INTERRUPT, | 167 | .flags = PHY_HAS_INTERRUPT, |
168 | .aneg_done = genphy_c45_aneg_done, | 168 | .aneg_done = genphy_c45_aneg_done, |
169 | .config_aneg = aquantia_config_aneg, | 169 | .config_aneg = aquantia_config_aneg, |
@@ -175,7 +175,7 @@ static struct phy_driver aquantia_driver[] = { | |||
175 | .phy_id = PHY_ID_AQR405, | 175 | .phy_id = PHY_ID_AQR405, |
176 | .phy_id_mask = 0xfffffff0, | 176 | .phy_id_mask = 0xfffffff0, |
177 | .name = "Aquantia AQR405", | 177 | .name = "Aquantia AQR405", |
178 | .features = PHY_AQUANTIA_FEATURES, | 178 | .features = PHY_10GBIT_FULL_FEATURES, |
179 | .flags = PHY_HAS_INTERRUPT, | 179 | .flags = PHY_HAS_INTERRUPT, |
180 | .aneg_done = genphy_c45_aneg_done, | 180 | .aneg_done = genphy_c45_aneg_done, |
181 | .config_aneg = aquantia_config_aneg, | 181 | .config_aneg = aquantia_config_aneg, |
diff --git a/drivers/net/phy/bcm63xx.c b/drivers/net/phy/bcm63xx.c index cf14613745c9..d95bffdec4c1 100644 --- a/drivers/net/phy/bcm63xx.c +++ b/drivers/net/phy/bcm63xx.c | |||
@@ -42,6 +42,9 @@ static int bcm63xx_config_init(struct phy_device *phydev) | |||
42 | { | 42 | { |
43 | int reg, err; | 43 | int reg, err; |
44 | 44 | ||
45 | /* ASYM_PAUSE bit is marked RO in datasheet, so don't cheat */ | ||
46 | phydev->supported |= SUPPORTED_Pause; | ||
47 | |||
45 | reg = phy_read(phydev, MII_BCM63XX_IR); | 48 | reg = phy_read(phydev, MII_BCM63XX_IR); |
46 | if (reg < 0) | 49 | if (reg < 0) |
47 | return reg; | 50 | return reg; |
@@ -65,8 +68,7 @@ static struct phy_driver bcm63xx_driver[] = { | |||
65 | .phy_id = 0x00406000, | 68 | .phy_id = 0x00406000, |
66 | .phy_id_mask = 0xfffffc00, | 69 | .phy_id_mask = 0xfffffc00, |
67 | .name = "Broadcom BCM63XX (1)", | 70 | .name = "Broadcom BCM63XX (1)", |
68 | /* ASYM_PAUSE bit is marked RO in datasheet, so don't cheat */ | 71 | .features = PHY_BASIC_FEATURES, |
69 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), | ||
70 | .flags = PHY_HAS_INTERRUPT | PHY_IS_INTERNAL, | 72 | .flags = PHY_HAS_INTERRUPT | PHY_IS_INTERNAL, |
71 | .config_init = bcm63xx_config_init, | 73 | .config_init = bcm63xx_config_init, |
72 | .ack_interrupt = bcm_phy_ack_intr, | 74 | .ack_interrupt = bcm_phy_ack_intr, |
@@ -75,8 +77,7 @@ static struct phy_driver bcm63xx_driver[] = { | |||
75 | /* same phy as above, with just a different OUI */ | 77 | /* same phy as above, with just a different OUI */ |
76 | .phy_id = 0x002bdc00, | 78 | .phy_id = 0x002bdc00, |
77 | .phy_id_mask = 0xfffffc00, | 79 | .phy_id_mask = 0xfffffc00, |
78 | .name = "Broadcom BCM63XX (2)", | 80 | .features = PHY_BASIC_FEATURES, |
79 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), | ||
80 | .flags = PHY_HAS_INTERRUPT | PHY_IS_INTERNAL, | 81 | .flags = PHY_HAS_INTERRUPT | PHY_IS_INTERNAL, |
81 | .config_init = bcm63xx_config_init, | 82 | .config_init = bcm63xx_config_init, |
82 | .ack_interrupt = bcm_phy_ack_intr, | 83 | .ack_interrupt = bcm_phy_ack_intr, |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 8872a430d74a..cbec296107bd 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
@@ -2201,7 +2201,7 @@ static struct phy_driver marvell_drivers[] = { | |||
2201 | .phy_id = MARVELL_PHY_ID_88E1510, | 2201 | .phy_id = MARVELL_PHY_ID_88E1510, |
2202 | .phy_id_mask = MARVELL_PHY_ID_MASK, | 2202 | .phy_id_mask = MARVELL_PHY_ID_MASK, |
2203 | .name = "Marvell 88E1510", | 2203 | .name = "Marvell 88E1510", |
2204 | .features = PHY_GBIT_FEATURES | SUPPORTED_FIBRE, | 2204 | .features = PHY_GBIT_FIBRE_FEATURES, |
2205 | .flags = PHY_HAS_INTERRUPT, | 2205 | .flags = PHY_HAS_INTERRUPT, |
2206 | .probe = &m88e1510_probe, | 2206 | .probe = &m88e1510_probe, |
2207 | .config_init = &m88e1510_config_init, | 2207 | .config_init = &m88e1510_config_init, |
diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index f214834819dd..1c9d039eec63 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c | |||
@@ -535,16 +535,7 @@ static struct phy_driver mv3310_drivers[] = { | |||
535 | .phy_id = 0x002b09aa, | 535 | .phy_id = 0x002b09aa, |
536 | .phy_id_mask = MARVELL_PHY_ID_MASK, | 536 | .phy_id_mask = MARVELL_PHY_ID_MASK, |
537 | .name = "mv88x3310", | 537 | .name = "mv88x3310", |
538 | .features = SUPPORTED_10baseT_Full | | 538 | .features = PHY_10GBIT_FEATURES, |
539 | SUPPORTED_10baseT_Half | | ||
540 | SUPPORTED_100baseT_Full | | ||
541 | SUPPORTED_100baseT_Half | | ||
542 | SUPPORTED_1000baseT_Full | | ||
543 | SUPPORTED_Autoneg | | ||
544 | SUPPORTED_TP | | ||
545 | SUPPORTED_FIBRE | | ||
546 | SUPPORTED_10000baseT_Full | | ||
547 | SUPPORTED_Backplane, | ||
548 | .soft_reset = gen10g_no_soft_reset, | 539 | .soft_reset = gen10g_no_soft_reset, |
549 | .config_init = mv3310_config_init, | 540 | .config_init = mv3310_config_init, |
550 | .probe = mv3310_probe, | 541 | .probe = mv3310_probe, |
diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c index b1917dd1978a..c600a8509d60 100644 --- a/drivers/net/phy/microchip_t1.c +++ b/drivers/net/phy/microchip_t1.c | |||
@@ -46,7 +46,7 @@ static struct phy_driver microchip_t1_phy_driver[] = { | |||
46 | .phy_id_mask = 0xfffffff0, | 46 | .phy_id_mask = 0xfffffff0, |
47 | .name = "Microchip LAN87xx T1", | 47 | .name = "Microchip LAN87xx T1", |
48 | 48 | ||
49 | .features = SUPPORTED_100baseT_Full, | 49 | .features = PHY_BASIC_T1_FEATURES, |
50 | .flags = PHY_HAS_INTERRUPT, | 50 | .flags = PHY_HAS_INTERRUPT, |
51 | 51 | ||
52 | .config_init = genphy_config_init, | 52 | .config_init = genphy_config_init, |
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 35102e17bbeb..f53ce65f45c5 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/mii.h> | 30 | #include <linux/mii.h> |
31 | #include <linux/ethtool.h> | 31 | #include <linux/ethtool.h> |
32 | #include <linux/bitmap.h> | ||
32 | #include <linux/phy.h> | 33 | #include <linux/phy.h> |
33 | #include <linux/phy_led_triggers.h> | 34 | #include <linux/phy_led_triggers.h> |
34 | #include <linux/mdio.h> | 35 | #include <linux/mdio.h> |
@@ -42,6 +43,149 @@ MODULE_DESCRIPTION("PHY library"); | |||
42 | MODULE_AUTHOR("Andy Fleming"); | 43 | MODULE_AUTHOR("Andy Fleming"); |
43 | MODULE_LICENSE("GPL"); | 44 | MODULE_LICENSE("GPL"); |
44 | 45 | ||
46 | __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_basic_features) __ro_after_init; | ||
47 | EXPORT_SYMBOL_GPL(phy_basic_features); | ||
48 | |||
49 | __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_basic_t1_features) __ro_after_init; | ||
50 | EXPORT_SYMBOL_GPL(phy_basic_t1_features); | ||
51 | |||
52 | __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_features) __ro_after_init; | ||
53 | EXPORT_SYMBOL_GPL(phy_gbit_features); | ||
54 | |||
55 | __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_fibre_features) __ro_after_init; | ||
56 | EXPORT_SYMBOL_GPL(phy_gbit_fibre_features); | ||
57 | |||
58 | __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_all_ports_features) __ro_after_init; | ||
59 | EXPORT_SYMBOL_GPL(phy_gbit_all_ports_features); | ||
60 | |||
61 | __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_features) __ro_after_init; | ||
62 | EXPORT_SYMBOL_GPL(phy_10gbit_features); | ||
63 | |||
64 | static const int phy_basic_ports_array[] = { | ||
65 | ETHTOOL_LINK_MODE_Autoneg_BIT, | ||
66 | ETHTOOL_LINK_MODE_TP_BIT, | ||
67 | ETHTOOL_LINK_MODE_MII_BIT, | ||
68 | }; | ||
69 | |||
70 | static const int phy_fibre_port_array[] = { | ||
71 | ETHTOOL_LINK_MODE_FIBRE_BIT, | ||
72 | }; | ||
73 | |||
74 | static const int phy_all_ports_features_array[] = { | ||
75 | ETHTOOL_LINK_MODE_Autoneg_BIT, | ||
76 | ETHTOOL_LINK_MODE_TP_BIT, | ||
77 | ETHTOOL_LINK_MODE_MII_BIT, | ||
78 | ETHTOOL_LINK_MODE_FIBRE_BIT, | ||
79 | ETHTOOL_LINK_MODE_AUI_BIT, | ||
80 | ETHTOOL_LINK_MODE_BNC_BIT, | ||
81 | ETHTOOL_LINK_MODE_Backplane_BIT, | ||
82 | }; | ||
83 | |||
84 | static const int phy_10_100_features_array[] = { | ||
85 | ETHTOOL_LINK_MODE_10baseT_Half_BIT, | ||
86 | ETHTOOL_LINK_MODE_10baseT_Full_BIT, | ||
87 | ETHTOOL_LINK_MODE_100baseT_Half_BIT, | ||
88 | ETHTOOL_LINK_MODE_100baseT_Full_BIT, | ||
89 | }; | ||
90 | |||
91 | static const int phy_basic_t1_features_array[] = { | ||
92 | ETHTOOL_LINK_MODE_TP_BIT, | ||
93 | ETHTOOL_LINK_MODE_100baseT_Full_BIT, | ||
94 | }; | ||
95 | |||
96 | static const int phy_gbit_features_array[] = { | ||
97 | ETHTOOL_LINK_MODE_1000baseT_Half_BIT, | ||
98 | ETHTOOL_LINK_MODE_1000baseT_Full_BIT, | ||
99 | }; | ||
100 | |||
101 | static const int phy_10gbit_features_array[] = { | ||
102 | ETHTOOL_LINK_MODE_10000baseT_Full_BIT, | ||
103 | }; | ||
104 | |||
105 | __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_init; | ||
106 | EXPORT_SYMBOL_GPL(phy_10gbit_full_features); | ||
107 | |||
108 | static const int phy_10gbit_full_features_array[] = { | ||
109 | ETHTOOL_LINK_MODE_10baseT_Full_BIT, | ||
110 | ETHTOOL_LINK_MODE_100baseT_Full_BIT, | ||
111 | ETHTOOL_LINK_MODE_1000baseT_Full_BIT, | ||
112 | ETHTOOL_LINK_MODE_10000baseT_Full_BIT, | ||
113 | }; | ||
114 | |||
115 | static void features_init(void) | ||
116 | { | ||
117 | /* 10/100 half/full*/ | ||
118 | linkmode_set_bit_array(phy_basic_ports_array, | ||
119 | ARRAY_SIZE(phy_basic_ports_array), | ||
120 | phy_basic_features); | ||
121 | linkmode_set_bit_array(phy_10_100_features_array, | ||
122 | ARRAY_SIZE(phy_10_100_features_array), | ||
123 | phy_basic_features); | ||
124 | |||
125 | /* 100 full, TP */ | ||
126 | linkmode_set_bit_array(phy_basic_t1_features_array, | ||
127 | ARRAY_SIZE(phy_basic_t1_features_array), | ||
128 | phy_basic_t1_features); | ||
129 | |||
130 | /* 10/100 half/full + 1000 half/full */ | ||
131 | linkmode_set_bit_array(phy_basic_ports_array, | ||
132 | ARRAY_SIZE(phy_basic_ports_array), | ||
133 | phy_gbit_features); | ||
134 | linkmode_set_bit_array(phy_10_100_features_array, | ||
135 | ARRAY_SIZE(phy_10_100_features_array), | ||
136 | phy_gbit_features); | ||
137 | linkmode_set_bit_array(phy_gbit_features_array, | ||
138 | ARRAY_SIZE(phy_gbit_features_array), | ||
139 | phy_gbit_features); | ||
140 | |||
141 | /* 10/100 half/full + 1000 half/full + fibre*/ | ||
142 | linkmode_set_bit_array(phy_basic_ports_array, | ||
143 | ARRAY_SIZE(phy_basic_ports_array), | ||
144 | phy_gbit_fibre_features); | ||
145 | linkmode_set_bit_array(phy_10_100_features_array, | ||
146 | ARRAY_SIZE(phy_10_100_features_array), | ||
147 | phy_gbit_fibre_features); | ||
148 | linkmode_set_bit_array(phy_gbit_features_array, | ||
149 | ARRAY_SIZE(phy_gbit_features_array), | ||
150 | phy_gbit_fibre_features); | ||
151 | linkmode_set_bit_array(phy_fibre_port_array, | ||
152 | ARRAY_SIZE(phy_fibre_port_array), | ||
153 | phy_gbit_fibre_features); | ||
154 | |||
155 | /* 10/100 half/full + 1000 half/full + TP/MII/FIBRE/AUI/BNC/Backplane*/ | ||
156 | linkmode_set_bit_array(phy_all_ports_features_array, | ||
157 | ARRAY_SIZE(phy_all_ports_features_array), | ||
158 | phy_gbit_all_ports_features); | ||
159 | linkmode_set_bit_array(phy_10_100_features_array, | ||
160 | ARRAY_SIZE(phy_10_100_features_array), | ||
161 | phy_gbit_all_ports_features); | ||
162 | linkmode_set_bit_array(phy_gbit_features_array, | ||
163 | ARRAY_SIZE(phy_gbit_features_array), | ||
164 | phy_gbit_all_ports_features); | ||
165 | |||
166 | /* 10/100 half/full + 1000 half/full + 10G full*/ | ||
167 | linkmode_set_bit_array(phy_all_ports_features_array, | ||
168 | ARRAY_SIZE(phy_all_ports_features_array), | ||
169 | phy_10gbit_features); | ||
170 | linkmode_set_bit_array(phy_10_100_features_array, | ||
171 | ARRAY_SIZE(phy_10_100_features_array), | ||
172 | phy_10gbit_features); | ||
173 | linkmode_set_bit_array(phy_gbit_features_array, | ||
174 | ARRAY_SIZE(phy_gbit_features_array), | ||
175 | phy_10gbit_features); | ||
176 | linkmode_set_bit_array(phy_10gbit_features_array, | ||
177 | ARRAY_SIZE(phy_10gbit_features_array), | ||
178 | phy_10gbit_features); | ||
179 | |||
180 | /* 10/100/1000/10G full */ | ||
181 | linkmode_set_bit_array(phy_all_ports_features_array, | ||
182 | ARRAY_SIZE(phy_all_ports_features_array), | ||
183 | phy_10gbit_full_features); | ||
184 | linkmode_set_bit_array(phy_10gbit_full_features_array, | ||
185 | ARRAY_SIZE(phy_10gbit_full_features_array), | ||
186 | phy_10gbit_full_features); | ||
187 | } | ||
188 | |||
45 | void phy_device_free(struct phy_device *phydev) | 189 | void phy_device_free(struct phy_device *phydev) |
46 | { | 190 | { |
47 | put_device(&phydev->mdio.dev); | 191 | put_device(&phydev->mdio.dev); |
@@ -1936,6 +2080,7 @@ static int phy_probe(struct device *dev) | |||
1936 | struct phy_device *phydev = to_phy_device(dev); | 2080 | struct phy_device *phydev = to_phy_device(dev); |
1937 | struct device_driver *drv = phydev->mdio.dev.driver; | 2081 | struct device_driver *drv = phydev->mdio.dev.driver; |
1938 | struct phy_driver *phydrv = to_phy_driver(drv); | 2082 | struct phy_driver *phydrv = to_phy_driver(drv); |
2083 | u32 features; | ||
1939 | int err = 0; | 2084 | int err = 0; |
1940 | 2085 | ||
1941 | phydev->drv = phydrv; | 2086 | phydev->drv = phydrv; |
@@ -1956,7 +2101,8 @@ static int phy_probe(struct device *dev) | |||
1956 | * a controller will attach, and may modify one | 2101 | * a controller will attach, and may modify one |
1957 | * or both of these values | 2102 | * or both of these values |
1958 | */ | 2103 | */ |
1959 | phydev->supported = phydrv->features; | 2104 | ethtool_convert_link_mode_to_legacy_u32(&features, phydrv->features); |
2105 | phydev->supported = features; | ||
1960 | of_set_phy_supported(phydev); | 2106 | of_set_phy_supported(phydev); |
1961 | phydev->advertising = phydev->supported; | 2107 | phydev->advertising = phydev->supported; |
1962 | 2108 | ||
@@ -1976,10 +2122,14 @@ static int phy_probe(struct device *dev) | |||
1976 | * (e.g. hardware erratum) where the driver wants to set only one | 2122 | * (e.g. hardware erratum) where the driver wants to set only one |
1977 | * of these bits. | 2123 | * of these bits. |
1978 | */ | 2124 | */ |
1979 | if (phydrv->features & (SUPPORTED_Pause | SUPPORTED_Asym_Pause)) { | 2125 | if (test_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydrv->features) || |
2126 | test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, phydrv->features)) { | ||
1980 | phydev->supported &= ~(SUPPORTED_Pause | SUPPORTED_Asym_Pause); | 2127 | phydev->supported &= ~(SUPPORTED_Pause | SUPPORTED_Asym_Pause); |
1981 | phydev->supported |= phydrv->features & | 2128 | if (test_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydrv->features)) |
1982 | (SUPPORTED_Pause | SUPPORTED_Asym_Pause); | 2129 | phydev->supported |= SUPPORTED_Pause; |
2130 | if (test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, | ||
2131 | phydrv->features)) | ||
2132 | phydev->supported |= SUPPORTED_Asym_Pause; | ||
1983 | } else { | 2133 | } else { |
1984 | phydev->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause; | 2134 | phydev->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause; |
1985 | } | 2135 | } |
@@ -2092,9 +2242,7 @@ static struct phy_driver genphy_driver = { | |||
2092 | .name = "Generic PHY", | 2242 | .name = "Generic PHY", |
2093 | .soft_reset = genphy_no_soft_reset, | 2243 | .soft_reset = genphy_no_soft_reset, |
2094 | .config_init = genphy_config_init, | 2244 | .config_init = genphy_config_init, |
2095 | .features = PHY_GBIT_FEATURES | SUPPORTED_MII | | 2245 | .features = PHY_GBIT_ALL_PORTS_FEATURES, |
2096 | SUPPORTED_AUI | SUPPORTED_FIBRE | | ||
2097 | SUPPORTED_BNC, | ||
2098 | .aneg_done = genphy_aneg_done, | 2246 | .aneg_done = genphy_aneg_done, |
2099 | .suspend = genphy_suspend, | 2247 | .suspend = genphy_suspend, |
2100 | .resume = genphy_resume, | 2248 | .resume = genphy_resume, |
@@ -2109,6 +2257,8 @@ static int __init phy_init(void) | |||
2109 | if (rc) | 2257 | if (rc) |
2110 | return rc; | 2258 | return rc; |
2111 | 2259 | ||
2260 | features_init(); | ||
2261 | |||
2112 | rc = phy_driver_register(&genphy_10g_driver, THIS_MODULE); | 2262 | rc = phy_driver_register(&genphy_10g_driver, THIS_MODULE); |
2113 | if (rc) | 2263 | if (rc) |
2114 | goto err_10g; | 2264 | goto err_10g; |
diff --git a/include/linux/linkmode.h b/include/linux/linkmode.h index 014fb86c7114..22443d7fb5cd 100644 --- a/include/linux/linkmode.h +++ b/include/linux/linkmode.h | |||
@@ -43,6 +43,15 @@ static inline void linkmode_set_bit(int nr, volatile unsigned long *addr) | |||
43 | __set_bit(nr, addr); | 43 | __set_bit(nr, addr); |
44 | } | 44 | } |
45 | 45 | ||
46 | static inline void linkmode_set_bit_array(const int *array, int array_size, | ||
47 | unsigned long *addr) | ||
48 | { | ||
49 | int i; | ||
50 | |||
51 | for (i = 0; i < array_size; i++) | ||
52 | linkmode_set_bit(array[i], addr); | ||
53 | } | ||
54 | |||
46 | static inline void linkmode_clear_bit(int nr, volatile unsigned long *addr) | 55 | static inline void linkmode_clear_bit(int nr, volatile unsigned long *addr) |
47 | { | 56 | { |
48 | __clear_bit(nr, addr); | 57 | __clear_bit(nr, addr); |
diff --git a/include/linux/phy.h b/include/linux/phy.h index 0f6e7bf5e9c5..dff51dd36e52 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -42,13 +42,21 @@ | |||
42 | #define PHY_1000BT_FEATURES (SUPPORTED_1000baseT_Half | \ | 42 | #define PHY_1000BT_FEATURES (SUPPORTED_1000baseT_Half | \ |
43 | SUPPORTED_1000baseT_Full) | 43 | SUPPORTED_1000baseT_Full) |
44 | 44 | ||
45 | #define PHY_BASIC_FEATURES (PHY_10BT_FEATURES | \ | 45 | extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_basic_features) __ro_after_init; |
46 | PHY_100BT_FEATURES | \ | 46 | extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_basic_t1_features) __ro_after_init; |
47 | PHY_DEFAULT_FEATURES) | 47 | extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_features) __ro_after_init; |
48 | 48 | extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_fibre_features) __ro_after_init; | |
49 | #define PHY_GBIT_FEATURES (PHY_BASIC_FEATURES | \ | 49 | extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_all_ports_features) __ro_after_init; |
50 | PHY_1000BT_FEATURES) | 50 | extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_features) __ro_after_init; |
51 | 51 | extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_init; | |
52 | |||
53 | #define PHY_BASIC_FEATURES ((unsigned long *)&phy_basic_features) | ||
54 | #define PHY_BASIC_T1_FEATURES ((unsigned long *)&phy_basic_t1_features) | ||
55 | #define PHY_GBIT_FEATURES ((unsigned long *)&phy_gbit_features) | ||
56 | #define PHY_GBIT_FIBRE_FEATURES ((unsigned long *)&phy_gbit_fibre_features) | ||
57 | #define PHY_GBIT_ALL_PORTS_FEATURES ((unsigned long *)&phy_gbit_all_ports_features) | ||
58 | #define PHY_10GBIT_FEATURES ((unsigned long *)&phy_10gbit_features) | ||
59 | #define PHY_10GBIT_FULL_FEATURES ((unsigned long *)&phy_10gbit_full_features) | ||
52 | 60 | ||
53 | /* | 61 | /* |
54 | * Set phydev->irq to PHY_POLL if interrupts are not supported, | 62 | * Set phydev->irq to PHY_POLL if interrupts are not supported, |
@@ -510,7 +518,7 @@ struct phy_driver { | |||
510 | u32 phy_id; | 518 | u32 phy_id; |
511 | char *name; | 519 | char *name; |
512 | u32 phy_id_mask; | 520 | u32 phy_id_mask; |
513 | u32 features; | 521 | const unsigned long * const features; |
514 | u32 flags; | 522 | u32 flags; |
515 | const void *driver_data; | 523 | const void *driver_data; |
516 | 524 | ||