diff options
-rw-r--r-- | drivers/net/sfc/efx.c | 23 | ||||
-rw-r--r-- | drivers/net/sfc/ethtool.c | 1 | ||||
-rw-r--r-- | drivers/net/sfc/falcon.c | 16 | ||||
-rw-r--r-- | drivers/net/sfc/falcon_xmac.c | 1 | ||||
-rw-r--r-- | drivers/net/sfc/gmii.h | 137 | ||||
-rw-r--r-- | drivers/net/sfc/net_driver.h | 6 | ||||
-rw-r--r-- | drivers/net/sfc/tenxpress.c | 4 | ||||
-rw-r--r-- | drivers/net/sfc/xfp_phy.c | 4 |
8 files changed, 18 insertions, 174 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index bba11490ef41..957a6320bbcb 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/ethtool.h> | 21 | #include <linux/ethtool.h> |
22 | #include <linux/topology.h> | 22 | #include <linux/topology.h> |
23 | #include "net_driver.h" | 23 | #include "net_driver.h" |
24 | #include "gmii.h" | ||
25 | #include "ethtool.h" | 24 | #include "ethtool.h" |
26 | #include "tx.h" | 25 | #include "tx.h" |
27 | #include "rx.h" | 26 | #include "rx.h" |
@@ -551,26 +550,8 @@ static void efx_link_status_changed(struct efx_nic *efx) | |||
551 | 550 | ||
552 | /* Status message for kernel log */ | 551 | /* Status message for kernel log */ |
553 | if (efx->link_up) { | 552 | if (efx->link_up) { |
554 | struct mii_if_info *gmii = &efx->mii; | 553 | EFX_INFO(efx, "link up at %uMbps %s-duplex (MTU %d)%s\n", |
555 | unsigned adv, lpa; | 554 | efx->link_speed, efx->link_fd ? "full" : "half", |
556 | /* NONE here means direct XAUI from the controller, with no | ||
557 | * MDIO-attached device we can query. */ | ||
558 | if (efx->phy_type != PHY_TYPE_NONE) { | ||
559 | adv = gmii_advertised(gmii); | ||
560 | lpa = gmii_lpa(gmii); | ||
561 | } else { | ||
562 | lpa = GM_LPA_10000 | LPA_DUPLEX; | ||
563 | adv = lpa; | ||
564 | } | ||
565 | EFX_INFO(efx, "link up at %dMbps %s-duplex " | ||
566 | "(adv %04x lpa %04x) (MTU %d)%s\n", | ||
567 | (efx->link_options & GM_LPA_10000 ? 10000 : | ||
568 | (efx->link_options & GM_LPA_1000 ? 1000 : | ||
569 | (efx->link_options & GM_LPA_100 ? 100 : | ||
570 | 10))), | ||
571 | (efx->link_options & GM_LPA_DUPLEX ? | ||
572 | "full" : "half"), | ||
573 | adv, lpa, | ||
574 | efx->net_dev->mtu, | 555 | efx->net_dev->mtu, |
575 | (efx->promiscuous ? " [PROMISC]" : "")); | 556 | (efx->promiscuous ? " [PROMISC]" : "")); |
576 | } else { | 557 | } else { |
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c index 931ce1410480..43d6d8b4429a 100644 --- a/drivers/net/sfc/ethtool.c +++ b/drivers/net/sfc/ethtool.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include "efx.h" | 16 | #include "efx.h" |
17 | #include "ethtool.h" | 17 | #include "ethtool.h" |
18 | #include "falcon.h" | 18 | #include "falcon.h" |
19 | #include "gmii.h" | ||
20 | #include "spi.h" | 19 | #include "spi.h" |
21 | #include "mac.h" | 20 | #include "mac.h" |
22 | 21 | ||
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c index 97cc037a10c5..448bba9eed09 100644 --- a/drivers/net/sfc/falcon.c +++ b/drivers/net/sfc/falcon.c | |||
@@ -15,11 +15,11 @@ | |||
15 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
16 | #include <linux/i2c.h> | 16 | #include <linux/i2c.h> |
17 | #include <linux/i2c-algo-bit.h> | 17 | #include <linux/i2c-algo-bit.h> |
18 | #include <linux/mii.h> | ||
18 | #include "net_driver.h" | 19 | #include "net_driver.h" |
19 | #include "bitfield.h" | 20 | #include "bitfield.h" |
20 | #include "efx.h" | 21 | #include "efx.h" |
21 | #include "mac.h" | 22 | #include "mac.h" |
22 | #include "gmii.h" | ||
23 | #include "spi.h" | 23 | #include "spi.h" |
24 | #include "falcon.h" | 24 | #include "falcon.h" |
25 | #include "falcon_hwdefs.h" | 25 | #include "falcon_hwdefs.h" |
@@ -1915,14 +1915,12 @@ void falcon_reconfigure_mac_wrapper(struct efx_nic *efx) | |||
1915 | int link_speed; | 1915 | int link_speed; |
1916 | bool tx_fc; | 1916 | bool tx_fc; |
1917 | 1917 | ||
1918 | if (efx->link_options & GM_LPA_10000) | 1918 | switch (efx->link_speed) { |
1919 | link_speed = 0x3; | 1919 | case 10000: link_speed = 3; break; |
1920 | else if (efx->link_options & GM_LPA_1000) | 1920 | case 1000: link_speed = 2; break; |
1921 | link_speed = 0x2; | 1921 | case 100: link_speed = 1; break; |
1922 | else if (efx->link_options & GM_LPA_100) | 1922 | default: link_speed = 0; break; |
1923 | link_speed = 0x1; | 1923 | } |
1924 | else | ||
1925 | link_speed = 0x0; | ||
1926 | /* MAC_LINK_STATUS controls MAC backpressure but doesn't work | 1924 | /* MAC_LINK_STATUS controls MAC backpressure but doesn't work |
1927 | * as advertised. Disable to ensure packets are not | 1925 | * as advertised. Disable to ensure packets are not |
1928 | * indefinitely held and TX queue can be flushed at any point | 1926 | * indefinitely held and TX queue can be flushed at any point |
diff --git a/drivers/net/sfc/falcon_xmac.c b/drivers/net/sfc/falcon_xmac.c index d4012314dd01..4a54d0933e72 100644 --- a/drivers/net/sfc/falcon_xmac.c +++ b/drivers/net/sfc/falcon_xmac.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include "falcon_hwdefs.h" | 15 | #include "falcon_hwdefs.h" |
16 | #include "falcon_io.h" | 16 | #include "falcon_io.h" |
17 | #include "mac.h" | 17 | #include "mac.h" |
18 | #include "gmii.h" | ||
19 | #include "mdio_10g.h" | 18 | #include "mdio_10g.h" |
20 | #include "phy.h" | 19 | #include "phy.h" |
21 | #include "boards.h" | 20 | #include "boards.h" |
diff --git a/drivers/net/sfc/gmii.h b/drivers/net/sfc/gmii.h index d25bbd1297f4..dfccaa7b573e 100644 --- a/drivers/net/sfc/gmii.h +++ b/drivers/net/sfc/gmii.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | * Driver for Solarflare Solarstorm network controllers and boards | 2 | * Driver for Solarflare Solarstorm network controllers and boards |
3 | * Copyright 2005-2006 Fen Systems Ltd. | 3 | * Copyright 2005-2006 Fen Systems Ltd. |
4 | * Copyright 2006 Solarflare Communications Inc. | 4 | * Copyright 2006-2008 Solarflare Communications Inc. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of the GNU General Public License version 2 as published | 7 | * under the terms of the GNU General Public License version 2 as published |
@@ -57,139 +57,4 @@ | |||
57 | #define ISR_POLARITY_CHG 0x0002 /* Bit 1 - polarity changed */ | 57 | #define ISR_POLARITY_CHG 0x0002 /* Bit 1 - polarity changed */ |
58 | #define ISR_JABBER 0x0001 /* Bit 0 - jabber */ | 58 | #define ISR_JABBER 0x0001 /* Bit 0 - jabber */ |
59 | 59 | ||
60 | /* Logically extended advertisement register */ | ||
61 | #define GM_ADVERTISE_SLCT ADVERTISE_SLCT | ||
62 | #define GM_ADVERTISE_CSMA ADVERTISE_CSMA | ||
63 | #define GM_ADVERTISE_10HALF ADVERTISE_10HALF | ||
64 | #define GM_ADVERTISE_1000XFULL ADVERTISE_1000XFULL | ||
65 | #define GM_ADVERTISE_10FULL ADVERTISE_10FULL | ||
66 | #define GM_ADVERTISE_1000XHALF ADVERTISE_1000XHALF | ||
67 | #define GM_ADVERTISE_100HALF ADVERTISE_100HALF | ||
68 | #define GM_ADVERTISE_1000XPAUSE ADVERTISE_1000XPAUSE | ||
69 | #define GM_ADVERTISE_100FULL ADVERTISE_100FULL | ||
70 | #define GM_ADVERTISE_1000XPSE_ASYM ADVERTISE_1000XPSE_ASYM | ||
71 | #define GM_ADVERTISE_100BASE4 ADVERTISE_100BASE4 | ||
72 | #define GM_ADVERTISE_PAUSE_CAP ADVERTISE_PAUSE_CAP | ||
73 | #define GM_ADVERTISE_PAUSE_ASYM ADVERTISE_PAUSE_ASYM | ||
74 | #define GM_ADVERTISE_RESV ADVERTISE_RESV | ||
75 | #define GM_ADVERTISE_RFAULT ADVERTISE_RFAULT | ||
76 | #define GM_ADVERTISE_LPACK ADVERTISE_LPACK | ||
77 | #define GM_ADVERTISE_NPAGE ADVERTISE_NPAGE | ||
78 | #define GM_ADVERTISE_1000FULL (ADVERTISE_1000FULL << 8) | ||
79 | #define GM_ADVERTISE_1000HALF (ADVERTISE_1000HALF << 8) | ||
80 | #define GM_ADVERTISE_1000 (GM_ADVERTISE_1000FULL | \ | ||
81 | GM_ADVERTISE_1000HALF) | ||
82 | #define GM_ADVERTISE_FULL (GM_ADVERTISE_1000FULL | \ | ||
83 | ADVERTISE_FULL) | ||
84 | #define GM_ADVERTISE_ALL (GM_ADVERTISE_1000FULL | \ | ||
85 | GM_ADVERTISE_1000HALF | \ | ||
86 | ADVERTISE_ALL) | ||
87 | |||
88 | /* Logically extended link partner ability register */ | ||
89 | #define GM_LPA_SLCT LPA_SLCT | ||
90 | #define GM_LPA_10HALF LPA_10HALF | ||
91 | #define GM_LPA_1000XFULL LPA_1000XFULL | ||
92 | #define GM_LPA_10FULL LPA_10FULL | ||
93 | #define GM_LPA_1000XHALF LPA_1000XHALF | ||
94 | #define GM_LPA_100HALF LPA_100HALF | ||
95 | #define GM_LPA_1000XPAUSE LPA_1000XPAUSE | ||
96 | #define GM_LPA_100FULL LPA_100FULL | ||
97 | #define GM_LPA_1000XPAUSE_ASYM LPA_1000XPAUSE_ASYM | ||
98 | #define GM_LPA_100BASE4 LPA_100BASE4 | ||
99 | #define GM_LPA_PAUSE_CAP LPA_PAUSE_CAP | ||
100 | #define GM_LPA_PAUSE_ASYM LPA_PAUSE_ASYM | ||
101 | #define GM_LPA_RESV LPA_RESV | ||
102 | #define GM_LPA_RFAULT LPA_RFAULT | ||
103 | #define GM_LPA_LPACK LPA_LPACK | ||
104 | #define GM_LPA_NPAGE LPA_NPAGE | ||
105 | #define GM_LPA_1000FULL (LPA_1000FULL << 6) | ||
106 | #define GM_LPA_1000HALF (LPA_1000HALF << 6) | ||
107 | #define GM_LPA_10000FULL 0x00040000 | ||
108 | #define GM_LPA_10000HALF 0x00080000 | ||
109 | #define GM_LPA_DUPLEX (GM_LPA_1000FULL | GM_LPA_10000FULL \ | ||
110 | | LPA_DUPLEX) | ||
111 | #define GM_LPA_10 (LPA_10FULL | LPA_10HALF) | ||
112 | #define GM_LPA_100 LPA_100 | ||
113 | #define GM_LPA_1000 (GM_LPA_1000FULL | GM_LPA_1000HALF) | ||
114 | #define GM_LPA_10000 (GM_LPA_10000FULL | GM_LPA_10000HALF) | ||
115 | |||
116 | /* Retrieve GMII autonegotiation advertised abilities | ||
117 | * | ||
118 | * The MII advertisment register (MII_ADVERTISE) is logically extended | ||
119 | * to include advertisement bits ADVERTISE_1000FULL and | ||
120 | * ADVERTISE_1000HALF from MII_CTRL1000. The result can be tested | ||
121 | * against the GM_ADVERTISE_xxx constants. | ||
122 | */ | ||
123 | static inline unsigned int gmii_advertised(struct mii_if_info *gmii) | ||
124 | { | ||
125 | unsigned int advertise; | ||
126 | unsigned int ctrl1000; | ||
127 | |||
128 | advertise = gmii->mdio_read(gmii->dev, gmii->phy_id, MII_ADVERTISE); | ||
129 | ctrl1000 = gmii->mdio_read(gmii->dev, gmii->phy_id, MII_CTRL1000); | ||
130 | return (((ctrl1000 << 8) & GM_ADVERTISE_1000) | advertise); | ||
131 | } | ||
132 | |||
133 | /* Retrieve GMII autonegotiation link partner abilities | ||
134 | * | ||
135 | * The MII link partner ability register (MII_LPA) is logically | ||
136 | * extended by adding bits LPA_1000HALF and LPA_1000FULL from | ||
137 | * MII_STAT1000. The result can be tested against the GM_LPA_xxx | ||
138 | * constants. | ||
139 | */ | ||
140 | static inline unsigned int gmii_lpa(struct mii_if_info *gmii) | ||
141 | { | ||
142 | unsigned int lpa; | ||
143 | unsigned int stat1000; | ||
144 | |||
145 | lpa = gmii->mdio_read(gmii->dev, gmii->phy_id, MII_LPA); | ||
146 | stat1000 = gmii->mdio_read(gmii->dev, gmii->phy_id, MII_STAT1000); | ||
147 | return (((stat1000 << 6) & GM_LPA_1000) | lpa); | ||
148 | } | ||
149 | |||
150 | /* Calculate GMII autonegotiated link technology | ||
151 | * | ||
152 | * "negotiated" should be the result of gmii_advertised() logically | ||
153 | * ANDed with the result of gmii_lpa(). | ||
154 | * | ||
155 | * "tech" will be negotiated with the unused bits masked out. For | ||
156 | * example, if both ends of the link are capable of both | ||
157 | * GM_LPA_1000FULL and GM_LPA_100FULL, GM_LPA_100FULL will be masked | ||
158 | * out. | ||
159 | */ | ||
160 | static inline unsigned int gmii_nway_result(unsigned int negotiated) | ||
161 | { | ||
162 | unsigned int other_bits; | ||
163 | |||
164 | /* Mask out the speed and duplexity bits */ | ||
165 | other_bits = negotiated & ~(GM_LPA_10 | GM_LPA_100 | GM_LPA_1000); | ||
166 | |||
167 | if (negotiated & GM_LPA_1000FULL) | ||
168 | return (other_bits | GM_LPA_1000FULL); | ||
169 | else if (negotiated & GM_LPA_1000HALF) | ||
170 | return (other_bits | GM_LPA_1000HALF); | ||
171 | else | ||
172 | return (other_bits | mii_nway_result(negotiated)); | ||
173 | } | ||
174 | |||
175 | /* Calculate GMII non-autonegotiated link technology | ||
176 | * | ||
177 | * This provides an equivalent to gmii_nway_result for the case when | ||
178 | * autonegotiation is disabled. | ||
179 | */ | ||
180 | static inline unsigned int gmii_forced_result(unsigned int bmcr) | ||
181 | { | ||
182 | unsigned int result; | ||
183 | int full_duplex; | ||
184 | |||
185 | full_duplex = bmcr & BMCR_FULLDPLX; | ||
186 | if (bmcr & BMCR_SPEED1000) | ||
187 | result = full_duplex ? GM_LPA_1000FULL : GM_LPA_1000HALF; | ||
188 | else if (bmcr & BMCR_SPEED100) | ||
189 | result = full_duplex ? GM_LPA_100FULL : GM_LPA_100HALF; | ||
190 | else | ||
191 | result = full_duplex ? GM_LPA_10FULL : GM_LPA_10HALF; | ||
192 | return result; | ||
193 | } | ||
194 | |||
195 | #endif /* EFX_GMII_H */ | 60 | #endif /* EFX_GMII_H */ |
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index abff9084a986..6cac5ed427ba 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -694,7 +694,8 @@ union efx_multicast_hash { | |||
694 | * @mii: PHY interface | 694 | * @mii: PHY interface |
695 | * @phy_mode: PHY operating mode. Serialised by @mac_lock. | 695 | * @phy_mode: PHY operating mode. Serialised by @mac_lock. |
696 | * @link_up: Link status | 696 | * @link_up: Link status |
697 | * @link_options: Link options (MII/GMII format) | 697 | * @link_fd: Link is full duplex |
698 | * @link_speed: Link speed (Mbps) | ||
698 | * @n_link_state_changes: Number of times the link has changed state | 699 | * @n_link_state_changes: Number of times the link has changed state |
699 | * @promiscuous: Promiscuous flag. Protected by netif_tx_lock. | 700 | * @promiscuous: Promiscuous flag. Protected by netif_tx_lock. |
700 | * @multicast_hash: Multicast hash table | 701 | * @multicast_hash: Multicast hash table |
@@ -772,7 +773,8 @@ struct efx_nic { | |||
772 | enum efx_phy_mode phy_mode; | 773 | enum efx_phy_mode phy_mode; |
773 | 774 | ||
774 | bool link_up; | 775 | bool link_up; |
775 | unsigned int link_options; | 776 | bool link_fd; |
777 | unsigned int link_speed; | ||
776 | unsigned int n_link_state_changes; | 778 | unsigned int n_link_state_changes; |
777 | 779 | ||
778 | bool promiscuous; | 780 | bool promiscuous; |
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c index 8d41c29b9d7b..3fa7ccb08d50 100644 --- a/drivers/net/sfc/tenxpress.c +++ b/drivers/net/sfc/tenxpress.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/delay.h> | 10 | #include <linux/delay.h> |
11 | #include <linux/seq_file.h> | 11 | #include <linux/seq_file.h> |
12 | #include "efx.h" | 12 | #include "efx.h" |
13 | #include "gmii.h" | ||
14 | #include "mdio_10g.h" | 13 | #include "mdio_10g.h" |
15 | #include "falcon.h" | 14 | #include "falcon.h" |
16 | #include "phy.h" | 15 | #include "phy.h" |
@@ -362,7 +361,8 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx) | |||
362 | phy_data->loopback_mode = efx->loopback_mode; | 361 | phy_data->loopback_mode = efx->loopback_mode; |
363 | phy_data->phy_mode = efx->phy_mode; | 362 | phy_data->phy_mode = efx->phy_mode; |
364 | efx->link_up = tenxpress_link_ok(efx, false); | 363 | efx->link_up = tenxpress_link_ok(efx, false); |
365 | efx->link_options = GM_LPA_10000FULL; | 364 | efx->link_speed = 10000; |
365 | efx->link_fd = true; | ||
366 | } | 366 | } |
367 | 367 | ||
368 | static void tenxpress_phy_clear_interrupt(struct efx_nic *efx) | 368 | static void tenxpress_phy_clear_interrupt(struct efx_nic *efx) |
diff --git a/drivers/net/sfc/xfp_phy.c b/drivers/net/sfc/xfp_phy.c index 91f024662101..971a24b59fa7 100644 --- a/drivers/net/sfc/xfp_phy.c +++ b/drivers/net/sfc/xfp_phy.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/timer.h> | 14 | #include <linux/timer.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include "efx.h" | 16 | #include "efx.h" |
17 | #include "gmii.h" | ||
18 | #include "mdio_10g.h" | 17 | #include "mdio_10g.h" |
19 | #include "xenpack.h" | 18 | #include "xenpack.h" |
20 | #include "phy.h" | 19 | #include "phy.h" |
@@ -154,7 +153,8 @@ static void xfp_phy_reconfigure(struct efx_nic *efx) | |||
154 | 153 | ||
155 | phy_data->phy_mode = efx->phy_mode; | 154 | phy_data->phy_mode = efx->phy_mode; |
156 | efx->link_up = xfp_link_ok(efx); | 155 | efx->link_up = xfp_link_ok(efx); |
157 | efx->link_options = GM_LPA_10000FULL; | 156 | efx->link_speed = 10000; |
157 | efx->link_fd = true; | ||
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||