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.

DRA829J: Enable USB host in u-boot (and kernel)

Part Number: DRA829J
Other Parts Discussed in Thread: DRA821, TUSB8041, TDA4VM

Hello experts,

We have a custom board that has mimicked the BeagleBoneAI64 in its layout with usb-hub and two host ports connected to that hub.

I am trying to get those two ports functioning in U-boot (Linux will follow) to verify that the hardware is correct.

I have copied the usb-related blocks in the dts:

    main_usbss1_pins_default: main-usbss1-pins-default {
        pinctrl-single,pins = <
            J721E_IOPAD(0x290, INPUT_DISABLE, 1) /* (U6) USB0_DRVVBUS.USB1_DRVVBUS */
        >;
    };
<snip>

    mcu_usbss1_pins_default: mcu-usbss1-pins-default {
        pinctrl-single,pins = <
            J721E_WKUP_IOPAD(0x3c, PIN_OUTPUT_PULLUP, 5) /* (A23) MCU_OSPI1_LBCLKO.WKUP_GPIO0_30 */
        >;
    };
<snip>
&usb_serdes_mux {
    idle-states = <1>, <1>; /* USB0 to SERDES3, USB1 to SERDES2 */
};

&serdes_ln_ctrl {
    idle-states = <J721E_SERDES0_LANE0_IP4_UNUSED>, <J721E_SERDES0_LANE1_IP4_UNUSED>,
                <J721E_SERDES1_LANE0_PCIE1_LANE0>, <J721E_SERDES1_LANE1_PCIE1_LANE1>,
                <J721E_SERDES2_LANE0_IP1_UNUSED>, <J721E_SERDES2_LANE1_USB3_1>,
                <J721E_SERDES3_LANE0_USB3_0_SWAP>, <J721E_SERDES3_LANE1_USB3_0>,
                <J721E_SERDES4_LANE0_EDP_LANE0>, <J721E_SERDES4_LANE1_EDP_LANE1>,
                <J721E_SERDES4_LANE2_EDP_LANE2>, <J721E_SERDES4_LANE3_EDP_LANE3>;
};
&serdes2 {
    serdes2_usb_link: phy@1 {
        reg = <1>;
        cdns,num-lanes = <1>;
        #phy-cells = <0>;
        cdns,phy-type = <PHY_TYPE_USB3>;
        resets = <&serdes_wiz2 2>;
    };
};

&usbss1 {
    pinctrl-names = "default";
    pinctrl-0 = <&main_usbss1_pins_default>, <&mcu_usbss1_pins_default>;
    ti,vbus-divider;
};

