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.

66AK2G12: U-Boot USB Problem

Part Number: 66AK2G12

Hello,

I am working with a U-Boot 2019.01 port in an Arago distribution based off of Processor SDK 6.0.3.

I am unable to get the USB drivers working in U-Boot.  When I call "usb start" in U-Boot I get the following error:


=> usb start
starting USB...
USB0:   uclass_find_device_by_seq: 0 -1
uclass_find_device_by_seq: 0 0
   - -1 -1 'keystone-dwc3@2680000'
   - not found
uclass_find_device_by_seq: 0 0
   - 0 -1 'usb@2690000'
   - not found
ofnode_read_bool: snps,has-lpm-erratum: false
ofnode_read_bool: snps,is-utmi-l1-suspend: false
ofnode_read_bool: snps,disable_scramble_quirk: false
ofnode_read_bool: snps,u2exit_lfps_quirk: false
ofnode_read_bool: snps,u2ss_inp3_quirk: false
ofnode_read_bool: snps,req_p1p2p3_quirk: false
ofnode_read_bool: snps,del_p1p2p3_quirk: false
ofnode_read_bool: snps,del_phy_power_chg_quirk: false
ofnode_read_bool: snps,lfps_filter_quirk: false
ofnode_read_bool: snps,rx_detect_poll_quirk: false
ofnode_read_bool: snps,dis_u3_susphy_quirk: false
ofnode_read_bool: snps,dis_u2_susphy_quirk: false
ofnode_read_bool: snps,tx_de_emphasis_quirk: false
this is not a DesignWare USB3 DRD Core
failed to initialize core
Port not available.



We are trying to use USB0 as a host port to mount a flash drive as storage.  The port also does not appear to function in Linux, however an older firmware (based upon Processor SDK 5.1) has a functioning USB port in both U-Boot and Linux.  There appears to be a significant change in how the USB subsystem works, especially with respect to the driver model, between U-Boot 2018.01 and U-Boot 2019.01.  Because of this we have been unable to simply compare the working image and the image under development.  I will be looking into the Linux side of this tomorrow.  This post is about the U-Boot side of things.

The device tree I am using is based upon the K2G EVM dts, using keystone-k2g.dtsi as the main "include".  For our device tree, I copied the relevant USB nodes from keystone-k2g-evm.dts.  They are shown below:

&keystone_usb0 {
  status = "okay";
};

&usb0_phy {
  status = "okay";
  compatible = "nop-phy";
};

&usb0 {
  dr_mode = "host";
  status = "okay";
};



The relevant portions of the dtsi file are:


usb0_phy: usb-phy@0 {
    compatible = "usb-nop-xceiv";
    status = "disabled";
};

keystone_usb0: keystone-dwc3@2680000 {
    compatible = "ti,keystone-dwc3";
    #address-cells = <1>;
    #size-cells = <1>;
    reg = <0x2680000 0x10000>;
    interrupts = <GIC_SPI 128 IRQ_TYPE_EDGE_RISING>;
    ranges;
    dma-coherent;
    dma-ranges;
    status = "disabled";
    /*power-domains = <&k2g_pds 0x0016>;*/

    usb0: usb@2690000 {
        compatible = "snps,dwc3";
        reg = <0x2690000 0x10000>;
        interrupts = <GIC_SPI 128 IRQ_TYPE_EDGE_RISING>;
        maximum-speed = "high-speed";
        dr_mode = "otg";
        /*usb-phy = <&usb0_phy>;*/
        status = "disabled";
    };
};



--------------- code ---------------

And finally, the defconfig we are using in our U-Boot port:


CONFIG_ARM=y
CONFIG_ARCH_KEYSTONE=y
CONFIG_SYS_TEXT_BASE=0xC000000
CONFIG_TI_COMMON_CMD_OPTIONS=y
CONFIG_SPL_LIBCOMMON_SUPPORT=y
CONFIG_SPL_LIBGENERIC_SUPPORT=y
CONFIG_TARGET_K2G_<TARGET>=y
CONFIG_SPL_SERIAL_SUPPORT=y
CONFIG_SPL=y
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI_SUPPORT=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_NR_DRAM_BANKS=2
CONFIG_OF_BOARD_SETUP=y
# CONFIG_USE_BOOTCOMMAND is not set
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_VERSION_VARIABLE=y
CONFIG_BOARD_EARLY_INIT_F=y
CONFIG_SPL_I2C_SUPPORT=y
CONFIG_SPL_POWER_SUPPORT=y
CONFIG_SPL_SPI_LOAD=y
# CONFIG_CMD_FLASH is not set
# CONFIG_CMD_GPIO is not set
# CONFIG_CMD_GPT is not set
CONFIG_CMD_REMOTEPROC=y
# CONFIG_CMD_SETEXPR is not set
CONFIG_MTDIDS_DEFAULT="nand0=davinci_nand.0"
CONFIG_MTDPARTS_DEFAULT="mtdparts=davinci_nand.0:1024k(bootloader)ro,512k(params)ro,-(ubifs)"
CONFIG_CMD_UBI=y
CONFIG_OF_CONTROL=y
CONFIG_DEFAULT_DEVICE_TREE="keystone-k2g-<product>"
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_DM=y
CONFIG_DM_DEBUG=y
CONFIG_DFU_MMC=y
CONFIG_SYS_I2C_DAVINCI=y
CONFIG_MISC=y
CONFIG_DM_MMC=y
CONFIG_MMC_OMAP_HS=y
CONFIG_NAND=y
CONFIG_NAND_DAVINCI=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_SPANSION=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_PHYLIB=y
CONFIG_PHY_MARVELL=y
CONFIG_PHY_MICREL=y
CONFIG_PHY_TI=y
CONFIG_DM_ETH=y
CONFIG_RGMII=y
CONFIG_DRIVER_TI_KEYSTONE_NET=y
CONFIG_PHY=y
CONFIG_NOP_PHY=y
CONFIG_KEYSTONE_USB_PHY=y
CONFIG_REMOTEPROC_TI_POWER=y
CONFIG_DM_SERIAL=y
CONFIG_SYS_NS16550=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_DAVINCI_SPI=y
CONFIG_USB=y
CONFIG_DM_USB=y
CONFIG_DM_USB_GADGET=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GENERIC=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_USB_FUNCTION_SDP=y



Thanks in advance for any insights into the problems I'm seeing.

Jeff

  • Hi Jeff,

    I just got your query routed to me but it is already late today. I will be taking time off tomorrow and next Monday, but I will look more into it next week.

    It is good to know that it was no issue with SDK 5.1 U-Boot and Linux, so this should be just a software issue.

    I don't have an K2g EVM to test it myself, but I will review the USB configuration difference btw SDK v5.1 and v6.0 UBoot to see how to properly configure USB0 to host mode.

  • Bin Liu,

    I hope you enjoyed your time off.  I would like to follow up with you on this question.  Have you had a chance to look into this?

    Since I posted last, I have been able to get the USB Storage class working in Linux.  We didn't have all of the correct modules built into our Yocto distribution.  After adding them, the system behaves exactly like the old system (SDK 5.1) when in Linux

    I have made no progress on determining why the USB subsystem does not work in U-Boot.

  • Hi Jeff,

    I am unable to observe anything obviously wrong in your defconfig. Is it generated from configs/k2g_evm_defconfig?

    I see your console log has "this is not a DesignWare USB3 DRD Core" message. I think it is printed from dwc3_core_init() in drivers/usb/host/xhci-dwc3.c. Can you please add a debug to print the value of revision from the register read before printing the error message?

  • Our defconfig was derived from configs/k2g_evm_defconfig with a few modifications to suit our needs.

    I seem to have fixed the issue, but I'm positive I know what the fix did.  I'll try to explain.

    There are two occurrances of the printed log message in the U-Boot Source tree.  One which you listed above, and another in another dwc3-related file.  In both cases the code seems to be reading a register.  I did not think to print the read value, but I suspected that perhaps the LPSC region was not enabled for the USB peripheral.  If the clocks aren't running, the correct value wouldn't be read.

    This got me looking at the drivers that turn on the LPSC for USB.  I found the keystone-usb-phy.c driver (comaptible string "ti,keystone-usbphy") and changed my device tree to use that driver instead of "nop-phy".  I believe this was the change that made this work.  This driver is used in keystone-k2g-evm-u-boot.dtsi, though I see no mention of this dtsi in any of the evm dts files, so I did not think to look there.

    With this working, we're now well on our way to having a system that can boot from a USB drive (the end goal of this project).  I will be making another forum post with questions about the Linux side of the issue shortly.  In short, it seems that becuase the Linux drivers for USB are licensed/proprietary/closed-source, they cannot be built into the kernel.  This means that the USB drivers need to be added to the initrd, but that's not what this post is about.

    Since others on the forum might find it useful, I thought I would share the U-Boot commands we added to our configuration that allows us to boot from a USB drive that is formatted in the same manner as the EVM SD Card:

    usb_start=usb start
    args_usb=setenv bootargs console=${console} ${optargs} root=/dev/sda2 rw rootfstype=ext4 rootwait
    get_mon_usb=ext4load usb 0:2 ${addr_mon} ${bootdir}/${name_mon}
    init_usb=run args_all args_usb; run usb_start
    get_pmmc_usb=ext4load usb 0:2 ${loadaddr} ${bootdir}/${name_pmmc}
    get_kern_usb=ext4load usb 0:2 ${loadaddr} ${bootdir}/${name_kern}
    init_fw_rd_usb=ext4load usb 0:2 ${rdaddr} ${bootdir}/${name_fw_rd}; run set_rd_spec
    get_fdt_usb=ext4load usb 0:2 ${fdtaddr} ${bootdir}/${name_fdt} 

  • Hi Jeff,

    I am glad the issue is solved. Thanks for the detailed update.

    Yes, I was thinking the same thing about clocking, because the only reason that register read won't match would be the USB module was not clocked.

    I don't have access to a K2G EVM to test this out, but I wonder why the EVM uses "nop-phy"...

  • Not a clue why nop-phy is used.  There are a number of things in the K2G configuration/setup code that are a little confusing.

    Thank you for your time on this issue.

    In case you are able to help, my other post is here: (3) 66AK2G12: Booting Linux from a USB Mass Storage Device - Processors forum - Processors - TI E2E support forums

  • Jeff,

    Thanks for the heads-up on the new thread. I will take a look after lunch.