aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlcnic/qlcnic_main.c
diff options
context:
space:
mode:
authorSucheta Chakraborty <sucheta.chakraborty@qlogic.com>2010-04-01 15:01:32 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-03 17:19:14 -0400
commitaa5e18c04af8706251768e6aba83465e31de7810 (patch)
tree8a766de994e5a9313b5019cca67400375a6a7220 /drivers/net/qlcnic/qlcnic_main.c
parent0c39aa4819fab75dcce0b1a9d99dcac0d85274f6 (diff)
qlcnic: use IDC defined timeout value
o USE/Read IDC defined timeout value from ROM. o While resetting chip, don't wait for other pci-func to respond, more than reset_ack_timeo seconds, Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@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/net/qlcnic/qlcnic_main.c')
-rw-r--r--drivers/net/qlcnic/qlcnic_main.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index a2346229312e..38e082969253 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -649,7 +649,10 @@ qlcnic_start_firmware(struct qlcnic_adapter *adapter)
649 if (err) 649 if (err)
650 return err; 650 return err;
651 651
652 if (!qlcnic_can_start_firmware(adapter)) 652 err = qlcnic_can_start_firmware(adapter);
653 if (err < 0)
654 return err;
655 else if (!err)
653 goto wait_init; 656 goto wait_init;
654 657
655 first_boot = QLCRD32(adapter, QLCNIC_CAM_RAM(0x1fc)); 658 first_boot = QLCRD32(adapter, QLCNIC_CAM_RAM(0x1fc));
@@ -1138,6 +1141,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1138 goto err_out_iounmap; 1141 goto err_out_iounmap;
1139 } 1142 }
1140 1143
1144 qlcnic_setup_idc_param(adapter);
1141 1145
1142 err = qlcnic_start_firmware(adapter); 1146 err = qlcnic_start_firmware(adapter);
1143 if (err) 1147 if (err)
@@ -2027,7 +2031,7 @@ static int
2027qlcnic_can_start_firmware(struct qlcnic_adapter *adapter) 2031qlcnic_can_start_firmware(struct qlcnic_adapter *adapter)
2028{ 2032{
2029 u32 val, prev_state; 2033 u32 val, prev_state;
2030 int cnt = 0; 2034 u8 dev_init_timeo = adapter->dev_init_timeo;
2031 int portnum = adapter->portnum; 2035 int portnum = adapter->portnum;
2032 2036
2033 if (qlcnic_api_lock(adapter)) 2037 if (qlcnic_api_lock(adapter))
@@ -2072,12 +2076,13 @@ start_fw:
2072 } 2076 }
2073 2077
2074 qlcnic_api_unlock(adapter); 2078 qlcnic_api_unlock(adapter);
2075 msleep(1000); 2079
2076 while ((QLCRD32(adapter, QLCNIC_CRB_DEV_STATE) != QLCNIC_DEV_READY) && 2080 do {
2077 ++cnt < 20)
2078 msleep(1000); 2081 msleep(1000);
2082 } while ((QLCRD32(adapter, QLCNIC_CRB_DEV_STATE) != QLCNIC_DEV_READY)
2083 && --dev_init_timeo);
2079 2084
2080 if (cnt >= 20) 2085 if (!dev_init_timeo)
2081 return -1; 2086 return -1;
2082 2087
2083 if (qlcnic_api_lock(adapter)) 2088 if (qlcnic_api_lock(adapter))
@@ -2099,12 +2104,10 @@ qlcnic_fwinit_work(struct work_struct *work)
2099 struct qlcnic_adapter, fw_work.work); 2104 struct qlcnic_adapter, fw_work.work);
2100 int dev_state; 2105 int dev_state;
2101 2106
2102 if (++adapter->fw_wait_cnt > FW_POLL_THRESH)
2103 goto err_ret;
2104
2105 if (test_bit(__QLCNIC_START_FW, &adapter->state)) { 2107 if (test_bit(__QLCNIC_START_FW, &adapter->state)) {
2106 2108
2107 if (qlcnic_check_drv_state(adapter)) { 2109 if (qlcnic_check_drv_state(adapter) &&
2110 (adapter->fw_wait_cnt++ < adapter->reset_ack_timeo)) {
2108 qlcnic_schedule_work(adapter, 2111 qlcnic_schedule_work(adapter,
2109 qlcnic_fwinit_work, FW_POLL_DELAY); 2112 qlcnic_fwinit_work, FW_POLL_DELAY);
2110 return; 2113 return;
@@ -2118,6 +2121,9 @@ qlcnic_fwinit_work(struct work_struct *work)
2118 goto err_ret; 2121 goto err_ret;
2119 } 2122 }
2120 2123
2124 if (adapter->fw_wait_cnt++ > (adapter->dev_init_timeo / 2))
2125 goto err_ret;
2126
2121 dev_state = QLCRD32(adapter, QLCNIC_CRB_DEV_STATE); 2127 dev_state = QLCRD32(adapter, QLCNIC_CRB_DEV_STATE);
2122 switch (dev_state) { 2128 switch (dev_state) {
2123 case QLCNIC_DEV_READY: 2129 case QLCNIC_DEV_READY: