Commit 5a861022 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-2.6.27' of git://git.infradead.org/users/dwmw2/firmware-2.6

* 'for-2.6.27' of git://git.infradead.org/users/dwmw2/firmware-2.6: (64 commits)
  firmware: convert sb16_csp driver to use firmware loader exclusively
  dsp56k: use request_firmware
  edgeport-ti: use request_firmware()
  edgeport: use request_firmware()
  vicam: use request_firmware()
  dabusb: use request_firmware()
  cpia2: use request_firmware()
  ip2: use request_firmware()
  firmware: convert Ambassador ATM driver to request_firmware()
  whiteheat: use request_firmware()
  ti_usb_3410_5052: use request_firmware()
  emi62: use request_firmware()
  emi26: use request_firmware()
  keyspan_pda: use request_firmware()
  keyspan: use request_firmware()
  ttusb-budget: use request_firmware()
  kaweth: use request_firmware()
  smctr: use request_firmware()
  firmware: convert ymfpci driver to use firmware loader exclusively
  firmware: convert maestro3 driver to use firmware loader exclusively
  ...

Fix up trivial conflicts with BKL removal in drivers/char/dsp56k.c and
drivers/char/ip2/ip2main.c manually.
parents 85082fd7 751851af
......@@ -450,7 +450,7 @@ scripts: scripts_basic include/config/auto.conf
# Objects we will link into vmlinux / subdirs we need to visit
init-y := init/
drivers-y := drivers/ sound/
drivers-y := drivers/ sound/ firmware/
net-y := net/
libs-y := lib/
core-y := usr/
......@@ -998,6 +998,16 @@ PHONY += depend dep
depend dep:
@echo '*** Warning: make $@ is unnecessary now.'
# ---------------------------------------------------------------------------
# Firmware install
INSTALL_FW_PATH=$(INSTALL_MOD_PATH)/lib/firmware
export INSTALL_FW_PATH
PHONY += firmware_install
firmware_install: FORCE
@mkdir -p $(objtree)/firmware
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_install
# ---------------------------------------------------------------------------
# Kernel headers
INSTALL_HDR_PATH=$(objtree)/usr
......@@ -1084,6 +1094,7 @@ _modinst_:
# boot script depmod is the master version.
PHONY += _modinst_post
_modinst_post: _modinst_
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modinst
$(call cmd,depmod)
else # CONFIG_MODULES
......@@ -1201,6 +1212,8 @@ help:
@echo '* vmlinux - Build the bare kernel'
@echo '* modules - Build all modules'
@echo ' modules_install - Install all modules to INSTALL_MOD_PATH (default: /)'
@echo ' firmware_install- Install all firmware to INSTALL_FW_PATH'
@echo ' (default: $$(INSTALL_MOD_PATH)/lib/firmware)'
@echo ' dir/ - Build all files in dir and below'
@echo ' dir/file.[ois] - Build specified target only'
@echo ' dir/file.ko - Build module including final link'
......
......@@ -491,7 +491,7 @@ MODULE_ALIAS_MISCDEV(MICROCODE_MINOR);
#define microcode_dev_exit() do { } while(0)
#endif
static long get_next_ucode_from_buffer(void **mc, void *buf,
static long get_next_ucode_from_buffer(void **mc, const u8 *buf,
unsigned long size, long offset)
{
microcode_header_t *mc_header;
......@@ -525,7 +525,7 @@ static int cpu_request_microcode(int cpu)
char name[30];
struct cpuinfo_x86 *c = &cpu_data(cpu);
const struct firmware *firmware;
void *buf;
const u8 *buf;
unsigned long size;
long offset = 0;
int error;
......
......@@ -6,9 +6,9 @@ fore_200e-objs := fore200e.o
hostprogs-y := fore200e_mkfirm
# Files generated that shall be removed upon make clean
clean-files := atmsar11.bin atmsar11.bin1 atmsar11.bin2 pca200e.bin \
pca200e.bin1 pca200e.bin2 pca200e_ecd.bin pca200e_ecd.bin1 \
pca200e_ecd.bin2 sba200e_ecd.bin sba200e_ecd.bin1 sba200e_ecd.bin2
clean-files := pca200e.bin pca200e.bin1 pca200e.bin2 pca200e_ecd.bin \
pca200e_ecd.bin1 pca200e_ecd.bin2 sba200e_ecd.bin sba200e_ecd.bin1 \
sba200e_ecd.bin2
# Firmware generated that shall be removed upon make clean
clean-files += fore200e_pca_fw.c fore200e_sba_fw.c
......
......@@ -34,6 +34,8 @@
#include <linux/poison.h>
#include <linux/bitrev.h>
#include <linux/mutex.h>
#include <linux/firmware.h>
#include <linux/ihex.h>
#include <asm/atomic.h>
#include <asm/io.h>
......@@ -290,29 +292,6 @@ static inline void __init show_version (void) {
*/
/********** microcode **********/
#ifdef AMB_NEW_MICROCODE
#define UCODE(x) UCODE2(atmsar12.x)
#else
#define UCODE(x) UCODE2(atmsar11.x)
#endif
#define UCODE2(x) #x
static u32 __devinitdata ucode_start =
#include UCODE(start)
;
static region __devinitdata ucode_regions[] = {
#include UCODE(regions)
{ 0, 0 }
};
static u32 __devinitdata ucode_data[] = {
#include UCODE(data)
0xdeadbeef
};
static void do_housekeeping (unsigned long arg);
/********** globals **********/
......@@ -1841,45 +1820,34 @@ static int __devinit get_loader_version (loader_block * lb,
/* loader: write memory data blocks */
static int __devinit loader_write (loader_block * lb,
const amb_dev * dev, const u32 * data,
u32 address, unsigned int count) {
unsigned int i;
static int __devinit loader_write (loader_block* lb,
const amb_dev *dev,
const struct ihex_binrec *rec) {
transfer_block * tb = &lb->payload.transfer;
PRINTD (DBG_FLOW|DBG_LOAD, "loader_write");
if (count > MAX_TRANSFER_DATA)
return -EINVAL;
tb->address = cpu_to_be32 (address);
tb->count = cpu_to_be32 (count);
for (i = 0; i < count; ++i)
tb->data[i] = cpu_to_be32 (data[i]);
tb->address = rec->addr;
tb->count = cpu_to_be32(be16_to_cpu(rec->len) / 4);
memcpy(tb->data, rec->data, be16_to_cpu(rec->len));
return do_loader_command (lb, dev, write_adapter_memory);
}
/* loader: verify memory data blocks */
static int __devinit loader_verify (loader_block * lb,
const amb_dev * dev, const u32 * data,
u32 address, unsigned int count) {
unsigned int i;
const amb_dev *dev,
const struct ihex_binrec *rec) {
transfer_block * tb = &lb->payload.transfer;
int res;
PRINTD (DBG_FLOW|DBG_LOAD, "loader_verify");
if (count > MAX_TRANSFER_DATA)
return -EINVAL;
tb->address = cpu_to_be32 (address);
tb->count = cpu_to_be32 (count);
tb->address = rec->addr;
tb->count = cpu_to_be32(be16_to_cpu(rec->len) / 4);
res = do_loader_command (lb, dev, read_adapter_memory);
if (!res)
for (i = 0; i < count; ++i)
if (tb->data[i] != cpu_to_be32 (data[i])) {
res = -EINVAL;
break;
}
if (!res && memcmp(tb->data, rec->data, be16_to_cpu(rec->len)))
res = -EINVAL;
return res;
}
......@@ -1962,47 +1930,53 @@ static int amb_reset (amb_dev * dev, int diags) {
/********** transfer and start the microcode **********/
static int __devinit ucode_init (loader_block * lb, amb_dev * dev) {
unsigned int i = 0;
unsigned int total = 0;
const u32 * pointer = ucode_data;
u32 address;
unsigned int count;
const struct firmware *fw;
unsigned long start_address;
const struct ihex_binrec *rec;
int res;
res = request_ihex_firmware(&fw, "atmsar11.fw", &dev->pci_dev->dev);
if (res) {
PRINTK (KERN_ERR, "Cannot load microcode data");
return res;
}
/* First record contains just the start address */
rec = (const struct ihex_binrec *)fw->data;
if (be16_to_cpu(rec->len) != sizeof(__be32) || be32_to_cpu(rec->addr)) {
PRINTK (KERN_ERR, "Bad microcode data (no start record)");
return -EINVAL;
}
start_address = be32_to_cpup((__be32 *)rec->data);
rec = ihex_next_binrec(rec);
PRINTD (DBG_FLOW|DBG_LOAD, "ucode_init");
while (address = ucode_regions[i].start,
count = ucode_regions[i].count) {
PRINTD (DBG_LOAD, "starting region (%x, %u)", address, count);
while (count) {
unsigned int words;
if (count <= MAX_TRANSFER_DATA)
words = count;
else
words = MAX_TRANSFER_DATA;
total += words;
res = loader_write (lb, dev, pointer, address, words);
if (res)
return res;
res = loader_verify (lb, dev, pointer, address, words);
if (res)
return res;
count -= words;
address += sizeof(u32) * words;
pointer += words;
while (rec) {
PRINTD (DBG_LOAD, "starting region (%x, %u)", be32_to_cpu(rec->addr),
be16_to_cpu(rec->len));
if (be16_to_cpu(rec->len) > 4 * MAX_TRANSFER_DATA) {
PRINTK (KERN_ERR, "Bad microcode data (record too long)");
return -EINVAL;
}
i += 1;
}
if (*pointer == ATM_POISON) {
return loader_start (lb, dev, ucode_start);
} else {
// cast needed as there is no %? for pointer differnces
PRINTD (DBG_LOAD|DBG_ERR,
"offset=%li, *pointer=%x, address=%x, total=%u",
(long) (pointer - ucode_data), *pointer, address, total);
PRINTK (KERN_ERR, "incorrect microcode data");
return -ENOMEM;
if (be16_to_cpu(rec->len) & 3) {
PRINTK (KERN_ERR, "Bad microcode data (odd number of bytes)");
return -EINVAL;
}
res = loader_write(lb, dev, rec);
if (res)
break;
res = loader_verify(lb, dev, rec);
if (res)
break;
}
release_firmware(fw);
if (!res)
res = loader_start(lb, dev, start_address);
return res;
}
/********** give adapter parameters **********/
......
......@@ -656,17 +656,6 @@ typedef struct amb_dev amb_dev;
#define AMB_DEV(atm_dev) ((amb_dev *) (atm_dev)->dev_data)
#define AMB_VCC(atm_vcc) ((amb_vcc *) (atm_vcc)->dev_data)
/* the microcode */
typedef struct {
u32 start;
unsigned int count;
} region;
static region ucode_regions[];
static u32 ucode_data[];
static u32 ucode_start;
/* rate rounding */
typedef enum {
......
This diff is collapsed.
/*
See copyright and licensing conditions in ambassador.* files.
*/
{ 0x00000080, 993, },
{ 0xa0d0d500, 80, },
{ 0xa0d0f000, 978, },
/*
See copyright and licensing conditions in ambassador.* files.
*/
0xa0d0f000
......@@ -34,6 +34,70 @@ config FW_LOADER
require userspace firmware loading support, but a module built outside
the kernel tree does.
config FIRMWARE_IN_KERNEL
bool "Include in-kernel firmware blobs in kernel binary"
depends on FW_LOADER
default y
help
The kernel source tree includes a number of firmware 'blobs'
which are used by various drivers. The recommended way to
use these is to run "make firmware_install" and to copy the
resulting binary files created in usr/lib/firmware directory
of the kernel tree to the /lib/firmware on your system so
that they can be loaded by userspace helpers on request.
Enabling this option will build each required firmware blob
into the kernel directly, where request_firmware() will find
them without having to call out to userspace. This may be
useful if your root file system requires a device which uses
such firmware, and do not wish to use an initrd.
This single option controls the inclusion of firmware for
every driver which usees request_firmare() and ships its
firmware in the kernel source tree, to avoid a proliferation
of 'Include firmware for xxx device' options.
Say 'N' and let firmware be loaded from userspace.
config EXTRA_FIRMWARE
string "External firmware blobs to build into the kernel binary"
depends on FW_LOADER
help
This option allows firmware to be built into the kernel, for the
cases where the user either cannot or doesn't want to provide it from
userspace at runtime (for example, when the firmware in question is
required for accessing the boot device, and the user doesn't want to
use an initrd).
This option is a string, and takes the (space-separated) names of the
firmware files -- the same names which appear in MODULE_FIRMWARE()
and request_firmware() in the source. These files should exist under
the directory specified by the EXTRA_FIRMWARE_DIR option, which is
by default the firmware/ subdirectory of the kernel source tree.
So, for example, you might set CONFIG_EXTRA_FIRMWARE="usb8388.bin",
copy the usb8388.bin file into the firmware/ directory, and build the
kernel. Then any request_firmware("usb8388.bin") will be
satisfied internally without needing to call out to userspace.
WARNING: If you include additional firmware files into your binary
kernel image which are not available under the terms of the GPL,
then it may be a violation of the GPL to distribute the resulting
image -- since it combines both GPL and non-GPL work. You should
consult a lawyer of your own before distributing such an image.
config EXTRA_FIRMWARE_DIR
string "Firmware blobs root directory"
depends on EXTRA_FIRMWARE != ""
default "firmware"
help
This option controls the directory in which the kernel build system
looks for the firmware files listed in the EXTRA_FIRMWARE option.
The default is the firmware/ directory in the kernel source tree,
but by changing this option you can point it elsewhere, such as
the /lib/firmware/ directory or another separate directory
containing firmware files.
config DEBUG_DRIVER
bool "Driver Core verbose debug messages"
depends on DEBUG_KERNEL
......
......@@ -49,6 +49,14 @@ struct firmware_priv {
struct timer_list timeout;
};
#ifdef CONFIG_FW_LOADER
extern struct builtin_fw __start_builtin_fw[];
extern struct builtin_fw __end_builtin_fw[];
#else /* Module case. Avoid ifdefs later; it'll all optimise out */
static struct builtin_fw *__start_builtin_fw;
static struct builtin_fw *__end_builtin_fw;
#endif
static void
fw_load_abort(struct firmware_priv *fw_priv)
{
......@@ -257,7 +265,7 @@ firmware_data_write(struct kobject *kobj, struct bin_attribute *bin_attr,
if (retval)
goto out;
memcpy(fw->data + offset, buffer, count);
memcpy((u8 *)fw->data + offset, buffer, count);
fw->size = max_t(size_t, offset + count, fw->size);
retval = count;
......@@ -391,13 +399,12 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
struct device *f_dev;
struct firmware_priv *fw_priv;
struct firmware *firmware;
struct builtin_fw *builtin;
int retval;
if (!firmware_p)
return -EINVAL;
printk(KERN_INFO "firmware: requesting %s\n", name);
*firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL);
if (!firmware) {
printk(KERN_ERR "%s: kmalloc(struct firmware) failed\n",
......@@ -406,6 +413,20 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
goto out;
}
for (builtin = __start_builtin_fw; builtin != __end_builtin_fw;
builtin++) {
if (strcmp(name, builtin->name))
continue;
printk(KERN_INFO "firmware: using built-in firmware %s\n",
name);
firmware->size = builtin->size;
firmware->data = builtin->data;
return 0;
}
if (uevent)
printk(KERN_INFO "firmware: requesting %s\n", name);
retval = fw_setup_device(firmware, &f_dev, name, device, uevent);
if (retval)
goto error_kfree_fw;
......@@ -473,8 +494,16 @@ request_firmware(const struct firmware **firmware_p, const char *name,
void
release_firmware(const struct firmware *fw)
{
struct builtin_fw *builtin;
if (fw) {
for (builtin = __start_builtin_fw; builtin != __end_builtin_fw;
builtin++) {
if (fw->data == builtin->data)
goto free_fw;
}
vfree(fw->data);
free_fw:
kfree(fw);
}
}
......
......@@ -566,7 +566,8 @@ static int bfusb_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg
return -ENOIOCTLCMD;
}
static int bfusb_load_firmware(struct bfusb_data *data, unsigned char *firmware, int count)
static int bfusb_load_firmware(struct bfusb_data *data,
const unsigned char *firmware, int count)
{
unsigned char *buf;
int err, pipe, len, size, sent = 0;
......
......@@ -470,7 +470,8 @@ static int bt3c_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long
/* ======================== Card services HCI interaction ======================== */
static int bt3c_load_firmware(bt3c_info_t *info, unsigned char *firmware, int count)
static int bt3c_load_firmware(bt3c_info_t *info, const unsigned char *firmware,
int count)
{
char *ptr = (char *) firmware;
char b[9];
......
......@@ -4668,7 +4668,7 @@ static inline int __devinit cyc_isfwstr(const char *str, unsigned int size)
return 0;
}
static inline void __devinit cyz_fpga_copy(void __iomem *fpga, u8 *data,
static inline void __devinit cyz_fpga_copy(void __iomem *fpga, const u8 *data,
unsigned int size)
{
for (; size > 0; size--) {
......@@ -4701,10 +4701,10 @@ static int __devinit __cyz_load_fw(const struct firmware *fw,
const char *name, const u32 mailbox, void __iomem *base,
void __iomem *fpga)
{
void *ptr = fw->data;
struct zfile_header *h = ptr;
struct zfile_config *c, *cs;
struct zfile_block *b, *bs;
const void *ptr = fw->data;
const struct zfile_header *h = ptr;
const struct zfile_config *c, *cs;
const struct zfile_block *b, *bs;
unsigned int a, tmp, len = fw->size;
#define BAD_FW KERN_ERR "Bad firmware: "
if (len < sizeof(*h)) {
......
......@@ -34,6 +34,8 @@
#include <linux/init.h>
#include <linux/device.h>
#include <linux/smp_lock.h>
#include <linux/firmware.h>
#include <linux/platform_device.h>
#include <asm/atarihw.h>
#include <asm/traps.h>
......@@ -93,49 +95,6 @@
} \
}
/* DSP56001 bootstrap code */
static char bootstrap[] = {
0x0c, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x60, 0xf4, 0x00, 0x00, 0x00, 0x4f, 0x61, 0xf4,
0x00, 0x00, 0x7e, 0xa9, 0x06, 0x2e, 0x80, 0x00, 0x00, 0x47,
0x07, 0xd8, 0x84, 0x07, 0x59, 0x84, 0x08, 0xf4, 0xa8, 0x00,
0x00, 0x04, 0x08, 0xf4, 0xbf, 0x00, 0x0c, 0x00, 0x00, 0xfe,
0xb8, 0x0a, 0xf0, 0x80, 0x00, 0x7e, 0xa9, 0x08, 0xf4, 0xa0,
0x00, 0x00, 0x01, 0x08, 0xf4, 0xbe, 0x00, 0x00, 0x00, 0x0a,
0xa9, 0x80, 0x00, 0x7e, 0xad, 0x08, 0x4e, 0x2b, 0x44, 0xf4,
0x00, 0x00, 0x00, 0x03, 0x44, 0xf4, 0x45, 0x00, 0x00, 0x01,
0x0e, 0xa0, 0x00, 0x0a, 0xa9, 0x80, 0x00, 0x7e, 0xb5, 0x08,
0x50, 0x2b, 0x0a, 0xa9, 0x80, 0x00, 0x7e, 0xb8, 0x08, 0x46,
0x2b, 0x44, 0xf4, 0x45, 0x00, 0x00, 0x02, 0x0a, 0xf0, 0xaa,
0x00, 0x7e, 0xc9, 0x20, 0x00, 0x45, 0x0a, 0xf0, 0xaa, 0x00,
0x7e, 0xd0, 0x06, 0xc6, 0x00, 0x00, 0x7e, 0xc6, 0x0a, 0xa9,
0x80, 0x00, 0x7e, 0xc4, 0x08, 0x58, 0x6b, 0x0a, 0xf0, 0x80,
0x00, 0x7e, 0xad, 0x06, 0xc6, 0x00, 0x00, 0x7e, 0xcd, 0x0a,
0xa9, 0x80, 0x00, 0x7e, 0xcb, 0x08, 0x58, 0xab, 0x0a, 0xf0,
0x80, 0x00, 0x7e, 0xad, 0x06, 0xc6, 0x00, 0x00, 0x7e, 0xd4,
0x0a, 0xa9, 0x80, 0x00, 0x7e, 0xd2, 0x08, 0x58, 0xeb, 0x0a,
0xf0, 0x80, 0x00, 0x7e, 0xad};
static int sizeof_bootstrap = 375;
static struct dsp56k_device {
unsigned long in_use;
long maxio, timeout;
......@@ -165,18 +124,40 @@ static int dsp56k_reset(void)
static int dsp56k_upload(u_char __user *bin, int len)
{
struct platform_device *pdev;
const struct firmware *fw;
const char fw_name[] = "dsp56k/bootstrap.bin";
int err;
int i;
u_char *p;
dsp56k_reset();
p = bootstrap;
for (i = 0; i < sizeof_bootstrap/3; i++) {
pdev = platform_device_register_simple("dsp56k", 0, NULL, 0);
if (IS_ERR(pdev)) {
printk(KERN_ERR "Failed to register device for \"%s\"\n",
fw_name);
return -EINVAL;
}
err = request_firmware(&fw, fw_name, &pdev->dev);
platform_device_unregister(pdev);
if (err) {
printk(KERN_ERR "Failed to load image \"%s\" err %d\n",
fw_name, err);
return err;
}
if (fw->size % 3) {
printk(KERN_ERR "Bogus length %d in image \"%s\"\n",
fw->size, fw_name);
release_firmware(fw);
return -EINVAL;
}
for (i = 0; i < fw->size; i = i + 3) {
/* tx_wait(10); */
dsp56k_host_interface.data.b[1] = *p++;
dsp56k_host_interface.data.b[2] = *p++;
dsp56k_host_interface.data.b[3] = *p++;
dsp56k_host_interface.data.b[1] = fw->data[i];
dsp56k_host_interface.data.b[2] = fw->data[i + 1];
dsp56k_host_interface.data.b[3] = fw->data[i + 2];
}
release_firmware(fw);
for (; i < 512; i++) {
/* tx_wait(10); */
dsp56k_host_interface.data.b[1] = 0;
......@@ -540,3 +521,4 @@ static void __exit dsp56k_cleanup_driver(void)
module_exit(dsp56k_cleanup_driver);
MODULE_LICENSE("GPL");
MODULE_FIRMWARE("dsp56k/bootstrap.bin");
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -21,10 +21,9 @@
#endif
#include "ip2types.h"
#include "fip_firm.h" // the meat
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
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;
}
return ip2_loadmain(io,irq,(unsigned char *)fip_firm,sizeof(fip_firm));
return ip2_loadmain(io, irq);
}
module_init(ip2_init);
......
......@@ -99,6 +99,8 @@
#include <linux/wait.h>
#include <linux/device.h>
#include <linux/smp_lock.h>
#include <linux/firmware.h>
#include <linux/platform_device.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
......@@ -156,9 +158,7 @@ static char *pcDriver_name = "ip2";
static char *pcIpl = "ip2ipl";
// cheezy kludge or genius - you decide?
int ip2_loadmain(int *, int *, unsigned char *, int);
static unsigned char *Fip_firmware;
static int Fip_firmware_size;
int ip2_loadmain(int *, int *);
/***********************/
/* Function Prototypes */
......@@ -209,7 +209,7 @@ static int ip2_ipl_open(struct inode *, struct file *);
static int DumpTraceBuffer(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);
/***************/
......@@ -475,8 +475,27 @@ static const struct tty_operations ip2_ops = {
/* SA_RANDOM - can be source for cert. random number generators */
#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
ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
ip2_loadmain(int *iop, int *irqp)
{
int i, j, box;
int err = 0;
......@@ -484,6 +503,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
i2eBordStrPtr pB = NULL;
int rc = -1;
static struct pci_dev *pci_dev_i = NULL;
const struct firmware *fw = NULL;
ip2trace (ITRC_NO_PORT, ITRC_INIT, ITRC_ENTER, 0 );
......@@ -517,9 +537,6 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
}
poll_only = !poll_only;
Fip_firmware = firmware;
Fip_firmware_size = firmsize;
/* Announce our presence */
printk( KERN_INFO "%s version %s\n", pcName, pcVersion );
......@@ -639,10 +656,18 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
}
}
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 ) {
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 );
......@@ -770,7 +795,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
/* are reported on the console. */
/******************************************************************************/
static void
ip2_init_board( int boardnum )
ip2_init_board(int boardnum, const struct firmware *fw)
{
int i;
int nports = 0, nboxes = 0;
......@@ -790,7 +815,7 @@ ip2_init_board( int boardnum )
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 ) {
printk ( KERN_ERR "IP2: failed to download loadware\n" );
goto err_release_region;
......
......@@ -721,7 +721,7 @@ static int moxa_load_code(struct moxa_board_conf *brd, const void *ptr,
static int moxa_load_fw(struct moxa_board_conf *brd, const struct firmware *fw)
{
void *ptr = fw->data;
const void *ptr = fw->data;
char rsn[64];
u16 lens[5];
size_t len;
......@@ -734,7 +734,7 @@ static int moxa_load_fw(struct moxa_board_conf *brd, const struct firmware *fw)
u8 model; /* C218T=1, C320T=2, CP204=3 */
u8 reserved2[8];
__le16 len[5];
} *hdr = ptr;
} const *hdr = ptr;
BUILD_BUG_ON(ARRAY_SIZE(hdr->len) != ARRAY_SIZE(lens));
......
......@@ -220,7 +220,7 @@ static int create_packet(void *data, size_t length)
return retval;
}
static int packetize_data(void *data, size_t length)
static int packetize_data(const u8 *data, size_t length)
{
int rc = 0;
int done = 0;
......
......@@ -254,7 +254,7 @@ static int load_all_firmwares(struct dvb_frontend *fe)
{
struct xc2028_data *priv = fe->tuner_priv;
const struct firmware *fw = NULL;
unsigned char *p, *endp;
const unsigned char *p, *endp;
int rc = 0;
int n, n_array;
char name[33];
......
......@@ -278,7 +278,7 @@ static int xc_read_reg(struct xc5000_priv *priv, u16 regAddr, u16 *i2cData)
return result;
}
static int xc_load_i2c_sequence(struct dvb_frontend *fe, u8 i2c_sequence[])
static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence)
{
struct xc5000_priv *priv = fe->tuner_priv;
......
......@@ -24,6 +24,7 @@
* see Documentation/dvb/README.dvb-usb for more information
*/
#include <media/tuner.h>
#include <linux/vmalloc.h>
#include "cxusb.h"
......@@ -700,12 +701,26 @@ static int bluebird_patch_dvico_firmware_download(struct usb_device *udev,
if (fw->data[idoff] == (USB_VID_DVICO & 0xff) &&
fw->data[idoff + 1] == USB_VID_DVICO >> 8) {
fw->data[idoff + 2] =
struct firmware new_fw;
u8 *new_fw_data = vmalloc(fw->size);
int ret;
if (!new_fw_data)
return -ENOMEM;
memcpy(new_fw_data, fw->data, fw->size);
new_fw.size = fw->size;
new_fw.data = new_fw_data;
new_fw_data[idoff + 2] =
le16_to_cpu(udev->descriptor.idProduct) + 1;
fw->data[idoff + 3] =
new_fw_data[idoff + 3] =
le16_to_cpu(udev->descriptor.idProduct) >> 8;
return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2);
ret = usb_cypress_load_firmware(udev, &new_fw,
CYPRESS_FX2);
vfree(new_fw_data);
return ret;
}
}
......
......@@ -86,7 +86,8 @@ static int gp8psk_load_bcm4500fw(struct dvb_usb_device *d)
{
int ret;
const struct firmware *fw = NULL;
u8 *ptr, *buf;
const u8 *ptr;
u8 *buf;
if ((ret = request_firmware(&fw, bcm4500_firmware,
&d->udev->dev)) != 0) {
err("did not find the bcm4500 firmware file. (%s) "
......
......@@ -590,7 +590,8 @@ static void bcm3510_release(struct dvb_frontend* fe)
*/
#define BCM3510_DEFAULT_FIRMWARE "dvb-fe-bcm3510-01.fw"
static int bcm3510_write_ram(struct bcm3510_state *st, u16 addr, u8 *b, u16 len)
static int bcm3510_write_ram(struct bcm3510_state *st, u16 addr, const u8 *b,
u16 len)
{
int ret = 0,i;
bcm3510_register_value vH, vL,vD;
......@@ -614,7 +615,7 @@ static int bcm3510_download_firmware(struct dvb_frontend* fe)
struct bcm3510_state* st = fe->demodulator_priv;
const struct firmware *fw;
u16 addr,len;
u8 *b;
const u8 *b;
int ret,i;
deb_info("requesting firmware\n");
......
......@@ -93,7 +93,8 @@ static u8 i2c_readbytes (struct nxt200x_state* state, u8 addr, u8* buf, u8 len)
return 0;
}
static int nxt200x_writebytes (struct nxt200x_state* state, u8 reg, u8 *buf, u8 len)
static int nxt200x_writebytes (struct nxt200x_state* state, u8 reg,
const u8 *buf, u8 len)
{
u8 buf2 [len+1];
int err;
......
......@@ -69,7 +69,7 @@ struct or51211_state {
u32 current_frequency;
};
static int i2c_writebytes (struct or51211_state* state, u8 reg, u8 *buf,
static int i2c_writebytes (struct or51211_state* state, u8 reg, const u8 *buf,
int len)
{
int err;
......@@ -77,7 +77,7 @@ static int i2c_writebytes (struct or51211_state* state, u8 reg, u8 *buf,
msg.addr = reg;
msg.flags = 0;
msg.len = len;
msg.buf = buf;
msg.buf = (u8 *)buf;
if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) {
printk(KERN_WARNING "or51211: i2c_writebytes error "
......
......@@ -98,7 +98,7 @@ static int sp8870_readreg (struct sp8870_state* state, u16 reg)
static int sp8870_firmware_upload (struct sp8870_state* state, const struct firmware *fw)
{
struct i2c_msg msg;
char *fw_buf = fw->data;
const char *fw_buf = fw->data;
int fw_pos;
u8 tx_buf[255];
int tx_len;
......
......@@ -140,7 +140,7 @@ static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware
u8 buf [BLOCKSIZE+2];
int i;
int fw_size = fw->size;
unsigned char *mem = fw->data;
const unsigned char *mem = fw->data;
dprintk("%s\n", __func__);
......
......@@ -233,7 +233,7 @@ static u8 tda10048_readreg(struct tda10048_state *state, u8 reg)
}
static int tda10048_writeregbulk(struct tda10048_state *state, u8 reg,
u8 *data, u16 len)
const u8 *data, u16 len)
{
int ret = -EREMOTEIO;
struct i2c_msg msg;
......
......@@ -317,7 +317,7 @@ static int tda10046h_set_bandwidth(struct tda1004x_state *state,
}
static int tda1004x_do_upload(struct tda1004x_state *state,
unsigned char *mem, unsigned int len,
const unsigned char *mem, unsigned int len,
u8 dspCodeCounterReg, u8 dspCodeInReg)
{
u8 buf[65];
......
......@@ -19,6 +19,7 @@
#include <linux/errno.h>
#include <linux/jiffies.h>
#include <linux/mutex.h>
#include <linux/firmware.h>
#include "dvb_frontend.h"
#include "dmxdev.h"
......@@ -285,13 +286,19 @@ static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num
return i;
}
#include "dvb-ttusb-dspbootcode.h"
static int ttusb_boot_dsp(struct ttusb *ttusb)
{
const struct firmware *fw;
int i, err;
u8 b[40];
err = request_firmware(&fw, "ttusb-budget/dspbootcode.bin",
&ttusb->dev->dev);
if (err) {
printk(KERN_ERR "ttusb-budget: failed to request firmware\n");
return err;
}
/* BootBlock */
b[0] = 0xaa;
b[2] = 0x13;
......@@ -299,8 +306,8 @@ static int ttusb_boot_dsp(struct ttusb *ttusb)
/* upload dsp code in 32 byte steps (36 didn't work for me ...) */
/* 32 is max packet size, no messages should be splitted. */
for (i = 0; i < sizeof(dsp_bootcode); i += 28) {
memcpy(&b[4], &dsp_bootcode[i], 28);
for (i = 0; i < fw->size; i += 28) {
memcpy(&b[4], &fw->data[i], 28);
b[1] = ++ttusb->c;
......@@ -1820,3 +1827,4 @@ module_exit(ttusb_exit);
MODULE_AUTHOR("Holger Waechtler <holger@convergence.de>");
MODULE_DESCRIPTION("TTUSB DVB Driver");
MODULE_LICENSE("GPL");
MODULE_FIRMWARE("ttusb-budget/dspbootcode.bin");
This diff is collapsed.
......@@ -1275,7 +1275,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec)
u8 b1[] = { 0x61 };
u8 *b;
char idstring[21];
u8 *firmware = NULL;
const u8 *firmware = NULL;
size_t firmware_size = 0;
u16 firmware_csum = 0;
__be16 firmware_csum_ns;
......
......@@ -3768,7 +3768,8 @@ static int terratec_active_radio_upgrade(struct bttv *btv)
#define BTTV_ALT_DCLK 0x100000
#define BTTV_ALT_NCONFIG 0x800000
static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen)
static int __devinit pvr_altera_load(struct bttv *btv, const u8 *micro,
u32 microlen)
{
u32 n;
u8 bits;
......
......@@ -33,11 +33,10 @@
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/firmware.h>
/* #define _CPIA2_DEBUG_ */
#include "cpia2patch.h"
#ifdef _CPIA2_DEBUG_
static const char *block_name[] = {
......@@ -893,24 +892,53 @@ int cpia2_set_low_power(struct camera_data *cam)
* apply_vp_patch
*
*****************************************************************************/
static int cpia2_send_onebyte_command(struct camera_data *cam,
struct cpia2_command *cmd,
u8 start, u8 datum)
{
cmd->buffer.block_data[0] = datum;
cmd->start = start;
cmd->reg_count = 1;
return cpia2_send_command(cam, cmd);
}
static int apply_vp_patch(struct camera_data *cam)
{
int i, j;
const struct firmware *fw;
const char fw_name[] = "cpia2/stv0672_vp4.bin";
int i, ret;
struct cpia2_command cmd;
ret = request_firmware(&fw, fw_name, &cam->dev->dev);
if (ret) {
printk(KERN_ERR "cpia2: failed to load VP patch \"%s\"\n",
fw_name);
return ret;
}
cmd.req_mode = CAMERAACCESS_TYPE_REPEAT | CAMERAACCESS_VP;
cmd.direction = TRANSFER_WRITE;
for (i = 0; i < PATCH_DATA_SIZE; i++) {
for (j = 0; j < patch_data[i].count; j++) {
cmd.buffer.block_data[j] = patch_data[i].data[j];
}
/* First send the start address... */
cpia2_send_onebyte_command(cam, &cmd, 0x0A, fw->data[0]); /* hi */
cpia2_send_onebyte_command(cam, &cmd, 0x0B, fw->data[1]); /* lo */
cmd.start = patch_data[i].reg;
cmd.reg_count = patch_data[i].count;
/* ... followed by the data payload */
for (i = 2; i < fw->size; i += 64) {
cmd.start = 0x0C; /* Data */
cmd.reg_count = min_t(int, 64, fw->size - i);
memcpy(cmd.buffer.block_data, &fw->data[i], cmd.reg_count);
cpia2_send_command(cam, &cmd);
}
/* Next send the start address... */
cpia2_send_onebyte_command(cam, &cmd, 0x0A, fw->data[0]); /* hi */
cpia2_send_onebyte_command(cam, &cmd, 0x0B, fw->data[1]); /* lo */
/* ... followed by the 'goto' command */
cpia2_send_onebyte_command(cam, &cmd, 0x0D, 1);
release_firmware(fw);
return 0;
}
......
/****************************************************************************
*
* Filename: cpia2patch.h
*
* Copyright 2001, STMicrolectronics, Inc.
*
* Contact: steve.miller@st.com
*
* Description:
* This file contains patch data for the CPiA2 (stv0672) VP4.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
****************************************************************************/
#ifndef CPIA2_PATCH_HEADER
#define CPIA2_PATCH_HEADER
typedef struct {
unsigned char reg;
unsigned char count;
const unsigned char *data;
} cpia2_patch;
static const unsigned char start_address_hi[1] = {
0x01
};
static const unsigned char start_address_lo[1] = {
0xBC
};
static const unsigned char patch_block0[64] = {
0xE3, 0x02, 0xE3, 0x03, 0xE3, 0x04, 0xE3, 0x05,
0xE3, 0x06, 0xE3, 0x07, 0x93, 0x44, 0x56, 0xD4,
0x93, 0x4E, 0x56, 0x51, 0x93, 0x4E, 0x51, 0xD6,
0x93, 0x4E, 0x4F, 0x54, 0x93, 0x4E, 0x92, 0x4F,
0x92, 0xA4, 0x93, 0x05, 0x92, 0xF4, 0x93, 0x1B,
0x92, 0x92, 0x91, 0xE6, 0x92, 0x36, 0x92, 0x74,
0x92, 0x4A, 0x92, 0x8C, 0x92, 0x8E, 0xC8, 0xD0,
0x0B, 0x42, 0x02, 0xA0, 0xCA, 0x92, 0x09, 0x02
};
static const unsigned char patch_block1[64] = {
0xC9, 0x10, 0x0A, 0x0A, 0x0A, 0x81, 0xE3, 0xB8,
0xE3, 0xB0, 0xE3, 0xA8, 0xE3, 0xA0, 0xE3, 0x98,
0xE3, 0x90, 0xE1, 0x00, 0xCF, 0xD7, 0x0A, 0x12,
0xCC, 0x95, 0x08, 0xB2, 0x0A, 0x18, 0xE1, 0x00,
0x01, 0xEE, 0x0C, 0x08, 0x4A, 0x12, 0xC8, 0x18,
0xF0, 0x9A, 0xC0, 0x22, 0xF3, 0x1C, 0x4A, 0x13,
0xF3, 0x14, 0xC8, 0xA0, 0xF2, 0x14, 0xF2, 0x1C,
0xEB, 0x13, 0xD3, 0xA2, 0x63, 0x16, 0x48, 0x9E
};
static const unsigned char patch_block2[64] = {
0xF0, 0x18, 0xA4, 0x03, 0xF3, 0x93, 0xC0, 0x58,
0xF7, 0x13, 0x51, 0x9C, 0xE9, 0x20, 0xCF, 0xEF,
0x63, 0xF9, 0x92, 0x2E, 0xD3, 0x5F, 0x63, 0xFA,
0x92, 0x2E, 0xD3, 0x67, 0x63, 0xFB, 0x92, 0x2E,
0xD3, 0x6F, 0xE9, 0x1A, 0x63, 0x16, 0x48, 0xA7,
0xF0, 0x20, 0xA4, 0x06, 0xF3, 0x94, 0xC0, 0x27,
0xF7, 0x14, 0xF5, 0x13, 0x51, 0x9D, 0xF6, 0x13,
0x63, 0x18, 0xC4, 0x20, 0xCB, 0xEF, 0x63, 0xFC
};
static const unsigned char patch_block3[64] = {
0x92, 0x2E, 0xD3, 0x77, 0x63, 0xFD, 0x92, 0x2E,
0xD3, 0x7F, 0x63, 0xFE, 0x92, 0x2E, 0xD3, 0x87,
0x63, 0xFF, 0x92, 0x2E, 0xD3, 0x8F, 0x64, 0x38,
0x92, 0x2E, 0xD3, 0x97, 0x64, 0x39, 0x92, 0x2E,
0xD3, 0x9F, 0xE1, 0x00, 0xF5, 0x3A, 0xF4, 0x3B,
0xF7, 0xBF, 0xF2, 0xBC, 0xF2, 0x3D, 0xE1, 0x00,
0x80, 0x87, 0x90, 0x80, 0x51, 0xD5, 0x02, 0x22,
0x02, 0x32, 0x4B, 0xD3, 0xF7, 0x11, 0x0B, 0xDA
};
static const unsigned char patch_block4[64] = {
0xE1, 0x00, 0x0E, 0x02, 0x02, 0x40, 0x0D, 0xB5,
0xE3, 0x02, 0x48, 0x55, 0xE5, 0x12, 0xA4, 0x01,
0xE8, 0x1B, 0xE3, 0x90, 0xF0, 0x18, 0xA4, 0x01,
0xE8, 0xBF, 0x8D, 0xB8, 0x4B, 0xD1, 0x4B, 0xD8,
0x0B, 0xCB, 0x0B, 0xC2, 0xE1, 0x00, 0xE3, 0x02,
0xE3, 0x03, 0x52, 0xD3, 0x60, 0x59, 0xE6, 0x93,
0x0D, 0x22, 0x52, 0xD4, 0xE6, 0x93, 0x0D, 0x2A,
0xE3, 0x98, 0xE3, 0x90, 0xE1, 0x00, 0x02, 0x5D
};
static const unsigned char patch_block5[64] = {
0x02, 0x63, 0xE3, 0x02, 0xC8, 0x12, 0x02, 0xCA,
0xC8, 0x52, 0x02, 0xC2, 0x82, 0x68, 0xE3, 0x02,
0xC8, 0x14, 0x02, 0xCA, 0xC8, 0x90, 0x02, 0xC2,
0x0A, 0xD0, 0xC9, 0x93, 0x0A, 0xDA, 0xCC, 0xD2,
0x0A, 0xE2, 0x63, 0x12, 0x02, 0xDA, 0x0A, 0x98,
0x0A, 0xA0, 0x0A, 0xA8, 0xE3, 0x90, 0xE1, 0x00,
0xE3, 0x02, 0x0A, 0xD0, 0xC9, 0x93, 0x0A, 0xDA,
0xCC, 0xD2, 0x0A, 0xE2, 0x63, 0x12, 0x02, 0xDA
};
static const unsigned char patch_block6[64] = {
0x0A, 0x98, 0x0A, 0xA0, 0x0A, 0xA8, 0x49, 0x91,
0xE5, 0x6A, 0xA4, 0x04, 0xC8, 0x12, 0x02, 0xCA,
0xC8, 0x52, 0x82, 0x89, 0xC8, 0x14, 0x02, 0xCA,
0xC8, 0x90, 0x02, 0xC2, 0xE3, 0x90, 0xE1, 0x00,
0x08, 0x60, 0xE1, 0x00, 0x48, 0x53, 0xE8, 0x97,
0x08, 0x5A, 0xE1, 0x00, 0xE3, 0x02, 0xE3, 0x03,
0x54, 0xD3, 0x60, 0x59, 0xE6, 0x93, 0x0D, 0x52,
0xE3, 0x98, 0xE3, 0x90, 0xE1, 0x00, 0x02, 0x9C
};
static const unsigned char patch_block7[64] = {
0xE3, 0x02, 0x55, 0x13, 0x93, 0x17, 0x55, 0x13,
0x93, 0x17, 0xE3, 0x90, 0xE1, 0x00, 0x75, 0x30,
0xE3, 0x02, 0xE3, 0x03, 0x55, 0x55, 0x60, 0x59,
0xE6, 0x93, 0x0D, 0xB2, 0xE3, 0x98, 0xE3, 0x90,
0xE1, 0x00, 0x02, 0xAE, 0xE7, 0x92, 0xE9, 0x18,
0xEA, 0x9A, 0xE8, 0x98, 0xE8, 0x10, 0xE8, 0x11,
0xE8, 0x51, 0xD2, 0xDA, 0xD2, 0xF3, 0xE8, 0x13,
0xD2, 0xFA, 0xE8, 0x50, 0xD2, 0xEA, 0xE8, 0xD0
};
static const unsigned char patch_block8[64] = {
0xE8, 0xD1, 0xD3, 0x0A, 0x03, 0x09, 0x48, 0x23,
0xE5, 0x2C, 0xA0, 0x03, 0x48, 0x24, 0xEA, 0x1C,
0x03, 0x08, 0xD2, 0xE3, 0xD3, 0x03, 0xD3, 0x13,
0xE1, 0x00, 0x02, 0xCB, 0x05, 0x93, 0x57, 0x93,
0xF0, 0x9A, 0xAC, 0x0B, 0xE3, 0x07, 0x92, 0xEA,
0xE2, 0x9F, 0xE5, 0x06, 0xE3, 0xB0, 0xA0, 0x02,
0xEB, 0x1E, 0x82, 0xD7, 0xEA, 0x1E, 0xE2, 0x3B,
0x85, 0x9B, 0xE9, 0x1E, 0xC8, 0x90, 0x85, 0x94
};
static const unsigned char patch_block9[64] = {
0x02, 0xDE, 0x05, 0x80, 0x57, 0x93, 0xF0, 0xBA,
0xAC, 0x06, 0x92, 0xEA, 0xE2, 0xBF, 0xE5, 0x06,
0xA0, 0x01, 0xEB, 0xBF, 0x85, 0x88, 0xE9, 0x3E,
0xC8, 0x90, 0x85, 0x81, 0xE9, 0x3E, 0xF0, 0xBA,
0xF3, 0x39, 0xF0, 0x3A, 0x60, 0x17, 0xF0, 0x3A,
0xC0, 0x90, 0xF0, 0xBA, 0xE1, 0x00, 0x00, 0x3F,
0xE3, 0x02, 0xE3, 0x03, 0x58, 0x10, 0x60, 0x59,
0xE6, 0x93, 0x0D, 0xA2, 0x58, 0x12, 0xE6, 0x93
};
static const unsigned char patch_block10[64] = {
0x0D, 0xAA, 0xE3, 0x98, 0xE3, 0x90, 0xE1, 0x00,
0x03, 0x01, 0xE1, 0x00, 0x03, 0x03, 0x9B, 0x7D,
0x8B, 0x8B, 0xE3, 0x02, 0xE3, 0x03, 0x58, 0x56,
0x60, 0x59, 0xE6, 0x93, 0x0D, 0xBA, 0xE3, 0x98,
0xE3, 0x90, 0xE1, 0x00, 0x03, 0x0F, 0x93, 0x11,
0xE1, 0x00, 0xE3, 0x02, 0x4A, 0x11, 0x0B, 0x42,
0x91, 0xAF, 0xE3, 0x90, 0xE1, 0x00, 0xF2, 0x91,
0xF0, 0x91, 0xA3, 0xFE, 0xE1, 0x00, 0x60, 0x92
};
static const unsigned char patch_block11[64] = {
0xC0, 0x5F, 0xF0, 0x13, 0xF0, 0x13, 0x59, 0x5B,
0xE2, 0x13, 0xF0, 0x11, 0x5A, 0x19, 0xE2, 0x13,
0xE1, 0x00, 0x00, 0x00, 0x03, 0x27, 0x68, 0x61,
0x76, 0x61, 0x6E, 0x61, 0x00, 0x06, 0x03, 0x2C,
0xE3, 0x02, 0xE3, 0x03, 0xE9, 0x38, 0x59, 0x15,
0x59, 0x5A, 0xF2, 0x9A, 0xBC, 0x0B, 0xA4, 0x0A,
0x59, 0x1E, 0xF3, 0x11, 0xF0, 0x1A, 0xE2, 0xBB,
0x59, 0x15, 0xF0, 0x11, 0x19, 0x2A, 0xE5, 0x02
};
static const unsigned char patch_block12[54] = {
0xA4, 0x01, 0xEB, 0xBF, 0xE3, 0x98, 0xE3, 0x90,
0xE1, 0x00, 0x03, 0x42, 0x19, 0x28, 0xE1, 0x00,
0xE9, 0x30, 0x60, 0x79, 0xE1, 0x00, 0xE3, 0x03,
0xE3, 0x07, 0x60, 0x79, 0x93, 0x4E, 0xE3, 0xB8,
0xE3, 0x98, 0xE1, 0x00, 0xE9, 0x1A, 0xF0, 0x1F,
0xE2, 0x33, 0xF0, 0x91, 0xE2, 0x92, 0xE0, 0x32,
0xF0, 0x31, 0xE1, 0x00, 0x00, 0x00
};
static const unsigned char do_call[1] = {
0x01
};
#define PATCH_DATA_SIZE 18
static const cpia2_patch patch_data[PATCH_DATA_SIZE] = {
{0x0A, sizeof(start_address_hi), start_address_hi}
, // 0
{0x0B, sizeof(start_address_lo), start_address_lo}
, // 1
{0x0C, sizeof(patch_block0), patch_block0}
, // 2
{0x0C, sizeof(patch_block1), patch_block1}
, // 3
{0x0C, sizeof(patch_block2), patch_block2}
, // 4
{0x0C, sizeof(patch_block3), patch_block3}
, // 5
{0x0C, sizeof(patch_block4), patch_block4}
, // 6
{0x0C, sizeof(patch_block5), patch_block5}
, // 7
{0x0C, sizeof(patch_block6), patch_block6}
, // 8
{0x0C, sizeof(patch_block7), patch_block7}
, // 9
{0x0C, sizeof(patch_block8), patch_block8}
, // 10
{0x0C, sizeof(patch_block9), patch_block9}
, //11
{0x0C, sizeof(patch_block10), patch_block10}
, // 12
{0x0C, sizeof(patch_block11), patch_block11}
, // 13
{0x0C, sizeof(patch_block12), patch_block12}
, // 14
{0x0A, sizeof(start_address_hi), start_address_hi}
, // 15
{0x0B, sizeof(start_address_lo), start_address_lo}
, // 16
{0x0D, sizeof(do_call), do_call} //17
};
#endif
......@@ -29,7 +29,7 @@ int cx18_av_loadfw(struct cx18 *cx)
const struct firmware *fw = NULL;
u32 size;
u32 v;
u8 *ptr;
const u8 *ptr;
int i;
if (request_firmware(&fw, FWFILE, &cx->dev->dev) != 0) {
......
......@@ -79,7 +79,7 @@ static int check_fw_load(struct i2c_client *client, int size)
return 0;
}
static int fw_write(struct i2c_client *client, u8 *data, int size)
static int fw_write(struct i2c_client *client, const u8 *data, int size)
{
if (i2c_master_send(client, data, size) < size) {
v4l_err(client, "firmware load i2c failure\n");
......@@ -93,7 +93,8 @@ int cx25840_loadfw(struct i2c_client *client)
{
struct cx25840_state *state = i2c_get_clientdata(client);
const struct firmware *fw = NULL;
u8 buffer[4], *ptr;
u8 buffer[FWSEND];
const u8 *ptr;
int size, retval;
if (state->is_cx23885)
......@@ -108,29 +109,23 @@ int cx25840_loadfw(struct i2c_client *client)
buffer[0] = 0x08;
buffer[1] = 0x02;
buffer[2] = fw->data[0];
buffer[3] = fw->data[1];
retval = fw_write(client, buffer, 4);
if (retval < 0) {
release_firmware(fw);
return retval;
}
size = fw->size - 2;
size = fw->size;
ptr = fw->data;
while (size > 0) {
ptr[0] = 0x08;
ptr[1] = 0x02;
retval = fw_write(client, ptr, min(FWSEND, size + 2));
int len = min(FWSEND - 2, size);
memcpy(buffer + 2, ptr, len);
retval = fw_write(client, buffer, len + 2);
if (retval < 0) {
release_firmware(fw);
return retval;
}
size -= FWSEND - 2;
ptr += FWSEND - 2;
size -= len;
ptr += len;
}
end_fw_load(client);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -686,8 +686,9 @@ int t3_seeprom_write(struct adapter *adapter, u32 addr, __le32 data);
int t3_seeprom_wp(struct adapter *adapter, int enable);
int t3_get_tp_version(struct adapter *adapter, u32 *vers);
int t3_check_tpsram_version(struct adapter *adapter, int *must_load);
int t3_check_tpsram(struct adapter *adapter, u8 *tp_ram, unsigned int size);
int t3_set_proto_sram(struct adapter *adap, u8 *data);
int t3_check_tpsram(struct adapter *adapter, const u8 *tp_ram,
unsigned int size);
int t3_set_proto_sram(struct adapter *adap, const u8 *data);
int t3_read_flash(struct adapter *adapter, unsigned int addr,
unsigned int nwords, u32 *data, int byte_oriented);
int t3_load_fw(struct adapter *adapter, const u8 * fw_data, unsigned int size);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment