19 May, 2020

1 commit

  • To avoid calling devfdt_get_addr_index in bind, which introduces
    much overhead, checks the req_seq and only call the devfdt_get_addr_index
    when the req_seq (usb alias) is not set in DTS

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

    Ye Li
     

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

37 commits

  • This reverts commit bbe3d4a6c14e17d251029e4dde07f184244e9a4a.
    If we set to periperal at exiting, will get a windows USB warning since
    it detect a new connection on device mode. Remove this patch to fix
    the problem

    Signed-off-by: Ye Li

    Ye Li
     
  • On CDNS3 usb, the IOC interrupt for IN is triggered when data
    move from memory to FIFO, but not for the transfer completion.

    When running fastboot command "continue" to disconnect USB device.
    The last message "OKAY" sent from device setups a callback to IOC
    interrupt handler and disconnect with host in this callback.
    However, the real transfer hasn't finished due to host doesn't send
    IN at that time, it causes the error at host side.

    This patch will reset all enabled endpoints in pull up before disable
    the device mode. The reset checks the EP_STS.BUFFEREMPTY bit to ensure
    data has sent to host.

    Signed-off-by: Ye Li
    Signed-off-by: Peter Chen
    Reviewed-by: Peter Chen
    (cherry picked from commit 9be87bc89c1e75755b524703dc536c93bd3fbe5c)

    Ye Li
     
  • fix usb_power_config hard code to first one

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

    Frank Li
     
  • when boot from A72, use fastboot to download images, the first usb
    request buf to save image data may have problem with the cache, which
    cause the last 64bytes of this packet to be wrong.

    flush this cache before data movement to avoid this issue.

    Change-Id: Ic0927f1ec90ec9fb4cecdf4055bc7f536ef5471a
    Signed-off-by: faqiang.zhu
    (cherry picked from commit 45119132756b951c6f52e27625c06f94e4f0db59)

    faqiang.zhu
     
  • Update PHY settings to select 24M ref clock and enable clock in
    HSIOMIX GPR.

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

    Ye Li
     
  • 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
     
  • - Advantage of park mode
    When only a single Async endpoint is active.

    - Behavior of park mode
    1. The controller prefetches data/TRBs to do 3 * burst_size worth
    of packets.
    2. When park mode is disabled there will be some delay between
    bursts on the USB. This can be avoided if park mode is enabled
    in cases of only one endpoint is active.
    3. But this delay is significant only with systems of large
    latencies.
    4. We have noticed that in cases where a device NAKs often, it
    tends to bring down the performance for a single endpoint case.

    - Issue on "park mode"
    1. LSP (List Processor) goes in and out of park mode irrespective
    of the fact that there are more endpoints active. #LSP consider
    that there is only one endpoint active.
    2. This causes master scheduler and transaction handlers to think
    that they are in park mode even though they are not. This is
    because request to transaction handlers, generated by HSCH is
    in park mode when the request is made
    3. This causes a case where the master scheduler calculates wrongly
    the number of TRB cache space available.
    4. Because of the wrongly calculated number of TRB spaces, the core
    fetches more TRBS than there is space for.
    5. This causes overwriting the TRB cache area into the TRQ cache
    area which is next to the TRB cache area.
    6. This causes invalidating an entry in the TRQ
    7. This causes transaction handlers to ignore a request in the TRQ
    which it should have processed.
    8. This causes the main scheduler to hang because it is waiting for
    status from transaction handler.
    9. This causes host controller to hang.

    - Work Around
    Disabling park mode for super speed by setting GUCTL1[17] to be 1.

    The STAR number is 9001415732, which is target to be released around
    May,2020.

    Reviewed-by: Peter Chen
    Signed-off-by: Li Jun
    (cherry picked from commit 191211adfc8a797875079c228a10269c5b0d7e13)

    Li Jun
     
  • When use ep1out interrupt endpoint to receive data in sdp, the max
    packetsize of ep1out is set to 1024. But in cdns3 gadget driver, the
    max packetsize is limited to 512 bytes in high speed. So we can't
    implement data download through ep1out of cdns3 driver, here need
    change the max packesize of interrupt endpoints to 1024.

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

    Sherry Sun
     
  • 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
     
  • 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
     
  • 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 the fuse checking in drivers, when the module is disabled in fuse,
    the driver will not work.

    Changed drivers: BEE, GPMI, APBH-DMA, ESDHC, FEC, QSPI, ECSPI, I2C,
    USB-EHCI, GIS, LCDIF and EPDC.

    Signed-off-by: Ye Li
    (cherry picked from commit 1704e116f9b39aeb99201919a18bc2b1e19a980e)
    (cherry picked from commit 2d3b5df8530cd5ef883750378838dea7c40259af)
    (cherry picked from commit 6e8c9ae136bee8ec0121c1db4b935510caad09db)
    (cherry picked from commit 99b54a6965904a879afdb6883a519de726cb4e96)

    Ye Li