aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2008-08-01 06:14:55 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-08-07 02:11:07 -0400
commit24a7a45511f89959b4f1dc60a66260d09777901a (patch)
treeef48a3f9c6f65ba98f047b38937f71baef4a95ed
parent4ad7a018cf4ac3cbad661c28c0f783ee0a6e3bf6 (diff)
netxen: fix link status, link speed
For NX3031, the phy is managed by firmware, so driver should avoid setting any phy registers. Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c33
-rw-r--r--drivers/net/netxen/netxen_nic_hdr.h7
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c17
-rw-r--r--drivers/net/netxen/netxen_nic_main.c19
-rw-r--r--drivers/net/netxen/netxen_nic_niu.c12
-rw-r--r--drivers/net/netxen/netxen_nic_phan_reg.h4
6 files changed, 66 insertions, 26 deletions
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index 48ee06b6f4e9..f9b933efa362 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -140,18 +140,33 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
140 if (netif_running(dev)) { 140 if (netif_running(dev)) {
141 ecmd->speed = adapter->link_speed; 141 ecmd->speed = adapter->link_speed;
142 ecmd->duplex = adapter->link_duplex; 142 ecmd->duplex = adapter->link_duplex;
143 } else 143 ecmd->autoneg = adapter->link_autoneg;
144 return -EIO; /* link absent */ 144 }
145
145 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { 146 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) {
146 ecmd->supported = (SUPPORTED_TP | 147 u32 val;
147 SUPPORTED_1000baseT_Full | 148
148 SUPPORTED_10000baseT_Full); 149 adapter->hw_read_wx(adapter, NETXEN_PORT_MODE_ADDR, &val, 4);
149 ecmd->advertising = (ADVERTISED_TP | 150 if (val == NETXEN_PORT_MODE_802_3_AP) {
150 ADVERTISED_1000baseT_Full | 151 ecmd->supported = SUPPORTED_1000baseT_Full;
151 ADVERTISED_10000baseT_Full); 152 ecmd->advertising = ADVERTISED_1000baseT_Full;
153 } else {
154 ecmd->supported = SUPPORTED_10000baseT_Full;
155 ecmd->advertising = ADVERTISED_10000baseT_Full;
156 }
157
152 ecmd->port = PORT_TP; 158 ecmd->port = PORT_TP;
153 159
154 ecmd->speed = SPEED_10000; 160 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
161 u16 pcifn = adapter->ahw.pci_func;
162
163 adapter->hw_read_wx(adapter,
164 P3_LINK_SPEED_REG(pcifn), &val, 4);
165 ecmd->speed = P3_LINK_SPEED_MHZ *
166 P3_LINK_SPEED_VAL(pcifn, val);
167 } else
168 ecmd->speed = SPEED_10000;
169
155 ecmd->duplex = DUPLEX_FULL; 170 ecmd->duplex = DUPLEX_FULL;
156 ecmd->autoneg = AUTONEG_DISABLE; 171 ecmd->autoneg = AUTONEG_DISABLE;
157 } else 172 } else
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h
index 3ce13e451aac..ccf6d70064bc 100644
--- a/drivers/net/netxen/netxen_nic_hdr.h
+++ b/drivers/net/netxen/netxen_nic_hdr.h
@@ -724,6 +724,13 @@ enum {
724#define XG_LINK_STATE_P3(pcifn,val) \ 724#define XG_LINK_STATE_P3(pcifn,val) \
725 (((val) >> ((pcifn) * 4)) & XG_LINK_STATE_P3_MASK) 725 (((val) >> ((pcifn) * 4)) & XG_LINK_STATE_P3_MASK)
726 726
727#define P3_LINK_SPEED_MHZ 100
728#define P3_LINK_SPEED_MASK 0xff
729#define P3_LINK_SPEED_REG(pcifn) \
730 (CRB_PF_LINK_SPEED_1 + (((pcifn) / 4) * 4))
731#define P3_LINK_SPEED_VAL(pcifn, reg) \
732 (((reg) >> (8 * ((pcifn) & 0x3))) & P3_LINK_SPEED_MASK)
733
727#define NETXEN_CAM_RAM_BASE (NETXEN_CRB_CAM + 0x02000) 734#define NETXEN_CAM_RAM_BASE (NETXEN_CRB_CAM + 0x02000)
728#define NETXEN_CAM_RAM(reg) (NETXEN_CAM_RAM_BASE + (reg)) 735#define NETXEN_CAM_RAM(reg) (NETXEN_CAM_RAM_BASE + (reg))
729#define NETXEN_FW_VERSION_MAJOR (NETXEN_CAM_RAM(0x150)) 736#define NETXEN_FW_VERSION_MAJOR (NETXEN_CAM_RAM(0x150))
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 96a3bc6426e2..008a6e7ffa00 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -2074,12 +2074,22 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
2074 __u32 status; 2074 __u32 status;
2075 __u32 autoneg; 2075 __u32 autoneg;
2076 __u32 mode; 2076 __u32 mode;
2077 __u32 port_mode;
2077 2078
2078 netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode); 2079 netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode);
2079 if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */ 2080 if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */
2081
2082 adapter->hw_read_wx(adapter,
2083 NETXEN_PORT_MODE_ADDR, &port_mode, 4);
2084 if (port_mode == NETXEN_PORT_MODE_802_3_AP) {
2085 adapter->link_speed = SPEED_1000;
2086 adapter->link_duplex = DUPLEX_FULL;
2087 adapter->link_autoneg = AUTONEG_DISABLE;
2088 return;
2089 }
2090
2080 if (adapter->phy_read 2091 if (adapter->phy_read
2081 && adapter-> 2092 && adapter->phy_read(adapter,
2082 phy_read(adapter,
2083 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, 2093 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
2084 &status) == 0) { 2094 &status) == 0) {
2085 if (netxen_get_phy_link(status)) { 2095 if (netxen_get_phy_link(status)) {
@@ -2109,8 +2119,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
2109 break; 2119 break;
2110 } 2120 }
2111 if (adapter->phy_read 2121 if (adapter->phy_read
2112 && adapter-> 2122 && adapter->phy_read(adapter,
2113 phy_read(adapter,
2114 NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, 2123 NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
2115 &autoneg) != 0) 2124 &autoneg) != 0)
2116 adapter->link_autoneg = autoneg; 2125 adapter->link_autoneg = autoneg;
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 91d209a8f6cb..7b8688e7bfa3 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -1410,20 +1410,17 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter)
1410 1410
1411 port = adapter->physical_port; 1411 port = adapter->physical_port;
1412 1412
1413 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 1413 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
1414 val = adapter->pci_read_normalize(adapter, CRB_XG_STATE); 1414 val = adapter->pci_read_normalize(adapter, CRB_XG_STATE_P3);
1415 linkup = (val >> port) & 1; 1415 val = XG_LINK_STATE_P3(adapter->ahw.pci_func, val);
1416 linkup = (val == XG_LINK_UP_P3);
1416 } else { 1417 } else {
1417 if (adapter->fw_major < 4) { 1418 val = adapter->pci_read_normalize(adapter, CRB_XG_STATE);
1418 val = adapter->pci_read_normalize(adapter, 1419 if (adapter->ahw.board_type == NETXEN_NIC_GBE)
1419 CRB_XG_STATE); 1420 linkup = (val >> port) & 1;
1421 else {
1420 val = (val >> port*8) & 0xff; 1422 val = (val >> port*8) & 0xff;
1421 linkup = (val == XG_LINK_UP); 1423 linkup = (val == XG_LINK_UP);
1422 } else {
1423 val = adapter->pci_read_normalize(adapter,
1424 CRB_XG_STATE_P3);
1425 val = XG_LINK_STATE_P3(adapter->ahw.pci_func, val);
1426 linkup = (val == XG_LINK_UP_P3);
1427 } 1424 }
1428 } 1425 }
1429 1426
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c
index 4cb8f4a1cf4b..c9493e2df200 100644
--- a/drivers/net/netxen/netxen_nic_niu.c
+++ b/drivers/net/netxen/netxen_nic_niu.c
@@ -610,6 +610,9 @@ int netxen_niu_macaddr_set(struct netxen_adapter *adapter,
610 int i; 610 int i;
611 DECLARE_MAC_BUF(mac); 611 DECLARE_MAC_BUF(mac);
612 612
613 if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
614 return 0;
615
613 for (i = 0; i < 10; i++) { 616 for (i = 0; i < 10; i++) {
614 temp[0] = temp[1] = 0; 617 temp[0] = temp[1] = 0;
615 memcpy(temp + 2, addr, 2); 618 memcpy(temp + 2, addr, 2);
@@ -727,6 +730,9 @@ int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter)
727 __u32 mac_cfg0; 730 __u32 mac_cfg0;
728 u32 port = adapter->physical_port; 731 u32 port = adapter->physical_port;
729 732
733 if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
734 return 0;
735
730 if (port > NETXEN_NIU_MAX_GBE_PORTS) 736 if (port > NETXEN_NIU_MAX_GBE_PORTS)
731 return -EINVAL; 737 return -EINVAL;
732 mac_cfg0 = 0; 738 mac_cfg0 = 0;
@@ -743,6 +749,9 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
743 __u32 mac_cfg; 749 __u32 mac_cfg;
744 u32 port = adapter->physical_port; 750 u32 port = adapter->physical_port;
745 751
752 if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
753 return 0;
754
746 if (port > NETXEN_NIU_MAX_XG_PORTS) 755 if (port > NETXEN_NIU_MAX_XG_PORTS)
747 return -EINVAL; 756 return -EINVAL;
748 757
@@ -819,6 +828,9 @@ int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter,
819 u8 temp[4]; 828 u8 temp[4];
820 u32 val; 829 u32 val;
821 830
831 if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
832 return 0;
833
822 if ((phy < 0) || (phy > NETXEN_NIU_MAX_XG_PORTS)) 834 if ((phy < 0) || (phy > NETXEN_NIU_MAX_XG_PORTS))
823 return -EIO; 835 return -EIO;
824 836
diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h b/drivers/net/netxen/netxen_nic_phan_reg.h
index 3bfa51b62a4f..83e5ee57bfef 100644
--- a/drivers/net/netxen/netxen_nic_phan_reg.h
+++ b/drivers/net/netxen/netxen_nic_phan_reg.h
@@ -95,8 +95,8 @@
95#define CRB_HOST_STS_PROD NETXEN_NIC_REG(0xdc) 95#define CRB_HOST_STS_PROD NETXEN_NIC_REG(0xdc)
96#define CRB_HOST_STS_CONS NETXEN_NIC_REG(0xe0) 96#define CRB_HOST_STS_CONS NETXEN_NIC_REG(0xe0)
97#define CRB_PEG_CMD_PROD NETXEN_NIC_REG(0xe4) 97#define CRB_PEG_CMD_PROD NETXEN_NIC_REG(0xe4)
98#define CRB_PEG_CMD_CONS NETXEN_NIC_REG(0xe8) 98#define CRB_PF_LINK_SPEED_1 NETXEN_NIC_REG(0xe8)
99#define CRB_HOST_BUFFER_PROD NETXEN_NIC_REG(0xec) 99#define CRB_PF_LINK_SPEED_2 NETXEN_NIC_REG(0xec)
100#define CRB_HOST_BUFFER_CONS NETXEN_NIC_REG(0xf0) 100#define CRB_HOST_BUFFER_CONS NETXEN_NIC_REG(0xf0)
101#define CRB_JUMBO_BUFFER_PROD NETXEN_NIC_REG(0xf4) 101#define CRB_JUMBO_BUFFER_PROD NETXEN_NIC_REG(0xf4)
102#define CRB_JUMBO_BUFFER_CONS NETXEN_NIC_REG(0xf8) 102#define CRB_JUMBO_BUFFER_CONS NETXEN_NIC_REG(0xf8)