06 May, 2020

40 commits

  • Modify defconfig files to enable fastboot in mx6qpsabre SDB/ARD boards

    Signed-off-by: Joakim Zhang
    Signed-off-by: Ye Li
    (cherry picked from commit 2de4c0110145b07009bb19ca5dfd809bb554369b)

    Ye Li
     
  • Enable fastboot configurations in mx6solo sabresd and sabreauto
    defconfigs to support UUU. Since the DDR size on mx6solo sabre
    boards is smaller, also change the fastboot buffer to 256MB.

    Signed-off-by: Ye Li
    Reviewed-by: Peng Fan
    (cherry picked from commit 8435fc2e868e7cdd82a36081a97ab73a894b4531)

    Ye Li
     
  • Enable the SPL SDP driver and FASTBOOT driver in iMX8QXP MEK board
    defconfigs to support running UUU

    Signed-off-by: Ye Li
    (cherry picked from commit c0e91ab4f97448a1e529a07513079f859e57df5e)

    Ye Li
     
  • Enable the SPL SDP driver and FASTBOOT driver in MEK board defconfigs

    Signed-off-by: Ye Li
    (cherry picked from commit 29b514bd91919cbfbe638f1474d370c2aae42896)

    Ye Li
     
  • Currenlty U1 and U2 low power modes are allowed in device mode.
    Allowing U1 and U2 low power modes during data transfers in
    device mode is causing U1 exit failure on some USB3 host: which
    will transite to SS.inactive instead of U0, then host will send
    warm reset and ultimately result in reenumeration. This is observed
    on UUU tool with some PC host. Hence disable U1 and U2 low power
    modes for now.

    USB3 spec 7.5.10.4.2 Exit from Recovery.Configuration
    The port shall transition to eSS.Inactive when the following
    conditions are met:
    1. Either the Ux_EXIT_TIMER or the 6-ms timer
    (tRecoveryConfigurationTimeout) times out.
    2. For a downstream port, the transition to Recovery is not to
    attempt a Hot Reset.

    Signed-off-by: Li Jun
    (cherry picked from commit ae0cdc741f7313398539f7b576ced73871f6cd71)
    (cherry picked from commit ac852ce99326e75806e007587fb695c48107d602)

    Li Jun
     
  • As endpoint.maxpackt is set at init for super speed, we can't use it
    for USB2 connection, we need use the right max packet length according
    to connection speed.

    Signed-off-by: Li Jun
    (cherry picked from commit 9c6bb3684649b4ae6f0275b5ad3799ea5c8f32df)
    (cherry picked from commit be0f3cddac9fc393c1868b9b28e9291cf4746638)

    Li Jun
     
  • As we need standard usb_ep's desc, so set it when enable ep.

    Reviewed-by: Peter Chen
    Signed-off-by: Li Jun
    (cherry picked from commit 7d7097a07f8b770840f2e1e240b8cd004a9478b0)
    (cherry picked from commit 42729e2debb41b1e5a0edc71bc04babb10746f7d)

    Li Jun
     
  • Change to use wMaxPacketSize of current speed EP desc for request
    length wrap up.

    Reviewed-by: Peter Chen
    Signed-off-by: Li Jun
    (cherry picked from commit 0d7928ce976d7bcca8e5e27dc1f1645d41460838)
    (cherry picked from commit fb75480f0e1b015f865a303b889a8066338f6483)

    Li Jun
     
  • Remove the gadget driver speed check, and set its max_speed to
    be USB_SPEED_HIGH.

    Reviewed-by: Ye Li
    Reviewed-by: Peter Chen
    Tested-by: faqiang.zhu
    Signed-off-by: Li Jun
    (cherry picked from commit d2eda0a1834e3f4747642a57b36dd76e80e0a101)
    (cherry picked from commit e6d08aa94646a50b03c2b2993b70485d553a2d11)

    Li Jun
     
  • If one of functions is not super speed capable, we need force the udc
    to be high speed, this is an equivalent implementation of
    usb_gadget_udc_set_speed() in kernel but simple, which set the gadget
    max_speed to be high speed, so afterwards when start gadget duc can
    set the HW to be USB 2.0 mode.

    Reviewed-by: Ye Li
    Reviewed-by: Peter Chen
    Tested-by: faqiang.zhu
    Signed-off-by: Li Jun
    (cherry picked from commit 86247b0c88380cc5982b57f094f9b74fec01de31)
    (cherry picked from commit 3583e50d412357be216906824d4c6886395f2258)

    Li Jun
     
  • Change the dwc3 device mode to be super speed capable.

    Reviewed-by: Ye Li
    Reviewed-by: Peter Chen
    Tested-by: faqiang.zhu
    Signed-off-by: Li Jun
    (cherry picked from commit a9dac41fea56c0f41c5d15acd53a232bb1785841)
    (cherry picked from commit 5b506ed4ca952429e819d2765ade20c0178e5a1b)

    Li Jun
     
  • Set its max_speed to be super speed.

    Reviewed-by: Ye Li
    Reviewed-by: Peter Chen
    Tested-by: faqiang.zhu
    Signed-off-by: Li Jun
    (cherry picked from commit dfe8582b06721c9dca8103baec83e6aca4b27b44)
    (cherry picked from commit 9ad7c85b3bb28d99398243f0dcf1d8513df4384c)

    Li Jun
     
  • Add super speed EP config.

    Reviewed-by: Ye Li
    Reviewed-by: Peter Chen
    Tested-by: faqiang.zhu
    Signed-off-by: Li Jun
    (cherry picked from commit a7b7085dec66602bf8905ba3f4ca9235de400366)
    (cherry picked from commit fb0fd21cd06fd54bb86e217fb4e8bfed39941468)

    Li Jun
     
  • This patch is to add usb gadget super speed support in common
    driver, including BOS descriptor and select the super speed
    descriptor from function driver.

    Reviewed-by: Ye Li
    Reviewed-by: Peter Chen
    Tested-by: faqiang.zhu
    Signed-off-by: Li Jun
    (cherry picked from commit b0bc5f6d1292158a068446771c10a4e7285f9623)
    (cherry picked from commit 363267844637123d4fcfb924d624882b02059082)

    Li Jun
     
  • Always use the new added config for os_desc_config to fix cdev->
    os_desc_config may miss set in case we restart usb gadget driver.

    Signed-off-by: Li Jun
    (cherry picked from commit e8efb32e9b7a4fe45c7f21e86052c7f5bcdb6695)
    (cherry picked from commit 8481dd21ded1782a5efcf0efab86aa99313f74c2)
    (cherry picked from commit e77bc59cf1a0ca536beb9279e816ac960bfe00c2)

    Jun Li
     
  • The current way to set cdev->os_desc_config is wrong if user restart
    fastboot, as the old config is not used anymore and new allocated
    usb_configuration will be used, so set the os_desc_config while
    usb_add_config.

    Reviewed-by: Ye Li
    Signed-off-by: Li Jun
    Signed-off-by: Peter Chen
    (cherry picked from commit d401df4812e6c4b368b1c4aa02b584563822b59e)
    (cherry picked from commit c7cd977fcde8b165891bee80acaeb2bace5a2c5b)
    (cherry picked from commit 7decc7985d22bd8400d20e80a16e5e5a93f22798)

    Jun Li
     
  • Add device interface GUID for Microsoft Extended Properties Feature
    Descriptor.

    Signed-off-by: Li Jun
    (cherry picked from commit afee07bcc82b4f1900731a5a68ad920dc89fe88c)
    (cherry picked from commit a505d1ed5f58123f9aec131a0920d1e2672fbd11)
    (cherry picked from commit 36977b1b8e918bc14b465c9164ae0fa72e7fc7da)

    Li Jun
     
  • Enable WCID(Microsoft Compatible ID Feature Descriptor) for mfgtool.

    Signed-off-by: Li Jun
    (cherry picked from commit 7a98d176be377e5df4f7199445977318aa868272)
    (cherry picked from commit 02ce3d544361ddf56f4d790ea56b3bc1b86f8833)
    (cherry picked from commit 244066e0016ba3b8646bcd4356a2c044775adec9)

    Li Jun
     
  • This is a proting patch from linux kernel: 37a3a533429e
    ("usb: gadget: OS Feature Descriptors support"), the original commit
    log see below:

    There is a custom (non-USB IF) extension to the USB standard:

    http://msdn.microsoft.com/library/windows/hardware/gg463182

    They grant permission to use the specification - there is
    "Microsoft OS Descriptor Specification License Agreement"
    under the link mentioned above, and its Section 2 "Grant
    of License", letter (b) reads:

    "Patent license. Microsoft hereby grants to You a nonexclusive,
    royalty-free, nontransferable, worldwide license under Microsoft’s
    patents embodied solely within the Specification and that are owned
    or licensable by Microsoft to make, use, import, offer to sell,
    sell and distribute directly or indirectly to Your Licensees Your
    Implementation. You may sublicense this patent license to Your
    Licensees under the same terms and conditions."

    The said extension is maintained by Microsoft for Microsoft.

    Yet it is fairly common for various devices to use it, and a
    popular proprietary operating system expects devices to provide
    "OS descriptors", so Linux-based USB gadgets whishing to be able
    to talk to a variety of operating systems should be able to provide
    the "OS descriptors".

    This patch adds optional support for gadgets whishing to expose
    the so called "OS Feature Descriptors", that is "Extended Compatibility ID"
    and "Extended Properties".

    Hosts which do request "OS descriptors" from gadgets do so during
    the enumeration phase and before the configuration is set with
    SET_CONFIGURATION. What is more, those hosts never ask for configurations
    at indices other than 0. Therefore, gadgets whishing to provide
    "OS descriptors" must designate one configuration to be used with
    this kind of hosts - this is what os_desc_config is added for in
    struct usb_composite_dev. There is an additional advantage to it:
    if a gadget provides "OS descriptors" and designates one configuration
    to be used with such non-USB-compliant hosts it can invoke
    "usb_add_config" in any order because the designated configuration
    will be reported to be at index 0 anyway.

    This patch also adds handling vendor-specific requests addressed
    at device or interface and related to handling "OS descriptors"."

    Signed-off-by: Li Jun
    (cherry picked from commit 859be2fc12dbd1b99e140641f2d7fa14df29c9dd)
    (cherry picked from commit b524637d502ca75e6eb385b59df708f858a6da2a)
    (cherry picked from commit 56ac0900c5182055a771fd2777f0bbb2295f49a8)

    Li Jun
     
  • As other users may use utf8_to_utf16le() to convert the utf8
    to utf16 for usb, so move it to head file.

    Signed-off-by: Li Jun
    (cherry picked from commit 94870cb6b587243e0a68ee9a3ec43540d76152cc)
    (cherry picked from commit 80150d76172e4443179ddfe8f91c39126493cffa)
    (cherry picked from commit 2d84420646336bc8e9ffea23122ef6c28d3a4f89)

    Li Jun
     
  • This is a porting patch from linux kernel: 19824d5eeece
    ("usb: gadget: OS String support"), original commit log
    see below:

    "There is a custom (non-USB IF) extension to the USB standard:

    http://msdn.microsoft.com/library/windows/hardware/gg463182

    They grant permission to use the specification - there is
    "Microsoft OS Descriptor Specification License Agreement"
    under the link mentioned above, and its Section 2 "Grant
    of License", letter (b) reads:

    "Patent license. Microsoft hereby grants to You a nonexclusive,
    royalty-free, nontransferable, worldwide license under Microsoft’s
    patents embodied solely within the Specification and that are owned
    or licensable by Microsoft to make, use, import, offer to sell,
    sell and distribute directly or indirectly to Your Licensees Your
    Implementation. You may sublicense this patent license to Your
    Licensees under the same terms and conditions."

    The said extension is maintained by Microsoft for Microsoft.

    Yet it is fairly common for various devices to use it, and a
    popular proprietary operating system expects devices to provide
    "OS descriptors", so Linux-based USB gadgets whishing to be able
    to talk to a variety of operating systems should be able to provide
    the "OS descriptors".

    This patch adds optional support for gadgets whishing to expose
    the so called "OS String" under index 0xEE of language 0.
    The contents of the string is generated based on the qw_sign
    array and b_vendor_code.

    Interested gadgets need to set the cdev->use_os_string flag,
    fill cdev->qw_sign with appropriate values and fill cdev->b_vendor_code
    with a value of their choice.

    This patch does not however implement responding to any vendor-specific
    USB requests."

    Signed-off-by: Li Jun
    (cherry picked from commit b6ea0aaee307be0defaf8dc2c1eae9110bdae9a7)
    (cherry picked from commit ccc7596829c33eb1b616e3f5ba434edff444f805)
    (cherry picked from commit 98d8afdca42c1f0e7a875b628e0fb398af2cdea7)

    Li Jun
     
  • The SPL loads the FIT image FDT part to an address related with the device
    block length. This length is 512 for SD/MMC and is 1 for other devices
    like SDP, NOR, NAND, SPI, etc.
    When signing FIT image, we use fixed address caculated by SD/MMC block length
    to sign FDT part. Thus, when booting through uuu, this causes mismatch and
    gets authentication failed.

    Fix the issue by providing a override function for this FIT buffer address.
    When secure boot is enabled, adjust the addresses of other devices to be same
    with SD/MMC.

    Signed-off-by: Ye Li
    Reviewed-by: Peng Fan
    (cherry picked from commit 710efd3ccb99e144bd30af8e1ee46459b4a54dd6)
    (cherry picked from commit f48835f0b6b801cb267b4c27a50136c93dfd3bcf)

    Ye Li
     
  • Stop the usb device controller before enter kernel, this is required
    to make kernel can properly init usb controller with it's in stopped
    state.

    Suggested-by: Ye.Li
    Reviewed-by: Ye Li
    Signed-off-by: Li Jun
    (cherry picked from commit 27d6b4cf3d8d6701aeb800b307ef52afd18540ba)
    (cherry picked from commit dfcd809622bd994937724dc8c3252c16a2131056)

    Li Jun
     
  • uuu will use fastboot command to write emmc, enable it as
    default for iMX8MM EVK board

    Signed-off-by: Frank Li
    Signed-off-by: Ye Li
    (cherry picked from commit ed6898da1c1a78dbf59ac4d6d291bc25e14c636e)

    Ye Li
     
  • As there is problem with super speed with SDP, we force the dwc3
    usb speed to be high speed.

    Signed-off-by: Li Jun
    (cherry picked from commit eeb6a8d545e4810df6e3ce2125fa69a1781ea605)
    (cherry picked from commit 6f2cb1d190acebd5e55260c1eaeb3b7666c1f70c)

    Li Jun
     
  • As the SDP protocol use the predefined ep num for communication, we can't
    change its name hence reset its ep num while do ep autoconfig, this is
    only apply for SPL.

    Signed-off-by: Li Jun
    (cherry picked from commit bc76fe6dad1e8d6e5a98eea635a57b0feb4fefcf)
    (cherry picked from commit 4931d49ae958ca8c3d28a9c206228d7458afd4bd)

    Li Jun
     
  • uuu can download whole uboot and run it
    fastboot also enabled.

    Signed-off-by: Frank Li
    (cherry picked from commit 21ce8ab67d0a8eae3df91b074ffad9fb4b987961)
    Signed-off-by: Ye Li
    (cherry picked from commit 95a805fe1fb46b0a49e89bfb99ebe0dd70705927)

    Frank Li
     
  • Enable DWC3 USB support at i.MX850D platform

    Signed-off-by: Li Jun
    Signed-off-by: Frank Li
    (cherry picked from commit 7c3d2a17bf85e97a486d01e231480baaa7e7a167)
    (cherry picked from commit 1dd830df85ef684d8b6acd4655204ce7bd6be997)

    Frank Li
     
  • When booting from USB device, change u-boot autoboot to default
    run UUU bootcmd or enter fastboot directly for android.

    Signed-off-by: Ye Li
    (cherry picked from commit eba8710106348a283940b851080b049bc7fbe466)

    Ye Li
     
  • Add the uuu environment to each board, when booting from USB, the
    u-boot will use them by default

    Signed-off-by: Ye Li
    (cherry picked from commit e36e653ca2f5b0e879d84925219455790acaf2d2)

    Ye Li
     
  • For flash devices, like spi nor, weim nor and qspi/flexspi,
    we don't define the ENV in MMC, but UUU fastboot always use the
    mmc_get_env_dev. So we have to decouple the function with
    CONFIG_ENV_IS_IN_MMC

    Signed-off-by: Ye Li
    (cherry picked from commit ef480647da5686403c7fed09aaf47ca1ace54731)

    Ye Li
     
  • Base on MLK-18406: uuu write to any positionn of mmc
    Support i.MX6 boards.

    Signed-off-by: Xiaoning Wang
    (cherry picked from commit 808ccb44593b58552d3356d52f9ae23b7b77fd0a)
    (cherry picked from commit ae4b9669cc6e2054fbf32e2e38aec3e43488cbb1)

    Xiaoning Wang
     
  • uuu can write to any position of mmc
    sdps: boot -f ../mkimage_imx8dv/imx-mkimage/iMX8QX/flash.bin

    FB: ucmd setenv fastboot_dev mmc
    FB: ucmd setenv mmcdev ${emmc_dev}
    FB: ucmd mmc dev ${emmc_dev}
    FB: flash -raw2sparse all xx.sdcard

    Signed-off-by: Frank Li
    (cherry picked from commit ca96e0bd1aea1996904b0a71fb1d74c3f5176929)
    (cherry picked from commit 482d31e412f5b373d143dbdf363667b066762711)

    Frank Li
     
  • uuu can change emmc device number for fastboot

    Signed-off-by: Frank Li
    (cherry picked from commit 4da1ab91f864b804ad561e04f44b618ec86b99b7)
    (cherry picked from commit 922533b57d134d68817dbadc62314e3345438606)

    Frank Li
     
  • Fix coverity issue CID 18031: Resource leak (RESOURCE_LEAK)
    leaked_storage: Variable fill_buf going out of scope leaks the storage it points to

    Should free the fill_buf before function return.

    Signed-off-by: Ye Li
    (cherry picked from commit bc23ae569c7aaea338648c000b7b733b09eb735a)
    (cherry picked from commit 0a496da0851e981b0ab19338145fcb622762af94)

    Ye Li
     
  • chunk_data_sz = sparse_header->blk_sz * chunk_header->chunk_sz;
    All is uint32. chunk_data_sz may be bigger than 4G.

    Change chunk_data_sz to 64bit.
    force chunk_header->chunk_sz and sparse_header->blk_sz to 64bit.

    Signed-off-by: Frank Li
    Acked-by: Ye Li
    (cherry picked from commit 08090670625c4ccf86dbc9157dad4799f3669fb7)
    (cherry picked from commit af09befee9c55525a6bc9844904048c324db7261)

    Frank Li
     
  • The get_boot_device will return USB type from ROM info if booting from
    serial download, so change the is_boot_from_usb to use this function.

    Signed-off-by: Ye Li
    (cherry picked from commit 306fca12fb21829be552a6262e310a90664a8cc2)

    Ye Li
     
  • Because the ROM info on iMX7D does not set device type to USB when booting
    from serial download mode, we have to use the mechanism on mx6 to implement
    the is_boot_from_usb. The original implementation is checking USB controller
    register, it can't work correctly after any USB functionality is run in u-boot.

    Signed-off-by: Ye Li
    (cherry picked from commit 4934c765c6f1c9c997a28aa79f08c14fc4e91202)

    Ye Li
     
  • The mmc_get_boot_dev reads from SRC SBMR register. When booting with USB
    serial download, this function does not return correctly. Because SBMR won't
    reflect the USB boot.

    The patch adds USB boot checking to this function to fix the issue.

    Signed-off-by: Ye Li
    (cherry picked from commit f49acb763ec7165d634a119626620c596d74e419)

    Ye Li
     
  • We introduce a new arch-specific flag GD_FLG_ARCH_IMX_USB_BOOT to indicate if it is
    USB boot. We check the USB PHY PWD bit at early of boot stage then set that flag
    in global variable. So any following calling of is_boot_from_usb will return
    correct value.

    Signed-off-by: Ye Li
    (cherry picked from commit 50b30746a9aac8785bfe6ea8077c8572b02065c2)

    Ye Li