Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158848
b: refs/heads/master
c: a3f47b9
h: refs/heads/master
v: v3
  • Loading branch information
David Kilroy authored and John W. Linville committed Jul 10, 2009
1 parent 3f0657e commit 9dbf24b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 51 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 42a51b933034bbed93fa54009c96a482044e5b43
refs/heads/master: a3f47b9c2ada45ffacc8f2b54507221a1ba8eb10
92 changes: 42 additions & 50 deletions trunk/drivers/net/wireless/orinoco/hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* See copyright notice in main.c
*/
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/if_arp.h>
#include <linux/ieee80211.h>
#include <linux/wireless.h>
Expand Down Expand Up @@ -56,10 +57,13 @@ static inline fwtype_t determine_firmware_type(struct comp_id *nic_id)
return FIRMWARE_TYPE_INTERSIL;
}

/* Set priv->firmware type, determine firmware properties */
/* Set priv->firmware type, determine firmware properties
* This function can be called before we have registerred with netdev,
* so all errors go out with dev_* rather than printk
*/
int determine_fw_capabilities(struct orinoco_private *priv)
{
struct net_device *dev = priv->ndev;
struct device *dev = priv->dev;
hermes_t *hw = &priv->hw;
int err;
struct comp_id nic_id, sta_id;
Expand All @@ -69,52 +73,47 @@ int determine_fw_capabilities(struct orinoco_private *priv)
/* Get the hardware version */
err = HERMES_READ_RECORD(hw, USER_BAP, HERMES_RID_NICID, &nic_id);
if (err) {
printk(KERN_ERR "%s: Cannot read hardware identity: error %d\n",
dev->name, err);
dev_err(dev, "Cannot read hardware identity: error %d\n",
err);
return err;
}

le16_to_cpus(&nic_id.id);
le16_to_cpus(&nic_id.variant);
le16_to_cpus(&nic_id.major);
le16_to_cpus(&nic_id.minor);
printk(KERN_DEBUG "%s: Hardware identity %04x:%04x:%04x:%04x\n",
dev->name, nic_id.id, nic_id.variant,
nic_id.major, nic_id.minor);
dev_info(dev, "Hardware identity %04x:%04x:%04x:%04x\n",
nic_id.id, nic_id.variant, nic_id.major, nic_id.minor);

priv->firmware_type = determine_firmware_type(&nic_id);

/* Get the firmware version */
err = HERMES_READ_RECORD(hw, USER_BAP, HERMES_RID_STAID, &sta_id);
if (err) {
printk(KERN_ERR "%s: Cannot read station identity: error %d\n",
dev->name, err);
dev_err(dev, "Cannot read station identity: error %d\n",
err);
return err;
}

le16_to_cpus(&sta_id.id);
le16_to_cpus(&sta_id.variant);
le16_to_cpus(&sta_id.major);
le16_to_cpus(&sta_id.minor);
printk(KERN_DEBUG "%s: Station identity %04x:%04x:%04x:%04x\n",
dev->name, sta_id.id, sta_id.variant,
sta_id.major, sta_id.minor);
dev_info(dev, "Station identity %04x:%04x:%04x:%04x\n",
sta_id.id, sta_id.variant, sta_id.major, sta_id.minor);

switch (sta_id.id) {
case 0x15:
printk(KERN_ERR "%s: Primary firmware is active\n",
dev->name);
dev_err(dev, "Primary firmware is active\n");
return -ENODEV;
case 0x14b:
printk(KERN_ERR "%s: Tertiary firmware is active\n",
dev->name);
dev_err(dev, "Tertiary firmware is active\n");
return -ENODEV;
case 0x1f: /* Intersil, Agere, Symbol Spectrum24 */
case 0x21: /* Symbol Spectrum24 Trilogy */
break;
default:
printk(KERN_NOTICE "%s: Unknown station ID, please report\n",
dev->name);
dev_notice(dev, "Unknown station ID, please report\n");
break;
}

Expand Down Expand Up @@ -168,10 +167,8 @@ int determine_fw_capabilities(struct orinoco_private *priv)
HERMES_RID_SECONDARYVERSION_SYMBOL,
SYMBOL_MAX_VER_LEN, NULL, &tmp);
if (err) {
printk(KERN_WARNING
"%s: Error %d reading Symbol firmware info. "
"Wildly guessing capabilities...\n",
dev->name, err);
dev_warn(dev, "Error %d reading Symbol firmware info. "
"Wildly guessing capabilities...\n", err);
firmver = 0;
tmp[0] = '\0';
} else {
Expand Down Expand Up @@ -242,24 +239,24 @@ int determine_fw_capabilities(struct orinoco_private *priv)
if (firmver >= 0x000800)
priv->ibss_port = 0;
else {
printk(KERN_NOTICE "%s: Intersil firmware earlier "
"than v0.8.x - several features not supported\n",
dev->name);
dev_notice(dev, "Intersil firmware earlier than v0.8.x"
" - several features not supported\n");
priv->ibss_port = 1;
}
break;
}
printk(KERN_DEBUG "%s: Firmware determined as %s\n", dev->name,
priv->fw_name);
dev_info(dev, "Firmware determined as %s\n", priv->fw_name);

return 0;
}

/* Read settings from EEPROM into our private structure.
* MAC address gets dropped into callers buffer */
* MAC address gets dropped into callers buffer
* Can be called before netdev registration.
*/
int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr)
{
struct net_device *dev = priv->ndev;
struct device *dev = priv->dev;
struct hermes_idstring nickbuf;
hermes_t *hw = &priv->hw;
int len;
Expand All @@ -270,20 +267,17 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr)
err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNMACADDR,
ETH_ALEN, NULL, dev_addr);
if (err) {
printk(KERN_WARNING "%s: failed to read MAC address!\n",
dev->name);
dev_warn(dev, "Failed to read MAC address!\n");
goto out;
}

printk(KERN_DEBUG "%s: MAC address %pM\n",
dev->name, dev_addr);
dev_dbg(dev, "MAC address %pM\n", dev_addr);

/* Get the station name */
err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNNAME,
sizeof(nickbuf), &reclen, &nickbuf);
if (err) {
printk(KERN_ERR "%s: failed to read station name\n",
dev->name);
dev_err(dev, "failed to read station name\n");
goto out;
}
if (nickbuf.len)
Expand All @@ -293,14 +287,13 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr)
memcpy(priv->nick, &nickbuf.val, len);
priv->nick[len] = '\0';

printk(KERN_DEBUG "%s: Station name \"%s\"\n", dev->name, priv->nick);
dev_dbg(dev, "Station name \"%s\"\n", priv->nick);

/* Get allowed channels */
err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CHANNELLIST,
&priv->channel_mask);
if (err) {
printk(KERN_ERR "%s: failed to read channel list!\n",
dev->name);
dev_err(dev, "Failed to read channel list!\n");
goto out;
}

Expand All @@ -314,8 +307,7 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr)
err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFRTSTHRESHOLD,
&priv->rts_thresh);
if (err) {
printk(KERN_ERR "%s: failed to read RTS threshold!\n",
dev->name);
dev_err(dev, "Failed to read RTS threshold!\n");
goto out;
}

Expand All @@ -329,8 +321,7 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr)
HERMES_RID_CNFFRAGMENTATIONTHRESHOLD,
&priv->frag_thresh);
if (err) {
printk(KERN_ERR "%s: failed to read fragmentation settings!\n",
dev->name);
dev_err(dev, "Failed to read fragmentation settings!\n");
goto out;
}

Expand All @@ -342,16 +333,16 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr)
HERMES_RID_CNFMAXSLEEPDURATION,
&priv->pm_period);
if (err) {
printk(KERN_ERR "%s: failed to read power management "
"period!\n", dev->name);
dev_err(dev, "Failed to read power management "
"period!\n");
goto out;
}
err = hermes_read_wordrec(hw, USER_BAP,
HERMES_RID_CNFPMHOLDOVERDURATION,
&priv->pm_timeout);
if (err) {
printk(KERN_ERR "%s: failed to read power management "
"timeout!\n", dev->name);
dev_err(dev, "Failed to read power management "
"timeout!\n");
goto out;
}
}
Expand All @@ -367,9 +358,10 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr)
return err;
}

/* Can be called before netdev registration */
int orinoco_hw_allocate_fid(struct orinoco_private *priv)
{
struct net_device *dev = priv->ndev;
struct device *dev = priv->dev;
struct hermes *hw = &priv->hw;
int err;

Expand All @@ -379,9 +371,9 @@ int orinoco_hw_allocate_fid(struct orinoco_private *priv)
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.");
dev_warn(dev, "Firmware ALLOC bug detected "
"(old Symbol firmware?). Work around %s\n",
err ? "failed!" : "ok.");
}

return err;
Expand Down

0 comments on commit 9dbf24b

Please sign in to comment.