mwl8k: handle loading AP firmware images

AP and STA firmware images provide a different signature in the
HIU_INT_CODE register after loading.  Record which of the signatures
we saw, as it determines which command sequences to use later on.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Lennert Buytenhek 2009-10-22 20:20:53 +02:00 committed by John W. Linville
parent a74b295edb
commit eae74e6545

View File

@ -130,6 +130,7 @@ struct mwl8k_priv {
struct pci_dev *pdev;
struct mwl8k_device_info *device_info;
bool ap_fw;
/* firmware files and meta data */
struct mwl8k_firmware fw;
@ -534,6 +535,7 @@ static int mwl8k_load_firmware(struct ieee80211_hw *hw)
{
struct mwl8k_priv *priv = hw->priv;
struct firmware *fw = priv->fw.ucode;
struct mwl8k_device_info *di = priv->device_info;
int rc;
int loops;
@ -565,14 +567,26 @@ static int mwl8k_load_firmware(struct ieee80211_hw *hw)
return rc;
}
iowrite32(MWL8K_MODE_STA, priv->regs + MWL8K_HIU_GEN_PTR);
if (di->modes & BIT(NL80211_IFTYPE_AP))
iowrite32(MWL8K_MODE_AP, priv->regs + MWL8K_HIU_GEN_PTR);
else
iowrite32(MWL8K_MODE_STA, priv->regs + MWL8K_HIU_GEN_PTR);
msleep(1);
loops = 200000;
do {
if (ioread32(priv->regs + MWL8K_HIU_INT_CODE)
== MWL8K_FWSTA_READY)
u32 ready_code;
ready_code = ioread32(priv->regs + MWL8K_HIU_INT_CODE);
if (ready_code == MWL8K_FWAP_READY) {
priv->ap_fw = 1;
break;
} else if (ready_code == MWL8K_FWSTA_READY) {
priv->ap_fw = 0;
break;
}
cond_resched();
udelay(1);
} while (--loops);
@ -3165,9 +3179,10 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev,
goto err_stop_firmware;
}
printk(KERN_INFO "%s: %s v%d, %pM, firmware version %u.%u.%u.%u\n",
printk(KERN_INFO "%s: %s v%d, %pM, %s firmware %u.%u.%u.%u\n",
wiphy_name(hw->wiphy), priv->device_info->part_name,
priv->hw_rev, hw->wiphy->perm_addr,
priv->ap_fw ? "AP" : "STA",
(priv->fw_rev >> 24) & 0xff, (priv->fw_rev >> 16) & 0xff,
(priv->fw_rev >> 8) & 0xff, priv->fw_rev & 0xff);