aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-10-23 04:33:42 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-24 07:27:28 -0400
commitb37b62fea1d1bf68ca51818f8eb1035188efd030 (patch)
tree13a0d5822c5d12cb86b1750f63e74ed0d53ceba4
parentfc2b5e673fceece2bbc153fe8c63c8cf93cfe611 (diff)
sfc: Rename 'xfp' file and functions to reflect reality
The 'XFP' driver is really a driver for the QT2022C2 and QT2025C PHYs, covering both more and less than XFP. Rename its functions and constants to reflect reality and to reduce namespace pollution when sfc is a built-in driver. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/sfc/Makefile2
-rw-r--r--drivers/net/sfc/falcon.c2
-rw-r--r--drivers/net/sfc/falcon_boards.c26
-rw-r--r--drivers/net/sfc/phy.h6
-rw-r--r--drivers/net/sfc/qt202x_phy.c (renamed from drivers/net/sfc/xfp_phy.c)80
5 files changed, 58 insertions, 58 deletions
diff --git a/drivers/net/sfc/Makefile b/drivers/net/sfc/Makefile
index 9c98d06ada7d..7b52fe10d38f 100644
--- a/drivers/net/sfc/Makefile
+++ b/drivers/net/sfc/Makefile
@@ -1,5 +1,5 @@
1sfc-y += efx.o falcon.o tx.o rx.o falcon_gmac.o \ 1sfc-y += efx.o falcon.o tx.o rx.o falcon_gmac.o \
2 falcon_xmac.o selftest.o ethtool.o xfp_phy.o \ 2 falcon_xmac.o selftest.o ethtool.o qt202x_phy.o \
3 mdio_10g.o tenxpress.o falcon_boards.o 3 mdio_10g.o tenxpress.o falcon_boards.o
4sfc-$(CONFIG_SFC_MTD) += mtd.o 4sfc-$(CONFIG_SFC_MTD) += mtd.o
5 5
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index d9ce21edfa6a..8776432f683c 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -2239,7 +2239,7 @@ int falcon_probe_port(struct efx_nic *efx)
2239 break; 2239 break;
2240 case PHY_TYPE_QT2022C2: 2240 case PHY_TYPE_QT2022C2:
2241 case PHY_TYPE_QT2025C: 2241 case PHY_TYPE_QT2025C:
2242 efx->phy_op = &falcon_xfp_phy_ops; 2242 efx->phy_op = &falcon_qt202x_phy_ops;
2243 break; 2243 break;
2244 default: 2244 default:
2245 EFX_ERR(efx, "Unknown PHY type %d\n", 2245 EFX_ERR(efx, "Unknown PHY type %d\n",
diff --git a/drivers/net/sfc/falcon_boards.c b/drivers/net/sfc/falcon_boards.c
index f65738bb5536..99f737223b10 100644
--- a/drivers/net/sfc/falcon_boards.c
+++ b/drivers/net/sfc/falcon_boards.c
@@ -612,17 +612,17 @@ static void sfe4002_init_leds(struct efx_nic *efx)
612{ 612{
613 /* Set the TX and RX LEDs to reflect status and activity, and the 613 /* Set the TX and RX LEDs to reflect status and activity, and the
614 * fault LED off */ 614 * fault LED off */
615 xfp_set_led(efx, SFE4002_TX_LED, 615 falcon_qt202x_set_led(efx, SFE4002_TX_LED,
616 QUAKE_LED_TXLINK | QUAKE_LED_LINK_ACTSTAT); 616 QUAKE_LED_TXLINK | QUAKE_LED_LINK_ACTSTAT);
617 xfp_set_led(efx, SFE4002_RX_LED, 617 falcon_qt202x_set_led(efx, SFE4002_RX_LED,
618 QUAKE_LED_RXLINK | QUAKE_LED_LINK_ACTSTAT); 618 QUAKE_LED_RXLINK | QUAKE_LED_LINK_ACTSTAT);
619 xfp_set_led(efx, SFE4002_FAULT_LED, QUAKE_LED_OFF); 619 falcon_qt202x_set_led(efx, SFE4002_FAULT_LED, QUAKE_LED_OFF);
620} 620}
621 621
622static void sfe4002_set_id_led(struct efx_nic *efx, bool state) 622static void sfe4002_set_id_led(struct efx_nic *efx, bool state)
623{ 623{
624 xfp_set_led(efx, SFE4002_FAULT_LED, state ? QUAKE_LED_ON : 624 falcon_qt202x_set_led(efx, SFE4002_FAULT_LED, state ? QUAKE_LED_ON :
625 QUAKE_LED_OFF); 625 QUAKE_LED_OFF);
626} 626}
627 627
628static int sfe4002_check_hw(struct efx_nic *efx) 628static int sfe4002_check_hw(struct efx_nic *efx)
@@ -677,16 +677,16 @@ static struct i2c_board_info sfn4112f_hwmon_info = {
677 677
678static void sfn4112f_init_leds(struct efx_nic *efx) 678static void sfn4112f_init_leds(struct efx_nic *efx)
679{ 679{
680 xfp_set_led(efx, SFN4112F_ACT_LED, 680 falcon_qt202x_set_led(efx, SFN4112F_ACT_LED,
681 QUAKE_LED_RXLINK | QUAKE_LED_LINK_ACT); 681 QUAKE_LED_RXLINK | QUAKE_LED_LINK_ACT);
682 xfp_set_led(efx, SFN4112F_LINK_LED, 682 falcon_qt202x_set_led(efx, SFN4112F_LINK_LED,
683 QUAKE_LED_RXLINK | QUAKE_LED_LINK_STAT); 683 QUAKE_LED_RXLINK | QUAKE_LED_LINK_STAT);
684} 684}
685 685
686static void sfn4112f_set_id_led(struct efx_nic *efx, bool state) 686static void sfn4112f_set_id_led(struct efx_nic *efx, bool state)
687{ 687{
688 xfp_set_led(efx, SFN4112F_LINK_LED, 688 falcon_qt202x_set_led(efx, SFN4112F_LINK_LED,
689 state ? QUAKE_LED_ON : QUAKE_LED_OFF); 689 state ? QUAKE_LED_ON : QUAKE_LED_OFF);
690} 690}
691 691
692static int sfn4112f_check_hw(struct efx_nic *efx) 692static int sfn4112f_check_hw(struct efx_nic *efx)
diff --git a/drivers/net/sfc/phy.h b/drivers/net/sfc/phy.h
index c1cff9c0c173..b5150f3bca31 100644
--- a/drivers/net/sfc/phy.h
+++ b/drivers/net/sfc/phy.h
@@ -23,9 +23,9 @@ extern void tenxpress_phy_blink(struct efx_nic *efx, bool blink);
23extern int sft9001_wait_boot(struct efx_nic *efx); 23extern int sft9001_wait_boot(struct efx_nic *efx);
24 24
25/**************************************************************************** 25/****************************************************************************
26 * AMCC/Quake QT20xx PHYs 26 * AMCC/Quake QT202x PHYs
27 */ 27 */
28extern struct efx_phy_operations falcon_xfp_phy_ops; 28extern struct efx_phy_operations falcon_qt202x_phy_ops;
29 29
30/* These PHYs provide various H/W control states for LEDs */ 30/* These PHYs provide various H/W control states for LEDs */
31#define QUAKE_LED_LINK_INVAL (0) 31#define QUAKE_LED_LINK_INVAL (0)
@@ -39,6 +39,6 @@ extern struct efx_phy_operations falcon_xfp_phy_ops;
39#define QUAKE_LED_TXLINK (0) 39#define QUAKE_LED_TXLINK (0)
40#define QUAKE_LED_RXLINK (8) 40#define QUAKE_LED_RXLINK (8)
41 41
42extern void xfp_set_led(struct efx_nic *p, int led, int state); 42extern void falcon_qt202x_set_led(struct efx_nic *p, int led, int state);
43 43
44#endif 44#endif
diff --git a/drivers/net/sfc/xfp_phy.c b/drivers/net/sfc/qt202x_phy.c
index e6b3d5eaddba..560eb18280e1 100644
--- a/drivers/net/sfc/xfp_phy.c
+++ b/drivers/net/sfc/qt202x_phy.c
@@ -7,8 +7,7 @@
7 * by the Free Software Foundation, incorporated herein by reference. 7 * by the Free Software Foundation, incorporated herein by reference.
8 */ 8 */
9/* 9/*
10 * Driver for SFP+ and XFP optical PHYs plus some support specific to the 10 * Driver for AMCC QT202x SFP+ and XFP adapters; see www.amcc.com for details
11 * AMCC QT20xx adapters; see www.amcc.com for details
12 */ 11 */
13 12
14#include <linux/timer.h> 13#include <linux/timer.h>
@@ -18,13 +17,13 @@
18#include "phy.h" 17#include "phy.h"
19#include "falcon.h" 18#include "falcon.h"
20 19
21#define XFP_REQUIRED_DEVS (MDIO_DEVS_PCS | \ 20#define QT202X_REQUIRED_DEVS (MDIO_DEVS_PCS | \
22 MDIO_DEVS_PMAPMD | \ 21 MDIO_DEVS_PMAPMD | \
23 MDIO_DEVS_PHYXS) 22 MDIO_DEVS_PHYXS)
24 23
25#define XFP_LOOPBACKS ((1 << LOOPBACK_PCS) | \ 24#define QT202X_LOOPBACKS ((1 << LOOPBACK_PCS) | \
26 (1 << LOOPBACK_PMAPMD) | \ 25 (1 << LOOPBACK_PMAPMD) | \
27 (1 << LOOPBACK_NETWORK)) 26 (1 << LOOPBACK_NETWORK))
28 27
29/****************************************************************************/ 28/****************************************************************************/
30/* Quake-specific MDIO registers */ 29/* Quake-specific MDIO registers */
@@ -45,18 +44,18 @@
45#define PCS_VEND1_REG 0xc000 44#define PCS_VEND1_REG 0xc000
46#define PCS_VEND1_LBTXD_LBN 5 45#define PCS_VEND1_LBTXD_LBN 5
47 46
48void xfp_set_led(struct efx_nic *p, int led, int mode) 47void falcon_qt202x_set_led(struct efx_nic *p, int led, int mode)
49{ 48{
50 int addr = MDIO_QUAKE_LED0_REG + led; 49 int addr = MDIO_QUAKE_LED0_REG + led;
51 efx_mdio_write(p, MDIO_MMD_PMAPMD, addr, mode); 50 efx_mdio_write(p, MDIO_MMD_PMAPMD, addr, mode);
52} 51}
53 52
54struct xfp_phy_data { 53struct qt202x_phy_data {
55 enum efx_phy_mode phy_mode; 54 enum efx_phy_mode phy_mode;
56}; 55};
57 56
58#define XFP_MAX_RESET_TIME 500 57#define QT2022C2_MAX_RESET_TIME 500
59#define XFP_RESET_WAIT 10 58#define QT2022C2_RESET_WAIT 10
60 59
61static int qt2025c_wait_reset(struct efx_nic *efx) 60static int qt2025c_wait_reset(struct efx_nic *efx)
62{ 61{
@@ -97,7 +96,7 @@ static int qt2025c_wait_reset(struct efx_nic *efx)
97 return 0; 96 return 0;
98} 97}
99 98
100static int xfp_reset_phy(struct efx_nic *efx) 99static int qt202x_reset_phy(struct efx_nic *efx)
101{ 100{
102 int rc; 101 int rc;
103 102
@@ -111,8 +110,9 @@ static int xfp_reset_phy(struct efx_nic *efx)
111 /* Reset the PHYXS MMD. This is documented as doing 110 /* Reset the PHYXS MMD. This is documented as doing
112 * a complete soft reset. */ 111 * a complete soft reset. */
113 rc = efx_mdio_reset_mmd(efx, MDIO_MMD_PHYXS, 112 rc = efx_mdio_reset_mmd(efx, MDIO_MMD_PHYXS,
114 XFP_MAX_RESET_TIME / XFP_RESET_WAIT, 113 QT2022C2_MAX_RESET_TIME /
115 XFP_RESET_WAIT); 114 QT2022C2_RESET_WAIT,
115 QT2022C2_RESET_WAIT);
116 if (rc < 0) 116 if (rc < 0)
117 goto fail; 117 goto fail;
118 } 118 }
@@ -122,7 +122,7 @@ static int xfp_reset_phy(struct efx_nic *efx)
122 122
123 /* Check that all the MMDs we expect are present and responding. We 123 /* Check that all the MMDs we expect are present and responding. We
124 * expect faults on some if the link is down, but not on the PHY XS */ 124 * expect faults on some if the link is down, but not on the PHY XS */
125 rc = efx_mdio_check_mmds(efx, XFP_REQUIRED_DEVS, MDIO_DEVS_PHYXS); 125 rc = efx_mdio_check_mmds(efx, QT202X_REQUIRED_DEVS, MDIO_DEVS_PHYXS);
126 if (rc < 0) 126 if (rc < 0)
127 goto fail; 127 goto fail;
128 128
@@ -135,13 +135,13 @@ static int xfp_reset_phy(struct efx_nic *efx)
135 return rc; 135 return rc;
136} 136}
137 137
138static int xfp_phy_init(struct efx_nic *efx) 138static int qt202x_phy_init(struct efx_nic *efx)
139{ 139{
140 struct xfp_phy_data *phy_data; 140 struct qt202x_phy_data *phy_data;
141 u32 devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS); 141 u32 devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS);
142 int rc; 142 int rc;
143 143
144 phy_data = kzalloc(sizeof(struct xfp_phy_data), GFP_KERNEL); 144 phy_data = kzalloc(sizeof(struct qt202x_phy_data), GFP_KERNEL);
145 if (!phy_data) 145 if (!phy_data)
146 return -ENOMEM; 146 return -ENOMEM;
147 efx->phy_data = phy_data; 147 efx->phy_data = phy_data;
@@ -152,7 +152,7 @@ static int xfp_phy_init(struct efx_nic *efx)
152 152
153 phy_data->phy_mode = efx->phy_mode; 153 phy_data->phy_mode = efx->phy_mode;
154 154
155 rc = xfp_reset_phy(efx); 155 rc = qt202x_reset_phy(efx);
156 156
157 EFX_INFO(efx, "PHY init %s.\n", 157 EFX_INFO(efx, "PHY init %s.\n",
158 rc ? "failed" : "successful"); 158 rc ? "failed" : "successful");
@@ -167,28 +167,28 @@ static int xfp_phy_init(struct efx_nic *efx)
167 return rc; 167 return rc;
168} 168}
169 169
170static void xfp_phy_clear_interrupt(struct efx_nic *efx) 170static void qt202x_phy_clear_interrupt(struct efx_nic *efx)
171{ 171{
172 /* Read to clear link status alarm */ 172 /* Read to clear link status alarm */
173 efx_mdio_read(efx, MDIO_MMD_PMAPMD, MDIO_PMA_LASI_STAT); 173 efx_mdio_read(efx, MDIO_MMD_PMAPMD, MDIO_PMA_LASI_STAT);
174} 174}
175 175
176static int xfp_link_ok(struct efx_nic *efx) 176static int qt202x_link_ok(struct efx_nic *efx)
177{ 177{
178 return efx_mdio_links_ok(efx, XFP_REQUIRED_DEVS); 178 return efx_mdio_links_ok(efx, QT202X_REQUIRED_DEVS);
179} 179}
180 180
181static void xfp_phy_poll(struct efx_nic *efx) 181static void qt202x_phy_poll(struct efx_nic *efx)
182{ 182{
183 int link_up = xfp_link_ok(efx); 183 int link_up = qt202x_link_ok(efx);
184 /* Simulate a PHY event if link state has changed */ 184 /* Simulate a PHY event if link state has changed */
185 if (link_up != efx->link_up) 185 if (link_up != efx->link_up)
186 falcon_sim_phy_event(efx); 186 falcon_sim_phy_event(efx);
187} 187}
188 188
189static void xfp_phy_reconfigure(struct efx_nic *efx) 189static void qt202x_phy_reconfigure(struct efx_nic *efx)
190{ 190{
191 struct xfp_phy_data *phy_data = efx->phy_data; 191 struct qt202x_phy_data *phy_data = efx->phy_data;
192 192
193 if (efx->phy_type == PHY_TYPE_QT2025C) { 193 if (efx->phy_type == PHY_TYPE_QT2025C) {
194 /* There are several different register bits which can 194 /* There are several different register bits which can
@@ -207,7 +207,7 @@ static void xfp_phy_reconfigure(struct efx_nic *efx)
207 /* Reset the PHY when moving from tx off to tx on */ 207 /* Reset the PHY when moving from tx off to tx on */
208 if (!(efx->phy_mode & PHY_MODE_TX_DISABLED) && 208 if (!(efx->phy_mode & PHY_MODE_TX_DISABLED) &&
209 (phy_data->phy_mode & PHY_MODE_TX_DISABLED)) 209 (phy_data->phy_mode & PHY_MODE_TX_DISABLED))
210 xfp_reset_phy(efx); 210 qt202x_reset_phy(efx);
211 211
212 efx_mdio_transmit_disable(efx); 212 efx_mdio_transmit_disable(efx);
213 } 213 }
@@ -215,18 +215,18 @@ static void xfp_phy_reconfigure(struct efx_nic *efx)
215 efx_mdio_phy_reconfigure(efx); 215 efx_mdio_phy_reconfigure(efx);
216 216
217 phy_data->phy_mode = efx->phy_mode; 217 phy_data->phy_mode = efx->phy_mode;
218 efx->link_up = xfp_link_ok(efx); 218 efx->link_up = qt202x_link_ok(efx);
219 efx->link_speed = 10000; 219 efx->link_speed = 10000;
220 efx->link_fd = true; 220 efx->link_fd = true;
221 efx->link_fc = efx->wanted_fc; 221 efx->link_fc = efx->wanted_fc;
222} 222}
223 223
224static void xfp_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) 224static void qt202x_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
225{ 225{
226 mdio45_ethtool_gset(&efx->mdio, ecmd); 226 mdio45_ethtool_gset(&efx->mdio, ecmd);
227} 227}
228 228
229static void xfp_phy_fini(struct efx_nic *efx) 229static void qt202x_phy_fini(struct efx_nic *efx)
230{ 230{
231 /* Clobber the LED if it was blinking */ 231 /* Clobber the LED if it was blinking */
232 efx->board_info.blink(efx, false); 232 efx->board_info.blink(efx, false);
@@ -236,15 +236,15 @@ static void xfp_phy_fini(struct efx_nic *efx)
236 efx->phy_data = NULL; 236 efx->phy_data = NULL;
237} 237}
238 238
239struct efx_phy_operations falcon_xfp_phy_ops = { 239struct efx_phy_operations falcon_qt202x_phy_ops = {
240 .macs = EFX_XMAC, 240 .macs = EFX_XMAC,
241 .init = xfp_phy_init, 241 .init = qt202x_phy_init,
242 .reconfigure = xfp_phy_reconfigure, 242 .reconfigure = qt202x_phy_reconfigure,
243 .poll = xfp_phy_poll, 243 .poll = qt202x_phy_poll,
244 .fini = xfp_phy_fini, 244 .fini = qt202x_phy_fini,
245 .clear_interrupt = xfp_phy_clear_interrupt, 245 .clear_interrupt = qt202x_phy_clear_interrupt,
246 .get_settings = xfp_phy_get_settings, 246 .get_settings = qt202x_phy_get_settings,
247 .set_settings = efx_mdio_set_settings, 247 .set_settings = efx_mdio_set_settings,
248 .mmds = XFP_REQUIRED_DEVS, 248 .mmds = QT202X_REQUIRED_DEVS,
249 .loopbacks = XFP_LOOPBACKS, 249 .loopbacks = QT202X_LOOPBACKS,
250}; 250};