at v2.6.28-rc2 205 lines 8.0 kB view raw
1This README escorted the skystar2-driver rewriting procedure. It describes the 2state of the new flexcop-driver set and some internals are written down here 3too. 4 5This document hopefully describes things about the flexcop and its 6device-offsprings. Goal was to write an easy-to-write and easy-to-read set of 7drivers based on the skystar2.c and other information. 8 9Remark: flexcop-pci.c was a copy of skystar2.c, but every line has been 10touched and rewritten. 11 12History & News 13============== 14 2005-04-01 - correct USB ISOC transfers (thanks to Vadim Catana) 15 16 17 18 19General coding processing 20========================= 21 22We should proceed as follows (as long as no one complains): 23 240) Think before start writing code! 25 261) rewriting the skystar2.c with the help of the flexcop register descriptions 27and splitting up the files to a pci-bus-part and a flexcop-part. 28The new driver will be called b2c2-flexcop-pci.ko/b2c2-flexcop-usb.ko for the 29device-specific part and b2c2-flexcop.ko for the common flexcop-functions. 30 312) Search for errors in the leftover of flexcop-pci.c (compare with pluto2.c 32and other pci drivers) 33 343) make some beautification (see 'Improvements when rewriting (refactoring) is 35done') 36 374) Testing the new driver and maybe substitute the skystar2.c with it, to reach 38a wider tester audience. 39 405) creating an usb-bus-part using the already written flexcop code for the pci 41card. 42 43Idea: create a kernel-object for the flexcop and export all important 44functions. This option saves kernel-memory, but maybe a lot of functions have 45to be exported to kernel namespace. 46 47 48Current situation 49================= 50 510) Done :) 521) Done (some minor issues left) 532) Done 543) Not ready yet, more information is necessary 554) next to be done (see the table below) 565) USB driver is working (yes, there are some minor issues) 57 58What seems to be ready? 59----------------------- 60 611) Rewriting 621a) i2c is cut off from the flexcop-pci.c and seems to work 631b) moved tuner and demod stuff from flexcop-pci.c to flexcop-tuner-fe.c 641c) moved lnb and diseqc stuff from flexcop-pci.c to flexcop-tuner-fe.c 651e) eeprom (reading MAC address) 661d) sram (no dynamic sll size detection (commented out) (using default as JJ told me)) 671f) misc. register accesses for reading parameters (e.g. resetting, revision) 681g) pid/mac filter (flexcop-hw-filter.c) 691i) dvb-stuff initialization in flexcop.c (done) 701h) dma stuff (now just using the size-irq, instead of all-together, to be done) 711j) remove flexcop initialization from flexcop-pci.c completely (done) 721l) use a well working dma IRQ method (done, see 'Known bugs and problems and TODO') 731k) cleanup flexcop-files (remove unused EXPORT_SYMBOLs, make static from 74non-static where possible, moved code to proper places) 75 762) Search for errors in the leftover of flexcop-pci.c (partially done) 775a) add MAC address reading 785c) feeding of ISOC data to the software demux (format of the isochronous data 79and speed optimization, no real error) (thanks to Vadim Catana) 80 81What to do in the near future? 82-------------------------------------- 83(no special order here) 84 855) USB driver 865b) optimize isoc-transfer (submitting/killing isoc URBs when transfer is starting) 87 88Testing changes 89--------------- 90 91O = item is working 92P = item is partially working 93X = item is not working 94N = item does not apply here 95<empty field> = item need to be examined 96 97 | PCI | USB 98item | mt352 | nxt2002 | stv0299 | mt312 | mt352 | nxt2002 | stv0299 | mt312 99-------+-------+---------+---------+-------+-------+---------+---------+------- 1001a) | O | | | | N | N | N | N 1011b) | O | | | | | | O | 1021c) | N | N | | | N | N | O | 1031d) | O | O 1041e) | O | O 1051f) | P 1061g) | O 1071h) | P | 1081i) | O | N 1091j) | O | N 1101l) | O | N 1112) | O | N 1125a) | N | O 1135b)* | N | 1145c) | N | O 115 116* - not done yet 117 118Known bugs and problems and TODO 119-------------------------------- 120 1211g/h/l) when pid filtering is enabled on the pci card 122 123DMA usage currently: 124 The DMA is splitted in 2 equal-sized subbuffers. The Flexcop writes to first 125 address and triggers an IRQ when it's full and starts writing to the second 126 address. When the second address is full, the IRQ is triggered again, and 127 the flexcop writes to first address again, and so on. 128 The buffersize of each address is currently 640*188 bytes. 129 130 Problem is, when using hw-pid-filtering and doing some low-bandwidth 131 operation (like scanning) the buffers won't be filled enough to trigger 132 the IRQ. That's why: 133 134 When PID filtering is activated, the timer IRQ is used. Every 1.97 ms the IRQ 135 is triggered. Is the current write address of DMA1 different to the one 136 during the last IRQ, then the data is passed to the demuxer. 137 138 There is an additional DMA-IRQ-method: packet count IRQ. This isn't 139 implemented correctly yet. 140 141 The solution is to disable HW PID filtering, but I don't know how the DVB 142 API software demux behaves on slow systems with 45MBit/s TS. 143 144Solved bugs :) 145-------------- 1461g) pid-filtering (somehow pid index 4 and 5 (EMM_PID and ECM_PID) aren't 147working) 148SOLUTION: also index 0 was affected, because net_translation is done for 149these indexes by default 150 1515b) isochronous transfer does only work in the first attempt (for the Sky2PC 152USB, Air2PC is working) SOLUTION: the flexcop was going asleep and never really 153woke up again (don't know if this need fixes, see 154flexcop-fe-tuner.c:flexcop_sleep) 155 156NEWS: when the driver is loaded and unloaded and loaded again (w/o doing 157anything in the while the driver is loaded the first time), no transfers take 158place anymore. 159 160Improvements when rewriting (refactoring) is done 161================================================= 162 163- split sleeping of the flexcop (misc_204.ACPI3_sig = 1;) from lnb_control 164 (enable sleeping for other demods than dvb-s) 165- add support for CableStar (stv0297 Microtune 203x/ALPS) (almost done, incompatibilities with the Nexus-CA) 166 167Debugging 168--------- 169- add verbose debugging to skystar2.c (dump the reg_dw_data) and compare it 170 with this flexcop, this is important, because i2c is now using the 171 flexcop_ibi_value union from flexcop-reg.h (do you have a better idea for 172 that, please tell us so). 173 174Everything which is identical in the following table, can be put into a common 175flexcop-module. 176 177 PCI USB 178------------------------------------------------------------------------------- 179Different: 180Register access: accessing IO memory USB control message 181I2C bus: I2C bus of the FC USB control message 182Data transfer: DMA isochronous transfer 183EEPROM transfer: through i2c bus not clear yet 184 185Identical: 186Streaming: accessing registers 187PID Filtering: accessing registers 188Sram destinations: accessing registers 189Tuner/Demod: I2C bus 190DVB-stuff: can be written for common use 191 192Acknowledgements (just for the rewriting part) 193================ 194 195Bjarne Steinsbo thought a lot in the first place of the pci part for this code 196sharing idea. 197 198Andreas Oberritter for providing a recent PCI initialization template 199(pluto2.c). 200 201Boleslaw Ciesielski for pointing out a problem with firmware loader. 202 203Vadim Catana for correcting the USB transfer. 204 205comments, critics and ideas to linux-dvb@linuxtv.org.