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.

Linux/TDA2EXEVM: question on vision sdk kernel?

Part Number: TDA2EXEVM

Tool/software: Linux

Hi Guys,

I just want some information regarding kernel. Due to some issue usb gadget enumeration is failing. For that i was cross checking main line kernel with vision sdk kernel.

i know vision sdk kernel is builded around TI SOCs.

1-> Is their any changes made to vision sdk kernel from main line kernel for usb for TI SOCs?

2-> is usb dwc3 gadget mode for isochronous endpoint tested or not? how to know isochronous endpoints working?

regards,

Ganesh

  • Hi Ganesh,

    I have notified an USB expert.

    Regards,
    Yordan
  • Hi ,

    Their is no response from USB expert.

    regards,
    Ganesh
  • Hi Ganesh,

    sorry for the delay, I will ping them.

    Regards,
    Yordan
  • Ganesh

    >> 1-> Is their any changes made to vision sdk kernel from main line kernel for usb for TI SOCs?

    There is no TI specific changes to USB driver from mainline driver, except enable DRD role switch through debugfs interface

    >> 2-> is usb dwc3 gadget mode for isochronous endpoint tested or not? how to know isochronous endpoints working?

    The isochronous has been verified in host mode, not verified in gadget mode operation.

    Regards

    Ravi

  • What is the specific use-case not working for you ? what's the kernel version using?
  • Hi Ravi B (711789) ,

    kernel version - 4.4

    vision sdk - 02_12

    usb gadget mode for uvc device.

    For gadget mass storage, endpoint 81 is assigned and IRQ 475 in dwc3(core.c)  for 488d0000 usb port is assigned and when we connect to host their is triggering and ISR are getting called but when we go for uvc, IRQ is 475 with EP81 and EP82 their is no irq triggering when we run demo uvc-gadget application. At host side USB device is not getting enumerated for uvc.

    From main line kernel 4.4 to vision sdk 4.4 kernel their are lot changes are their.

    In dwc3 - gadget.c file, function dwc3_gadget_pullup is having some kind of workaround for dwc3 revision in vision sdk.

    I have put debug log and cross check with ftrace in usb source. it is not able to pass dwc3_gadget_pullup when we are using uvc.

    [   93.539140] [DEBUG] dwc3_set_mode : mode : 0x00000002
    insmod /lib/modules/4.4.23-00012-g84a3125-dirty/kernel/fs/configfs/configfs.ko
    insmod /lib/modules/4.4.23-00012-g84a3125-dirty/kernel/drivers/usb/gadget/libcomposite.ko
    insmod /lib/modules/4.4.23-00012-g84a3125-dirty/kernel/drivers/media/v4l2-core/videobuf2-vmalloc.ko
    insmod /lib/modules/4.4.23-00012-g84a3125-dirty/kernel/drivers/usb/gadget/function/usb_f_uvc.ko
    [   97.726710] configfs-gadget gadget: uvc_function_bind
    [   44.731792] [DEBUG] In usb_ep_autoconfig
    [   44.738046] [DEBUG] Ep->type = 3 desc->wMaxPacketSize = 16
    [   44.744527] [DEBUG] desc->bEndpointAddress = 80
    [   44.749079] [DEBUG] desc->bEndpointAddress1 = 81
    [   44.755392] [DEBUG] In usb_ep_autoconfig
    [   44.759334] [DEBUG] Ep->type = 1 desc->wMaxPacketSize = 1024
    [   44.766623] [DEBUG] desc->bEndpointAddress = 80
    [   44.771173] [DEBUG] desc->bEndpointAddress1 = 82
    [   44.778864] [DEBUG] drivers/usb/dwc3/gadget.c : dwc3_gadget_enable_irq
    # uvc-gadget -d -u /dev/video1
    [   44.804838] BUG: scheduling while atomic: uvc-gadget/1011/0x00000002
    [   44.811284] Modules linked in:usb_f_uvc videobuf2_vmalloc libcomposite configfs xhci_plat_hcd xhci_hcd usbcore
    rpmsg_proto dwc3 udc_core virtio_rpmsg_bus sha512_generic sha512_arm sha256_generic hmac md5 sha1_gl
    [   45.045856] [DEBUG] drivers/usb/dwc3/gadget.c : dwc3_gadget_enable_irq
    [   45.060563] [DEBUG] dwc3_gadget_pullup : WORKAROUND
    [   45.065559] BUG: scheduling while atomic: v4l_id/619/0x00000002
    [   45.071504] Modules linked in: usb_f_uvc videobuf2_vmalloc libcomposite configfs xhci_plat_hcd xhci_hcd usbcore rpmsg_proto dwc3 udc_core vl
    [   45.115484] CPU: 0 PID: 619 Comm: v4l_id Tainted: G        W  O    4.4.23-00012-g84a3125-dirty #44
    [   45.124480] Hardware name: Generic DRA72X (Flattened Device Tree)
    [   45.130597] Backtrace:
    [   45.133078] [<c00131a4>] (dump_backtrace) from [<c00133a0>] (show_stack+0x18/0x1c)
    [   45.140680]  r7:c09426d4 r6:20070013 r5:00000000 r4:c096ce4c
    [   45.146404] [<c0013388>] (show_stack) from [<c02b428c>] (dump_stack+0x8c/0xa0)
    [   45.153660] [<c02b4200>] (dump_stack) from [<c0054d40>] (__schedule_bug+0x54/0x64)
    [   45.161259]  r7:c09426d4 r6:c093ee00 r5:ee68cc00 r4:00000000
    [   45.166981] [<c0054cec>] (__schedule_bug) from [<c0677b08>] (__schedule+0x55c/0x668)
    [   45.174755]  r5:ee68cc00 r4:ef639e00
    [   45.178363] [<c06775ac>] (__schedule) from [<c0677c68>] (schedule+0x54/0xc4)
    [   45.185439]  r10:ed377b44 r9:00000000 r8:ffff9c74 r7:c0942100 r6:ecc31c6c r5:ef6373c0
    [   45.193342]  r4:ecc30000
    [   45.195896] [<c0677c14>] (schedule) from [<c067ab1c>] (schedule_timeout+0x118/0x1ac)
    [   45.203669]  r5:ef6373c0 r4:ef6373c0
    [   45.207279] [<c067aa04>] (schedule_timeout) from [<c067895c>] (wait_for_common+0x90/0x140)
    [   45.215576]  r8:00000002 r7:ecc30000 r6:ed377b44 r5:ed377b48 r4:0000000a
    [   45.222351] [<c06788cc>] (wait_for_common) from [<c0678a3c>] (wait_for_completion_timeout+0x14/0x18)
    [   45.231519]  r9:00000000 r8:ed377810 r7:55332209 r6:ed37788c r5:00000000 r4:ed377970
    [   45.239359] [<c0678a28>] (wait_for_completion_timeout) from [<bf225904>] (dwc3_gadget_pullup+0x110/0x308 [dwc3])
    [   45.249610] [<bf2257f4>] (dwc3_gadget_pullup [dwc3]) from [<bf0bb0d4>] (usb_function_activate+0xcc/0xe0 [libcomposite])
    [   45.260437]  r10:ecc31f5c r9:eec023b8 r8:00000000 r7:ed377970 r6:60070013 r5:ee601288
    [   45.268340]  r4:ee60122c
    [   45.270920] [<bf0bb008>] (usb_function_activate [libcomposite]) from [<bf11b14c>] (uvc_function_connect+0x1c/0x3c [usb_f_uvc])
    [   45.282356]  r7:ee762540 r6:ecfba000 r5:ecfba000 r4:ee60122c
    [   45.288089] [<bf11b130>] (uvc_function_connect [usb_f_uvc]) from [<bf11bb90>] (uvc_v4l2_open+0x60/0x70 [usb_f_uvc])
    [   45.298566]  r5:ecfba000 r4:ecf0bf80
    [   45.302186] [<bf11bb30>] (uvc_v4l2_open [usb_f_uvc]) from [<c048ed28>] (v4l2_open+0xa4/0x108)
    [   45.310744]  r7:ee762540 r6:ecfba050 r5:ee762540 r4:ecfba000
    [   45.316465] [<c048ec84>] (v4l2_open) from [<c0123e04>] (chrdev_open+0xac/0x180)
    [   45.323803]  r7:ee762540 r6:ee6471b0 r5:ecf0bac0 r4:c06e9f78
    [   45.329525] [<c0123d58>] (chrdev_open) from [<c011ded4>] (do_dentry_open+0x1e0/0x300)
    [   45.337386]  r8:00000000 r7:ee6471b0 r6:c0123d58 r5:ee762548 r4:ee762540
    [   45.344159] [<c011dcf4>] (do_dentry_open) from [<c011f000>] (vfs_open+0x60/0x88)
    [   45.351584]  r9:eec023b8 r8:00000000 r7:00000000 r6:ecc31eb0 r5:ee762540 r4:ecc31eb0
    [   45.359404] [<c011efa0>] (vfs_open) from [<c012c614>] (path_openat+0x17c/0xfb0)
    [   45.366742]  r5:00000000 r4:00020000
    [   45.370349] [<c012c498>] (path_openat) from [<c012e5d8>] (do_filp_open+0x6c/0xd0)
    [   45.377861]  r10:00000000 r9:ecc30000 r8:c000fc84 r7:00000001 r6:ecc31f5c r5:ecc31eb0
    [   45.385761]  r4:00000003
    [   45.388315] [<c012e56c>] (do_filp_open) from [<c011f364>] (do_sys_open+0x118/0x1dc)
    [   45.396000]  r7:fffff000 r6:ed191000 r5:ffffff9c r4:00000003
    [   45.401719] [<c011f24c>] (do_sys_open) from [<c011f448>] (SyS_open+0x20/0x24)
    [   45.408883]  r9:ecc30000 r8:c000fc84 r7:00000005 r6:00000000 r5:b6f7ace0 r4:00000000
    [   45.416703] [<c011f428>] (SyS_open) from [<c000fae0>] (ret_fast_syscall+0x0/0x34)

     

    where as for mass storage perfectly working.

    [   56.408287] [DEBUG] dwc3_set_mode : mode : 0x00000002
    insmod /lib/modules/4.4.23-00012-g84a3125-dirty/kernel/drivers/usb/gadget/function/usb_f_mass_storage.ko
    [   58.545084] Mass Storage Function, version: 2009/09/11
    [   58.550256] LUN: removable file: (no medium)
    16+0 records in
    16+0 records out
    [   58.611639] [DEBUG] In usb_ep_autoconfig
    [   58.615934] [DEBUG] Ep->type = 2 desc->wMaxPacketSize = 0
    [   58.621357] [DEBUG] desc->bEndpointAddress = 80
    [   58.628558] [DEBUG] desc->bEndpointAddress1 = 81
    [   58.634652] [DEBUG] In usb_ep_autoconfig
    [   58.638596] [DEBUG] Ep->type = 2 desc->wMaxPacketSize = 0
    [   58.645723] [DEBUG] desc->bEndpointAddress = 0
    [   58.650189] [DEBUG] desc->bEndpointAddress1 = 1
    [   58.656670] [DEBUG] drivers/usb/dwc3/gadget.c : dwc3_gadget_enable_irq
    [   58.664167] [DEBUG] dwc3_gadget_pullup : WORKAROUND
    [   76.297528] [DEBUG] gadget->state : 5
    [   76.405640] [DEBUG] gadget->state : 6
    [   76.432459] configfs-gadget gadget: high-speed config #1: c
    [   76.438057] [DEBUG] gadget->state : 7
    [   76.441833] [DEBUG] gadget->state : 7

    can you check dwc3 code and verify workarounds.

    regards,

    Ganesh

  • Hi ,

    Any update?

    regards,
    Ganesh
  • Ganesh

    The UVC gadget is not support feature in this release.

    Can you send the steps to reproduce the issue and what is the top kernel commit information of VSDK release. 

    Regards

    Ravi

  • Hi Ravi B (711789) ,

    Rules.make in vision_sdk

    MAKECONFIG?=tda2ex_evm_linux_all

    kernel commit/tag

    tag: processor-sdk-linux-automotive-3.01.00.03
    
    or
    
    commit id: 91222fb

    arch/arm/boot/dts/dra72-evm-common.dtsi
    
     &usb1 {
    -       dr_mode = "otg";
    +       dr_mode = "host";
     };
     
     &usb2 {
    -       dr_mode = "host";
    +       dr_mode = "peripheral";
     };


    you need enable vivid test driver and default config of kernel will have support for usb gadget and uvc in configfs.

    Virtual Video Test Driver in kernel
                                                                                                            
    Location:                                                                                                                        
      -> Device Drivers                                                                                                              
         -> Multimedia support (MEDIA_SUPPORT [=y])                                                                                  
            -> Media test drivers (V4L_TEST_DRIVERS [=y])
               -> VIDEO_VIVID [=m]     

    rebuild the kernel and copy the modules in sd card.

    you need test application to test you can use below application

    https://github.com/madscientist42/uvc-gadget

    cross compile with arm-linux-gnueabihf-gcc toolchain. copy uvc-gadget binary in rootfs. 

    copy below command into one script to set configfs. copy the script in rootfs home directory.

    #configfs.sh
    mount -t debugfs debugfs /mnt/
    sleep 1
    echo "device" > /mnt/488d0000.usb/mode
    modprobe -v configfs
    modprobe -v libcomposite
    cd /sys/kernel/config/usb_gadget
    mkdir g1
    cd g1
    echo "0x1d6b" > idVendor
    echo "0x0104" > idProduct
    mkdir strings/0x409
    echo "0123456789" > strings/0x409/serialnumber
    echo "TI Inc." > strings/0x409/manufacturer
    echo "UVC gadget" > strings/0x409/product
    modprobe -v usb_f_uvc
    mkdir functions/uvc.usb0
    mkdir configs/c.1
    mkdir configs/c.1/strings/0x409
    echo "Video" > configs/c.1/strings/0x409/configuration
    echo 120 > configs/c.1/MaxPower
    mkdir functions/uvc.usb0/control/header/h
    cd functions/uvc.usb0/control/
    ln -s header/h class/fs
    ln -s header/h class/ss
    cd ../../../
    mkdir -p functions/uvc.usb0/streaming/uncompressed/u/360p
    cat <<EOF > functions/uvc.usb0/streaming/uncompressed/u/360p/dwFrameInterval
    666666
    1000000
    5000000
    EOF
    mkdir functions/uvc.usb0/streaming/header/h
    cd functions/uvc.usb0/streaming/header/h
    ln -s ../../uncompressed/u
    cd ../../class/fs
    ln -s ../../header/h
    cd ../../class/hs
    ln -s ../../header/h
    cd ../../../control
    cd ../../../
    ln -s functions/uvc.usb0 configs/c.1/
    echo "488d0000.usb" > UDC

    once card prepared please follow below steps to generate kernel error.

    sh configfs.sh

    onece you run script you will video device node (ls /dev/video* probably zero [default video10 & video11 will be their])

    modprobe vivid

    [  252.974209] vivid-000: using single planar format API
    [  252.985202] vivid-000: V4L2 capture device registered as video1
    [  252.997470] vivid-000: V4L2 output device registered as video2
    [  253.011800] vivid-000: V4L2 capture device registered as vbi0, supports raw and sliced VBI
    [  253.032184] vivid-000: V4L2 output device registered as vbi1, supports raw and sliced VBI
    [  253.050850] vivid-000: V4L2 capture device registered as swradio0
    [  253.062216] vivid-000: V4L2 receiver device registered as radio0
    [  253.078478] vivid-000: V4L2 transmitter device registered as radio1

    ./uvc-gadget -u /dev/video0 -v /dev/video1

    once you run the scripts you will get error.

    NOTE: make sure to connect otg usb cable to usb port 2(device) to HOST PC.

    NOTE: At PC side if every thing goes correct you will get video0 node. if your host PC is ubuntu just install luvcview. and run luvcview application after you run uvc-gadget application.

    please check below link:

    github.com/.../gadget-testing.txt

    any help you need just ping i will try to respond as soon as possible.

    regards,

    Ganesh

  • https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/uvc_2D00_fixes.7zGanesh

    Also please check whether you have the fixes (attached).

    And pick the most recent master of uvc-gadget?
    git.ideasonboard.org/uvc-gadget.git


    Regards
    Ravi

  • Hi ,

    Have you reproduced the issue. Yes i'm taking latest uvc-gadget application master. Issue is at dwc3 side.

    regards,
    Ganesh
  • Ganesh

    I could not get time to reproduce this on my setup. I will let you know in a day or two.

    Regards
    Ravi