mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
ip2: use request_firmware()
Converted with help from Jaswinder Singh Signed-off-by: David Woodhouse <dwmw2@infradead.org> Acked-by: Alan Cox <alan@redhat.com>
This commit is contained in:
parent
27d202fff1
commit
547d8bb7dd
6 changed files with 2196 additions and 2163 deletions
File diff suppressed because it is too large
Load diff
|
@ -21,10 +21,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ip2types.h"
|
#include "ip2types.h"
|
||||||
#include "fip_firm.h" // the meat
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ip2_loadmain(int *, int *, unsigned char *, int ); // ref into ip2main.c
|
ip2_loadmain(int *, int *); // ref into ip2main.c
|
||||||
|
|
||||||
/* Note: Add compiled in defaults to these arrays, not to the structure
|
/* Note: Add compiled in defaults to these arrays, not to the structure
|
||||||
in ip2.h any longer. That structure WILL get overridden
|
in ip2.h any longer. That structure WILL get overridden
|
||||||
|
@ -52,7 +51,7 @@ static int __init ip2_init(void)
|
||||||
irq[0] = irq[1] = irq[2] = irq[3] = 0;
|
irq[0] = irq[1] = irq[2] = irq[3] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ip2_loadmain(io,irq,(unsigned char *)fip_firm,sizeof(fip_firm));
|
return ip2_loadmain(io, irq);
|
||||||
}
|
}
|
||||||
module_init(ip2_init);
|
module_init(ip2_init);
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,8 @@
|
||||||
#include <linux/major.h>
|
#include <linux/major.h>
|
||||||
#include <linux/wait.h>
|
#include <linux/wait.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
|
#include <linux/firmware.h>
|
||||||
|
#include <linux/platform_device.h>
|
||||||
|
|
||||||
#include <linux/tty.h>
|
#include <linux/tty.h>
|
||||||
#include <linux/tty_flip.h>
|
#include <linux/tty_flip.h>
|
||||||
|
@ -155,9 +157,7 @@ static char *pcDriver_name = "ip2";
|
||||||
static char *pcIpl = "ip2ipl";
|
static char *pcIpl = "ip2ipl";
|
||||||
|
|
||||||
// cheezy kludge or genius - you decide?
|
// cheezy kludge or genius - you decide?
|
||||||
int ip2_loadmain(int *, int *, unsigned char *, int);
|
int ip2_loadmain(int *, int *);
|
||||||
static unsigned char *Fip_firmware;
|
|
||||||
static int Fip_firmware_size;
|
|
||||||
|
|
||||||
/***********************/
|
/***********************/
|
||||||
/* Function Prototypes */
|
/* Function Prototypes */
|
||||||
|
@ -208,7 +208,7 @@ static int ip2_ipl_open(struct inode *, struct file *);
|
||||||
static int DumpTraceBuffer(char __user *, int);
|
static int DumpTraceBuffer(char __user *, int);
|
||||||
static int DumpFifoBuffer( char __user *, int);
|
static int DumpFifoBuffer( char __user *, int);
|
||||||
|
|
||||||
static void ip2_init_board(int);
|
static void ip2_init_board(int, const struct firmware *);
|
||||||
static unsigned short find_eisa_board(int);
|
static unsigned short find_eisa_board(int);
|
||||||
|
|
||||||
/***************/
|
/***************/
|
||||||
|
@ -474,8 +474,27 @@ static const struct tty_operations ip2_ops = {
|
||||||
/* SA_RANDOM - can be source for cert. random number generators */
|
/* SA_RANDOM - can be source for cert. random number generators */
|
||||||
#define IP2_SA_FLAGS 0
|
#define IP2_SA_FLAGS 0
|
||||||
|
|
||||||
|
|
||||||
|
static const struct firmware *ip2_request_firmware(void)
|
||||||
|
{
|
||||||
|
struct platform_device *pdev;
|
||||||
|
const struct firmware *fw;
|
||||||
|
|
||||||
|
pdev = platform_device_register_simple("ip2", 0, NULL, 0);
|
||||||
|
if (IS_ERR(pdev)) {
|
||||||
|
printk(KERN_ERR "Failed to register platform device for ip2\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (request_firmware(&fw, "intelliport2.bin", &pdev->dev)) {
|
||||||
|
printk(KERN_ERR "Failed to load firmware 'intelliport2.bin'\n");
|
||||||
|
fw = NULL;
|
||||||
|
}
|
||||||
|
platform_device_unregister(pdev);
|
||||||
|
return fw;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
|
ip2_loadmain(int *iop, int *irqp)
|
||||||
{
|
{
|
||||||
int i, j, box;
|
int i, j, box;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
@ -483,6 +502,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
|
||||||
i2eBordStrPtr pB = NULL;
|
i2eBordStrPtr pB = NULL;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
static struct pci_dev *pci_dev_i = NULL;
|
static struct pci_dev *pci_dev_i = NULL;
|
||||||
|
const struct firmware *fw = NULL;
|
||||||
|
|
||||||
ip2trace (ITRC_NO_PORT, ITRC_INIT, ITRC_ENTER, 0 );
|
ip2trace (ITRC_NO_PORT, ITRC_INIT, ITRC_ENTER, 0 );
|
||||||
|
|
||||||
|
@ -516,9 +536,6 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
|
||||||
}
|
}
|
||||||
poll_only = !poll_only;
|
poll_only = !poll_only;
|
||||||
|
|
||||||
Fip_firmware = firmware;
|
|
||||||
Fip_firmware_size = firmsize;
|
|
||||||
|
|
||||||
/* Announce our presence */
|
/* Announce our presence */
|
||||||
printk( KERN_INFO "%s version %s\n", pcName, pcVersion );
|
printk( KERN_INFO "%s version %s\n", pcName, pcVersion );
|
||||||
|
|
||||||
|
@ -638,10 +655,18 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for ( i = 0; i < IP2_MAX_BOARDS; ++i ) {
|
for ( i = 0; i < IP2_MAX_BOARDS; ++i ) {
|
||||||
|
/* We don't want to request the firmware unless we have at
|
||||||
|
least one board */
|
||||||
if ( i2BoardPtrTable[i] != NULL ) {
|
if ( i2BoardPtrTable[i] != NULL ) {
|
||||||
ip2_init_board( i );
|
if (!fw)
|
||||||
|
fw = ip2_request_firmware();
|
||||||
|
if (!fw)
|
||||||
|
break;
|
||||||
|
ip2_init_board(i, fw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (fw)
|
||||||
|
release_firmware(fw);
|
||||||
|
|
||||||
ip2trace (ITRC_NO_PORT, ITRC_INIT, 2, 0 );
|
ip2trace (ITRC_NO_PORT, ITRC_INIT, 2, 0 );
|
||||||
|
|
||||||
|
@ -769,7 +794,7 @@ out:
|
||||||
/* are reported on the console. */
|
/* are reported on the console. */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
static void
|
static void
|
||||||
ip2_init_board( int boardnum )
|
ip2_init_board(int boardnum, const struct firmware *fw)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int nports = 0, nboxes = 0;
|
int nports = 0, nboxes = 0;
|
||||||
|
@ -789,7 +814,7 @@ ip2_init_board( int boardnum )
|
||||||
goto err_initialize;
|
goto err_initialize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( iiDownloadAll ( pB, (loadHdrStrPtr)Fip_firmware, 1, Fip_firmware_size )
|
if ( iiDownloadAll ( pB, (loadHdrStrPtr)fw->data, 1, fw->size )
|
||||||
!= II_DOWN_GOOD ) {
|
!= II_DOWN_GOOD ) {
|
||||||
printk ( KERN_ERR "IP2: failed to download loadware\n" );
|
printk ( KERN_ERR "IP2: failed to download loadware\n" );
|
||||||
goto err_release_region;
|
goto err_release_region;
|
||||||
|
|
|
@ -21,6 +21,7 @@ fw-external-y := $(subst ",,$(CONFIG_EXTRA_FIRMWARE))
|
||||||
# But be aware that the config file might not be included at all.
|
# But be aware that the config file might not be included at all.
|
||||||
|
|
||||||
fw-shipped-$(CONFIG_ATM_AMBASSADOR) += atmsar11.fw
|
fw-shipped-$(CONFIG_ATM_AMBASSADOR) += atmsar11.fw
|
||||||
|
fw-shipped-$(CONFIG_COMPUTONE) += intelliport2.bin
|
||||||
fw-shipped-$(CONFIG_DVB_TTUSB_BUDGET) += ttusb-budget/dspbootcode.bin
|
fw-shipped-$(CONFIG_DVB_TTUSB_BUDGET) += ttusb-budget/dspbootcode.bin
|
||||||
fw-shipped-$(CONFIG_SMCTR) += tr_smctr.bin
|
fw-shipped-$(CONFIG_SMCTR) += tr_smctr.bin
|
||||||
fw-shipped-$(CONFIG_SND_KORG1212) += korg/k1212.dsp
|
fw-shipped-$(CONFIG_SND_KORG1212) += korg/k1212.dsp
|
||||||
|
|
|
@ -226,3 +226,13 @@ Debug loader claims the following behaviour:
|
||||||
Converted from Intel HEX files, used in our binary representation of ihex.
|
Converted from Intel HEX files, used in our binary representation of ihex.
|
||||||
|
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Driver: ip2 -- Computone IntelliPort Plus serial device
|
||||||
|
|
||||||
|
File: intelliport2.bin
|
||||||
|
|
||||||
|
Licence: Unknown
|
||||||
|
|
||||||
|
Found in hex form in kernel source.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
|
2147
firmware/intelliport2.bin.ihex
Normal file
2147
firmware/intelliport2.bin.ihex
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue