13 Jun, 2017

12 commits


02 Jun, 2017

15 commits

  • This commit allows a gadget that does not support SuperSpeed to indicate
    that it supports LPM. It does this by setting the 'lpm_capable' flag in
    the gadget structure.

    If a gadget sets this, the composite gadget framework will set the
    bcdUSB to 0x0201 to indicate that this supports BOS descriptors, and
    also return a USB 2.0 Extension descriptor as part of the BOS descriptor
    set.

    See USB 2.0 LPM ECN Section 3.

    Signed-off-by: John Youn
    Signed-off-by: Sevak Arakelyan
    Signed-off-by: Felipe Balbi

    John Youn
     
  • Don't send the SuperSpeed USB Device Capability descriptor if
    the gadget is not capable of SuperSpeed.

    Signed-off-by: John Youn
    Signed-off-by: Sevak Arakelyan
    Signed-off-by: Felipe Balbi

    John Youn
     
  • There were individual waitqueues for each epfile but eps_enable
    would iterate through all of them, resulting in essentially the
    same wakeup time.

    The waitqueue represents the function being enabled, so a central
    waitqueue in ffs_data makes more sense and is less redundant.

    Also use wake_up_interruptible to reflect use of
    wait_event_interruptible.

    Acked-by: Michal Nazarewicz
    Signed-off-by: Jerry Zhang
    Signed-off-by: Felipe Balbi

    Jerry Zhang
     
  • This allows users to make an ioctl call as the first action on a
    connection. Ex, some functions might want to get endpoint size
    before making any i/os.

    Previously, calling ioctls before read/write would depending on the
    timing of endpoints being enabled.

    ESHUTDOWN is now a possible return value and ENODEV is not, so change
    docs accordingly.

    Acked-by: Michal Nazarewicz
    Signed-off-by: Jerry Zhang
    Signed-off-by: Felipe Balbi

    Jerry Zhang
     
  • The assignment ret = ret is redundant and can be removed.

    Reviewed-by: Krzysztof Opasiak
    Reviewed-by: Peter Chen
    Signed-off-by: Stefan Agner
    Signed-off-by: Felipe Balbi

    Stefan Agner
     
  • This is where all other USB ReST documentation has moved to.

    Signed-off-by: Felipe Balbi

    Felipe Balbi
     
  • Document a few details about DWC3 in order to help people report bugs
    and debug DWC3.

    Signed-off-by: Felipe Balbi

    Felipe Balbi
     
  • Instead of *always* dumping raw ctrl bytes, let's decode standard
    requests which will make the lives of those debugging DWC3 quite a bit
    easier.

    Output will now look like so:

    irq/34-dwc3-1594 [000] d..1 107.573081: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
    irq/34-dwc3-1594 [000] d..1 107.573694: dwc3_ctrl_req: Set Address(Addr = 01)
    irq/34-dwc3-1594 [000] d..1 107.588319: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
    irq/34-dwc3-1594 [000] d..1 107.588816: dwc3_ctrl_req: Get Configuration Descriptor(Index = 0, Length = 9)
    irq/34-dwc3-1594 [000] d..1 107.589191: dwc3_ctrl_req: Set Configuration(Config = 3)
    irq/34-dwc3-1594 [000] d..1 107.589846: dwc3_ctrl_req: Get BOS Descriptor(Index = 0, Length = 5)
    irq/34-dwc3-1594 [000] d..1 107.590146: dwc3_ctrl_req: Get BOS Descriptor(Index = 0, Length = 22)
    irq/34-dwc3-1594 [000] d..1 107.590546: dwc3_ctrl_req: Get Configuration Descriptor(Index = 0, Length = 9)
    irq/34-dwc3-1594 [000] d..1 107.590840: dwc3_ctrl_req: Get Configuration Descriptor(Index = 0, Length = 69)
    irq/34-dwc3-1594 [000] d..1 107.591138: dwc3_ctrl_req: Get Configuration Descriptor(Index = 1, Length = 9)
    irq/34-dwc3-1594 [000] d..1 107.591541: dwc3_ctrl_req: Get Configuration Descriptor(Index = 1, Length = 32)
    irq/34-dwc3-1594 [000] d..1 107.591834: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
    irq/34-dwc3-1594 [000] d..1 114.701005: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
    irq/34-dwc3-1594 [000] d..1 114.721080: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
    irq/34-dwc3-1594 [000] d..1 114.722709: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
    irq/34-dwc3-1594 [000] d..1 114.728979: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
    irq/34-dwc3-1594 [000] d..1 114.730544: dwc3_ctrl_req: Get Device Qualifier Descriptor(Index = 0, Length = 10)
    irq/34-dwc3-1594 [000] d..1 115.776018: dwc3_ctrl_req: Get Configuration Descriptor(Index = 0, Length = 9)
    irq/34-dwc3-1594 [000] d..1 115.776760: dwc3_ctrl_req: Set Configuration(Config = 0)
    irq/34-dwc3-1594 [000] d..1 115.777676: dwc3_ctrl_req: Get Configuration(Length = 1)
    irq/34-dwc3-1594 [000] d..1 115.924797: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
    irq/34-dwc3-1594 [000] d..1 115.929025: dwc3_ctrl_req: Get String Descriptor(Index = 0, Length = 500)
    irq/34-dwc3-1594 [000] d..1 115.929566: dwc3_ctrl_req: Get String Descriptor(Index = 1, Length = 500)
    irq/34-dwc3-1594 [000] d..1 115.930911: dwc3_ctrl_req: Get String Descriptor(Index = 0, Length = 500)
    irq/34-dwc3-1594 [000] d..1 115.931528: dwc3_ctrl_req: Get String Descriptor(Index = 2, Length = 500)
    irq/34-dwc3-1594 [000] d..1 115.932950: dwc3_ctrl_req: Get String Descriptor(Index = 0, Length = 500)
    irq/34-dwc3-1594 [000] d..1 115.933533: dwc3_ctrl_req: Get String Descriptor(Index = 3, Length = 500)

    Note that Class and Vendor requests won't be decoded for obvious
    reasons. Those will be printed as a raw sequence of bytes.

    This patch has been tested against a normal host (both Linux and
    Windows) and USB30CV Chapter 9 tests.

    Signed-off-by: Felipe Balbi

    Felipe Balbi
     
  • Instead, we can require caller to pass a buffer for the function to
    use. This cleans things quite a bit.

    Signed-off-by: Felipe Balbi

    Felipe Balbi
     
  • Instead of going for a 512 byte buffer and using snprintf(), let's
    rely on helps __string() and __assign_str() where possible.

    Signed-off-by: Felipe Balbi

    Felipe Balbi
     
  • No functional changes, just a slight readability improvement.

    Signed-off-by: Felipe Balbi

    Felipe Balbi
     
  • Instead of printing out enqueue and dequeue pointer value as a header
    to the output, let's mark the TRBs in question with 'E' and 'D'. The
    output looks slightly easier to read.

    Signed-off-by: Felipe Balbi

    Felipe Balbi
     
  • No functional changes, just making sure we can use these for ReST docs
    later.

    Signed-off-by: Felipe Balbi

    Felipe Balbi
     
  • Currently, default vary will not accomodate superspeed endpoints
    causing unexpected babble errors in the IN direction. Let's update
    default 'vary' parameter so that we can maintain a "short-less"
    transfer as hinted at the comment.

    Reported-by: Ammy Yi
    Signed-off-by: Felipe Balbi

    Felipe Balbi
     
  • %p will leak kernel pointers, so let's not expose the information on
    dmesg and instead use %pK. %pK will only show the actual addresses if
    explicitly enabled under /proc/sys/kernel/kptr_restrict.

    Cc:
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Felipe Balbi

    Felipe Balbi
     

17 May, 2017

10 commits

  • "ep->udc->lock" and "udc->lock" are the same thing. It confuses Smatch
    if we don't use the same name consistently.

    Reviewed-by: Sören Brinkmann
    Signed-off-by: Dan Carpenter
    Signed-off-by: Felipe Balbi

    Dan Carpenter
     
  • This patch adds a quirk to disable USB 2.0 MAC linestate check
    during HS transmit. Refer the dwc3 databook, we can use it for
    some special platforms if the linestate not reflect the expected
    line state(J) during transmission.

    When use this quirk, the controller implements a fixed 40-bit
    TxEndDelay after the packet is given on UTMI and ignores the
    linestate during the transmit of a token (during token-to-token
    and token-to-data IPGAP).

    On some rockchip platforms (e.g. rk3399), it requires to disable
    the u2mac linestate check to decrease the SSPLIT token to SETUP
    token inter-packet delay from 566ns to 466ns, and fix the issue
    that FS/LS devices not recognized if inserted through USB 3.0 HUB.

    Acked-by: Rob Herring
    Reviewed-by: Guenter Roeck
    Signed-off-by: William Wu
    Signed-off-by: Felipe Balbi

    William Wu
     
  • Add null check before dereferencing dev->regs pointer inside
    net2280_led_shutdown() function.

    Addresses-Coverity-ID: 101783
    Acked-by: Alan Stern
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Felipe Balbi

    Gustavo A. R. Silva
     
  • Since usb phy core has added common code to register or unregister
    extcon device, then phy-msm-usb driver does not need its own
    code to register/unregister extcon device, then remove them.

    Signed-off-by: Baolin Wang
    Signed-off-by: Felipe Balbi

    Baolin Wang
     
  • Since usb phy core has added common code to register or unregister
    extcon device, then phy-qcom-8x16-usb driver does not need its own
    code to register/unregister extcon device, then remove them.

    Signed-off-by: Baolin Wang
    Signed-off-by: Felipe Balbi

    Baolin Wang
     
  • Usually usb phy need register one extcon device to get the connection
    notifications. It will remove some duplicate code if the extcon device
    is registered using common code instead of each phy driver having its
    own related extcon APIs. So we add one pointer of extcon device into
    usb phy structure, and some other helper functions to register extcon.

    Signed-off-by: Baolin Wang
    Signed-off-by: Felipe Balbi

    Baolin Wang
     
  • The USB gadget documentation is not at DocBook anymore.
    The main file was converted to ReST, and stored at
    Documentation/driver-api/usb/gadget.rst, but there are
    still several plain text files related to gadget under
    Documentation/usb.

    So, be generic and just mention documentation
    without specifying where it is.

    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Felipe Balbi

    Mauro Carvalho Chehab
     
  • Calculate wMaxPacketSize before endpoint matching the
    descriptor is found.

    This allows audio gadget to be used with controllers
    which have a shortage or unavailability of endpoints
    that can handle max packet size of 1023 (FS) or 1024
    (HS).

    With this audio gadget can be used on TI's OMAP-L138 SoC
    which has a MUSB HS controller with endpoints having max
    packet size much less than 1023 or 1024. See mode_2_cfg in
    drivers/usb/musb/musb_core.c

    Signed-off-by: Sekhar Nori
    Signed-off-by: Felipe Balbi

    Sekhar Nori
     
  • Some functions might want to have very, very long request queues. We
    can't make any assumptions about how many requests we *are* able to
    map, so instead of mapping requests early, let's map them late. This
    way, functions can queue as many requests as they'd like but we won't
    take DMA resources until they are needed.

    Also, we can now stop processing requests when we run out of DMA
    resources but still keep requests in the queue for late processing.

    Signed-off-by: Felipe Balbi

    Felipe Balbi
     
  • We don't need a big fat warning with stack dump at all. Running out of
    TRBs is a normal condition and we will have more TRBs available as
    soon as some transfers complete.

    Signed-off-by: Felipe Balbi

    Felipe Balbi
     

