| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 1 | /**************************************************************************** | 
| Ben Hutchings | 177dfcd | 2008-12-12 21:50:08 -0800 | [diff] [blame] | 2 |  * Driver for Solarflare Solarstorm network controllers and boards | 
 | 3 |  * Copyright 2007-2008 Solarflare Communications Inc. | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 4 |  * | 
 | 5 |  * This program is free software; you can redistribute it and/or modify it | 
 | 6 |  * under the terms of the GNU General Public License version 2 as published | 
 | 7 |  * by the Free Software Foundation, incorporated herein by reference. | 
 | 8 |  */ | 
 | 9 |  | 
 | 10 | #include <linux/delay.h> | 
 | 11 | #include <linux/seq_file.h> | 
 | 12 | #include "efx.h" | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 13 | #include "mdio_10g.h" | 
 | 14 | #include "falcon.h" | 
 | 15 | #include "phy.h" | 
 | 16 | #include "falcon_hwdefs.h" | 
 | 17 | #include "boards.h" | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 18 | #include "workarounds.h" | 
 | 19 | #include "selftest.h" | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 20 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 21 | /* We expect these MMDs to be in the package.  SFT9001 also has a | 
 | 22 |  * clause 22 extension MMD, but since it doesn't have all the generic | 
 | 23 |  * MMD registers it is pointless to include it here. | 
 | 24 |  */ | 
| Ben Hutchings | 27dd2ca | 2008-12-12 21:44:14 -0800 | [diff] [blame] | 25 | #define TENXPRESS_REQUIRED_DEVS (MDIO_MMDREG_DEVS_PMAPMD	| \ | 
 | 26 | 				 MDIO_MMDREG_DEVS_PCS		| \ | 
| Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 27 | 				 MDIO_MMDREG_DEVS_PHYXS		| \ | 
 | 28 | 				 MDIO_MMDREG_DEVS_AN) | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 29 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 30 | #define SFX7101_LOOPBACKS ((1 << LOOPBACK_PHYXS) |	\ | 
 | 31 | 			   (1 << LOOPBACK_PCS) |	\ | 
 | 32 | 			   (1 << LOOPBACK_PMAPMD) |	\ | 
 | 33 | 			   (1 << LOOPBACK_NETWORK)) | 
 | 34 |  | 
 | 35 | #define SFT9001_LOOPBACKS ((1 << LOOPBACK_GPHY) |	\ | 
 | 36 | 			   (1 << LOOPBACK_PHYXS) |	\ | 
 | 37 | 			   (1 << LOOPBACK_PCS) |	\ | 
 | 38 | 			   (1 << LOOPBACK_PMAPMD) |	\ | 
 | 39 | 			   (1 << LOOPBACK_NETWORK)) | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 40 |  | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 41 | /* We complain if we fail to see the link partner as 10G capable this many | 
 | 42 |  * times in a row (must be > 1 as sampling the autoneg. registers is racy) | 
 | 43 |  */ | 
 | 44 | #define MAX_BAD_LP_TRIES	(5) | 
 | 45 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 46 | /* LASI Control */ | 
 | 47 | #define PMA_PMD_LASI_CTRL	36866 | 
 | 48 | #define PMA_PMD_LASI_STATUS	36869 | 
 | 49 | #define PMA_PMD_LS_ALARM_LBN	0 | 
 | 50 | #define PMA_PMD_LS_ALARM_WIDTH	1 | 
 | 51 | #define PMA_PMD_TX_ALARM_LBN	1 | 
 | 52 | #define PMA_PMD_TX_ALARM_WIDTH	1 | 
 | 53 | #define PMA_PMD_RX_ALARM_LBN	2 | 
 | 54 | #define PMA_PMD_RX_ALARM_WIDTH	1 | 
 | 55 | #define PMA_PMD_AN_ALARM_LBN	3 | 
 | 56 | #define PMA_PMD_AN_ALARM_WIDTH	1 | 
 | 57 |  | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 58 | /* Extended control register */ | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 59 | #define PMA_PMD_XCONTROL_REG	49152 | 
 | 60 | #define PMA_PMD_EXT_GMII_EN_LBN	1 | 
 | 61 | #define PMA_PMD_EXT_GMII_EN_WIDTH 1 | 
 | 62 | #define PMA_PMD_EXT_CLK_OUT_LBN	2 | 
 | 63 | #define PMA_PMD_EXT_CLK_OUT_WIDTH 1 | 
 | 64 | #define PMA_PMD_LNPGA_POWERDOWN_LBN 8	/* SFX7101 only */ | 
 | 65 | #define PMA_PMD_LNPGA_POWERDOWN_WIDTH 1 | 
 | 66 | #define PMA_PMD_EXT_CLK312_LBN	8	/* SFT9001 only */ | 
 | 67 | #define PMA_PMD_EXT_CLK312_WIDTH 1 | 
 | 68 | #define PMA_PMD_EXT_LPOWER_LBN  12 | 
 | 69 | #define PMA_PMD_EXT_LPOWER_WIDTH 1 | 
| Steve Hodgson | 869b5b3 | 2009-01-29 17:48:10 +0000 | [diff] [blame] | 70 | #define PMA_PMD_EXT_ROBUST_LBN	14 | 
 | 71 | #define PMA_PMD_EXT_ROBUST_WIDTH 1 | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 72 | #define PMA_PMD_EXT_SSR_LBN	15 | 
 | 73 | #define PMA_PMD_EXT_SSR_WIDTH	1 | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 74 |  | 
 | 75 | /* extended status register */ | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 76 | #define PMA_PMD_XSTATUS_REG	49153 | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 77 | #define PMA_PMD_XSTAT_FLP_LBN   (12) | 
 | 78 |  | 
 | 79 | /* LED control register */ | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 80 | #define PMA_PMD_LED_CTRL_REG	49159 | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 81 | #define PMA_PMA_LED_ACTIVITY_LBN	(3) | 
 | 82 |  | 
 | 83 | /* LED function override register */ | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 84 | #define PMA_PMD_LED_OVERR_REG	49161 | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 85 | /* Bit positions for different LEDs (there are more but not wired on SFE4001)*/ | 
 | 86 | #define PMA_PMD_LED_LINK_LBN	(0) | 
 | 87 | #define PMA_PMD_LED_SPEED_LBN	(2) | 
 | 88 | #define PMA_PMD_LED_TX_LBN	(4) | 
 | 89 | #define PMA_PMD_LED_RX_LBN	(6) | 
 | 90 | /* Override settings */ | 
 | 91 | #define	PMA_PMD_LED_AUTO	(0)	/* H/W control */ | 
 | 92 | #define	PMA_PMD_LED_ON		(1) | 
 | 93 | #define	PMA_PMD_LED_OFF		(2) | 
 | 94 | #define PMA_PMD_LED_FLASH	(3) | 
| Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 95 | #define PMA_PMD_LED_MASK	3 | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 96 | /* All LEDs under hardware control */ | 
 | 97 | #define PMA_PMD_LED_FULL_AUTO	(0) | 
 | 98 | /* Green and Amber under hardware control, Red off */ | 
 | 99 | #define PMA_PMD_LED_DEFAULT	(PMA_PMD_LED_OFF << PMA_PMD_LED_RX_LBN) | 
 | 100 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 101 | #define PMA_PMD_SPEED_ENABLE_REG 49192 | 
 | 102 | #define PMA_PMD_100TX_ADV_LBN    1 | 
 | 103 | #define PMA_PMD_100TX_ADV_WIDTH  1 | 
 | 104 | #define PMA_PMD_1000T_ADV_LBN    2 | 
 | 105 | #define PMA_PMD_1000T_ADV_WIDTH  1 | 
 | 106 | #define PMA_PMD_10000T_ADV_LBN   3 | 
 | 107 | #define PMA_PMD_10000T_ADV_WIDTH 1 | 
 | 108 | #define PMA_PMD_SPEED_LBN        4 | 
 | 109 | #define PMA_PMD_SPEED_WIDTH      4 | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 110 |  | 
| Ben Hutchings | 307505e | 2008-12-26 13:48:00 -0800 | [diff] [blame] | 111 | /* Cable diagnostics - SFT9001 only */ | 
 | 112 | #define PMA_PMD_CDIAG_CTRL_REG  49213 | 
 | 113 | #define CDIAG_CTRL_IMMED_LBN    15 | 
 | 114 | #define CDIAG_CTRL_BRK_LINK_LBN 12 | 
 | 115 | #define CDIAG_CTRL_IN_PROG_LBN  11 | 
 | 116 | #define CDIAG_CTRL_LEN_UNIT_LBN 10 | 
 | 117 | #define CDIAG_CTRL_LEN_METRES   1 | 
 | 118 | #define PMA_PMD_CDIAG_RES_REG   49174 | 
 | 119 | #define CDIAG_RES_A_LBN         12 | 
 | 120 | #define CDIAG_RES_B_LBN         8 | 
 | 121 | #define CDIAG_RES_C_LBN         4 | 
 | 122 | #define CDIAG_RES_D_LBN         0 | 
 | 123 | #define CDIAG_RES_WIDTH         4 | 
 | 124 | #define CDIAG_RES_OPEN          2 | 
 | 125 | #define CDIAG_RES_OK            1 | 
 | 126 | #define CDIAG_RES_INVALID       0 | 
 | 127 | /* Set of 4 registers for pairs A-D */ | 
 | 128 | #define PMA_PMD_CDIAG_LEN_REG   49175 | 
 | 129 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 130 | /* Serdes control registers - SFT9001 only */ | 
 | 131 | #define PMA_PMD_CSERDES_CTRL_REG 64258 | 
 | 132 | /* Set the 156.25 MHz output to 312.5 MHz to drive Falcon's XMAC */ | 
 | 133 | #define PMA_PMD_CSERDES_DEFAULT	0x000f | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 134 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 135 | /* Misc register defines - SFX7101 only */ | 
 | 136 | #define PCS_CLOCK_CTRL_REG	55297 | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 137 | #define PLL312_RST_N_LBN 2 | 
 | 138 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 139 | #define PCS_SOFT_RST2_REG	55302 | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 140 | #define SERDES_RST_N_LBN 13 | 
 | 141 | #define XGXS_RST_N_LBN 12 | 
 | 142 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 143 | #define	PCS_TEST_SELECT_REG	55303	/* PRM 10.5.8 */ | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 144 | #define	CLK312_EN_LBN 3 | 
 | 145 |  | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 146 | /* PHYXS registers */ | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 147 | #define PHYXS_XCONTROL_REG	49152 | 
 | 148 | #define PHYXS_RESET_LBN		15 | 
 | 149 | #define PHYXS_RESET_WIDTH	1 | 
 | 150 |  | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 151 | #define PHYXS_TEST1         (49162) | 
 | 152 | #define LOOPBACK_NEAR_LBN   (8) | 
 | 153 | #define LOOPBACK_NEAR_WIDTH (1) | 
 | 154 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 155 | #define PCS_10GBASET_STAT1       32 | 
 | 156 | #define PCS_10GBASET_BLKLK_LBN   0 | 
 | 157 | #define PCS_10GBASET_BLKLK_WIDTH 1 | 
 | 158 |  | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 159 | /* Boot status register */ | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 160 | #define PCS_BOOT_STATUS_REG	53248 | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 161 | #define PCS_BOOT_FATAL_ERR_LBN	(0) | 
 | 162 | #define PCS_BOOT_PROGRESS_LBN	(1) | 
 | 163 | #define PCS_BOOT_PROGRESS_WIDTH	(2) | 
 | 164 | #define PCS_BOOT_COMPLETE_LBN	(3) | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 165 |  | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 166 | #define PCS_BOOT_MAX_DELAY	(100) | 
 | 167 | #define PCS_BOOT_POLL_DELAY	(10) | 
 | 168 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 169 | /* 100M/1G PHY registers */ | 
 | 170 | #define GPHY_XCONTROL_REG	49152 | 
 | 171 | #define GPHY_ISOLATE_LBN	10 | 
 | 172 | #define GPHY_ISOLATE_WIDTH	1 | 
 | 173 | #define GPHY_DUPLEX_LBN	  	8 | 
 | 174 | #define GPHY_DUPLEX_WIDTH	1 | 
 | 175 | #define GPHY_LOOPBACK_NEAR_LBN	14 | 
 | 176 | #define GPHY_LOOPBACK_NEAR_WIDTH 1 | 
 | 177 |  | 
 | 178 | #define C22EXT_STATUS_REG       49153 | 
 | 179 | #define C22EXT_STATUS_LINK_LBN  2 | 
 | 180 | #define C22EXT_STATUS_LINK_WIDTH 1 | 
 | 181 |  | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 182 | #define C22EXT_MSTSLV_CTRL			49161 | 
 | 183 | #define C22EXT_MSTSLV_CTRL_ADV_1000_HD_LBN	8 | 
 | 184 | #define C22EXT_MSTSLV_CTRL_ADV_1000_FD_LBN	9 | 
 | 185 |  | 
 | 186 | #define C22EXT_MSTSLV_STATUS			49162 | 
 | 187 | #define C22EXT_MSTSLV_STATUS_LP_1000_HD_LBN	10 | 
 | 188 | #define C22EXT_MSTSLV_STATUS_LP_1000_FD_LBN	11 | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 189 |  | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 190 | /* Time to wait between powering down the LNPGA and turning off the power | 
 | 191 |  * rails */ | 
 | 192 | #define LNPGA_PDOWN_WAIT	(HZ / 5) | 
 | 193 |  | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 194 | struct tenxpress_phy_data { | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 195 | 	enum efx_loopback_mode loopback_mode; | 
| Ben Hutchings | f8b87c1 | 2008-09-01 12:48:17 +0100 | [diff] [blame] | 196 | 	enum efx_phy_mode phy_mode; | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 197 | 	int bad_lp_tries; | 
 | 198 | }; | 
 | 199 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 200 | static ssize_t show_phy_short_reach(struct device *dev, | 
 | 201 | 				    struct device_attribute *attr, char *buf) | 
 | 202 | { | 
 | 203 | 	struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); | 
 | 204 | 	int reg; | 
 | 205 |  | 
 | 206 | 	reg = mdio_clause45_read(efx, efx->mii.phy_id, MDIO_MMD_PMAPMD, | 
 | 207 | 				 MDIO_PMAPMD_10GBT_TXPWR); | 
 | 208 | 	return sprintf(buf, "%d\n", | 
 | 209 | 		       !!(reg & (1 << MDIO_PMAPMD_10GBT_TXPWR_SHORT_LBN))); | 
 | 210 | } | 
 | 211 |  | 
 | 212 | static ssize_t set_phy_short_reach(struct device *dev, | 
 | 213 | 				   struct device_attribute *attr, | 
 | 214 | 				   const char *buf, size_t count) | 
 | 215 | { | 
 | 216 | 	struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); | 
 | 217 |  | 
 | 218 | 	rtnl_lock(); | 
 | 219 | 	mdio_clause45_set_flag(efx, efx->mii.phy_id, MDIO_MMD_PMAPMD, | 
 | 220 | 			       MDIO_PMAPMD_10GBT_TXPWR, | 
 | 221 | 			       MDIO_PMAPMD_10GBT_TXPWR_SHORT_LBN, | 
 | 222 | 			       count != 0 && *buf != '0'); | 
 | 223 | 	efx_reconfigure_port(efx); | 
 | 224 | 	rtnl_unlock(); | 
 | 225 |  | 
 | 226 | 	return count; | 
 | 227 | } | 
 | 228 |  | 
 | 229 | static DEVICE_ATTR(phy_short_reach, 0644, show_phy_short_reach, | 
 | 230 | 		   set_phy_short_reach); | 
 | 231 |  | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 232 | /* Check that the C166 has booted successfully */ | 
 | 233 | static int tenxpress_phy_check(struct efx_nic *efx) | 
 | 234 | { | 
 | 235 | 	int phy_id = efx->mii.phy_id; | 
 | 236 | 	int count = PCS_BOOT_MAX_DELAY / PCS_BOOT_POLL_DELAY; | 
 | 237 | 	int boot_stat; | 
 | 238 |  | 
 | 239 | 	/* Wait for the boot to complete (or not) */ | 
 | 240 | 	while (count) { | 
 | 241 | 		boot_stat = mdio_clause45_read(efx, phy_id, | 
 | 242 | 					       MDIO_MMD_PCS, | 
 | 243 | 					       PCS_BOOT_STATUS_REG); | 
 | 244 | 		if (boot_stat & (1 << PCS_BOOT_COMPLETE_LBN)) | 
 | 245 | 			break; | 
 | 246 | 		count--; | 
 | 247 | 		udelay(PCS_BOOT_POLL_DELAY); | 
 | 248 | 	} | 
 | 249 |  | 
 | 250 | 	if (!count) { | 
 | 251 | 		EFX_ERR(efx, "%s: PHY boot timed out. Last status " | 
 | 252 | 			"%x\n", __func__, | 
 | 253 | 			(boot_stat >> PCS_BOOT_PROGRESS_LBN) & | 
 | 254 | 			((1 << PCS_BOOT_PROGRESS_WIDTH) - 1)); | 
 | 255 | 		return -ETIMEDOUT; | 
 | 256 | 	} | 
 | 257 |  | 
 | 258 | 	return 0; | 
 | 259 | } | 
 | 260 |  | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 261 | static int tenxpress_init(struct efx_nic *efx) | 
 | 262 | { | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 263 | 	int phy_id = efx->mii.phy_id; | 
 | 264 | 	int reg; | 
 | 265 | 	int rc; | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 266 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 267 | 	if (efx->phy_type == PHY_TYPE_SFX7101) { | 
 | 268 | 		/* Enable 312.5 MHz clock */ | 
 | 269 | 		mdio_clause45_write(efx, phy_id, | 
 | 270 | 				    MDIO_MMD_PCS, PCS_TEST_SELECT_REG, | 
 | 271 | 				    1 << CLK312_EN_LBN); | 
 | 272 | 	} else { | 
 | 273 | 		/* Enable 312.5 MHz clock and GMII */ | 
 | 274 | 		reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD, | 
 | 275 | 					 PMA_PMD_XCONTROL_REG); | 
 | 276 | 		reg |= ((1 << PMA_PMD_EXT_GMII_EN_LBN) | | 
 | 277 | 			(1 << PMA_PMD_EXT_CLK_OUT_LBN) | | 
| Steve Hodgson | 869b5b3 | 2009-01-29 17:48:10 +0000 | [diff] [blame] | 278 | 			(1 << PMA_PMD_EXT_CLK312_LBN) | | 
 | 279 | 			(1 << PMA_PMD_EXT_ROBUST_LBN)); | 
 | 280 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 281 | 		mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD, | 
 | 282 | 				    PMA_PMD_XCONTROL_REG, reg); | 
 | 283 | 		mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_C22EXT, | 
 | 284 | 				       GPHY_XCONTROL_REG, GPHY_ISOLATE_LBN, | 
 | 285 | 				       false); | 
 | 286 | 	} | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 287 |  | 
 | 288 | 	rc = tenxpress_phy_check(efx); | 
 | 289 | 	if (rc < 0) | 
 | 290 | 		return rc; | 
 | 291 |  | 
 | 292 | 	/* Set the LEDs up as: Green = Link, Amber = Link/Act, Red = Off */ | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 293 | 	if (efx->phy_type == PHY_TYPE_SFX7101) { | 
 | 294 | 		mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_PMAPMD, | 
 | 295 | 				       PMA_PMD_LED_CTRL_REG, | 
 | 296 | 				       PMA_PMA_LED_ACTIVITY_LBN, | 
 | 297 | 				       true); | 
 | 298 | 		mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD, | 
 | 299 | 				    PMA_PMD_LED_OVERR_REG, PMA_PMD_LED_DEFAULT); | 
 | 300 | 	} | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 301 |  | 
 | 302 | 	return rc; | 
 | 303 | } | 
 | 304 |  | 
 | 305 | static int tenxpress_phy_init(struct efx_nic *efx) | 
 | 306 | { | 
 | 307 | 	struct tenxpress_phy_data *phy_data; | 
 | 308 | 	int rc = 0; | 
 | 309 |  | 
 | 310 | 	phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL); | 
