aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorInaky Perez-Gonzalez <inaky@linux.intel.com>2009-06-03 04:13:14 -0400
committerInaky Perez-Gonzalez <inaky@linux.intel.com>2009-06-11 06:30:23 -0400
commitecddfd5ed73c070413f07a5251c16c10e69f35a2 (patch)
tree4caaeedf3b8a49441d3656ffdd2ac8e8479991a2 /drivers/net
parentb4013f91cdda10f3f15530914f3c7f39738b0b50 (diff)
wimax/i2400m: Allow bus-specific driver to specify retry count
The code that sets up the i2400m (firmware load and general driver setup after it) includes a couple of retry loops. The SDIO device sometimes can get in more complicated corners than the USB one (due to its interaction with other SDIO functions), that require trying a few more times. To solve that, without having a failing USB device taking longer to be considered dead, allow the retry counts to be specified by the bus-specific driver, which the general driver takes as a parameter. Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wimax/i2400m/driver.c2
-rw-r--r--drivers/net/wimax/i2400m/fw.c2
-rw-r--r--drivers/net/wimax/i2400m/i2400m.h14
-rw-r--r--drivers/net/wimax/i2400m/sdio.c3
-rw-r--r--drivers/net/wimax/i2400m/usb.c1
5 files changed, 20 insertions, 2 deletions
diff --git a/drivers/net/wimax/i2400m/driver.c b/drivers/net/wimax/i2400m/driver.c
index e8d022d58427..8d8628e5af44 100644
--- a/drivers/net/wimax/i2400m/driver.c
+++ b/drivers/net/wimax/i2400m/driver.c
@@ -399,7 +399,7 @@ int __i2400m_dev_start(struct i2400m *i2400m, enum i2400m_bri flags)
399 struct wimax_dev *wimax_dev = &i2400m->wimax_dev; 399 struct wimax_dev *wimax_dev = &i2400m->wimax_dev;
400 struct net_device *net_dev = wimax_dev->net_dev; 400 struct net_device *net_dev = wimax_dev->net_dev;
401 struct device *dev = i2400m_dev(i2400m); 401 struct device *dev = i2400m_dev(i2400m);
402 int times = 3; 402 int times = i2400m->bus_bm_retries;
403 403
404 d_fnstart(3, dev, "(i2400m %p)\n", i2400m); 404 d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
405retry: 405retry:
diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c
index 01c926ed309e..c48fa241857a 100644
--- a/drivers/net/wimax/i2400m/fw.c
+++ b/drivers/net/wimax/i2400m/fw.c
@@ -980,7 +980,7 @@ int i2400m_fw_dnload(struct i2400m *i2400m, const struct i2400m_bcf_hdr *bcf,
980{ 980{
981 int ret = 0; 981 int ret = 0;
982 struct device *dev = i2400m_dev(i2400m); 982 struct device *dev = i2400m_dev(i2400m);
983 int count = I2400M_BOOT_RETRIES; 983 int count = i2400m->bus_bm_retries;
984 984
985 d_fnstart(5, dev, "(i2400m %p bcf %p size %zu)\n", 985 d_fnstart(5, dev, "(i2400m %p bcf %p size %zu)\n",
986 i2400m, bcf, bcf_size); 986 i2400m, bcf, bcf_size);
diff --git a/drivers/net/wimax/i2400m/i2400m.h b/drivers/net/wimax/i2400m/i2400m.h
index 8dba246e15bf..59cd78315498 100644
--- a/drivers/net/wimax/i2400m/i2400m.h
+++ b/drivers/net/wimax/i2400m/i2400m.h
@@ -150,6 +150,7 @@
150enum { 150enum {
151 /* Firmware uploading */ 151 /* Firmware uploading */
152 I2400M_BOOT_RETRIES = 3, 152 I2400M_BOOT_RETRIES = 3,
153 I3200_BOOT_RETRIES = 3,
153 /* Size of the Boot Mode Command buffer */ 154 /* Size of the Boot Mode Command buffer */
154 I2400M_BM_CMD_BUF_SIZE = 16 * 1024, 155 I2400M_BM_CMD_BUF_SIZE = 16 * 1024,
155 I2400M_BM_ACK_BUF_SIZE = 256, 156 I2400M_BM_ACK_BUF_SIZE = 256,
@@ -224,6 +225,17 @@ struct i2400m_roq;
224 * process, so it cannot rely on common infrastructure being laid 225 * process, so it cannot rely on common infrastructure being laid
225 * out. 226 * out.
226 * 227 *
228 * @bus_bm_retries: [fill] How many times shall a firmware upload /
229 * device initialization be retried? Different models of the same
230 * device might need different values, hence it is set by the
231 * bus-specific driver. Note this value is used in two places,
232 * i2400m_fw_dnload() and __i2400m_dev_start(); they won't become
233 * multiplicative (__i2400m_dev_start() calling N times
234 * i2400m_fw_dnload() and this trying N times to download the
235 * firmware), as if __i2400m_dev_start() only retries if the
236 * firmware crashed while initializing the device (not in a
237 * general case).
238 *
227 * @bus_bm_cmd_send: [fill] Function called to send a boot-mode 239 * @bus_bm_cmd_send: [fill] Function called to send a boot-mode
228 * command. Flags are defined in 'enum i2400m_bm_cmd_flags'. This 240 * command. Flags are defined in 'enum i2400m_bm_cmd_flags'. This
229 * is synchronous and has to return 0 if ok or < 0 errno code in 241 * is synchronous and has to return 0 if ok or < 0 errno code in
@@ -399,6 +411,8 @@ struct i2400m {
399 411
400 size_t bus_tx_block_size; 412 size_t bus_tx_block_size;
401 size_t bus_pl_size_max; 413 size_t bus_pl_size_max;
414 unsigned bus_bm_retries;
415
402 int (*bus_dev_start)(struct i2400m *); 416 int (*bus_dev_start)(struct i2400m *);
403 void (*bus_dev_stop)(struct i2400m *); 417 void (*bus_dev_stop)(struct i2400m *);
404 void (*bus_tx_kick)(struct i2400m *); 418 void (*bus_tx_kick)(struct i2400m *);
diff --git a/drivers/net/wimax/i2400m/sdio.c b/drivers/net/wimax/i2400m/sdio.c
index d6fac5ccf938..afde89770044 100644
--- a/drivers/net/wimax/i2400m/sdio.c
+++ b/drivers/net/wimax/i2400m/sdio.c
@@ -418,6 +418,9 @@ int i2400ms_probe(struct sdio_func *func,
418 i2400m->bus_dev_stop = i2400ms_bus_dev_stop; 418 i2400m->bus_dev_stop = i2400ms_bus_dev_stop;
419 i2400m->bus_tx_kick = i2400ms_bus_tx_kick; 419 i2400m->bus_tx_kick = i2400ms_bus_tx_kick;
420 i2400m->bus_reset = i2400ms_bus_reset; 420 i2400m->bus_reset = i2400ms_bus_reset;
421 /* The iwmc3200-wimax sometimes requires the driver to try
422 * hard when we paint it into a corner. */
423 i2400m->bus_bm_retries = I3200_BOOT_RETRIES;
421 i2400m->bus_bm_cmd_send = i2400ms_bus_bm_cmd_send; 424 i2400m->bus_bm_cmd_send = i2400ms_bus_bm_cmd_send;
422 i2400m->bus_bm_wait_for_ack = i2400ms_bus_bm_wait_for_ack; 425 i2400m->bus_bm_wait_for_ack = i2400ms_bus_bm_wait_for_ack;
423 i2400m->bus_fw_names = i2400ms_bus_fw_names; 426 i2400m->bus_fw_names = i2400ms_bus_fw_names;
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c
index 17851321b7fd..ebc05da89687 100644
--- a/drivers/net/wimax/i2400m/usb.c
+++ b/drivers/net/wimax/i2400m/usb.c
@@ -399,6 +399,7 @@ int i2400mu_probe(struct usb_interface *iface,
399 i2400m->bus_dev_stop = i2400mu_bus_dev_stop; 399 i2400m->bus_dev_stop = i2400mu_bus_dev_stop;
400 i2400m->bus_tx_kick = i2400mu_bus_tx_kick; 400 i2400m->bus_tx_kick = i2400mu_bus_tx_kick;
401 i2400m->bus_reset = i2400mu_bus_reset; 401 i2400m->bus_reset = i2400mu_bus_reset;
402 i2400m->bus_bm_retries = I2400M_BOOT_RETRIES;
402 i2400m->bus_bm_cmd_send = i2400mu_bus_bm_cmd_send; 403 i2400m->bus_bm_cmd_send = i2400mu_bus_bm_cmd_send;
403 i2400m->bus_bm_wait_for_ack = i2400mu_bus_bm_wait_for_ack; 404 i2400m->bus_bm_wait_for_ack = i2400mu_bus_bm_wait_for_ack;
404 i2400m->bus_fw_names = i2400mu_bus_fw_names; 405 i2400m->bus_fw_names = i2400mu_bus_fw_names;