aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSony Chacko <sony.chacko@qlogic.com>2011-04-28 07:48:19 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-29 16:00:00 -0400
commit7e610caaa5b32d3be9216f040f178e4a23b678b2 (patch)
tree993a027d6619dfe2ad3ca2d4e223a08a710e7260 /drivers
parentf94bc1e70281c5a587049015af8f3e024d45ad66 (diff)
qlcnic: Support for GBE port settings
Enable setting speed and auto negotiation parameters for GbE ports. Hardware do not support half duplex setting currently. o Update driver version to 5.0.17. Signed-off-by: Sony Chacko <sony.chacko@qlogic.com> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/qlcnic/qlcnic.h9
-rw-r--r--drivers/net/qlcnic/qlcnic_ctx.c26
-rw-r--r--drivers/net/qlcnic/qlcnic_ethtool.c68
3 files changed, 40 insertions, 63 deletions
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 1934ed9a1aad..f729363b3fc3 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -36,8 +36,8 @@
36 36
37#define _QLCNIC_LINUX_MAJOR 5 37#define _QLCNIC_LINUX_MAJOR 5
38#define _QLCNIC_LINUX_MINOR 0 38#define _QLCNIC_LINUX_MINOR 0
39#define _QLCNIC_LINUX_SUBVERSION 16 39#define _QLCNIC_LINUX_SUBVERSION 17
40#define QLCNIC_LINUX_VERSIONID "5.0.16" 40#define QLCNIC_LINUX_VERSIONID "5.0.17"
41#define QLCNIC_DRV_IDC_VER 0x01 41#define QLCNIC_DRV_IDC_VER 0x01
42#define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\ 42#define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\
43 (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION)) 43 (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION))
@@ -573,8 +573,10 @@ struct qlcnic_recv_context {
573#define QLCNIC_CDRP_CMD_CONFIGURE_ESWITCH 0x00000028 573#define QLCNIC_CDRP_CMD_CONFIGURE_ESWITCH 0x00000028
574#define QLCNIC_CDRP_CMD_GET_ESWITCH_PORT_CONFIG 0x00000029 574#define QLCNIC_CDRP_CMD_GET_ESWITCH_PORT_CONFIG 0x00000029
575#define QLCNIC_CDRP_CMD_GET_ESWITCH_STATS 0x0000002a 575#define QLCNIC_CDRP_CMD_GET_ESWITCH_STATS 0x0000002a
576#define QLCNIC_CDRP_CMD_CONFIG_PORT 0x0000002E
576 577
577#define QLCNIC_RCODE_SUCCESS 0 578#define QLCNIC_RCODE_SUCCESS 0
579#define QLCNIC_RCODE_NOT_SUPPORTED 9
578#define QLCNIC_RCODE_TIMEOUT 17 580#define QLCNIC_RCODE_TIMEOUT 17
579#define QLCNIC_DESTROY_CTX_RESET 0 581#define QLCNIC_DESTROY_CTX_RESET 0
580 582
@@ -1155,8 +1157,7 @@ struct qlcnic_esw_statistics {
1155 struct __qlcnic_esw_statistics tx; 1157 struct __qlcnic_esw_statistics tx;
1156}; 1158};
1157 1159
1158int qlcnic_fw_cmd_query_phy(struct qlcnic_adapter *adapter, u32 reg, u32 *val); 1160int qlcnic_fw_cmd_set_port(struct qlcnic_adapter *adapter, u32 config);
1159int qlcnic_fw_cmd_set_phy(struct qlcnic_adapter *adapter, u32 reg, u32 val);
1160 1161
1161u32 qlcnic_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong off); 1162u32 qlcnic_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong off);
1162int qlcnic_hw_write_wx_2M(struct qlcnic_adapter *, ulong off, u32 data); 1163int qlcnic_hw_write_wx_2M(struct qlcnic_adapter *, ulong off, u32 data);
diff --git a/drivers/net/qlcnic/qlcnic_ctx.c b/drivers/net/qlcnic/qlcnic_ctx.c
index 050fa5a99ff7..3a99886e4736 100644
--- a/drivers/net/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/qlcnic/qlcnic_ctx.c
@@ -359,33 +359,15 @@ qlcnic_fw_cmd_destroy_tx_ctx(struct qlcnic_adapter *adapter)
359} 359}
360 360
361int 361int
362qlcnic_fw_cmd_query_phy(struct qlcnic_adapter *adapter, u32 reg, u32 *val) 362qlcnic_fw_cmd_set_port(struct qlcnic_adapter *adapter, u32 config)
363{
364
365 if (qlcnic_issue_cmd(adapter,
366 adapter->ahw->pci_func,
367 adapter->fw_hal_version,
368 reg,
369 0,
370 0,
371 QLCNIC_CDRP_CMD_READ_PHY)) {
372
373 return -EIO;
374 }
375
376 return QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET);
377}
378
379int
380qlcnic_fw_cmd_set_phy(struct qlcnic_adapter *adapter, u32 reg, u32 val)
381{ 363{
382 return qlcnic_issue_cmd(adapter, 364 return qlcnic_issue_cmd(adapter,
383 adapter->ahw->pci_func, 365 adapter->ahw->pci_func,
384 adapter->fw_hal_version, 366 adapter->fw_hal_version,
385 reg, 367 config,
386 val, 368 0,
387 0, 369 0,
388 QLCNIC_CDRP_CMD_WRITE_PHY); 370 QLCNIC_CDRP_CMD_CONFIG_PORT);
389} 371}
390 372
391int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter) 373int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter)
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 8db1d1983cfe..27726ebfba2a 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -284,50 +284,44 @@ skip:
284static int 284static int
285qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) 285qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
286{ 286{
287 u32 config = 0;
288 u32 ret = 0;
287 struct qlcnic_adapter *adapter = netdev_priv(dev); 289 struct qlcnic_adapter *adapter = netdev_priv(dev);
288 __u32 status; 290
291 if (adapter->ahw->port_type != QLCNIC_GBE)
292 return -EOPNOTSUPP;
289 293
290 /* read which mode */ 294 /* read which mode */
291 if (adapter->ahw->port_type == QLCNIC_GBE) { 295 if (ecmd->duplex)
292 /* autonegotiation */ 296 config |= 0x1;
293 if (qlcnic_fw_cmd_set_phy(adapter,
294 QLCNIC_NIU_GB_MII_MGMT_ADDR_AUTONEG,
295 ecmd->autoneg) != 0)
296 return -EIO;
297 else
298 adapter->link_autoneg = ecmd->autoneg;
299 297
300 if (qlcnic_fw_cmd_query_phy(adapter, 298 if (ecmd->autoneg)
301 QLCNIC_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, 299 config |= 0x2;
302 &status) != 0)
303 return -EIO;
304 300
305 switch (ecmd->speed) { 301 switch (ethtool_cmd_speed(ecmd)) {
306 case SPEED_10: 302 case SPEED_10:
307 qlcnic_set_phy_speed(status, 0); 303 config |= (0 << 8);
308 break; 304 break;
309 case SPEED_100: 305 case SPEED_100:
310 qlcnic_set_phy_speed(status, 1); 306 config |= (1 << 8);
311 break; 307 break;
312 case SPEED_1000: 308 case SPEED_1000:
313 qlcnic_set_phy_speed(status, 2); 309 config |= (10 << 8);
314 break; 310 break;
315 } 311 default:
312 return -EIO;
313 }
316 314
317 if (ecmd->duplex == DUPLEX_HALF) 315 ret = qlcnic_fw_cmd_set_port(adapter, config);
318 qlcnic_clear_phy_duplex(status); 316
319 if (ecmd->duplex == DUPLEX_FULL) 317 if (ret == QLCNIC_RCODE_NOT_SUPPORTED)
320 qlcnic_set_phy_duplex(status);
321 if (qlcnic_fw_cmd_set_phy(adapter,
322 QLCNIC_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
323 *((int *)&status)) != 0)
324 return -EIO;
325 else {
326 adapter->link_speed = ecmd->speed;
327 adapter->link_duplex = ecmd->duplex;
328 }
329 } else
330 return -EOPNOTSUPP; 318 return -EOPNOTSUPP;
319 else if (ret)
320 return -EIO;
321
322 adapter->link_speed = ethtool_cmd_speed(ecmd);
323 adapter->link_duplex = ecmd->duplex;
324 adapter->link_autoneg = ecmd->autoneg;
331 325
332 if (!netif_running(dev)) 326 if (!netif_running(dev))
333 return 0; 327 return 0;