&usb1 {
    dr_mode = "host";
    maximum-speed = "super-speed";
    phys = <&serdes2_usb_link>;
    phy-names = "cdns3,usb3-phy";
};
In U-boot I see the following (logging is turned on):
=> usb start
starting USB...
Bus usb@6400000: drivers/usb/cdns3/core.c:337- cdns3_probe() cdns-usb3-host usb@6400000: Unable to get USB2 phy (ret -61)
drivers/clk/clk-uclass.c:112-clk_get_by_index_tail() prop: returning err=-2
drivers/clk/clk-uclass.c:112-clk_get_by_index_tail() prop: returning err=-2
drivers/clk/clk-uclass.c:112-clk_get_by_index_tail() prop: returning err=-2
drivers/clk/clk-uclass.c:112-clk_get_by_index_tail() prop: returning err=-2
drivers/phy/cadence/phy-cadence-sierra.c:1122-cdns_sierra_phy_probe() cdns,sierra serdes@5020000: PHY not found 0x7364 vs 0x0
drivers/usb/cdns3/core.c:345- cdns3_probe() cdns-usb3-host usb@6400000: Unable to get USB3 phy (ret -19)
drivers/usb/cdns3/drd.c:273- cdns3_drd_init() cdns-usb3-host usb@6400000: DRD version v1 (ID: 0004024e, rev: 00000200)
drivers/usb/cdns3/core.c:309-cdns3_hw_role_switch() cdns-usb3-host usb@6400000: set 1 has failed, back to 0
scanning bus usb@6400000 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
As always, I'm thankful for any help.
/Bo
  • k3conf dump clock

    I don't have that command. How can I add it to my Yocto tree?

    Best regards,

    /Bo

  • I don't have that command. How can I add it to my Yocto tree?

    Bo,

    You can fetch it from:
    https://git.ti.com/cgit/k3conf/k3conf/tree/

    I am also attaching the Cross-Compiled binary of k3conf below which you can use:
    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/7282.k3conf

    Regards,
    Siddharth.

  • Thanks Siddharth,

    The clock dump is attached.

    Best regards,

    /Bo

    clock_dump.txt

  • Thanks Siddharth,

    The clock dump is attached.

    Best regards,

    /Bo

    clock_dump.txt

  • Sorry, have you seen my latest posts? I didn't get email notifications about them.

    Best regards,

    /Bo

  • One last update before the weekend.

    I managed to get usb3.0 working in U-Boot as well as Linux. Apparently there is a missing pll-clock setting in the device tree that has been added for usb0 but not for usb1:

    File k3-j721e-asp3-u-boot.dtsi. The wiz2 settings and usbss1 and usb1 settings are added by me:

    &wiz3_pll1_refclk {
    	assigned-clocks = <&wiz3_pll1_refclk>, <&wiz3_pll0_refclk>;
    	assigned-clock-parents = <&k3_clks 295 0>, <&k3_clks 295 9>;
    };
    
    &main_usbss0_pins_default {
    	bootph-pre-ram;
    };
    
    &usbss0 {
    	bootph-pre-ram;
    };
    
    &usb0 {
    	dr_mode = "peripheral";
    	bootph-pre-ram;
    };
    
    &wiz2_pll1_refclk {
    	assigned-clocks = <&wiz2_pll1_refclk>, <&wiz2_pll0_refclk>;
    	assigned-clock-parents = <&k3_clks 294 0>, <&k3_clks 294 11>;
    };
    
    &main_usbss1_pins_default {
    	bootph-pre-ram;
    };
    
    &usbss1 {
    	bootph-pre-ram;
    };
    
    &usb1 {
    	dr_mode = "host";
    	bootph-pre-ram;
    };
    

    These settings seem to take precedence in Linux as well, because there are no more errors when I boot, and lsmod now works:

    root@asp3:~# dmesg | grep usb
    [    0.043157] usbcore: registered new interface driver usbfs
    [    0.043170] usbcore: registered new interface driver hub
    [    0.043181] usbcore: registered new device driver usb
    [    0.091284] usbcore: registered new interface driver usb-storage
    [    0.093236] usbcore: registered new interface driver usbhid
    [    0.093238] usbhid: USB HID core driver
    [    0.484801] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.01
    [    0.484806] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [    0.484809] usb usb1: Product: xHCI Host Controller
    [    0.484812] usb usb1: Manufacturer: Linux 6.1.33-g999 xhci-hcd
    [    0.484815] usb usb1: SerialNumber: xhci-hcd.0.auto
    [    0.485213] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
    [    0.485248] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 6.01
    [    0.485252] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [    0.485256] usb usb2: Product: xHCI Host Controller
    [    0.485259] usb usb2: Manufacturer: Linux 6.1.33-g999 xhci-hcd
    [    0.485261] usb usb2: SerialNumber: xhci-hcd.0.auto
    [    0.740211] usb 1-1: new high-speed USB device number 2 using xhci-hcd
    [    0.888514] usb 1-1: New USB device found, idVendor=0451, idProduct=8142, bcdDevice= 1.00
    [    0.888521] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=1
    [    0.888524] usb 1-1: SerialNumber: 3001008138CE
    [    1.016227] usb 2-1: new SuperSpeed USB device number 2 using xhci-hcd
    [    1.036439] usb 2-1: New USB device found, idVendor=0451, idProduct=8140, bcdDevice= 1.00
    [    1.036444] usb 2-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
    [    1.176209] usb 1-1.1: new high-speed USB device number 3 using xhci-hcd
    [    1.290497] usb 1-1.1: New USB device found, idVendor=13fe, idProduct=4123, bcdDevice= 1.00
    [    1.290504] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [    1.290507] usb 1-1.1: Product: USB DISK Pro
    [    1.290510] usb 1-1.1: Manufacturer:
    [    1.290512] usb 1-1.1: SerialNumber: 07103C7537156A52
    [    1.291186] usb-storage 1-1.1:1.0: USB Mass Storage device detected
    [    1.291375] scsi host0: usb-storage 1-1.1:1.0
    
    root@asp3:~# lsusb
    Bus 002 Device 002: ID 0451:8140 Texas Instruments, Inc. TUSB8041 4-Port Hub
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 003: ID 13fe:4123 Kingston Technology Company Inc. USB DISK Pro
    Bus 001 Device 002: ID 0451:8142 Texas Instruments, Inc. TUSB8041 4-Port Hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    

    Thanks for all help, it was the register investigations that led me to the clocks setup.

    Thank you, Diwakar and Siddharth!

    Best regards,

    /Bo

  • Hi Bo 

    Great to hear that :) 

    Regards
    Diwakar

  • Diwakar,

    There is still one thing that needs fixing. Apparently I need to run "start usb" in U-Boot, to make it scan and detect the usb-bus. If I don't, the error message will re-appear in Linux, and no working usb host.

    Do you know what needs to be done to make the Linux boot also trigger a "start usb"?

    Best regards,

    /Bo

  • Hi Bo 

    sorry for the wrong interpretation 

    corrct me if my understanding is right 

    USB work : Run usb start in uboot and then check in linux 

    USB does not work:  Do not run usb start in uboot and then check in linux 

    Regards
    Diwakar

  • Hi Diwakar,

    No, it is not detecting any device changes on the usb ports. I would expect it to show per default. Also, as I said, the serdes error is back in Linux (if I don't do usb start):

    [ 0.572899] cdns-sierra-phy 5020000.serdes: Timeout waiting for PHY status ready
    [ 0.580290] phy phy-5020000.serdes.9: phy poweron failed --> -110

    Best regards,

    /Bo

  • Hi Bo 

    One quick thing which we can do is dump those serdes register before running the USB start and after that to see what exactly is getting change.

    Regards
    Diwakar

  • Hi Diwakar,

    I tried to read the reset-register for serdes2:

    Without "usb start":

    => md 0x0502040c 1
    "Error" handler, esr 0xbf000000
    elr: 00000000808c98b0 lr : 00000000808c6080 (reloc)
    elr: 00000000fff8a8b0 lr : 00000000fff87080
    x0 : 00000000fde86119 x1 : 00000000fffaa557
    x2 : 00000000fde86030 x3 : 00000000ffffffd0
    x4 : 0000000000000000 x5 : 00000000fde86111
    x6 : 0000000000000063 x7 : 00000000fde86060
    x8 : 0000000000000010 x9 : 0000000000000008
    x10: 00000000ffffffd8 x11: 0000000000000010
    x12: 000000000001869f x13: 00000000fde86388
    x14: 00000000fde86490 x15: 0000000000000021
    x16: 00000000ffeda788 x17: 0000000000000000
    x18: 00000000fdea0d90 x19: 0000000000000004
    x20: 0000000000000004 x21: 0000000000000001
    x22: 0000000005020410 x23: 00000000fde86119
    x24: 0000000000000000 x25: 00000000fde860c8
    x26: 00000000fffaa557 x27: 0000000000000008
    x28: 0000000000000004 x29: 00000000fde85fe0

    Code: b9004fff a9430fe2 a9010fe2 a9440fe2 (a9020fe2)
    Resetting CPU ...

    resetting ...

    With "usb start":

    => md 0x0502040c 1
    0502040c: b2000000 ....

    Best regards,

    /Bo

  • Hi Bo 

    Seems you serdes is not up before usb start.

    Hoping now there is just device tree changes no changes in the driver?

    Regards

    Diwakar 

  • Hi Diwakar,

    Correct. There are no changes in the driver right now.

    Maybe I can force a probe from within the driver. I will try.

    Best regards,

    /Bo

  • I'm still having trouble getting USB3.0 to work in Linux. As of now, I have to perform "usb start" in U-Boot, to get it to work in Linux. If I don't do "usb start", serdes is not setup correctly, and lsusb gives an empty output:

    [ 0.574511] cdns-sierra-phy 5020000.serdes: Timeout waiting for PHY status ready
    [ 0.581907] phy phy-5020000.serdes.9: phy poweron failed --> -110

    root@asp3:~# lsusb
    root@asp3:~# lsusb -v
    root@asp3:~# usb-devices

    When reading the reset-register of serdes2, it seems the pll-clocks are not set correctly:

    root@asp3:~# devmem2 0x0502040c
    /dev/mem opened.
    Memory mapped at address 0xffff9b7a9000.
    Read at address 0x0502040C (0xffff9b7a940c): 0x92000000

    When USB3.0 is working, the value of the reset-register is 0xb1000000 or 0xb2000000

    Best regards,

    /Bo

  • Update.

    I had a conflicting node late in my dts:

    &wiz2_pll1_refclk {
        assigned-clocks = <&wiz2_pll1_refclk>;
        assigned-clock-parents = <&cmn_refclk1>;
    };
     
    Which reset the clock setting that I described above. After removing the conflicting node, USB3.0 is now working fine in both U-Boot and Linux.
     
    Thanks again for all help!
     
    /Bo