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>
This commit is contained in:
parent
e9e3d0100e
commit
42a51b9330
|
@ -15,6 +15,9 @@
|
||||||
|
|
||||||
#define SYMBOL_MAX_VER_LEN (14)
|
#define SYMBOL_MAX_VER_LEN (14)
|
||||||
|
|
||||||
|
/* Symbol firmware has a bug allocating buffers larger than this */
|
||||||
|
#define TX_NICBUF_SIZE_BUG 1585
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
/* Data tables */
|
/* Data tables */
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
@ -364,6 +367,26 @@ out:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int orinoco_hw_allocate_fid(struct orinoco_private *priv)
|
||||||
|
{
|
||||||
|
struct net_device *dev = priv->ndev;
|
||||||
|
struct hermes *hw = &priv->hw;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid);
|
||||||
|
if (err == -EIO && priv->nicbuf_size > TX_NICBUF_SIZE_BUG) {
|
||||||
|
/* Try workaround for old Symbol firmware bug */
|
||||||
|
priv->nicbuf_size = TX_NICBUF_SIZE_BUG;
|
||||||
|
err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid);
|
||||||
|
|
||||||
|
printk(KERN_WARNING "%s: firmware ALLOC bug detected "
|
||||||
|
"(old Symbol firmware?). Work around %s\n",
|
||||||
|
dev->name, err ? "failed!" : "ok.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
int orinoco_get_bitratemode(int bitrate, int automatic)
|
int orinoco_get_bitratemode(int bitrate, int automatic)
|
||||||
{
|
{
|
||||||
int ratemode = -1;
|
int ratemode = -1;
|
||||||
|
|
|
@ -25,6 +25,7 @@ struct dev_addr_list;
|
||||||
|
|
||||||
int determine_fw_capabilities(struct orinoco_private *priv);
|
int determine_fw_capabilities(struct orinoco_private *priv);
|
||||||
int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr);
|
int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr);
|
||||||
|
int orinoco_hw_allocate_fid(struct orinoco_private *priv);
|
||||||
int orinoco_get_bitratemode(int bitrate, int automatic);
|
int orinoco_get_bitratemode(int bitrate, int automatic);
|
||||||
void orinoco_get_ratemode_cfg(int ratemode, int *bitrate, int *automatic);
|
void orinoco_get_ratemode_cfg(int ratemode, int *bitrate, int *automatic);
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,6 @@ static const u8 encaps_hdr[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
|
||||||
* how many events the
|
* how many events the
|
||||||
* device could
|
* device could
|
||||||
* legitimately generate */
|
* legitimately generate */
|
||||||
#define TX_NICBUF_SIZE_BUG 1585 /* Bug in Symbol firmware */
|
|
||||||
|
|
||||||
#define DUMMY_FID 0xFFFF
|
#define DUMMY_FID 0xFFFF
|
||||||
|
|
||||||
|
@ -1574,26 +1573,6 @@ int __orinoco_down(struct net_device *dev)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__orinoco_down);
|
EXPORT_SYMBOL(__orinoco_down);
|
||||||
|
|
||||||
static int orinoco_allocate_fid(struct net_device *dev)
|
|
||||||
{
|
|
||||||
struct orinoco_private *priv = netdev_priv(dev);
|
|
||||||
struct hermes *hw = &priv->hw;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid);
|
|
||||||
if (err == -EIO && priv->nicbuf_size > TX_NICBUF_SIZE_BUG) {
|
|
||||||
/* Try workaround for old Symbol firmware bug */
|
|
||||||
priv->nicbuf_size = TX_NICBUF_SIZE_BUG;
|
|
||||||
err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid);
|
|
||||||
|
|
||||||
printk(KERN_WARNING "%s: firmware ALLOC bug detected "
|
|
||||||
"(old Symbol firmware?). Work around %s\n",
|
|
||||||
dev->name, err ? "failed!" : "ok.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
int orinoco_reinit_firmware(struct net_device *dev)
|
int orinoco_reinit_firmware(struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct orinoco_private *priv = netdev_priv(dev);
|
struct orinoco_private *priv = netdev_priv(dev);
|
||||||
|
@ -1607,7 +1586,7 @@ int orinoco_reinit_firmware(struct net_device *dev)
|
||||||
priv->do_fw_download = 0;
|
priv->do_fw_download = 0;
|
||||||
}
|
}
|
||||||
if (!err)
|
if (!err)
|
||||||
err = orinoco_allocate_fid(dev);
|
err = orinoco_hw_allocate_fid(priv);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -2167,7 +2146,7 @@ static int orinoco_init(struct net_device *dev)
|
||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
err = orinoco_allocate_fid(dev);
|
err = orinoco_hw_allocate_fid(priv);
|
||||||
if (err) {
|
if (err) {
|
||||||
printk(KERN_ERR "%s: failed to allocate NIC buffer!\n",
|
printk(KERN_ERR "%s: failed to allocate NIC buffer!\n",
|
||||||
dev->name);
|
dev->name);
|
||||||
|
|
Reference in New Issue