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.

AM62A7: USB OTG support in kernel

Part Number: AM62A7

Hi,

We are testing USB in AM62A7 SOC based custom board.

We wanted to use USB0 as USB-OTG.

currently if dr_mode property is set to host in device tree USB host is working and dr_mode is set to otg/peripheral device mode is working.

but how to support OTG mode for USB0 node?

  • Hi Vinay,

    Please refer to the SK-AM62A board design, you have to have a USB type C companion device detecting if the attachment is to a USB device or host, then notify AM62A7 to switch to USB host or device mode.

    The device tree dr_mode should be set to "otg".

  • Hi,

    Tested usb-otg in evm board but after booting if i connect typeC host it detects properly but after sometime if i remove the connector and reinsert the host it is not able to register the USB host controller and below errors are seen in debug terminal. only on next boot usb works again until then we cannot use usb in host/device mode.

    working case:

    root@am62axx-evm:~# [   99.773412] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller
    [   99.778968] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 3
    [   99.786794] xhci-hcd xhci-hcd.2.auto: hcc params 0x0258fe6d hci version 0x110 quirks 0x0000000000010010
    [   99.796240] xhci-hcd xhci-hcd.2.auto: irq 460, io mem 0x31000000
    [   99.802355] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller
    [   99.807867] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 4
    [   99.815537] xhci-hcd xhci-hcd.2.auto: Host supports USB 3.0 SuperSpeed
    [   99.822199] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.10
    [   99.830476] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [   99.837696] usb usb3: Product: xHCI Host Controller
    [   99.842576] usb usb3: Manufacturer: Linux 5.10.168-g2c23e6c538 xhci-hcd
    [   99.849191] usb usb3: SerialNumber: xhci-hcd.2.auto
    [   99.854564] hub 3-0:1.0: USB hub found
    [   99.858418] hub 3-0:1.0: 1 port detected
    [   99.862760] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
    [   99.871012] usb usb4: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.10
    [   99.879307] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [   99.886541] usb usb4: Product: xHCI Host Controller
    [   99.891426] usb usb4: Manufacturer: Linux 5.10.168-g2c23e6c538 xhci-hcd
    [   99.898038] usb usb4: SerialNumber: xhci-hcd.2.auto
    [   99.903415] hub 4-0:1.0: USB hub found
    [   99.907230] hub 4-0:1.0: config failed, hub doesn't have any ports! (err -19)

    root@am62axx-evm:~# [  124.408886] usb 3-1: new high-speed USB device number 2 using xhci-hcd
    [  124.561200] usb 3-1: New USB device found, idVendor=0781, idProduct=5567, bcdDevice= 1.00
    [  124.569374] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [  124.576506] usb 3-1: Product: Cruzer Blade
    [  124.580611] usb 3-1: Manufacturer: SanDisk
    [  124.584710] usb 3-1: SerialNumber: 03026018040321123040
    [  124.590840] usb-storage 3-1:1.0: USB Mass Storage device detected
    [  124.597449] scsi host0: usb-storage 3-1:1.0
    [  125.633771] scsi 0:0:0:0: Direct-Access     SanDisk  Cruzer Blade     1.00 PQ: 0 ANSI: 6
    [  125.644408] sd 0:0:0:0: [sda] 30031872 512-byte logical blocks: (15.4 GB/14.3 GiB)
    [  125.653354] sd 0:0:0:0: [sda] Write Protect is off
    [  125.658483] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
    [  125.695478]  sda: sda1
    [  125.701657] sd 0:0:0:0: [sda] Attached SCSI removable disk
    [  130.259123] usb 3-1: USB disconnect, device number 2
    [  130.335925] FAT-fs (sda1): unable to read boot sector to mark fs as dirty
    [  130.667345] xhci-hcd xhci-hcd.2.auto: remove, state 4
    [  130.672458] usb usb4: USB disconnect, device number 1
    [  130.678126] xhci-hcd xhci-hcd.2.auto: USB bus 4 deregistered
    [  130.683862] xhci-hcd xhci-hcd.2.auto: remove, state 4
    [  130.688932] usb usb3: USB disconnect, device number 1
    [  130.694943] xhci-hcd xhci-hcd.2.auto: USB bus 3 deregistered

    non working case

    root@am62axx-evm:~# [  286.365422] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller
    [  286.370986] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 3
    [  296.378705] xhci-hcd xhci-hcd.2.auto: can't setup: -110           
    [  296.383947] xhci-hcd xhci-hcd.2.auto: USB bus 3 deregistered         
    [  296.389673] xhci-hcd: probe of xhci-hcd.2.auto failed with error -110

    in the above log working case is when usb is detected properly and non working case is in same boot after 290 seconds when typeC host is reconnected.

    why is this error shown and how can it be resolved?

  • Hi Vinay,

    [  296.378705] xhci-hcd xhci-hcd.2.auto: can't setup: -110   

    This is an known issue. The Linux development team is debugging it. It seems the xHCI controller is not in a correct state to enter host mode, but the root cause is unknown yet.