| Ben Hutchings | 9b7bfc4 | 2008-05-16 21:20:20 +0100 | [diff] [blame] | 311 | 	if (!phy_data) | 
 | 312 | 		return -ENOMEM; | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 313 | 	efx->phy_data = phy_data; | 
| Ben Hutchings | f8b87c1 | 2008-09-01 12:48:17 +0100 | [diff] [blame] | 314 | 	phy_data->phy_mode = efx->phy_mode; | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 315 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 316 | 	if (!(efx->phy_mode & PHY_MODE_SPECIAL)) { | 
 | 317 | 		if (efx->phy_type == PHY_TYPE_SFT9001A) { | 
 | 318 | 			int reg; | 
 | 319 | 			reg = mdio_clause45_read(efx, efx->mii.phy_id, | 
 | 320 | 						 MDIO_MMD_PMAPMD, | 
 | 321 | 						 PMA_PMD_XCONTROL_REG); | 
 | 322 | 			reg |= (1 << PMA_PMD_EXT_SSR_LBN); | 
 | 323 | 			mdio_clause45_write(efx, efx->mii.phy_id, | 
 | 324 | 					    MDIO_MMD_PMAPMD, | 
 | 325 | 					    PMA_PMD_XCONTROL_REG, reg); | 
 | 326 | 			mdelay(200); | 
 | 327 | 		} | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 328 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 329 | 		rc = mdio_clause45_wait_reset_mmds(efx, | 
 | 330 | 						   TENXPRESS_REQUIRED_DEVS); | 
 | 331 | 		if (rc < 0) | 
 | 332 | 			goto fail; | 
 | 333 |  | 
 | 334 | 		rc = mdio_clause45_check_mmds(efx, TENXPRESS_REQUIRED_DEVS, 0); | 
 | 335 | 		if (rc < 0) | 
 | 336 | 			goto fail; | 
 | 337 | 	} | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 338 |  | 
 | 339 | 	rc = tenxpress_init(efx); | 
 | 340 | 	if (rc < 0) | 
 | 341 | 		goto fail; | 
| Steve Hodgson | 4b98828 | 2009-01-29 17:50:51 +0000 | [diff] [blame] | 342 | 	mdio_clause45_set_pause(efx); | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 343 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 344 | 	if (efx->phy_type == PHY_TYPE_SFT9001B) { | 
 | 345 | 		rc = device_create_file(&efx->pci_dev->dev, | 
 | 346 | 					&dev_attr_phy_short_reach); | 
 | 347 | 		if (rc) | 
 | 348 | 			goto fail; | 
 | 349 | 	} | 
 | 350 |  | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 351 | 	schedule_timeout_uninterruptible(HZ / 5); /* 200ms */ | 
 | 352 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 353 | 	/* Let XGXS and SerDes out of reset */ | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 354 | 	falcon_reset_xaui(efx); | 
 | 355 |  | 
 | 356 | 	return 0; | 
 | 357 |  | 
 | 358 |  fail: | 
 | 359 | 	kfree(efx->phy_data); | 
 | 360 | 	efx->phy_data = NULL; | 
 | 361 | 	return rc; | 
 | 362 | } | 
 | 363 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 364 | /* Perform a "special software reset" on the PHY. The caller is | 
 | 365 |  * responsible for saving and restoring the PHY hardware registers | 
 | 366 |  * properly, and masking/unmasking LASI */ | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 367 | static int tenxpress_special_reset(struct efx_nic *efx) | 
 | 368 | { | 
 | 369 | 	int rc, reg; | 
 | 370 |  | 
| Ben Hutchings | c8fcc49 | 2008-09-01 12:49:25 +0100 | [diff] [blame] | 371 | 	/* The XGMAC clock is driven from the SFC7101/SFT9001 312MHz clock, so | 
 | 372 | 	 * a special software reset can glitch the XGMAC sufficiently for stats | 
| Ben Hutchings | 1974cc2 | 2009-01-29 18:00:07 +0000 | [diff] [blame] | 373 | 	 * requests to fail. */ | 
 | 374 | 	efx_stats_disable(efx); | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 375 |  | 
 | 376 | 	/* Initiate reset */ | 
 | 377 | 	reg = mdio_clause45_read(efx, efx->mii.phy_id, | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 378 | 				 MDIO_MMD_PMAPMD, PMA_PMD_XCONTROL_REG); | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 379 | 	reg |= (1 << PMA_PMD_EXT_SSR_LBN); | 
 | 380 | 	mdio_clause45_write(efx, efx->mii.phy_id, MDIO_MMD_PMAPMD, | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 381 | 			    PMA_PMD_XCONTROL_REG, reg); | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 382 |  | 
| Ben Hutchings | c8fcc49 | 2008-09-01 12:49:25 +0100 | [diff] [blame] | 383 | 	mdelay(200); | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 384 |  | 
 | 385 | 	/* Wait for the blocks to come out of reset */ | 
 | 386 | 	rc = mdio_clause45_wait_reset_mmds(efx, | 
 | 387 | 					   TENXPRESS_REQUIRED_DEVS); | 
 | 388 | 	if (rc < 0) | 
| Ben Hutchings | 1974cc2 | 2009-01-29 18:00:07 +0000 | [diff] [blame] | 389 | 		goto out; | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 390 |  | 
 | 391 | 	/* Try and reconfigure the device */ | 
 | 392 | 	rc = tenxpress_init(efx); | 
 | 393 | 	if (rc < 0) | 
| Ben Hutchings | 1974cc2 | 2009-01-29 18:00:07 +0000 | [diff] [blame] | 394 | 		goto out; | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 395 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 396 | 	/* Wait for the XGXS state machine to churn */ | 
 | 397 | 	mdelay(10); | 
| Ben Hutchings | 1974cc2 | 2009-01-29 18:00:07 +0000 | [diff] [blame] | 398 | out: | 
 | 399 | 	efx_stats_enable(efx); | 
| Ben Hutchings | c8fcc49 | 2008-09-01 12:49:25 +0100 | [diff] [blame] | 400 | 	return rc; | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 401 | } | 
 | 402 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 403 | static void sfx7101_check_bad_lp(struct efx_nic *efx, bool link_ok) | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 404 | { | 
 | 405 | 	struct tenxpress_phy_data *pd = efx->phy_data; | 
| Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 406 | 	int phy_id = efx->mii.phy_id; | 
 | 407 | 	bool bad_lp; | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 408 | 	int reg; | 
 | 409 |  | 
| Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 410 | 	if (link_ok) { | 
 | 411 | 		bad_lp = false; | 
 | 412 | 	} else { | 
 | 413 | 		/* Check that AN has started but not completed. */ | 
 | 414 | 		reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN, | 
 | 415 | 					 MDIO_AN_STATUS); | 
 | 416 | 		if (!(reg & (1 << MDIO_AN_STATUS_LP_AN_CAP_LBN))) | 
 | 417 | 			return; /* LP status is unknown */ | 
 | 418 | 		bad_lp = !(reg & (1 << MDIO_AN_STATUS_AN_DONE_LBN)); | 
 | 419 | 		if (bad_lp) | 
 | 420 | 			pd->bad_lp_tries++; | 
 | 421 | 	} | 
 | 422 |  | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 423 | 	/* Nothing to do if all is well and was previously so. */ | 
| Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 424 | 	if (!pd->bad_lp_tries) | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 425 | 		return; | 
 | 426 |  | 
| Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 427 | 	/* Use the RX (red) LED as an error indicator once we've seen AN | 
 | 428 | 	 * failure several times in a row, and also log a message. */ | 
 | 429 | 	if (!bad_lp || pd->bad_lp_tries == MAX_BAD_LP_TRIES) { | 
 | 430 | 		reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD, | 
 | 431 | 					 PMA_PMD_LED_OVERR_REG); | 
 | 432 | 		reg &= ~(PMA_PMD_LED_MASK << PMA_PMD_LED_RX_LBN); | 
 | 433 | 		if (!bad_lp) { | 
 | 434 | 			reg |= PMA_PMD_LED_OFF << PMA_PMD_LED_RX_LBN; | 
 | 435 | 		} else { | 
 | 436 | 			reg |= PMA_PMD_LED_FLASH << PMA_PMD_LED_RX_LBN; | 
 | 437 | 			EFX_ERR(efx, "appears to be plugged into a port" | 
 | 438 | 				" that is not 10GBASE-T capable. The PHY" | 
 | 439 | 				" supports 10GBASE-T ONLY, so no link can" | 
 | 440 | 				" be established\n"); | 
 | 441 | 		} | 
 | 442 | 		mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD, | 
 | 443 | 				    PMA_PMD_LED_OVERR_REG, reg); | 
 | 444 | 		pd->bad_lp_tries = bad_lp; | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 445 | 	} | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 446 | } | 
 | 447 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 448 | static bool sfx7101_link_ok(struct efx_nic *efx) | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 449 | { | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 450 | 	return mdio_clause45_links_ok(efx, | 
 | 451 | 				      MDIO_MMDREG_DEVS_PMAPMD | | 
 | 452 | 				      MDIO_MMDREG_DEVS_PCS | | 
 | 453 | 				      MDIO_MMDREG_DEVS_PHYXS); | 
 | 454 | } | 
 | 455 |  | 
 | 456 | static bool sft9001_link_ok(struct efx_nic *efx, struct ethtool_cmd *ecmd) | 
 | 457 | { | 
 | 458 | 	int phy_id = efx->mii.phy_id; | 
 | 459 | 	u32 reg; | 
 | 460 |  | 
| Ben Hutchings | caa8d8b | 2008-12-26 13:46:12 -0800 | [diff] [blame] | 461 | 	if (efx_phy_mode_disabled(efx->phy_mode)) | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 462 | 		return false; | 
| Ben Hutchings | caa8d8b | 2008-12-26 13:46:12 -0800 | [diff] [blame] | 463 | 	else if (efx->loopback_mode == LOOPBACK_GPHY) | 
 | 464 | 		return true; | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 465 | 	else if (efx->loopback_mode) | 
| Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 466 | 		return mdio_clause45_links_ok(efx, | 
 | 467 | 					      MDIO_MMDREG_DEVS_PMAPMD | | 
| Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 468 | 					      MDIO_MMDREG_DEVS_PHYXS); | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 469 |  | 
 | 470 | 	/* We must use the same definition of link state as LASI, | 
 | 471 | 	 * otherwise we can miss a link state transition | 
 | 472 | 	 */ | 
 | 473 | 	if (ecmd->speed == 10000) { | 
 | 474 | 		reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PCS, | 
 | 475 | 					 PCS_10GBASET_STAT1); | 
 | 476 | 		return reg & (1 << PCS_10GBASET_BLKLK_LBN); | 
 | 477 | 	} else { | 
 | 478 | 		reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_C22EXT, | 
 | 479 | 					 C22EXT_STATUS_REG); | 
 | 480 | 		return reg & (1 << C22EXT_STATUS_LINK_LBN); | 
 | 481 | 	} | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 482 | } | 
 | 483 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 484 | static void tenxpress_ext_loopback(struct efx_nic *efx) | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 485 | { | 
 | 486 | 	int phy_id = efx->mii.phy_id; | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 487 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 488 | 	mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_PHYXS, | 
 | 489 | 			       PHYXS_TEST1, LOOPBACK_NEAR_LBN, | 
 | 490 | 			       efx->loopback_mode == LOOPBACK_PHYXS); | 
 | 491 | 	if (efx->phy_type != PHY_TYPE_SFX7101) | 
 | 492 | 		mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_C22EXT, | 
 | 493 | 				       GPHY_XCONTROL_REG, | 
 | 494 | 				       GPHY_LOOPBACK_NEAR_LBN, | 
 | 495 | 				       efx->loopback_mode == LOOPBACK_GPHY); | 
 | 496 | } | 
 | 497 |  | 
 | 498 | static void tenxpress_low_power(struct efx_nic *efx) | 
 | 499 | { | 
 | 500 | 	int phy_id = efx->mii.phy_id; | 
 | 501 |  | 
 | 502 | 	if (efx->phy_type == PHY_TYPE_SFX7101) | 
 | 503 | 		mdio_clause45_set_mmds_lpower( | 
 | 504 | 			efx, !!(efx->phy_mode & PHY_MODE_LOW_POWER), | 
 | 505 | 			TENXPRESS_REQUIRED_DEVS); | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 506 | 	else | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 507 | 		mdio_clause45_set_flag( | 
 | 508 | 			efx, phy_id, MDIO_MMD_PMAPMD, | 
 | 509 | 			PMA_PMD_XCONTROL_REG, PMA_PMD_EXT_LPOWER_LBN, | 
 | 510 | 			!!(efx->phy_mode & PHY_MODE_LOW_POWER)); | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 511 | } | 
 | 512 |  | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 513 | static void tenxpress_phy_reconfigure(struct efx_nic *efx) | 
 | 514 | { | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 515 | 	struct tenxpress_phy_data *phy_data = efx->phy_data; | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 516 | 	struct ethtool_cmd ecmd; | 
| Steve Hodgson | 8b9dc8d | 2009-01-29 17:49:09 +0000 | [diff] [blame] | 517 | 	bool phy_mode_change, loop_reset; | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 518 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 519 | 	if (efx->phy_mode & (PHY_MODE_OFF | PHY_MODE_SPECIAL)) { | 
| Ben Hutchings | f8b87c1 | 2008-09-01 12:48:17 +0100 | [diff] [blame] | 520 | 		phy_data->phy_mode = efx->phy_mode; | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 521 | 		return; | 
| Ben Hutchings | f8b87c1 | 2008-09-01 12:48:17 +0100 | [diff] [blame] | 522 | 	} | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 523 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 524 | 	tenxpress_low_power(efx); | 
 | 525 |  | 
 | 526 | 	phy_mode_change = (efx->phy_mode == PHY_MODE_NORMAL && | 
 | 527 | 			   phy_data->phy_mode != PHY_MODE_NORMAL); | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 528 | 	loop_reset = (LOOPBACK_OUT_OF(phy_data, efx, efx->phy_op->loopbacks) || | 
 | 529 | 		      LOOPBACK_CHANGED(phy_data, efx, 1 << LOOPBACK_GPHY)); | 
 | 530 |  | 
| Steve Hodgson | 8b9dc8d | 2009-01-29 17:49:09 +0000 | [diff] [blame] | 531 | 	if (loop_reset || phy_mode_change) { | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 532 | 		int rc; | 
 | 533 |  | 
 | 534 | 		efx->phy_op->get_settings(efx, &ecmd); | 
 | 535 |  | 
 | 536 | 		if (loop_reset || phy_mode_change) { | 
 | 537 | 			tenxpress_special_reset(efx); | 
 | 538 |  | 
 | 539 | 			/* Reset XAUI if we were in 10G, and are staying | 
 | 540 | 			 * in 10G. If we're moving into and out of 10G | 
 | 541 | 			 * then xaui will be reset anyway */ | 
 | 542 | 			if (EFX_IS10G(efx)) | 
 | 543 | 				falcon_reset_xaui(efx); | 
 | 544 | 		} | 
 | 545 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 546 | 		rc = efx->phy_op->set_settings(efx, &ecmd); | 
 | 547 | 		WARN_ON(rc); | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 548 | 	} | 
 | 549 |  | 
 | 550 | 	mdio_clause45_transmit_disable(efx); | 
 | 551 | 	mdio_clause45_phy_reconfigure(efx); | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 552 | 	tenxpress_ext_loopback(efx); | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 553 |  | 
| Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 554 | 	phy_data->loopback_mode = efx->loopback_mode; | 
| Ben Hutchings | f8b87c1 | 2008-09-01 12:48:17 +0100 | [diff] [blame] | 555 | 	phy_data->phy_mode = efx->phy_mode; | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 556 |  | 
 | 557 | 	if (efx->phy_type == PHY_TYPE_SFX7101) { | 
 | 558 | 		efx->link_speed = 10000; | 
 | 559 | 		efx->link_fd = true; | 
 | 560 | 		efx->link_up = sfx7101_link_ok(efx); | 
 | 561 | 	} else { | 
 | 562 | 		efx->phy_op->get_settings(efx, &ecmd); | 
 | 563 | 		efx->link_speed = ecmd.speed; | 
 | 564 | 		efx->link_fd = ecmd.duplex == DUPLEX_FULL; | 
 | 565 | 		efx->link_up = sft9001_link_ok(efx, &ecmd); | 
 | 566 | 	} | 
| Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 567 | 	efx->link_fc = mdio_clause45_get_pause(efx); | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 568 | } | 
 | 569 |  | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 570 | /* Poll PHY for interrupt */ | 
| Ben Hutchings | 766ca0f | 2008-12-12 21:59:24 -0800 | [diff] [blame] | 571 | static void tenxpress_phy_poll(struct efx_nic *efx) | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 572 | { | 
 | 573 | 	struct tenxpress_phy_data *phy_data = efx->phy_data; | 
| Ben Hutchings | 766ca0f | 2008-12-12 21:59:24 -0800 | [diff] [blame] | 574 | 	bool change = false, link_ok; | 
 | 575 | 	unsigned link_fc; | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 576 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 577 | 	if (efx->phy_type == PHY_TYPE_SFX7101) { | 
 | 578 | 		link_ok = sfx7101_link_ok(efx); | 
 | 579 | 		if (link_ok != efx->link_up) { | 
 | 580 | 			change = true; | 
 | 581 | 		} else { | 
 | 582 | 			link_fc = mdio_clause45_get_pause(efx); | 
 | 583 | 			if (link_fc != efx->link_fc) | 
 | 584 | 				change = true; | 
 | 585 | 		} | 
 | 586 | 		sfx7101_check_bad_lp(efx, link_ok); | 
| Ben Hutchings | caa8d8b | 2008-12-26 13:46:12 -0800 | [diff] [blame] | 587 | 	} else if (efx->loopback_mode) { | 
 | 588 | 		bool link_ok = sft9001_link_ok(efx, NULL); | 
 | 589 | 		if (link_ok != efx->link_up) | 
 | 590 | 			change = true; | 
| Ben Hutchings | 766ca0f | 2008-12-12 21:59:24 -0800 | [diff] [blame] | 591 | 	} else { | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 592 | 		u32 status = mdio_clause45_read(efx, efx->mii.phy_id, | 
 | 593 | 						MDIO_MMD_PMAPMD, | 
 | 594 | 						PMA_PMD_LASI_STATUS); | 
 | 595 | 		if (status & (1 << PMA_PMD_LS_ALARM_LBN)) | 
| Ben Hutchings | 766ca0f | 2008-12-12 21:59:24 -0800 | [diff] [blame] | 596 | 			change = true; | 
 | 597 | 	} | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 598 |  | 
| Ben Hutchings | 766ca0f | 2008-12-12 21:59:24 -0800 | [diff] [blame] | 599 | 	if (change) | 
| Ben Hutchings | 177dfcd | 2008-12-12 21:50:08 -0800 | [diff] [blame] | 600 | 		falcon_sim_phy_event(efx); | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 601 |  | 
| Ben Hutchings | f8b87c1 | 2008-09-01 12:48:17 +0100 | [diff] [blame] | 602 | 	if (phy_data->phy_mode != PHY_MODE_NORMAL) | 
| Ben Hutchings | 766ca0f | 2008-12-12 21:59:24 -0800 | [diff] [blame] | 603 | 		return; | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 604 | } | 
 | 605 |  | 
 | 606 | static void tenxpress_phy_fini(struct efx_nic *efx) | 
 | 607 | { | 
 | 608 | 	int reg; | 
 | 609 |  | 
| Ben Hutchings | 2a7e637 | 2009-01-11 00:18:13 -0800 | [diff] [blame] | 610 | 	if (efx->phy_type == PHY_TYPE_SFT9001B) | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 611 | 		device_remove_file(&efx->pci_dev->dev, | 
 | 612 | 				   &dev_attr_phy_short_reach); | 
| Ben Hutchings | 2a7e637 | 2009-01-11 00:18:13 -0800 | [diff] [blame] | 613 |  | 
 | 614 | 	if (efx->phy_type == PHY_TYPE_SFX7101) { | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 615 | 		/* Power down the LNPGA */ | 
 | 616 | 		reg = (1 << PMA_PMD_LNPGA_POWERDOWN_LBN); | 
 | 617 | 		mdio_clause45_write(efx, efx->mii.phy_id, MDIO_MMD_PMAPMD, | 
 | 618 | 				    PMA_PMD_XCONTROL_REG, reg); | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 619 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 620 | 		/* Waiting here ensures that the board fini, which can turn | 
 | 621 | 		 * off the power to the PHY, won't get run until the LNPGA | 
 | 622 | 		 * powerdown has been given long enough to complete. */ | 
 | 623 | 		schedule_timeout_uninterruptible(LNPGA_PDOWN_WAIT); /* 200 ms */ | 
 | 624 | 	} | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 625 |  | 
 | 626 | 	kfree(efx->phy_data); | 
 | 627 | 	efx->phy_data = NULL; | 
 | 628 | } | 
 | 629 |  | 
 | 630 |  | 
 | 631 | /* Set the RX and TX LEDs and Link LED flashing. The other LEDs | 
 | 632 |  * (which probably aren't wired anyway) are left in AUTO mode */ | 
| Ben Hutchings | dc8cfa5 | 2008-09-01 12:46:50 +0100 | [diff] [blame] | 633 | void tenxpress_phy_blink(struct efx_nic *efx, bool blink) | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 634 | { | 
 | 635 | 	int reg; | 
 | 636 |  | 
 | 637 | 	if (blink) | 
 | 638 | 		reg = (PMA_PMD_LED_FLASH << PMA_PMD_LED_TX_LBN) | | 
 | 639 | 			(PMA_PMD_LED_FLASH << PMA_PMD_LED_RX_LBN) | | 
 | 640 | 			(PMA_PMD_LED_FLASH << PMA_PMD_LED_LINK_LBN); | 
 | 641 | 	else | 
 | 642 | 		reg = PMA_PMD_LED_DEFAULT; | 
 | 643 |  | 
 | 644 | 	mdio_clause45_write(efx, efx->mii.phy_id, MDIO_MMD_PMAPMD, | 
 | 645 | 			    PMA_PMD_LED_OVERR_REG, reg); | 
 | 646 | } | 
 | 647 |  | 
| Ben Hutchings | 307505e | 2008-12-26 13:48:00 -0800 | [diff] [blame] | 648 | static const char *const sfx7101_test_names[] = { | 
| Ben Hutchings | 1796721 | 2008-12-26 13:47:25 -0800 | [diff] [blame] | 649 | 	"bist" | 
 | 650 | }; | 
 | 651 |  | 
 | 652 | static int | 
| Ben Hutchings | 307505e | 2008-12-26 13:48:00 -0800 | [diff] [blame] | 653 | sfx7101_run_tests(struct efx_nic *efx, int *results, unsigned flags) | 
| Ben Hutchings | 8c8661e | 2008-09-01 12:49:02 +0100 | [diff] [blame] | 654 | { | 
| Ben Hutchings | 1796721 | 2008-12-26 13:47:25 -0800 | [diff] [blame] | 655 | 	int rc; | 
 | 656 |  | 
 | 657 | 	if (!(flags & ETH_TEST_FL_OFFLINE)) | 
 | 658 | 		return 0; | 
 | 659 |  | 
| Ben Hutchings | 8c8661e | 2008-09-01 12:49:02 +0100 | [diff] [blame] | 660 | 	/* BIST is automatically run after a special software reset */ | 
| Ben Hutchings | 1796721 | 2008-12-26 13:47:25 -0800 | [diff] [blame] | 661 | 	rc = tenxpress_special_reset(efx); | 
 | 662 | 	results[0] = rc ? -1 : 1; | 
 | 663 | 	return rc; | 
| Ben Hutchings | 8c8661e | 2008-09-01 12:49:02 +0100 | [diff] [blame] | 664 | } | 
 | 665 |  | 
| Ben Hutchings | 307505e | 2008-12-26 13:48:00 -0800 | [diff] [blame] | 666 | static const char *const sft9001_test_names[] = { | 
 | 667 | 	"bist", | 
 | 668 | 	"cable.pairA.status", | 
 | 669 | 	"cable.pairB.status", | 
 | 670 | 	"cable.pairC.status", | 
 | 671 | 	"cable.pairD.status", | 
 | 672 | 	"cable.pairA.length", | 
 | 673 | 	"cable.pairB.length", | 
 | 674 | 	"cable.pairC.length", | 
 | 675 | 	"cable.pairD.length", | 
 | 676 | }; | 
 | 677 |  | 
 | 678 | static int sft9001_run_tests(struct efx_nic *efx, int *results, unsigned flags) | 
 | 679 | { | 
 | 680 | 	struct ethtool_cmd ecmd; | 
 | 681 | 	int phy_id = efx->mii.phy_id; | 
 | 682 | 	int rc = 0, rc2, i, res_reg; | 
 | 683 |  | 
 | 684 | 	if (!(flags & ETH_TEST_FL_OFFLINE)) | 
 | 685 | 		return 0; | 
 | 686 |  | 
 | 687 | 	efx->phy_op->get_settings(efx, &ecmd); | 
 | 688 |  | 
 | 689 | 	/* Initialise cable diagnostic results to unknown failure */ | 
 | 690 | 	for (i = 1; i < 9; ++i) | 
 | 691 | 		results[i] = -1; | 
 | 692 |  | 
 | 693 | 	/* Run cable diagnostics; wait up to 5 seconds for them to complete. | 
 | 694 | 	 * A cable fault is not a self-test failure, but a timeout is. */ | 
 | 695 | 	mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD, | 
 | 696 | 			    PMA_PMD_CDIAG_CTRL_REG, | 
 | 697 | 			    (1 << CDIAG_CTRL_IMMED_LBN) | | 
 | 698 | 			    (1 << CDIAG_CTRL_BRK_LINK_LBN) | | 
 | 699 | 			    (CDIAG_CTRL_LEN_METRES << CDIAG_CTRL_LEN_UNIT_LBN)); | 
 | 700 | 	i = 0; | 
 | 701 | 	while (mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD, | 
 | 702 | 				  PMA_PMD_CDIAG_CTRL_REG) & | 
 | 703 | 	       (1 << CDIAG_CTRL_IN_PROG_LBN)) { | 
 | 704 | 		if (++i == 50) { | 
 | 705 | 			rc = -ETIMEDOUT; | 
 | 706 | 			goto reset; | 
 | 707 | 		} | 
 | 708 | 		msleep(100); | 
 | 709 | 	} | 
 | 710 | 	res_reg = mdio_clause45_read(efx, efx->mii.phy_id, MDIO_MMD_PMAPMD, | 
 | 711 | 				     PMA_PMD_CDIAG_RES_REG); | 
 | 712 | 	for (i = 0; i < 4; i++) { | 
 | 713 | 		int pair_res = | 
 | 714 | 			(res_reg >> (CDIAG_RES_A_LBN - i * CDIAG_RES_WIDTH)) | 
 | 715 | 			& ((1 << CDIAG_RES_WIDTH) - 1); | 
 | 716 | 		int len_reg = mdio_clause45_read(efx, efx->mii.phy_id, | 
 | 717 | 						 MDIO_MMD_PMAPMD, | 
 | 718 | 						 PMA_PMD_CDIAG_LEN_REG + i); | 
 | 719 | 		if (pair_res == CDIAG_RES_OK) | 
 | 720 | 			results[1 + i] = 1; | 
 | 721 | 		else if (pair_res == CDIAG_RES_INVALID) | 
 | 722 | 			results[1 + i] = -1; | 
 | 723 | 		else | 
 | 724 | 			results[1 + i] = -pair_res; | 
 | 725 | 		if (pair_res != CDIAG_RES_INVALID && | 
 | 726 | 		    pair_res != CDIAG_RES_OPEN && | 
 | 727 | 		    len_reg != 0xffff) | 
 | 728 | 			results[5 + i] = len_reg; | 
 | 729 | 	} | 
 | 730 |  | 
 | 731 | 	/* We must reset to exit cable diagnostic mode.  The BIST will | 
 | 732 | 	 * also run when we do this. */ | 
 | 733 | reset: | 
 | 734 | 	rc2 = tenxpress_special_reset(efx); | 
 | 735 | 	results[0] = rc2 ? -1 : 1; | 
 | 736 | 	if (!rc) | 
 | 737 | 		rc = rc2; | 
 | 738 |  | 
 | 739 | 	rc2 = efx->phy_op->set_settings(efx, &ecmd); | 
 | 740 | 	if (!rc) | 
 | 741 | 		rc = rc2; | 
 | 742 |  | 
 | 743 | 	return rc; | 
 | 744 | } | 
 | 745 |  | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 746 | static void | 
 | 747 | tenxpress_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) | 
| Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 748 | { | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 749 | 	int phy_id = efx->mii.phy_id; | 
 | 750 | 	u32 adv = 0, lpa = 0; | 
| Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 751 | 	int reg; | 
 | 752 |  | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 753 | 	if (efx->phy_type != PHY_TYPE_SFX7101) { | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 754 | 		reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_C22EXT, | 
 | 755 | 					 C22EXT_MSTSLV_CTRL); | 
 | 756 | 		if (reg & (1 << C22EXT_MSTSLV_CTRL_ADV_1000_FD_LBN)) | 
 | 757 | 			adv |= ADVERTISED_1000baseT_Full; | 
 | 758 | 		reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_C22EXT, | 
 | 759 | 					 C22EXT_MSTSLV_STATUS); | 
 | 760 | 		if (reg & (1 << C22EXT_MSTSLV_STATUS_LP_1000_HD_LBN)) | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 761 | 			lpa |= ADVERTISED_1000baseT_Half; | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 762 | 		if (reg & (1 << C22EXT_MSTSLV_STATUS_LP_1000_FD_LBN)) | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 763 | 			lpa |= ADVERTISED_1000baseT_Full; | 
 | 764 | 	} | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 765 | 	reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN, | 
 | 766 | 				 MDIO_AN_10GBT_CTRL); | 
 | 767 | 	if (reg & (1 << MDIO_AN_10GBT_CTRL_ADV_10G_LBN)) | 
 | 768 | 		adv |= ADVERTISED_10000baseT_Full; | 
 | 769 | 	reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN, | 
 | 770 | 				 MDIO_AN_10GBT_STATUS); | 
| Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 771 | 	if (reg & (1 << MDIO_AN_10GBT_STATUS_LP_10G_LBN)) | 
 | 772 | 		lpa |= ADVERTISED_10000baseT_Full; | 
| Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 773 |  | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 774 | 	mdio_clause45_get_settings_ext(efx, ecmd, adv, lpa); | 
| Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 775 |  | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 776 | 	if (efx->phy_type != PHY_TYPE_SFX7101) | 
 | 777 | 		ecmd->supported |= (SUPPORTED_100baseT_Full | | 
 | 778 | 				    SUPPORTED_1000baseT_Full); | 
| Steve Hodgson | 8b9dc8d | 2009-01-29 17:49:09 +0000 | [diff] [blame] | 779 |  | 
 | 780 | 	/* In loopback, the PHY automatically brings up the correct interface, | 
 | 781 | 	 * but doesn't advertise the correct speed. So override it */ | 
 | 782 | 	if (efx->loopback_mode == LOOPBACK_GPHY) | 
 | 783 | 		ecmd->speed = SPEED_1000; | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 784 | 	else if (LOOPBACK_MASK(efx) & efx->phy_op->loopbacks) | 
| Steve Hodgson | 8b9dc8d | 2009-01-29 17:49:09 +0000 | [diff] [blame] | 785 | 		ecmd->speed = SPEED_10000; | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 786 | } | 
 | 787 |  | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 788 | static int tenxpress_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 789 | { | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 790 | 	if (!ecmd->autoneg) | 
 | 791 | 		return -EINVAL; | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 792 |  | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 793 | 	return mdio_clause45_set_settings(efx, ecmd); | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 794 | } | 
 | 795 |  | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 796 | static void sfx7101_set_npage_adv(struct efx_nic *efx, u32 advertising) | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 797 | { | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 798 | 	mdio_clause45_set_flag(efx, efx->mii.phy_id, MDIO_MMD_AN, | 
 | 799 | 			       MDIO_AN_10GBT_CTRL, | 
 | 800 | 			       MDIO_AN_10GBT_CTRL_ADV_10G_LBN, | 
 | 801 | 			       advertising & ADVERTISED_10000baseT_Full); | 
 | 802 | } | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 803 |  | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 804 | static void sft9001_set_npage_adv(struct efx_nic *efx, u32 advertising) | 
 | 805 | { | 
 | 806 | 	int phy_id = efx->mii.phy_id; | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 807 |  | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 808 | 	mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_C22EXT, | 
 | 809 | 			       C22EXT_MSTSLV_CTRL, | 
 | 810 | 			       C22EXT_MSTSLV_CTRL_ADV_1000_FD_LBN, | 
 | 811 | 			       advertising & ADVERTISED_1000baseT_Full); | 
 | 812 | 	mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_AN, | 
 | 813 | 			       MDIO_AN_10GBT_CTRL, | 
 | 814 | 			       MDIO_AN_10GBT_CTRL_ADV_10G_LBN, | 
 | 815 | 			       advertising & ADVERTISED_10000baseT_Full); | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 816 | } | 
 | 817 |  | 
 | 818 | struct efx_phy_operations falcon_sfx7101_phy_ops = { | 
| Ben Hutchings | 177dfcd | 2008-12-12 21:50:08 -0800 | [diff] [blame] | 819 | 	.macs		  = EFX_XMAC, | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 820 | 	.init             = tenxpress_phy_init, | 
 | 821 | 	.reconfigure      = tenxpress_phy_reconfigure, | 
| Ben Hutchings | 766ca0f | 2008-12-12 21:59:24 -0800 | [diff] [blame] | 822 | 	.poll             = tenxpress_phy_poll, | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 823 | 	.fini             = tenxpress_phy_fini, | 
| Ben Hutchings | 766ca0f | 2008-12-12 21:59:24 -0800 | [diff] [blame] | 824 | 	.clear_interrupt  = efx_port_dummy_op_void, | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 825 | 	.get_settings	  = tenxpress_get_settings, | 
 | 826 | 	.set_settings	  = tenxpress_set_settings, | 
 | 827 | 	.set_npage_adv    = sfx7101_set_npage_adv, | 
| Ben Hutchings | 307505e | 2008-12-26 13:48:00 -0800 | [diff] [blame] | 828 | 	.num_tests	  = ARRAY_SIZE(sfx7101_test_names), | 
 | 829 | 	.test_names	  = sfx7101_test_names, | 
 | 830 | 	.run_tests	  = sfx7101_run_tests, | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 831 | 	.mmds             = TENXPRESS_REQUIRED_DEVS, | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 832 | 	.loopbacks        = SFX7101_LOOPBACKS, | 
 | 833 | }; | 
 | 834 |  | 
 | 835 | struct efx_phy_operations falcon_sft9001_phy_ops = { | 
 | 836 | 	.macs		  = EFX_GMAC | EFX_XMAC, | 
 | 837 | 	.init             = tenxpress_phy_init, | 
 | 838 | 	.reconfigure      = tenxpress_phy_reconfigure, | 
 | 839 | 	.poll             = tenxpress_phy_poll, | 
 | 840 | 	.fini             = tenxpress_phy_fini, | 
 | 841 | 	.clear_interrupt  = efx_port_dummy_op_void, | 
| Ben Hutchings | af4ad9b | 2009-01-29 17:59:37 +0000 | [diff] [blame] | 842 | 	.get_settings	  = tenxpress_get_settings, | 
 | 843 | 	.set_settings	  = tenxpress_set_settings, | 
 | 844 | 	.set_npage_adv    = sft9001_set_npage_adv, | 
| Ben Hutchings | 307505e | 2008-12-26 13:48:00 -0800 | [diff] [blame] | 845 | 	.num_tests	  = ARRAY_SIZE(sft9001_test_names), | 
 | 846 | 	.test_names	  = sft9001_test_names, | 
 | 847 | 	.run_tests	  = sft9001_run_tests, | 
| Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 848 | 	.mmds             = TENXPRESS_REQUIRED_DEVS, | 
 | 849 | 	.loopbacks        = SFT9001_LOOPBACKS, | 
| Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 850 | }; |