aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Gittler <g.marco@freenet.de>2007-07-04 18:18:34 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-07-18 13:24:41 -0400
commit59800555f79a52394c3c29e19e448b4635daf14c (patch)
treea6540f53684f2939bc89b26f2d72770a09d5c53e
parentb31c33bd8b339e426138dd267ec969291f802a0d (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>
-rw-r--r--Documentation/dvb/get_dvb_firmware61
-rw-r--r--Documentation/dvb/opera-firmware.txt27
-rw-r--r--drivers/media/dvb/dvb-usb/opera1.c17
3 files changed, 97 insertions, 8 deletions
diff --git a/Documentation/dvb/get_dvb_firmware b/Documentation/dvb/get_dvb_firmware
index e32f79e05c85..b4d306ae9234 100644
--- a/Documentation/dvb/get_dvb_firmware
+++ b/Documentation/dvb/get_dvb_firmware
@@ -24,7 +24,8 @@ use IO::Handle;
24@components = ( "sp8870", "sp887x", "tda10045", "tda10046", 24@components = ( "sp8870", "sp887x", "tda10045", "tda10046",
25 "tda10046lifeview", "av7110", "dec2000t", "dec2540t", 25 "tda10046lifeview", "av7110", "dec2000t", "dec2540t",
26 "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004", 26 "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004",
27 "or51211", "or51132_qam", "or51132_vsb", "bluebird"); 27 "or51211", "or51132_qam", "or51132_vsb", "bluebird",
28 "opera1");
28 29
29# Check args 30# Check args
30syntax() if (scalar(@ARGV) != 1); 31syntax() if (scalar(@ARGV) != 1);
@@ -210,6 +211,45 @@ sub dec3000s {
210 211
211 $outfile; 212 $outfile;
212} 213}
214sub opera1{
215 my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 0);
216
217 checkstandard();
218 my $fwfile1="dvb-usb-opera1-fpga-01.fw";
219 my $fwfile2="dvb-usb-opera-01.fw";
220 extract("2830SCap2.sys", 0x62e8, 55024, "$tmpdir/opera1-fpga.fw");
221 extract("2830SLoad2.sys",0x3178,0x3685-0x3178,"$tmpdir/fw1part1");
222 extract("2830SLoad2.sys",0x0980,0x3150-0x0980,"$tmpdir/fw1part2");
223 delzero("$tmpdir/fw1part1","$tmpdir/fw1part1-1");
224 delzero("$tmpdir/fw1part2","$tmpdir/fw1part2-1");
225 verify("$tmpdir/fw1part1-1","5e0909858fdf0b5b09ad48b9fe622e70");
226 verify("$tmpdir/fw1part2-1","d6e146f321427e931df2c6fcadac37a1");
227 verify("$tmpdir/opera1-fpga.fw","0f8133f5e9051f5f3c1928f7e5a1b07d");
228
229 my $RES1="\x01\x92\x7f\x00\x01\x00";
230 my $RES0="\x01\x92\x7f\x00\x00\x00";
231 my $DAT1="\x01\x00\xe6\x00\x01\x00";
232 my $DAT0="\x01\x00\xe6\x00\x00\x00";
233 open FW,">$tmpdir/opera.fw";
234 print FW "$RES1";
235 print FW "$DAT1";
236 print FW "$RES1";
237 print FW "$DAT1";
238 appendfile(FW,"$tmpdir/fw1part1-1");
239 print FW "$RES0";
240 print FW "$DAT0";
241 print FW "$RES1";
242 print FW "$DAT1";
243 appendfile(FW,"$tmpdir/fw1part2-1");
244 print FW "$RES1";
245 print FW "$DAT1";
246 print FW "$RES0";
247 print FW "$DAT0";
248 copy ("$tmpdir/opera1-fpga.fw",$fwfile1);
249 copy ("$tmpdir/opera.fw",$fwfile2);
250
251 $fwfile1.",".$fwfile2;
252}
213 253
214sub vp7041 { 254sub vp7041 {
215 my $sourcefile = "2.422.zip"; 255 my $sourcefile = "2.422.zip";
@@ -440,6 +480,25 @@ sub appendfile {
440 close(INFILE); 480 close(INFILE);
441} 481}
442 482
483sub delzero{
484 my ($infile,$outfile) =@_;
485
486 open INFILE,"<$infile";
487 open OUTFILE,">$outfile";
488 while (1){
489 $rcount=sysread(INFILE,$buf,22);
490 $len=ord(substr($buf,0,1));
491 print OUTFILE substr($buf,0,1);
492 print OUTFILE substr($buf,2,$len+3);
493 last if ($rcount<1);
494 printf OUTFILE "%c",0;
495#print $len." ".length($buf)."\n";
496
497 }
498 close(INFILE);
499 close(OUTFILE);
500}
501
443sub syntax() { 502sub syntax() {
444 print STDERR "syntax: get_dvb_firmware <component>\n"; 503 print STDERR "syntax: get_dvb_firmware <component>\n";
445 print STDERR "Supported components:\n"; 504 print STDERR "Supported components:\n";
diff --git a/Documentation/dvb/opera-firmware.txt b/Documentation/dvb/opera-firmware.txt
new file mode 100644
index 000000000000..93e784c2607b
--- /dev/null
+++ b/Documentation/dvb/opera-firmware.txt
@@ -0,0 +1,27 @@
1To extract the firmware for the Opera DVB-S1 USB-Box
2you need to copy the files:
3
42830SCap2.sys
52830SLoad2.sys
6
7from the windriver disk into this directory.
8
9Then run
10
11./get_dvb_firware opera1
12
13and after that you have 2 files:
14
15dvb-usb-opera-01.fw
16dvb-usb-opera1-fpga-01.fw
17
18in here.
19
20Copy them into /lib/firmware/ .
21
22After that the driver can load the firmware
23(if you have enabled firmware loading
24in kernel config and have hotplug running).
25
26
27Marco Gittler <g.marco@freenet.de> \ No newline at end of file
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 }