16 May, 2017

2 commits

  • This patch reworks the way f_mass_storage.c handles memory barriers
    and synchronization:

    The driver now uses a wait_queue instead of doing its own
    task-state manipulations (even though only one task will ever
    use the wait_queue).

    The thread_wakeup_needed variable is removed. It was only a
    source of trouble; although it was what the driver tested to
    see whether it should wake up, what we really wanted to see
    was whether a USB transfer had completed.

    All the explicit memory barriers scattered throughout the
    driver are replaced by a few calls to smp_load_acquire() and
    smp_store_release().

    The inreq_busy and outreq_busy fields are removed. In their
    place, the driver keeps track of the current I/O direction by
    splitting BUF_STATE_BUSY into two states: BUF_STATE_SENDING
    and BUF_STATE_RECEIVING.

    The buffer states are no longer protected by a lock. Mutual
    exclusion isn't needed; the state is changed only by the
    driver's main thread when it owns the buffer, and only by the
    request completion routine when the gadget core owns the buffer.

    The do_write() and throw_away_data() routines were reorganized
    to make efficient use of the new sleeping mechanism. This
    resulted in the removal of one indentation level in those
    routines, making the patch appear to be more more complicated
    than it really is.

    In a few places, the driver allowed itself to be frozen although
    it really shouldn't have (in the middle of executing a SCSI
    command). Those places have been fixed.

    The logic in the exception handler for aborting transfers and
    waiting for them to stop has been simplified.

    Tested-by: Thinh Nguyen
    Signed-off-by: Alan Stern
    Signed-off-by: Felipe Balbi

    Alan Stern
     
  • This patch makes several adjustments to the way f_mass_storage.c
    handles its internal state and asynchronous notifications (AKA
    exceptions):

    A number of states weren't being used for anything.
    They are removed.

    The FSG_STATE_IDLE state was renamed to FSG_STATE_NORMAL,
    because it now applies whenever the gadget is operating
    normally, not just when the gadget is idle.

    The FSG_STATE_RESET state was renamed to
    FSG_STATE_PROTOCOL_RESET, indicating that it represents a
    Bulk-Only Transport protocol reset and not a general USB
    reset.

    When a signal arrives, it's silly for the signal handler to
    send itself another signal! Now it takes care of everything
    inline.

    Along with an assortment of other minor changes in the same category.

    Tested-by: Thinh Nguyen
    Signed-off-by: Alan Stern
    Signed-off-by: Felipe Balbi

    Alan Stern
     

14 May, 2017

1 commit