This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

omap4460 usb otg DMA question

Hi sir,

   I programe the OTG as a peripheral, and try to enable OTG internal DMA to receive data from host.

but I can't receive data correctly, and some time received correctly. However I tranlate the same data from host.

If I read OTG FIFO byte one by one, the data received all correctly. Why the DMA fail?

Could some one give my some suggestion?

BTW, My OTG register programe same as the u-boot(it can run fastboot).

 

Thx!

 

 

  • Rain,

    Which OMAP device and board are you using?  (for example, OMAP4460 Blaze Tablet)  Also, which software release are you using?  (for example, 4AI.1.7)  Are you using the USB-OTG driver included for OMAP in that release or have you made any changes?

    Regards,
    Gina 

  • Hi Gina,

       The board is PandaBoard ES1.0 (OMAP4460), and the USB-OTG driver can work well in non-DMA mode.

    But when I try to use DMA mode to receive an large data block,  and Verify the data which I received. I find some words are zero (In fact those words should none zero).

    And I check the DMA_CNTL register D8(DMA_ERR) has no DMA bus error occur.

    However the DMA request mode 0 and 1, has the some result.

    Could you give me some sugestion? If other module's configuration should take care, like EMIF controller...

     

    Thx!

  • Hi Rain,

    What software release are you running on the PandaBoard?

    There are several patches pushed to the kernel tree recently that fix DMA issues with USB-OTG:

    http://review.omapzoom.org/22482 usb: musb: implement (un)map_urb_for_dma hooks
    http://review.omapzoom.org/22486 usb: hcd: Add a dma_align flag
    http://review.omapzoom.org/22489 usbnet: dma alignement fix
    http://review.omapzoom.org/22487 usb: musb: indicate DMA alignement requirement
    http://review.omapzoom.org/22488 usb: ehci-omap: indicate DMA alignement requirement (optional: for EHCI)

    They are especially necessary in the case of using USB-Ethernet over USB OTG, as the DMA could not handle the unaligned buffer addresses.

    Here is a related post on this topic: http://e2e.ti.com/support/omap/f/849/t/189866.aspx

    Regards,
    Gina

  • Hi Gina,

       The software my program is new bootloader, which I used to replace the xloader and u-boot.

    And my DMA buffer allocation is 4 byte aligned.  So your solution not apply to my issue.

    Could you give me some other suggestion? I think may be some DMA transfer configuration need to porting!

    Thx!

    Rain

  • Rain,

    We don't have DMA supported in the OMAP4 bootloader.  I suggest you look at the DMA implementation from the kernel as a reference.  The OMAP kernel tree is located at http://git.omapzoom.org/?p=kernel/omap.git;a=summary  You can use branch p-android-omap-3.0.  Some key files to look at for DMA with USB OTG are (in the kernel directory /drivers/usb):

    - /musb/musb_dma.h

    - /musb/musb_host.c

    - /musb/musb_core.c

    - /musb/musbhsdma.c

    - /core/usb.c

    - /gadget/omap_udc.c

    - /musb/musb_gadget.c

    (Some of this code is only needed for host case and some for peripheral case.)

    Regards,
    Gina 

  • Hi Gina,

      Thanks for you suggestion.

      I found the root cause is the memory buffer's attribute, that allocate should uncache.

      If cacheble, CPU will reflesh cache to this buffer. So when I display, some words has replace by cache line.

      So I modify those memory buffer's attribute.  the dma transfer works well!

     

    Thx!

    RainHe