Dear Steve,

We have done some modification in m8xxhci.c USB driver.

1.- We have initialize timer 2 count to 0 when arrives a SOF interrupt to
synchronise the timer 2 with 1 Khz signal

                                static void
                                m8xxhci_interrupt(void *hci_p)
                                {
                                        volatile struct m8xxhci_private *hp
= (struct m8xxhci_private *)hci_p;
                                        volatile usbregs_t *usbregs =
hp->usbregs;
                                        ushort ber;
                                        unsigned long flags;
                                        volatile immap_t *immap = (immap_t
*)IMAP_ADDR;

                                        spin_lock_irqsave(&isr_lock, flags);

                                          hp->stats.cpm_interrupts++;

                                        /* sample and reset the ber */
                                        ber = usbregs->usb_usber;
                                        usbregs->usb_usber = ber;

                                /* OUR MODIFICATION*/
                                if(ber & BER_SOF)
                                immap->im_cpmtimer.cpmt_tcn2 = 0

                                        pending_isrs |= ber;

                                        spin_unlock_irqrestore(&isr_lock,
flags);

                                        /* service pending work */
                                        m8xxhci_service_isr();
                                }


2.- We have reduced the communication speed to improve reliability changing
time_left_in_frame function. MIN_BYTES_LEFT was defined 200 and we have
changed to 700. Also, if bytes_left is smaller than 700, we return bytes = 0
and if bytes_left is greater than 700, we return the difference bytes =
bytes_left - 700.

                                static int
                                time_left_in_frame(int *bytes)
                                {
                                        volatile immap_t *immap = (immap_t
*)IMAP_ADDR;
                                        int counts_left, bytes_left,
timer_count;

                                        (void)immap;
                                        /*
                                           12Mhz bus, byte time = 1/12Mhz *
8 = 667ns
                                           1 frame = 1ms or 1,000,000ns
                                           1 frame = 1,000,000 / 667 = 1499
bytes

                                           but 1280 is the right number...
                                           (preamble? bit stuffing?)
                                         */
                                  timer_count =
immap->im_cpmtimer.cpmt_tcn2;
                                        counts_left = tmr_max_count -
timer_count;
                                        bytes_left = (counts_left *
tmr_bytes_per_count_frac) / 100;

                                        log_event(3, "bytes_left",
bytes_left);

                                        /*   *bytes = bytes_left; OUR
MODIFICATION */

                                        /*
                                         * Be careful! if we crash into the
SOF send, the transmit
                                         * will lock up...
                                         */
                                        if (bytes_left < MIN_BYTES_LEFT) {
                                /* OUR MODIFICATION */
                                   *bytes = 0; 
                                                return 0;
                                        }

                                  /* OUR MODIFICATION */
                                       *bytes = bytes_left - MIN_BYTES_LEFT;

                                        return 1;
                                } 


With those modifications, we have improved  reliability very much, we get
much less NAKS. But running our  hard test that copies great files from/to a
pendrive, a Compact Flash and a NFS file system simultaneously, sometimes we
get timeouts from USB or NFS, and this generates a lot of NAKS:

                                unlink_urb(urbÀ7699e0,qtype=3) status -115 
                                unlink_urb(urbÀ7699e0) done

                                NFS server 10.0.7.228 not responding still
trying 



Your previous mail has helped us very much and we have improved in
reliability, but don't know how improve more. 

We will appreciate any idea or suggestion. 

Thanks in advance.




Igor Luri Bravo
Tecnico I+D Software
Fagor Automation S. Coop.
P. O. Box 144
E-20500 Mondragón-Arrasate
Tel. ++34 943 71 92 00 - ++34 943 03 98 00
Fax. ++34 943 79 17 12
www.fagorautomation.com <http://www.fagorautomation.com> 

*       Este mensaje y los documentos que, en su caso, lleve anexos, pueden
contener información confidencial. Por ello, se informa a quien lo reciba
por error que la información contenida en el mismo es reservada y su uso no
autorizado está prohibido legalmente, por lo que en tal caso le rogamos que
nos lo comunique por la misma vía , se abstenga de realizar copias del
mensaje o remitirlo o entregarlo a otra persona y proceda a borrarlo de
inmediato.
*        Mezu honek eta txertatuta eraman ditzakeen dokumentuek informazio
konfidentziala izan dezakete. Hori dela eta, nahi gabe hartzen duenari
jakinarazten zaio bertako informazioa erreserbatua  dela eta baimenik gabe
erabiltzea legez debekatuta dagoela; horregatik, bide beretik guri
jakinarazteko eskatzen diogu, eta aldi berean  mezuaren kopiarik ez egiteko,
beste pertsona bati ez emateko eta berehala ezabatzeko erregutzen diogu."
*       This message together with any documents attached may contain
confidential information. You are informed that if you should receive it by
mistake, the information it contains is reserved and its use is not
authorized. It is legally prohibited. If you have received this message by
mistake, please let us know as soon as possible by e-mail. Do not make any
copies of the message, nor send it or give it to anybody else. Please delete
it right away.



        -----Mensaje original-----
        De:     Steve Calfee [SMTP:[EMAIL PROTECTED]
        Enviado el:     lunes, 31 de enero de 2005 18:20
        Para:   [EMAIL PROTECTED];
linux-usb-devel@lists.sourceforge.net
        Asunto: RE: USB m8xxhci driver transmision errors and   I/O error

        You wrote:

        <quote>
        Dear Sir,

        We have a custom board based on PowerPC 823 with 16 Mbyte of RAM,
ethernet,
        USB host mode and  direct PCMCIA - IDE  iterface with a Compact
Flash
        running Linux kernel   2.4.4, downloaded from Denx site.
        To have USB working in host mode, we have a external 48Mhz signal
aplied in
        PA7 (CLK1) pin and a external 1Khz signal in PC15 (DREQ0), both
signals in
        sync with 72 Mhz system clock. Also, we have installed the USB
microcode
        patch and  because  our USB tranceiver can "hear" it's own SOF being
send,
        we don't need TIMER2 interrupt, but we need TIMER2 to know the time
left to
        the following SOF. Here there are changes made in the m8xxhci.c
driver:
        #ifdef CONFIG_CNC8055
        #define USE_PA7_CLK1 /* 48mhz clock
        via CLK1 */
        #define USB_XCVER_ECHOS_SOF
        #define USE_TIMER2_FOR_SOF
        #endif   /* CONFIG_CNC8055 */
        #ifndef CONFIG_CNC8055
        cpm_install_handler(CPMVEC_TIMER2,
        m8xxhci_timer_interrupt, (void *)0);
        /* make pa4 (tout2*) an output */
                                        immap->im_ioport.iop_padir |=
                PA_DR4;
                immap->im_ioport.iop_papar |= PA_DR4;
        #endif /* !CONFIG_CNC8055 */

        With thouse changes, it seems everything works correctly, becuse we
can
        manage files from a USB pendrive. But after mounting de pendrive, if
we see
        proc file system information "cat /proc/driver/usb" we can see that
the
        driver has had 238 transmision errors. What does it means?
        USB host controller v1.3:
                controller enabled
                root hub port state connected, status
                CCS PES PPS
                ints: cpm 37452, timer 0, isrs 37452
        idle 37452, rst 0, bsy 0, rxb 129,
                txb 169
                errs: tx0 238, timeout 0, underrun 0
        rx  0, nak 238, stall 0, mismatch 0
        comp: iso 0, intr 1, ctrl 12, bulk 49
        root hub sends 151
                                       retransmits    0
                                       tx restarts    238

                frame lists: current c036c560, next c036c594
                active_qe: 00000000
                current: c036c560, total_bytes 0
                next: c036c594, total_bytes 0
                event message:
                event logging: disabled

        Also,   we can copy a 800Kbytes file form  USB pendrive to a
Compact
        flash, a 8 Mbytes file from USB pendrive to a ram file system, but
if we
                copy a 8 Mbytes file from  USB pendrive to a  Compact flash,
we have
        the
                following errors:

        <4>unlink_urb(urbÀ7699e0,qtype=3) status -115
<4>unlink_urb(urbÀ7699e0) done
        <4> I/O error: dev 08:01, sector 2483 <4> I/O error: dev 08:01,
sector 2499
        <4> I/O error: dev 08:01, sector 2504 <4> I/O error: dev 08:01,
sector 2550
        <4> I/O error: dev 08:01, sector 2583 <4> I/O error: dev 08:01,
sector 2588
        </quote>

        Search the mail list archives for  "823 850 host"  This has been
discussed 
        many times here. Summary, if you know what you are doing AND you
support 
        only one device, you probably can get it to work.

        The 823 takes an interrupt and stalls usb processing on every
"error" and 
        that includes "NAKs". In 1ms how many interrupts can your
software/hardware 
        handle? The SOF hack just restarts the CPM list processing, so if
you are in 
        the middle of bus transactions and the timer hits, the CPM will just

        continue wherever it was and you will miss a SOF. Chaos.

        Good Luck, ~Steve

        Linux compatible USB bus analyzer http://myspot.neteze.com/~calfee/
        


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Linux-usb-users@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to