1. 23 3月, 2017 1 次提交
  2. 20 1月, 2017 2 次提交
  3. 16 11月, 2016 1 次提交
    • P
      usb: chipidea: move the lock initialization to core file · a5d906bb
      Peter Chen 提交于
      This can fix below dump when the lock is accessed at host
      mode due to it is not initialized.
      
      [   46.119638] INFO: trying to register non-static key.
      [   46.124643] the code is fine but needs lockdep annotation.
      [   46.130144] turning off the locking correctness validator.
      [   46.135659] CPU: 0 PID: 690 Comm: cat Not tainted 4.9.0-rc3-00079-g4b75f1d #1210
      [   46.143075] Hardware name: Freescale i.MX6 SoloX (Device Tree)
      [   46.148923] Backtrace:
      [   46.151448] [<c010c460>] (dump_backtrace) from [<c010c658>] (show_stack+0x18/0x1c)
      [   46.159038]  r7:edf52000
      [   46.161412]  r6:60000193
      [   46.163967]  r5:00000000
      [   46.165035]  r4:c0e25c2c
      
      [   46.169109] [<c010c640>] (show_stack) from [<c03f58a4>] (dump_stack+0xb4/0xe8)
      [   46.176362] [<c03f57f0>] (dump_stack) from [<c016d690>] (register_lock_class+0x4fc/0x56c)
      [   46.184554]  r10:c0e25d24
      [   46.187014]  r9:edf53e70
      [   46.189569]  r8:c1642444
      [   46.190637]  r7:ee9da024
      [   46.193191]  r6:00000000
      [   46.194258]  r5:00000000
      [   46.196812]  r4:00000000
      [   46.199185]  r3:00000001
      
      [   46.203259] [<c016d194>] (register_lock_class) from [<c0171294>] (__lock_acquire+0x80/0x10f0)
      [   46.211797]  r10:c0e25d24
      [   46.214257]  r9:edf53e70
      [   46.216813]  r8:ee9da024
      [   46.217880]  r7:c1642444
      [   46.220435]  r6:edcd1800
      [   46.221502]  r5:60000193
      [   46.224057]  r4:00000000
      
      [   46.227953] [<c0171214>] (__lock_acquire) from [<c01726c0>] (lock_acquire+0x74/0x94)
      [   46.235710]  r10:00000001
      [   46.238169]  r9:edf53e70
      [   46.240723]  r8:edf53f80
      [   46.241790]  r7:00000001
      [   46.244344]  r6:00000001
      [   46.245412]  r5:60000193
      [   46.247966]  r4:00000000
      
      [   46.251866] [<c017264c>] (lock_acquire) from [<c096c8fc>] (_raw_spin_lock_irqsave+0x40/0x54)
      [   46.260319]  r7:ee1c6a00
      [   46.262691]  r6:c062a570
      [   46.265247]  r5:20000113
      [   46.266314]  r4:ee9da014
      
      [   46.270393] [<c096c8bc>] (_raw_spin_lock_irqsave) from [<c062a570>] (ci_port_test_show+0x2c/0x70)
      [   46.279280]  r6:eebd2000
      [   46.281652]  r5:ee9da010
      [   46.284207]  r4:ee9da014
      
      [   46.286810] [<c062a544>] (ci_port_test_show) from [<c0248d04>] (seq_read+0x1ac/0x4f8)
      [   46.294655]  r9:edf53e70
      [   46.297028]  r8:edf53f80
      [   46.299583]  r7:ee1c6a00
      [   46.300650]  r6:00000001
      [   46.303205]  r5:00000000
      [   46.304273]  r4:eebd2000
      [   46.306850] [<c0248b58>] (seq_read) from [<c039e864>] (full_proxy_read+0x54/0x6c)
      [   46.314348]  r10:00000000
      [   46.316808]  r9:c0a6ad30
      [   46.319363]  r8:edf53f80
      [   46.320430]  r7:00020000
      [   46.322986]  r6:b6de3000
      [   46.324053]  r5:ee1c6a00
      [   46.326607]  r4:c0248b58
      
      [   46.330505] [<c039e810>] (full_proxy_read) from [<c021ec98>] (__vfs_read+0x34/0x118)
      [   46.338262]  r9:edf52000
      [   46.340635]  r8:c0107fc4
      [   46.343190]  r7:00020000
      [   46.344257]  r6:edf53f80
      [   46.346812]  r5:c039e810
      [   46.347879]  r4:ee1c6a00
      [   46.350447] [<c021ec64>] (__vfs_read) from [<c021fbd0>] (vfs_read+0x8c/0x11c)
      [   46.357597]  r9:edf52000
      [   46.359969]  r8:c0107fc4
      [   46.362524]  r7:edf53f80
      [   46.363592]  r6:b6de3000
      [   46.366147]  r5:ee1c6a00
      [   46.367214]  r4:00020000
      [   46.369782] [<c021fb44>] (vfs_read) from [<c0220a4c>] (SyS_read+0x4c/0xa8)
      [   46.376672]  r8:c0107fc4
      [   46.379045]  r7:00020000
      [   46.381600]  r6:b6de3000
      [   46.382667]  r5:ee1c6a00
      [   46.385222]  r4:ee1c6a00
      
      [   46.387817] [<c0220a00>] (SyS_read) from [<c0107e20>] (ret_fast_syscall+0x0/0x1c)
      [   46.395314]  r7:00000003
      [   46.397687]  r6:b6de3000
      [   46.400243]  r5:00020000
      [   46.401310]  r4:00020000
      
      Cc: <stable@vger.kernel.org>
      Fixes: 26c696c6 ("USB: Chipidea: rename struct
      	       	ci13xxx variables from udc to ci")
      Signed-off-by: NPeter Chen <peter.chen@nxp.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a5d906bb
  4. 14 11月, 2016 1 次提交
  5. 03 11月, 2016 2 次提交
  6. 14 9月, 2016 6 次提交
  7. 09 9月, 2016 1 次提交
    • C
      usb: chipidea: udc: fix NULL ptr dereference in isr_setup_status_phase · 6f3c4fb6
      Clemens Gruber 提交于
      Problems with the signal integrity of the high speed USB data lines or
      noise on reference ground lines can cause the i.MX6 USB controller to
      violate USB specs and exhibit unexpected behavior.
      
      It was observed that USBi_UI interrupts were triggered first and when
      isr_setup_status_phase was called, ci->status was NULL, which lead to a
      NULL pointer dereference kernel panic.
      
      This patch fixes the kernel panic, emits a warning once and returns
      -EPIPE to halt the device and let the host get stalled.
      It also adds a comment to point people, who are experiencing this issue,
      to their USB hardware design.
      
      Cc: <stable@vger.kernel.org> #4.1+
      Signed-off-by: NClemens Gruber <clemens.gruber@pqgruber.com>
      Signed-off-by: NPeter Chen <peter.chen@nxp.com>
      6f3c4fb6
  8. 19 8月, 2016 1 次提交
  9. 04 3月, 2016 1 次提交
  10. 29 2月, 2016 1 次提交
  11. 24 12月, 2015 3 次提交
  12. 02 12月, 2015 1 次提交
  13. 18 11月, 2015 1 次提交
  14. 15 9月, 2015 1 次提交
    • P
      usb: chipidea: udc: using the correct stall implementation · 56ffa1d1
      Peter Chen 提交于
      According to spec, there are functional and protocol stalls.
      
      For functional stall, it is for bulk and interrupt endpoints,
      below are cases for it:
      - Host sends SET_FEATURE request for Set-Halt, the udc driver
      needs to set stall, and return true unconditionally.
      - The gadget driver may call usb_ep_set_halt to stall certain
      endpoints, if there is a transfer in pending, the udc driver
      should not set stall, and return -EAGAIN accordingly.
      These two kinds of stall need to be cleared by host using CLEAR_FEATURE
      request (Clear-Halt).
      
      For protocol stall, it is for control endpoint, this stall will
      be set if the control request has failed. This stall will be
      cleared by next setup request (hardware will do it).
      
      It fixed usbtest (drivers/usb/misc/usbtest.c) Test 13 "set/clear halt"
      test failure, meanwhile, this change has been verified by
      USB2 CV Compliance Test and MSC Tests.
      
      Cc: <stable@vger.kernel.org> #3.10+
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Felipe Balbi <balbi@ti.com>
      Signed-off-by: NPeter Chen <peter.chen@freescale.com>
      56ffa1d1
  15. 14 8月, 2015 2 次提交
  16. 05 8月, 2015 1 次提交
  17. 03 8月, 2015 1 次提交
  18. 29 7月, 2015 1 次提交
  19. 08 4月, 2015 1 次提交
    • L
      usb: chipidea: udc: bypass pullup DP when gadget connect in OTG fsm mode · 9b6567e1
      Li Jun 提交于
      By pass pullup DP in OTG fsm mode when do gadget connect, to let it handled
      by OTG state machine.
      
      This patch can fix the problem you found with my HNP polling patchset after
      below 3 patches introduced:
      467a78c8 usb: chipidea: udc: apply new usb_udc_vbus_handler interface
      628ef0d2 usb: udc: add usb_udc_vbus_handler
      dfea9c94 usb: udc: store usb_udc pointer in struct usb_gadget
      
      Problem:
      - Connect USB cable and MicroAB cable between two boards
      - Boot up two boards
      - load g_mass_storage at B-device side, the enumeration will success,
      and A will see a usb mass-storage device
      - load g_mass_storage at A-device side, the problem has occurred, the
      connection will be lost at the beginning, then connect again.
      
      This patch is based on
      commit eff933c1d3a2e046492b3dfc86db813856553a29
      (chipidea: pci: make it depends on NOP_USB_XCEIV)
      on branch peter-usb-dev of
      git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.gitSigned-off-by: NLi Jun <jun.li@freescale.com>
      Signed-off-by: NPeter Chen <peter.chen@freescale.com>
      9b6567e1
  20. 20 3月, 2015 1 次提交
  21. 18 3月, 2015 2 次提交
    • S
      usb: chipidea: Add errata for revision 2.40a · 06bdfcdb
      Sanchayan Maity 提交于
      At chipidea revision 2.40a, there is a below errata:
      
      9000531823  B2-Medium  Adding a dTD to a Primed Endpoint May Not Get Recognized
      
      Title: Adding a dTD to a Primed Endpoint May Not Get Recognized
      
      Impacted Configuration: All device mode configurations.
      
      Description:
      There is an issue with the add dTD tripwire semaphore (ATDTW bit in USBCMD register)
      that can cause the controller to ignore a dTD that is added to a primed endpoint.
      When this happens, the software can read the tripwire bit and the status bit at '1'
      even though the endpoint is unprimed.
      
      After executing a dTD, the device controller endpoint state machine executes a final
      read of the dTD terminate bit to check if the application added a dTD to the linked
      list at the last moment. This read is done in the finpkt_read_latest_next_td (44) state.
      After the read is performed, if the terminate bit is still set, the state machine moves
      to unprime the endpoint. The decision to unprime the endpoint is done in the
      checkqh_decision (59) state, based on the value of the terminate bit.
      Before reaching the checkqh_decision state, the state machine traverses the
      writeqhtd_status (57), writeqh_status (56), and release_prime_mask (42) states.
      As shown in the waveform, the ep_addtd_tripwire_clr signal is not set to clear
      the tripwire bit in these states.
      
      Workaround:
      The software must implement a periodic poll cycle, and check for each dTD
      pending on execution (Active = 1), if the enpoint is primed. It can do this by reading
      the corresponding bits in the ENDPTPRIME and ENDPTSTAT registers. If these bits are
      read at 0, the software needs to re-prime the endpoint by writing 1 to the corresponding
      bit in the ENDPTPRIME register. This can be done for every microframe, every frame or
      with a larger interval, depending on the urgency of transfer execution for the application.
      Tested-by: NStefan Agner <stefan@agner.ch>
      Signed-off-by: NPeter Chen <peter.chen@freescale.com>
      Signed-off-by: NSanchayan Maity <maitysanchayan@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      06bdfcdb
    • P
      usb: chipidea: udc: return immediately if re-enable non-empty endpoint · d5d1e1be
      Peter Chen 提交于
      Some gadget driver (like uac1) will try to enable endpoint again even
      the ep is not empty, it will cause the ep reset again and may affect
      the dTD list which has already queued.
      
      It returns -EBUSY immediately, and indicate the endpoint is in use.
      In this way, the ep's behavior will not be affected, and the gadget
      driver is also notified.
      
      Cc: Xuebing Wang <xbing6@gmail.com>
      Signed-off-by: NPeter Chen <peter.chen@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d5d1e1be
  22. 15 3月, 2015 1 次提交
    • L
      usb: chipidea: otg: add a_alt_hnp_support response for B device · d20f7807
      Li Jun 提交于
      This patch adds response to a_alt_hnp_support set feature request from legacy
      A device, that is, B-device can provide a message to the user indicating that
      the user needs to connect the B-device to an alternate port on the A-device.
      A device sets this feature indicates to the B-device that it is connected
      to an A-device port that is not capable of HNP, but that the A-device does have
      an alternate port that is capable of HNP.
      
      [Peter]
      Without this patch, the OTG B device can't be enumerated on
      non-HNP port at A device, see below log:
      [    2.287464] usb 1-1: Dual-Role OTG device on non-HNP port
      [    2.293105] usb 1-1: can't set HNP mode: -32
      [    2.417422] usb 1-1: new high-speed USB device number 4 using ci_hdrc
      [    2.460635] usb 1-1: Dual-Role OTG device on non-HNP port
      [    2.466424] usb 1-1: can't set HNP mode: -32
      [    2.587464] usb 1-1: new high-speed USB device number 5 using ci_hdrc
      [    2.630649] usb 1-1: Dual-Role OTG device on non-HNP port
      [    2.636436] usb 1-1: can't set HNP mode: -32
      [    2.641003] usb usb1-port1: unable to enumerate USB device
      
      Cc: stable <stable@vger.kernel.org>
      Acked-by: NPeter Chen <peter.chen@freescale.com>
      Signed-off-by: NLi Jun <b47624@freescale.com>
      Signed-off-by: NPeter Chen <peter.chen@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d20f7807
  23. 30 1月, 2015 1 次提交
  24. 27 11月, 2014 1 次提交
  25. 11 11月, 2014 1 次提交
  26. 04 11月, 2014 2 次提交
  27. 25 9月, 2014 1 次提交
  28. 18 7月, 2014 1 次提交
    • A
      usb: chipidea: udc: Disable auto ZLP generation on ep0 · 953c6646
      Abbas Raza 提交于
      There are 2 methods for ZLP (zero-length packet) generation:
      1) In software
      2) Automatic generation by device controller
      
      1) is implemented in UDC driver and it attaches ZLP to IN packet if
         descriptor->size < wLength
      2) can be enabled/disabled by setting ZLT bit in the QH
      
      When gadget ffs is connected to ubuntu host, the host sends
      get descriptor request and wLength in setup packet is 255 while the
      size of descriptor which will be sent by gadget in IN packet is
      64 byte. So the composite driver sets req->zero = 1.
      In UDC driver following code will be executed then
      
              if (hwreq->req.zero && hwreq->req.length
                  && (hwreq->req.length % hwep->ep.maxpacket == 0))
                      add_td_to_list(hwep, hwreq, 0);
      
      Case-A:
      So in case of ubuntu host, UDC driver will attach a ZLP to the IN packet.
      ubuntu host will request 255 byte in IN request, gadget will send 64 byte
      with ZLP and host will come to know that there is no more data.
      But hold on, by default ZLT=0 for endpoint 0 so hardware also tries to
      automatically generate the ZLP which blocks enumeration for ~6 seconds due
      to endpoint 0 STALL, NAKs are sent to host for any requests (OUT/PING)
      
      Case-B:
      In case when gadget ffs is connected to Apple device, Apple device sends
      setup packet with wLength=64. So descriptor->size = 64 and wLength=64
      therefore req->zero = 0 and UDC driver will not attach any ZLP to the
      IN packet. Apple device requests 64 bytes, gets 64 bytes and doesn't
      further request for IN data. But ZLT=0 by default for endpoint 0 so
      hardware tries to automatically generate the ZLP which blocks enumeration
      for ~6 seconds due to endpoint 0 STALL, NAKs are sent to host for any
      requests (OUT/PING)
      
      According to USB2.0 specs:
      
          8.5.3.2 Variable-length Data Stage
          A control pipe may have a variable-length data phase in which the
          host requests more data than is contained in the specified data
          structure. When all of the data structure is returned to the host,
          the function should indicate that the Data stage is ended by
          returning a packet that is shorter than the MaxPacketSize for the
          pipe. If the data structure is an exact multiple of wMaxPacketSize
          for the pipe, the function will return a zero-length packet to indicate
          the end of the Data stage.
      
      In Case-A mentioned above:
      If we disable software ZLP generation & ZLT=0 for endpoint 0 OR if software
      ZLP generation is not disabled but we set ZLT=1 for endpoint 0 then
      enumeration doesn't block for 6 seconds.
      
      In Case-B mentioned above:
      If we disable software ZLP generation & ZLT=0 for endpoint then enumeration
      still blocks due to ZLP automatically generated by hardware and host not needing
      it. But if we keep software ZLP generation enabled but we set ZLT=1 for
      endpoint 0 then enumeration doesn't block for 6 seconds.
      
      So the proper solution for this issue seems to disable automatic ZLP generation
      by hardware (i.e by setting ZLT=1 for endpoint 0) and let software (UDC driver)
      handle the ZLP generation based on req->zero field.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NAbbas Raza <Abbas_Raza@mentor.com>
      Signed-off-by: NPeter Chen <peter.chen@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      953c6646