Here's a patch for tehuti to make it use request_firmware. This is
compile-tested only. The firmware file can be produced by writing out
the array s_loadFirm as 32-bit little-endian values. However, the
licence remains a problem.
Ben.
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 3e433cb..9e1a73c 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2569,6 +2569,7 @@ config MLX4_DEBUG
config TEHUTI
tristate "Tehuti Networks 10G Ethernet"
depends on PCI
+ select FW_LOADER
help
Tehuti Networks 10G Ethernet NIC
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 432e837..3f732eb 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -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},
@@ -319,28 +318,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, 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 (fw)
+ release_firmware(fw);
if (master)
WRITE_REG(priv, regINIT_SEMAPHORE, 1);
- 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);
@@ -618,13 +630,6 @@ err:
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)) ?
@@ -2498,7 +2503,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));
@@ -2518,3 +2522,4 @@ module_exit(bdx_module_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(BDX_DRV_DESC);
+MODULE_FIRMWARE("tehuti/firmware.bin");
diff --git a/drivers/net/tehuti.h b/drivers/net/tehuti.h
index efd170f..b9acb3f 100644
--- a/drivers/net/tehuti.h
+++ b/drivers/net/tehuti.h
@@ -30,6 +30,7 @@
#include
#include
#include
+#include
#include
/* Compile Time Switches */
--- END ---
signature.asc
Description: This is a digitally signed message part