18 May, 2020

1 commit

  • Android implement the userspace fastboot in Android Recovery.
    Follow Google's spec, added below 2 fastboot command support:
    * fastboot getvar is-userspace
    * fastboot reboot fastboot

    TEST: fastboot commands.

    Change-Id: Ib6047413be0a45b3c00626cdb8594809eb8a2b6b
    Signed-off-by: Haoran.Wang
    (cherry picked from commit 314bded076dfc3e544cc7094ce3f6c4c330be4dd)

    Haoran.Wang
     

07 May, 2020

1 commit

  • Using this way to check if OTG bus active, not depending on checking
    OTG register. Because checking OTG register only working for first
    cold boot from ROM. While doing partition reboot, SCFW will turn off
    the entire conn SS, so that way won't work.

    Signed-off-by: Ye Li
    Reviewed-by: Peng Fan

    Ye Li
     

27 Apr, 2020

31 commits

  • to enable it, in uuu script add below command
    fb: ucmd setenv stdout serial,fastboot
    uuu add -v opition.
    output will show in uuu console

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

    Frank Li
     
  • On 2019.04 SPL, we enabled DM gadget driver for QM/QXP to support
    dual USB ports. The CI_UDC DM gadget driver will call init function
    inside EHCI mx6 driver, so when building SPL on iMX8QM/QXP with CI UDC
    enabled, we have to enable usb host driver as well, and this introduces
    about more than 40KB size to SPL.

    Move the common codes to a independent file, so that both host driver
    and gadget driver can call it, then decouple the host and gadget driver.

    Note: the patch only applies to ci_udc gadget DM driver. For non-DM gadget
    driver, it still depends ehci host interfaces.

    Signed-off-by: Ye Li
    Acked-by: Peng Fan
    (cherry picked from commit 1afed171a77b4c95cd4ea76f29d5a0a6bb199820)

    Ye Li
     
  • Since the USB HID limits the maximum bandwidth(3072) for interrupt
    endpoint transfers, when the bInterval set to 1, we can only support 3
    boards to run sdp at the same time. In order to support more boards,
    change the bInterval of interrupt endpoint to 3, which will not affect
    the transmission speed.

    Signed-off-by: Sherry Sun
    Reviewed-by: Ye Li

    Sherry Sun
     
  • EP0 has been used to transfer file data in sdp before, but the max
    packetsize of ep0 is 64 bytes. So in order to improve the file transfer
    speed, here add the EP1_OUT interrupt endpoint which max packetsize is
    set to 1024 byte.

    After testing, it turns out that using ep1out is twice as fast as using
    ep0 while receiving data in sdp.

    Signed-off-by: Sherry Sun
    Reviewed-by: Ye Li
    (cherry picked from commit 22614e317b7fdf4a716f2e5bde876649414ffd6c)

    Sherry Sun
     
  • Enable the configs of usb2 so that both usb2 and usb3 gadget
    drivers are now supported on imx8 plaform. And add
    CONFIG_USB_PORT_AUTO to support usb port autodetect function
    for SDP/fastboot.

    Signed-off-by: Sherry Sun
    (cherry picked from commit 1aa6e3f84c65e99de1219aa5d58d454cef1129f9)

    Sherry Sun
     
  • For one usb controller driver, the transport endpoint address won't
    change after the driver initialize. So the value of bEndpointAddress
    have no need to be cleared.

    But when more than one usb controller drivers are used at the same time,
    different endpoints address is used by different controller driver
    usually, it will cause confusion of endpoint address. So the value of
    bEndpointAddress had better been cleared everytime before we refill
    endpoint address to it.

    Signed-off-by: Sherry Sun
    (cherry picked from commit 9f9102968a777cfdcf0609a5435b35406f57124c)

    Sherry Sun
     
  • On imx8 platform, the usb2 and usb3 ports are both supported. Which
    means we can use usb2(ci_udc_otg) and usb3(cdns3_generic_peripheral)
    gadget driver to run sdp/fastboot/ums at the same time.

    For sdp and the fastboot that runs automatically when uboot starts,
    board_usb_gadget_port_auto() is added to autodetect usb port, this
    means that we don't have to specify which USB port should be used to
    download in code, now we can just connect either usb port then it
    will download automatically.

    Signed-off-by: Sherry Sun
    (cherry picked from commit 2b6fd3da6fffae0732e8e91ef5c1f870ea393ca9)

    Sherry Sun
     
  • Since the orginal way to call interrupts handle function of DM usb
    gadget driver is through dm_usb_gadget_handle_interrupts(), when we want
    to use two or more different gadget drivers at the same time, it will
    cause error of duplicate names.

    So here add a handle_interrupts function pointer instead of driectly
    call dm_usb_gadget_handle_interrupts(), then the error can be avoided.

    Signed-off-by: Sherry Sun
    (cherry picked from commit 2458ddd952a6a2d2304dfe7ea34e4192cd1d5ed4)

    Sherry Sun
     
  • Since the ci_udc driver has been converted to DM driver, the
    CONFIG_DM_USB_GADGET should also be selected when CONFIG_CI_UDC
    is enabled, then we can use DM ci_udc driver.

    Signed-off-by: Sherry Sun
    Reviewed-by: Ye Li
    (cherry picked from commit d456376b59459403c4570d66297cc34f7264bd6d)

    Sherry Sun
     
  • Convert the ci_udc driver to driver model by using the uclass
    UCLASS_USB_GADGET_GENERIC. The clk and power of USB controller and USB
    PHY both are initialized by parsing the device tree nodes.

    If CONFIG_DM_USB_GADGET is defined, we use the ci_udc driver in DM way,
    if it does not defined, we can use ci_udc driver in its original Non-DM
    way.

    Move some USB PHY register definitions from ehci-mx6.c to
    asm/mach-imx/regs-usbphy.h in order to share with DM usb gadget driver.

    Signed-off-by: Sherry Sun
    Reviewed-by: Ye Li
    (cherry picked from commit 5c50d6bd6fda34827a27387e42c9a803da40b1e5)

    Sherry Sun
     
  • 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
     
  • 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
     
  • 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
     
  • Porting the FSL android fastboot features from imx u-boot v2018.03 to
    support all SoCs: imx6/imx7/imx7ulp/imx8/imx8m.

    The UUU commands like UCmd and ACmd are also added. Users need set
    CONFIG_FASTBOOT_UUU_SUPPORT=y to enable the feature.

    Signed-off-by: Frank Li
    Signed-off-by: Ye Li
    (cherry picked from commit 65120b06a7f750b9b1a6e0db3d2082cc7088d5a8)
    (cherry picked from commit 9b149c2a28829fe7017f83981d634157bc31cc94)

    Ye Li
     
  • Add support to f_sdp to search and load iMX8 container image or iMX8M
    FIT image by new UUU command SDPV.

    When using the SDPV, the uuu will continue to send out data after first
    level boot loader used by ROM. This means uuu won't skip to the offset
    of the second boot loader, and the padding data before second boot loader
    will be sent out. So we have to search the FIT header or container header
    in the buffer that SDP received.

    Also change to more common method to exit f_sdp handler not depending on
    SPL_FIT_FOUND flag because container loader won't set this.

    The new BCD value is used by uuu to distinguish if the SPL supports the
    SDPV.

    Signed-off-by: Ye Li
    (cherry picked from commit cddb0fde374769dccff44275a5072c5e28e41446)
    (cherry picked from commit 519354f9c47f88ba325c08ea861d2a139a6be8aa)

    Ye Li
     
  • Because the buffer length of sdp usb request is 65, we have to allocate
    65 bytes not 64 bytes. Otherwise there is potential buffer overflow.

    Signed-off-by: Ye Li
    (cherry picked from commit 6ca3fc0bbdbcc6d870ceffa9d38c47d2e4edfee4)
    (cherry picked from commit 4313297467dd130222d50d923fd47a727ba50331)

    Ye Li
     
  • Add HS endpoint descriptor for SDP. So that we can use high speed endpoint,
    and the SDP device can send packet with 512 byte size.

    Signed-off-by: Ye Li
    (cherry picked from commit 825c6f13b7e77b5c025293365f25c44d6fddc009)
    (cherry picked from commit 8d82383da4f99d42f5f60cbc53a2e4378350708d)

    Ye Li
     
  • if SDP_WRITE and SDP_JUMP addr is zero, use CONFIG_SDP_LOADADDR
    as default address

    Signed-off-by: Frank Li
    (cherry picked from commit 192a26dbcd88da7d1773bb6336d855c408239d4a)
    (cherry picked from commit 7d24d618fc00cdd1f6e0f214a5b80d00cb6f9f18)
    (cherry picked from commit 84331220490af1040772653423aa9b291ef81fb4)

    Frank Li
     
  • When unregister gadget driver in ci_udc, the usb device is not
    removed or stop. This causes next "usb start" fails to work.

    Add a new interface "usb_remove_ehci_gadget" in usb-uclass to
    remove the usb device for DM driver. Using "usb_lowlevel_stop" for
    non-DM driver.

    Signed-off-by: Ye Li
    (cherry picked from commit c73d137e0a4a613a49f6f63ec63332508afb88c0)
    (cherry picked from commit c2f83b46c21e738fa8176a8f83661bf3603067f8)
    (cherry picked from commit 3f8718e927c2edf05065e31edf2bb896dcea2de2)

    Ye Li
     

23 Apr, 2020

3 commits

  • This driver is ported from NXP i.MX U-Boot version imx_v2019.04
    and some changes have also been made to adapt to U-Boot.

    Add the Cadence USB3 IP(CDNS3) driver for the gadget (device mode).
    The CDNS3 gadget driver support DM mode. CONFIG_DM_USB_GADGET should
    be enabled when use this driver.

    Signed-off-by: Sherry Sun
    Signed-off-by: Ye Li

    Sherry Sun
     
  • Since some new fields in usb_ep structure been moved to usb_ss_ep.
    The CDNS3 gadget driver should replies on this operation to bind the
    usb_ss_ep with the endpoint descriptor when function layer uses
    usb_ep_autoconfig to add endpoint descriptors to gadget. So that
    CDNS3 driver can know the EP information and configure the EP once
    the set configuration request is received.

    Signed-off-by: Sherry Sun
    Signed-off-by: Ye Li

    Ye Li
     
  • The usb mass storage (f_mass_storage.c) uses fixed usb index 0,
    this causes problem while CDNS3 USB controller index is 1.
    Modify the API of fsg to pass the controller index.

    Signed-off-by: Ye Li
    Reviewed-by: Jun Li
    (cherry picked from commit c633b49f9140390323e5e6e16ba57b8531d964a3)

    Ye Li
     

02 Mar, 2020

2 commits


19 Feb, 2020

2 commits