diff options
Diffstat (limited to 'drivers/net/netxen/netxen_nic_niu.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_niu.c | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c index 8b7cd9e1851a..1392e8994f2c 100644 --- a/drivers/net/netxen/netxen_nic_niu.c +++ b/drivers/net/netxen/netxen_nic_niu.c | |||
@@ -30,40 +30,6 @@ | |||
30 | 30 | ||
31 | #include "netxen_nic.h" | 31 | #include "netxen_nic.h" |
32 | 32 | ||
33 | static long phy_lock_timeout = 100000000; | ||
34 | |||
35 | static int phy_lock(struct netxen_adapter *adapter) | ||
36 | { | ||
37 | int i; | ||
38 | int done = 0, timeout = 0; | ||
39 | |||
40 | while (!done) { | ||
41 | done = NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM3_LOCK)); | ||
42 | if (done == 1) | ||
43 | break; | ||
44 | if (timeout >= phy_lock_timeout) { | ||
45 | return -1; | ||
46 | } | ||
47 | timeout++; | ||
48 | if (!in_atomic()) | ||
49 | schedule(); | ||
50 | else { | ||
51 | for (i = 0; i < 20; i++) | ||
52 | cpu_relax(); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | NXWR32(adapter, NETXEN_PHY_LOCK_ID, PHY_LOCK_DRIVER); | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | static int phy_unlock(struct netxen_adapter *adapter) | ||
61 | { | ||
62 | adapter->pci_read_immediate(adapter, NETXEN_PCIE_REG(PCIE_SEM3_UNLOCK)); | ||
63 | |||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | /* | 33 | /* |
68 | * netxen_niu_gbe_phy_read - read a register from the GbE PHY via | 34 | * netxen_niu_gbe_phy_read - read a register from the GbE PHY via |
69 | * mii management interface. | 35 | * mii management interface. |
@@ -89,9 +55,8 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg, | |||
89 | __u32 status; | 55 | __u32 status; |
90 | __u32 mac_cfg0; | 56 | __u32 mac_cfg0; |
91 | 57 | ||
92 | if (phy_lock(adapter) != 0) { | 58 | if (netxen_phy_lock(adapter) != 0) |
93 | return -1; | 59 | return -1; |
94 | } | ||
95 | 60 | ||
96 | /* | 61 | /* |
97 | * MII mgmt all goes through port 0 MAC interface, | 62 | * MII mgmt all goes through port 0 MAC interface, |
@@ -141,7 +106,7 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg, | |||
141 | if (restore) | 106 | if (restore) |
142 | if (NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(0), mac_cfg0)) | 107 | if (NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(0), mac_cfg0)) |
143 | return -EIO; | 108 | return -EIO; |
144 | phy_unlock(adapter); | 109 | netxen_phy_unlock(adapter); |
145 | return result; | 110 | return result; |
146 | } | 111 | } |
147 | 112 | ||