myri_sbus: use request_firmware
Firmware blob looks like this... __be16 lanai4_data_size unsigned char lanai4_code[] Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
81c5228514
commit
cd36e9efaa
File diff suppressed because it is too large
Load Diff
|
@ -25,6 +25,7 @@ static char version[] =
|
|||
#include <linux/dma-mapping.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/firmware.h>
|
||||
|
||||
#include <net/dst.h>
|
||||
#include <net/arp.h>
|
||||
|
@ -43,7 +44,6 @@ static char version[] =
|
|||
#include <asm/irq.h>
|
||||
|
||||
#include "myri_sbus.h"
|
||||
#include "myri_code.h"
|
||||
|
||||
/* #define DEBUG_DETECT */
|
||||
/* #define DEBUG_IRQ */
|
||||
|
@ -81,6 +81,9 @@ static char version[] =
|
|||
#define DHDR(x)
|
||||
#endif
|
||||
|
||||
/* Firmware name */
|
||||
#define FWNAME "myricom/lanai.bin"
|
||||
|
||||
static void myri_reset_off(void __iomem *lp, void __iomem *cregs)
|
||||
{
|
||||
/* Clear IRQ mask. */
|
||||
|
@ -171,10 +174,11 @@ static int myri_do_handshake(struct myri_eth *mp)
|
|||
|
||||
static int __devinit myri_load_lanai(struct myri_eth *mp)
|
||||
{
|
||||
const struct firmware *fw;
|
||||
struct net_device *dev = mp->dev;
|
||||
struct myri_shmem __iomem *shmem = mp->shmem;
|
||||
void __iomem *rptr;
|
||||
int i;
|
||||
int i, lanai4_data_size;
|
||||
|
||||
myri_disable_irq(mp->lregs, mp->cregs);
|
||||
myri_reset_on(mp->cregs);
|
||||
|
@ -186,13 +190,27 @@ static int __devinit myri_load_lanai(struct myri_eth *mp)
|
|||
if (mp->eeprom.cpuvers >= CPUVERS_3_0)
|
||||
sbus_writel(mp->eeprom.cval, mp->lregs + LANAI_CVAL);
|
||||
|
||||
i = request_firmware(&fw, FWNAME, &mp->myri_op->dev);
|
||||
if (i) {
|
||||
printk(KERN_ERR "Failed to load image \"%s\" err %d\n",
|
||||
FWNAME, i);
|
||||
return i;
|
||||
}
|
||||
if (fw->size < 2) {
|
||||
printk(KERN_ERR "Bogus length %zu in image \"%s\"\n",
|
||||
fw->size, FWNAME);
|
||||
release_firmware(fw);
|
||||
return -EINVAL;
|
||||
}
|
||||
lanai4_data_size = fw->data[0] << 8 | fw->data[1];
|
||||
|
||||
/* Load executable code. */
|
||||
for (i = 0; i < sizeof(lanai4_code); i++)
|
||||
sbus_writeb(lanai4_code[i], rptr + (lanai4_code_off * 2) + i);
|
||||
for (i = 2; i < fw->size; i++)
|
||||
sbus_writeb(fw->data[i], rptr++);
|
||||
|
||||
/* Load data segment. */
|
||||
for (i = 0; i < sizeof(lanai4_data); i++)
|
||||
sbus_writeb(lanai4_data[i], rptr + (lanai4_data_off * 2) + i);
|
||||
for (i = 0; i < lanai4_data_size; i++)
|
||||
sbus_writeb(0, rptr++);
|
||||
|
||||
/* Set device address. */
|
||||
sbus_writeb(0, &shmem->addr[0]);
|
||||
|
@ -228,6 +246,7 @@ static int __devinit myri_load_lanai(struct myri_eth *mp)
|
|||
if (mp->eeprom.cpuvers == CPUVERS_4_0)
|
||||
sbus_writel(0, mp->lregs + LANAI_VERS);
|
||||
|
||||
release_firmware(fw);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -1078,7 +1097,10 @@ static int __devinit myri_sbus_probe(struct of_device *op, const struct of_devic
|
|||
|
||||
/* Load code onto the LANai. */
|
||||
DET(("Loading LANAI firmware\n"));
|
||||
myri_load_lanai(mp);
|
||||
if (myri_load_lanai(mp)) {
|
||||
printk(KERN_ERR "MyriCOM: Cannot Load LANAI firmware.\n");
|
||||
goto err_free_irq;
|
||||
}
|
||||
|
||||
if (register_netdev(dev)) {
|
||||
printk("MyriCOM: Cannot register device.\n");
|
||||
|
@ -1159,3 +1181,4 @@ module_init(myri_sbus_init);
|
|||
module_exit(myri_sbus_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_FIRMWARE(FWNAME);
|
||||
|
|
|
@ -40,6 +40,7 @@ fw-shipped-$(CONFIG_CHELSIO_T3) += cxgb3/t3b_psram-1.1.0.bin \
|
|||
fw-shipped-$(CONFIG_DVB_TTUSB_BUDGET) += ttusb-budget/dspbootcode.bin
|
||||
fw-shipped-$(CONFIG_E100) += e100/d101m_ucode.bin e100/d101s_ucode.bin \
|
||||
e100/d102e_ucode.bin
|
||||
fw-shipped-$(CONFIG_MYRI_SBUS) += myricom/lanai.bin
|
||||
fw-shipped-$(CONFIG_PCMCIA_SMC91C92) += ositech/Xilinx7OD.bin
|
||||
fw-shipped-$(CONFIG_SMCTR) += tr_smctr.bin
|
||||
fw-shipped-$(CONFIG_SND_KORG1212) += korg/k1212.dsp
|
||||
|
|
|
@ -543,3 +543,13 @@ Licence: Allegedly GPL, but no source visible. Marked:
|
|||
Found in hex form in kernel source.
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Driver: MYRI_SBUS - MyriCOM Gigabit Ethernet
|
||||
|
||||
File: myricom/lanai.bin
|
||||
|
||||
Licence: Unknown
|
||||
|
||||
Found in hex form in kernel source.
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue