Skip to content

Commit

Permalink
tehuti: Use request_firmware()
Browse files Browse the repository at this point in the history
Firmware blob is little endian.

Compile-tested only.

Signed-off-by: Ben Hutchings <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
bwhacks authored and davem330 committed Feb 27, 2009
1 parent 1318136 commit 06e1f9f
Show file tree
Hide file tree
Showing 6 changed files with 2,718 additions and 10,729 deletions.
39 changes: 22 additions & 17 deletions drivers/net/tehuti.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
*/

#include "tehuti.h"
#include "tehuti_fw.h"

static struct pci_device_id __devinitdata bdx_pci_tbl[] = {
{0x1FC9, 0x3009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
Expand Down Expand Up @@ -318,28 +317,41 @@ static int bdx_poll(struct napi_struct *napi, int budget)

static int bdx_fw_load(struct bdx_priv *priv)
{
const struct firmware *fw = NULL;
int master, i;
int rc;

ENTER;
master = READ_REG(priv, regINIT_SEMAPHORE);
if (!READ_REG(priv, regINIT_STATUS) && master) {
bdx_tx_push_desc_safe(priv, s_firmLoad, sizeof(s_firmLoad));
rc = request_firmware(&fw, "tehuti/firmware.bin", &priv->pdev->dev);
if (rc)
goto out;
bdx_tx_push_desc_safe(priv, (char *)fw->data, fw->size);
mdelay(100);
}
for (i = 0; i < 200; i++) {
if (READ_REG(priv, regINIT_STATUS))
break;
if (READ_REG(priv, regINIT_STATUS)) {
rc = 0;
goto out;
}
mdelay(2);
}
rc = -EIO;
out:
if (master)
WRITE_REG(priv, regINIT_SEMAPHORE, 1);
if (fw)
release_firmware(fw);

if (i == 200) {
if (rc) {
ERR("%s: firmware loading failed\n", priv->ndev->name);
DBG("VPC = 0x%x VIC = 0x%x INIT_STATUS = 0x%x i=%d\n",
READ_REG(priv, regVPC),
READ_REG(priv, regVIC), READ_REG(priv, regINIT_STATUS), i);
RET(-EIO);
if (rc == -EIO)
DBG("VPC = 0x%x VIC = 0x%x INIT_STATUS = 0x%x i=%d\n",
READ_REG(priv, regVPC),
READ_REG(priv, regVIC),
READ_REG(priv, regINIT_STATUS), i);
RET(rc);
} else {
DBG("%s: firmware loading success\n", priv->ndev->name);
RET(0);
Expand Down Expand Up @@ -617,13 +629,6 @@ static int bdx_open(struct net_device *ndev)
RET(rc);
}

static void __init bdx_firmware_endianess(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(s_firmLoad); i++)
s_firmLoad[i] = CPU_CHIP_SWAP32(s_firmLoad[i]);
}

static int bdx_range_check(struct bdx_priv *priv, u32 offset)
{
return (offset > (u32) (BDX_REGS_SIZE / priv->nic->port_num)) ?
Expand Down Expand Up @@ -2501,7 +2506,6 @@ static void __init print_driver_id(void)
static int __init bdx_module_init(void)
{
ENTER;
bdx_firmware_endianess();
init_txd_sizes();
print_driver_id();
RET(pci_register_driver(&bdx_pci_driver));
Expand All @@ -2521,3 +2525,4 @@ module_exit(bdx_module_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(BDX_DRV_DESC);
MODULE_FIRMWARE("tehuti/firmware.bin");
1 change: 1 addition & 0 deletions drivers/net/tehuti.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <linux/if_vlan.h>
#include <linux/interrupt.h>
#include <linux/vmalloc.h>
#include <linux/firmware.h>
#include <asm/byteorder.h>

/* Compile Time Switches */
Expand Down
Loading

0 comments on commit 06e1f9f

Please sign in to comment.