diff options
author | Marco Gittler <g.marco@freenet.de> | 2007-07-04 18:18:34 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-07-18 13:24:41 -0400 |
commit | 59800555f79a52394c3c29e19e448b4635daf14c (patch) | |
tree | a6540f53684f2939bc89b26f2d72770a09d5c53e /drivers/media/dvb/dvb-usb/opera1.c | |
parent | b31c33bd8b339e426138dd267ec969291f802a0d (diff) |
V4L/DVB (5829): Firmware extract and loading for opera dvb-usb update
Better way of creating and loading the firmware used.
Update for get_dvb_firmware script to extract the files for opera usb-box
Help file for creating the firmware added
Signed-off-by: Marco Gittler <g.marco@freenet.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/opera1.c')
-rw-r--r-- | drivers/media/dvb/dvb-usb/opera1.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c index cdb02218ca6a..d7c04951ceab 100644 --- a/drivers/media/dvb/dvb-usb/opera1.c +++ b/drivers/media/dvb/dvb-usb/opera1.c | |||
@@ -435,9 +435,9 @@ static int opera1_xilinx_load_firmware(struct usb_device *dev, | |||
435 | { | 435 | { |
436 | const struct firmware *fw = NULL; | 436 | const struct firmware *fw = NULL; |
437 | u8 *b, *p; | 437 | u8 *b, *p; |
438 | int ret = 0, i; | 438 | int ret = 0, i,fpgasize=40; |
439 | u8 testval; | 439 | u8 testval; |
440 | info("start downloading fpga firmware"); | 440 | info("start downloading fpga firmware %s",filename); |
441 | 441 | ||
442 | if ((ret = request_firmware(&fw, filename, &dev->dev)) != 0) { | 442 | if ((ret = request_firmware(&fw, filename, &dev->dev)) != 0) { |
443 | err("did not find the firmware file. (%s) " | 443 | err("did not find the firmware file. (%s) " |
@@ -454,17 +454,20 @@ static int opera1_xilinx_load_firmware(struct usb_device *dev, | |||
454 | /* clear fpga ? */ | 454 | /* clear fpga ? */ |
455 | opera1_xilinx_rw(dev, 0xbc, 0xaa, &fpga_command, 1, | 455 | opera1_xilinx_rw(dev, 0xbc, 0xaa, &fpga_command, 1, |
456 | OPERA_WRITE_MSG); | 456 | OPERA_WRITE_MSG); |
457 | for (i = 0; p[i] != 0 && i < fw->size;) { | 457 | for (i = 0; i < fw->size;) { |
458 | if ( (fw->size - i) <fpgasize){ | ||
459 | fpgasize=fw->size-i; | ||
460 | } | ||
458 | b = (u8 *) p + i; | 461 | b = (u8 *) p + i; |
459 | if (opera1_xilinx_rw | 462 | if (opera1_xilinx_rw |
460 | (dev, OPERA_WRITE_FX2, 0x0, b + 1, b[0], | 463 | (dev, OPERA_WRITE_FX2, 0x0, b , fpgasize, |
461 | OPERA_WRITE_MSG) != b[0] | 464 | OPERA_WRITE_MSG) != fpgasize |
462 | ) { | 465 | ) { |
463 | err("error while transferring firmware"); | 466 | err("error while transferring firmware"); |
464 | ret = -EINVAL; | 467 | ret = -EINVAL; |
465 | break; | 468 | break; |
466 | } | 469 | } |
467 | i = i + 1 + b[0]; | 470 | i = i + fpgasize; |
468 | } | 471 | } |
469 | /* restart the CPU */ | 472 | /* restart the CPU */ |
470 | if (ret || opera1_xilinx_rw | 473 | if (ret || opera1_xilinx_rw |
@@ -538,7 +541,7 @@ static int opera1_probe(struct usb_interface *intf, | |||
538 | 541 | ||
539 | if (udev->descriptor.idProduct == USB_PID_OPERA1_WARM && | 542 | if (udev->descriptor.idProduct == USB_PID_OPERA1_WARM && |
540 | udev->descriptor.idVendor == USB_VID_OPERA1 && | 543 | udev->descriptor.idVendor == USB_VID_OPERA1 && |
541 | opera1_xilinx_load_firmware(udev, "dvb-usb-opera1-fpga.fw") != 0 | 544 | opera1_xilinx_load_firmware(udev, "dvb-usb-opera1-fpga-01.fw") != 0 |
542 | ) { | 545 | ) { |
543 | return -EINVAL; | 546 | return -EINVAL; |
544 | } | 547 | } |