1 From: Jesse Brandeburg <jesse.brandeburg@intel.com>
2 Date: Fri, 31 Oct 2008 07:46:40 +0000 (-0700)
3 Subject: ixgbe: add device support for 82598AT (copper 10GbE) adapters
4 X-Git-Url: http://gitlad.jf.intel.com/git/?p=davem%2Fnet-next-2.6%2F.git;a=commitdiff_plain;h=0befdb3e0a26a8949063915274e1bec8873c526b
5 Acked-by: Karsten Keil <kkeil@novell.com>
8 ixgbe: add device support for 82598AT (copper 10GbE) adapters
10 Intel is currently shipping support for adapters with a phy
11 that does 10GBase-T (copper), which is 10 Gigabit ethernet
12 over standard Category 6 cabling.
14 Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
15 Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
16 Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
19 Index: linux-2.6.27/drivers/net/ixgbe/ixgbe.h
20 ===================================================================
21 --- linux-2.6.27.orig/drivers/net/ixgbe/ixgbe.h
22 +++ linux-2.6.27/drivers/net/ixgbe/ixgbe.h
23 @@ -282,6 +282,7 @@ struct ixgbe_adapter {
24 #define IXGBE_FLAG_RSS_CAPABLE (u32)(1 << 17)
25 #define IXGBE_FLAG_VMDQ_CAPABLE (u32)(1 << 18)
26 #define IXGBE_FLAG_VMDQ_ENABLED (u32)(1 << 19)
27 +#define IXGBE_FLAG_FAN_FAIL_CAPABLE (u32)(1 << 20)
28 #define IXGBE_FLAG_NEED_LINK_UPDATE (u32)(1 << 22)
29 #define IXGBE_FLAG_IN_WATCHDOG_TASK (u32)(1 << 23)
30 #define IXGBE_FLAG_DCB_ENABLED (u32)(1 << 24)
31 Index: linux-2.6.27/drivers/net/ixgbe/ixgbe_82598.c
32 ===================================================================
33 --- linux-2.6.27.orig/drivers/net/ixgbe/ixgbe_82598.c
34 +++ linux-2.6.27/drivers/net/ixgbe/ixgbe_82598.c
35 @@ -59,6 +59,11 @@ static s32 ixgbe_get_invariants_82598(st
40 + phy->ops.check_link = &ixgbe_check_phy_link_tnx;
41 + phy->ops.get_firmware_version =
42 + &ixgbe_get_phy_firmware_version_tnx;
47 @@ -189,6 +194,9 @@ static enum ixgbe_media_type ixgbe_get_m
48 case IXGBE_DEV_ID_82598EB_XF_LR:
49 media_type = ixgbe_media_type_fiber;
51 + case IXGBE_DEV_ID_82598AT:
52 + media_type = ixgbe_media_type_copper;
55 media_type = ixgbe_media_type_unknown;
57 @@ -872,6 +880,10 @@ s32 ixgbe_get_supported_physical_layer_8
58 case IXGBE_DEV_ID_82598EB_XF_LR:
59 physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_LR;
61 + case IXGBE_DEV_ID_82598AT:
62 + physical_layer = (IXGBE_PHYSICAL_LAYER_10GBASE_T |
63 + IXGBE_PHYSICAL_LAYER_1000BASE_T);
67 physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN;
68 Index: linux-2.6.27/drivers/net/ixgbe/ixgbe_ethtool.c
69 ===================================================================
70 --- linux-2.6.27.orig/drivers/net/ixgbe/ixgbe_ethtool.c
71 +++ linux-2.6.27/drivers/net/ixgbe/ixgbe_ethtool.c
72 @@ -160,6 +160,8 @@ static int ixgbe_set_settings(struct net
74 struct ixgbe_adapter *adapter = netdev_priv(netdev);
75 struct ixgbe_hw *hw = &adapter->hw;
76 + u32 advertised, old;
79 switch (hw->phy.media_type) {
80 case ixgbe_media_type_fiber:
81 @@ -168,6 +170,31 @@ static int ixgbe_set_settings(struct net
83 /* in this case we currently only support 10Gb/FULL */
85 + case ixgbe_media_type_copper:
86 + /* 10000/copper and 1000/copper must autoneg
87 + * this function does not support any duplex forcing, but can
88 + * limit the advertising of the adapter to only 10000 or 1000 */
89 + if (ecmd->autoneg == AUTONEG_DISABLE)
92 + old = hw->phy.autoneg_advertised;
94 + if (ecmd->advertising & ADVERTISED_10000baseT_Full)
95 + advertised |= IXGBE_LINK_SPEED_10GB_FULL;
97 + if (ecmd->advertising & ADVERTISED_1000baseT_Full)
98 + advertised |= IXGBE_LINK_SPEED_1GB_FULL;
100 + if (old == advertised)
102 + /* this sets the link speed and restarts auto-neg */
103 + err = hw->mac.ops.setup_link_speed(hw, advertised, true, true);
105 + DPRINTK(PROBE, INFO,
106 + "setup link failed with code %d\n", err);
107 + hw->mac.ops.setup_link_speed(hw, old, true, true);
113 Index: linux-2.6.27/drivers/net/ixgbe/ixgbe_main.c
114 ===================================================================
115 --- linux-2.6.27.orig/drivers/net/ixgbe/ixgbe_main.c
116 +++ linux-2.6.27/drivers/net/ixgbe/ixgbe_main.c
117 @@ -68,6 +68,8 @@ static struct pci_device_id ixgbe_pci_tb
119 {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598AF_SINGLE_PORT),
121 + {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598AT),
123 {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598EB_CX4),
125 {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598_CX4_DUAL_PORT),
126 @@ -910,6 +912,17 @@ static void ixgbe_set_itr_msix(struct ix
130 +static void ixgbe_check_fan_failure(struct ixgbe_adapter *adapter, u32 eicr)
132 + struct ixgbe_hw *hw = &adapter->hw;
134 + if ((adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) &&
135 + (eicr & IXGBE_EICR_GPI_SDP1)) {
136 + DPRINTK(PROBE, CRIT, "Fan has stopped, replace the adapter\n");
137 + /* write to clear the interrupt */
138 + IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1);
142 static void ixgbe_check_lsc(struct ixgbe_adapter *adapter)
144 @@ -934,6 +947,8 @@ static irqreturn_t ixgbe_msix_lsc(int ir
145 if (eicr & IXGBE_EICR_LSC)
146 ixgbe_check_lsc(adapter);
148 + ixgbe_check_fan_failure(adapter, eicr);
150 if (!test_bit(__IXGBE_DOWN, &adapter->state))
151 IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMS_OTHER);
153 @@ -1322,6 +1337,8 @@ static irqreturn_t ixgbe_intr(int irq, v
154 if (eicr & IXGBE_EICR_LSC)
155 ixgbe_check_lsc(adapter);
157 + ixgbe_check_fan_failure(adapter, eicr);
159 if (netif_rx_schedule_prep(netdev, &adapter->q_vector[0].napi)) {
160 adapter->tx_ring[0].total_packets = 0;
161 adapter->tx_ring[0].total_bytes = 0;
162 @@ -1424,6 +1441,8 @@ static inline void ixgbe_irq_enable(stru
165 mask = IXGBE_EIMS_ENABLE_MASK;
166 + if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE)
167 + mask |= IXGBE_EIMS_GPI_SDP1;
168 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, mask);
169 IXGBE_WRITE_FLUSH(&adapter->hw);
171 @@ -1983,6 +2002,13 @@ static int ixgbe_up_complete(struct ixgb
172 IXGBE_WRITE_REG(hw, IXGBE_EIAM, IXGBE_EICS_RTX_QUEUE);
175 + /* Enable fan failure interrupt if media type is copper */
176 + if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) {
177 + gpie = IXGBE_READ_REG(hw, IXGBE_GPIE);
178 + gpie |= IXGBE_SDP1_GPIEN;
179 + IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);
182 mhadd = IXGBE_READ_REG(hw, IXGBE_MHADD);
183 if (max_frame != (mhadd >> IXGBE_MHADD_MFS_SHIFT)) {
184 mhadd &= ~IXGBE_MHADD_MFS_MASK;
185 @@ -2679,6 +2705,9 @@ static int __devinit ixgbe_sw_init(struc
186 rss = min(IXGBE_MAX_RSS_INDICES, (int)num_online_cpus());
187 adapter->ring_feature[RING_F_RSS].indices = rss;
188 adapter->flags |= IXGBE_FLAG_RSS_ENABLED;
189 + if (hw->mac.ops.get_media_type &&
190 + (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper))
191 + adapter->flags |= IXGBE_FLAG_FAN_FAIL_CAPABLE;
192 adapter->ring_feature[RING_F_DCB].indices = IXGBE_MAX_DCB_INDICES;
194 /* Configure DCB traffic classes */
195 @@ -3851,6 +3880,10 @@ static int ixgbe_link_config(struct ixgb
196 /* must always autoneg for both 1G and 10G link */
197 hw->mac.autoneg = true;
199 + if ((hw->mac.type == ixgbe_mac_82598EB) &&
200 + (hw->phy.media_type == ixgbe_media_type_copper))
201 + autoneg = IXGBE_LINK_SPEED_82598_AUTONEG;
203 return hw->mac.ops.setup_link_speed(hw, autoneg, true, true);
206 Index: linux-2.6.27/drivers/net/ixgbe/ixgbe_phy.c
207 ===================================================================
208 --- linux-2.6.27.orig/drivers/net/ixgbe/ixgbe_phy.c
209 +++ linux-2.6.27/drivers/net/ixgbe/ixgbe_phy.c
210 @@ -121,6 +121,9 @@ static enum ixgbe_phy_type ixgbe_get_phy
211 enum ixgbe_phy_type phy_type;
214 + case TN1010_PHY_ID:
215 + phy_type = ixgbe_phy_tn;
218 phy_type = ixgbe_phy_qt;
220 @@ -426,3 +429,68 @@ s32 ixgbe_setup_phy_link_speed_generic(s
225 + * ixgbe_check_phy_link_tnx - Determine link and speed status
226 + * @hw: pointer to hardware structure
228 + * Reads the VS1 register to determine if link is up and the current speed for
231 +s32 ixgbe_check_phy_link_tnx(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
236 + u32 max_time_out = 10;
241 + /* Initialize speed and link to default case */
243 + *speed = IXGBE_LINK_SPEED_10GB_FULL;
246 + * Check current speed and link status of the PHY register.
247 + * This is a vendor specific register and may have to
248 + * be changed for other copper PHYs.
250 + for (time_out = 0; time_out < max_time_out; time_out++) {
252 + status = hw->phy.ops.read_reg(hw,
253 + IXGBE_MDIO_VENDOR_SPECIFIC_1_STATUS,
254 + IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE,
256 + phy_link = phy_data &
257 + IXGBE_MDIO_VENDOR_SPECIFIC_1_LINK_STATUS;
258 + phy_speed = phy_data &
259 + IXGBE_MDIO_VENDOR_SPECIFIC_1_SPEED_STATUS;
260 + if (phy_link == IXGBE_MDIO_VENDOR_SPECIFIC_1_LINK_STATUS) {
263 + IXGBE_MDIO_VENDOR_SPECIFIC_1_SPEED_STATUS)
264 + *speed = IXGBE_LINK_SPEED_1GB_FULL;
273 + * ixgbe_get_phy_firmware_version_tnx - Gets the PHY Firmware Version
274 + * @hw: pointer to hardware structure
275 + * @firmware_version: pointer to the PHY Firmware Version
277 +s32 ixgbe_get_phy_firmware_version_tnx(struct ixgbe_hw *hw,
278 + u16 *firmware_version)
282 + status = hw->phy.ops.read_reg(hw, TNX_FW_REV,
283 + IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE,
289 Index: linux-2.6.27/drivers/net/ixgbe/ixgbe_phy.h
290 ===================================================================
291 --- linux-2.6.27.orig/drivers/net/ixgbe/ixgbe_phy.h
292 +++ linux-2.6.27/drivers/net/ixgbe/ixgbe_phy.h
293 @@ -77,4 +77,11 @@ s32 ixgbe_setup_phy_link_speed_generic(s
295 bool autoneg_wait_to_complete);
298 +s32 ixgbe_check_phy_link_tnx(struct ixgbe_hw *hw,
299 + ixgbe_link_speed *speed,
301 +s32 ixgbe_get_phy_firmware_version_tnx(struct ixgbe_hw *hw,
302 + u16 *firmware_version);
304 #endif /* _IXGBE_PHY_H_ */
305 Index: linux-2.6.27/drivers/net/ixgbe/ixgbe_type.h
306 ===================================================================
307 --- linux-2.6.27.orig/drivers/net/ixgbe/ixgbe_type.h
308 +++ linux-2.6.27/drivers/net/ixgbe/ixgbe_type.h
311 #define IXGBE_DEV_ID_82598AF_DUAL_PORT 0x10C6
312 #define IXGBE_DEV_ID_82598AF_SINGLE_PORT 0x10C7
313 +#define IXGBE_DEV_ID_82598AT 0x10C8
314 #define IXGBE_DEV_ID_82598EB_CX4 0x10DD
315 #define IXGBE_DEV_ID_82598_CX4_DUAL_PORT 0x10EC
316 #define IXGBE_DEV_ID_82598EB_XF_LR 0x10F4
318 #define IXGBE_MAX_PHY_ADDR 32
321 +#define TN1010_PHY_ID 0x00A19410
322 +#define TNX_FW_REV 0xB
323 #define QT2022_PHY_ID 0x0043A400
326 @@ -1202,6 +1205,7 @@ enum ixgbe_mac_type {
328 enum ixgbe_phy_type {
329 ixgbe_phy_unknown = 0,
334 @@ -1396,6 +1400,8 @@ struct ixgbe_phy_operations {
335 s32 (*setup_link)(struct ixgbe_hw *);
336 s32 (*setup_link_speed)(struct ixgbe_hw *, ixgbe_link_speed, bool,
338 + s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *);
339 + s32 (*get_firmware_version)(struct ixgbe_hw *, u16 *);
340 s32 (*read_i2c_byte)(struct ixgbe_hw *, u8, u8, u8 *);
341 s32 (*write_i2c_byte)(struct ixgbe_hw *, u8, u8, u8);
342 s32 (*read_i2c_eeprom)(struct ixgbe_hw *, u8 , u8 *);