diff options
author | David Kilroy <kilroyd@googlemail.com> | 2009-06-18 18:21:20 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 15:01:43 -0400 |
commit | 42a51b933034bbed93fa54009c96a482044e5b43 (patch) | |
tree | 46b946a7cb7b82c013caeb320f44b978ce2bc086 /drivers | |
parent | e9e3d0100eae5f254024bd59229ef1be2b719b84 (diff) |
orinoco: Move FID allocation to hw.c
This is part of refactorring the initialisation code so that we can
load the firmware before registerring with netdev.
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/orinoco/hw.c | 23 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/hw.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/main.c | 25 |
3 files changed, 26 insertions, 23 deletions
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c index 40dc25c7d0eb..0f6426d54f28 100644 --- a/drivers/net/wireless/orinoco/hw.c +++ b/drivers/net/wireless/orinoco/hw.c | |||
@@ -15,6 +15,9 @@ | |||
15 | 15 | ||
16 | #define SYMBOL_MAX_VER_LEN (14) | 16 | #define SYMBOL_MAX_VER_LEN (14) |
17 | 17 | ||
18 | /* Symbol firmware has a bug allocating buffers larger than this */ | ||
19 | #define TX_NICBUF_SIZE_BUG 1585 | ||
20 | |||
18 | /********************************************************************/ | 21 | /********************************************************************/ |
19 | /* Data tables */ | 22 | /* Data tables */ |
20 | /********************************************************************/ | 23 | /********************************************************************/ |
@@ -364,6 +367,26 @@ out: | |||
364 | return err; | 367 | return err; |
365 | } | 368 | } |
366 | 369 | ||
370 | int orinoco_hw_allocate_fid(struct orinoco_private *priv) | ||
371 | { | ||
372 | struct net_device *dev = priv->ndev; | ||
373 | struct hermes *hw = &priv->hw; | ||
374 | int err; | ||
375 | |||
376 | err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid); | ||
377 | if (err == -EIO && priv->nicbuf_size > TX_NICBUF_SIZE_BUG) { | ||
378 | /* Try workaround for old Symbol firmware bug */ | ||
379 | priv->nicbuf_size = TX_NICBUF_SIZE_BUG; | ||
380 | err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid); | ||
381 | |||
382 | printk(KERN_WARNING "%s: firmware ALLOC bug detected " | ||
383 | "(old Symbol firmware?). Work around %s\n", | ||
384 | dev->name, err ? "failed!" : "ok."); | ||
385 | } | ||
386 | |||
387 | return err; | ||
388 | } | ||
389 | |||
367 | int orinoco_get_bitratemode(int bitrate, int automatic) | 390 | int orinoco_get_bitratemode(int bitrate, int automatic) |
368 | { | 391 | { |
369 | int ratemode = -1; | 392 | int ratemode = -1; |
diff --git a/drivers/net/wireless/orinoco/hw.h b/drivers/net/wireless/orinoco/hw.h index 6186e44f54e9..89277de90876 100644 --- a/drivers/net/wireless/orinoco/hw.h +++ b/drivers/net/wireless/orinoco/hw.h | |||
@@ -25,6 +25,7 @@ struct dev_addr_list; | |||
25 | 25 | ||
26 | int determine_fw_capabilities(struct orinoco_private *priv); | 26 | int determine_fw_capabilities(struct orinoco_private *priv); |
27 | int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr); | 27 | int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr); |
28 | int orinoco_hw_allocate_fid(struct orinoco_private *priv); | ||
28 | int orinoco_get_bitratemode(int bitrate, int automatic); | 29 | int orinoco_get_bitratemode(int bitrate, int automatic); |
29 | void orinoco_get_ratemode_cfg(int ratemode, int *bitrate, int *automatic); | 30 | void orinoco_get_ratemode_cfg(int ratemode, int *bitrate, int *automatic); |
30 | 31 | ||
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index 0fe9420c4905..58a48db692e3 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c | |||
@@ -147,7 +147,6 @@ static const u8 encaps_hdr[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; | |||
147 | * how many events the | 147 | * how many events the |
148 | * device could | 148 | * device could |
149 | * legitimately generate */ | 149 | * legitimately generate */ |
150 | #define TX_NICBUF_SIZE_BUG 1585 /* Bug in Symbol firmware */ | ||
151 | 150 | ||
152 | #define DUMMY_FID 0xFFFF | 151 | #define DUMMY_FID 0xFFFF |
153 | 152 | ||
@@ -1574,26 +1573,6 @@ int __orinoco_down(struct net_device *dev) | |||
1574 | } | 1573 | } |
1575 | EXPORT_SYMBOL(__orinoco_down); | 1574 | EXPORT_SYMBOL(__orinoco_down); |
1576 | 1575 | ||
1577 | static int orinoco_allocate_fid(struct net_device *dev) | ||
1578 | { | ||
1579 | struct orinoco_private *priv = netdev_priv(dev); | ||
1580 | struct hermes *hw = &priv->hw; | ||
1581 | int err; | ||
1582 | |||
1583 | err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid); | ||
1584 | if (err == -EIO && priv->nicbuf_size > TX_NICBUF_SIZE_BUG) { | ||
1585 | /* Try workaround for old Symbol firmware bug */ | ||
1586 | priv->nicbuf_size = TX_NICBUF_SIZE_BUG; | ||
1587 | err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid); | ||
1588 | |||
1589 | printk(KERN_WARNING "%s: firmware ALLOC bug detected " | ||
1590 | "(old Symbol firmware?). Work around %s\n", | ||
1591 | dev->name, err ? "failed!" : "ok."); | ||
1592 | } | ||
1593 | |||
1594 | return err; | ||
1595 | } | ||
1596 | |||
1597 | int orinoco_reinit_firmware(struct net_device *dev) | 1576 | int orinoco_reinit_firmware(struct net_device *dev) |
1598 | { | 1577 | { |
1599 | struct orinoco_private *priv = netdev_priv(dev); | 1578 | struct orinoco_private *priv = netdev_priv(dev); |
@@ -1607,7 +1586,7 @@ int orinoco_reinit_firmware(struct net_device *dev) | |||
1607 | priv->do_fw_download = 0; | 1586 | priv->do_fw_download = 0; |
1608 | } | 1587 | } |
1609 | if (!err) | 1588 | if (!err) |
1610 | err = orinoco_allocate_fid(dev); | 1589 | err = orinoco_hw_allocate_fid(priv); |
1611 | 1590 | ||
1612 | return err; | 1591 | return err; |
1613 | } | 1592 | } |
@@ -2167,7 +2146,7 @@ static int orinoco_init(struct net_device *dev) | |||
2167 | if (err) | 2146 | if (err) |
2168 | goto out; | 2147 | goto out; |
2169 | 2148 | ||
2170 | err = orinoco_allocate_fid(dev); | 2149 | err = orinoco_hw_allocate_fid(priv); |
2171 | if (err) { | 2150 | if (err) { |
2172 | printk(KERN_ERR "%s: failed to allocate NIC buffer!\n", | 2151 | printk(KERN_ERR "%s: failed to allocate NIC buffer!\n", |
2173 | dev->name); | 2152 | dev->name); |