aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_niu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/netxen/netxen_nic_niu.c')
-rw-r--r--drivers/net/netxen/netxen_nic_niu.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c
index ff74f1e413d4..4987dc765d99 100644
--- a/drivers/net/netxen/netxen_nic_niu.c
+++ b/drivers/net/netxen/netxen_nic_niu.c
@@ -40,13 +40,15 @@
40 40
41static long phy_lock_timeout = 100000000; 41static long phy_lock_timeout = 100000000;
42 42
43static inline int phy_lock(void) 43static inline int phy_lock(struct netxen_adapter *adapter)
44{ 44{
45 int i; 45 int i;
46 int done = 0, timeout = 0; 46 int done = 0, timeout = 0;
47 47
48 while (!done) { 48 while (!done) {
49 done = readl((void __iomem *)NETXEN_PCIE_REG(PCIE_SEM3_LOCK)); 49 done =
50 readl(pci_base_offset
51 (adapter, NETXEN_PCIE_REG(PCIE_SEM3_LOCK)));
50 if (done == 1) 52 if (done == 1)
51 break; 53 break;
52 if (timeout >= phy_lock_timeout) { 54 if (timeout >= phy_lock_timeout) {
@@ -61,13 +63,15 @@ static inline int phy_lock(void)
61 } 63 }
62 } 64 }
63 65
64 writel(NETXEN_PHY_LOCK_ID, (void __iomem *)PHY_LOCK_DRIVER); 66 writel(PHY_LOCK_DRIVER,
67 NETXEN_CRB_NORMALIZE(adapter, NETXEN_PHY_LOCK_ID));
65 return 0; 68 return 0;
66} 69}
67 70
68static inline int phy_unlock(void) 71static inline int phy_unlock(struct netxen_adapter *adapter)
69{ 72{
70 readl((void __iomem *)NETXEN_PCIE_REG(PCIE_SEM3_UNLOCK)); 73 readl(pci_base_offset(adapter, NETXEN_PCIE_REG(PCIE_SEM3_UNLOCK)));
74
71 return 0; 75 return 0;
72} 76}
73 77
@@ -95,7 +99,7 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy,
95 __le32 status; 99 __le32 status;
96 __le32 mac_cfg0; 100 __le32 mac_cfg0;
97 101
98 if (phy_lock() != 0) { 102 if (phy_lock(adapter) != 0) {
99 return -1; 103 return -1;
100 } 104 }
101 105
@@ -162,7 +166,7 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy,
162 NETXEN_NIU_GB_MAC_CONFIG_0(0), 166 NETXEN_NIU_GB_MAC_CONFIG_0(0),
163 &mac_cfg0, 4)) 167 &mac_cfg0, 4))
164 return -EIO; 168 return -EIO;
165 phy_unlock(); 169 phy_unlock(adapter);
166 return result; 170 return result;
167} 171}
168 172
@@ -612,7 +616,7 @@ int netxen_niu_macaddr_set(struct netxen_port *port,
612 __le32 temp = 0; 616 __le32 temp = 0;
613 struct netxen_adapter *adapter = port->adapter; 617 struct netxen_adapter *adapter = port->adapter;
614 int phy = port->portnum; 618 int phy = port->portnum;
615 unsigned char mac_addr[MAX_ADDR_LEN]; 619 unsigned char mac_addr[6];
616 int i; 620 int i;
617 621
618 for (i = 0; i < 10; i++) { 622 for (i = 0; i < 10; i++) {
@@ -631,7 +635,7 @@ int netxen_niu_macaddr_set(struct netxen_port *port,
631 635
632 netxen_niu_macaddr_get(adapter, phy, 636 netxen_niu_macaddr_get(adapter, phy,
633 (netxen_ethernet_macaddr_t *) mac_addr); 637 (netxen_ethernet_macaddr_t *) mac_addr);
634 if (memcmp(mac_addr, addr, MAX_ADDR_LEN == 0)) 638 if (memcmp(mac_addr, addr, 6) == 0)
635 break; 639 break;
636 } 640 }
637 641