1. 30 10月, 2020 2 次提交
    • P
      usb: cdns3: gadget: own the lock wrongly at the suspend routine · e11d2bf2
      Peter Chen 提交于
      When the system goes to suspend, if the controller is at device mode with
      cable connecting to host, the call stack is: cdns3_suspend->
      cdns3_gadget_suspend -> cdns3_disconnect_gadget, after cdns3_disconnect_gadget
      is called, it owns lock wrongly, it causes the system being deadlock after
      resume due to at cdns3_device_thread_irq_handler, it tries to get the lock,
      but can't get it forever.
      
      To fix it, we delete the unlock-lock operations at cdns3_disconnect_gadget,
      and do it at the caller.
      
      Fixes: b1234e3b ("usb: cdns3: add runtime PM support")
      Acked-by: NPawel Laszczak <pawell@cadence.com>
      Signed-off-by: NPeter Chen <peter.chen@nxp.com>
      e11d2bf2
    • P
      usb: cdns3: Fix on-chip memory overflow issue · 52d39677
      Pawel Laszczak 提交于
      Patch fixes issue caused setting On-chip memory overflow bit in usb_sts
      register. The issue occurred because EP_CFG register was set twice
      before USB_STS.CFGSTS was set. Every write operation on EP_CFG.BUFFERING
      causes that controller increases internal counter holding the number
      of reserved on-chip buffers. First time this register was updated in
      function cdns3_ep_config before delegating SET_CONFIGURATION request
      to class driver and again it was updated when class wanted to enable
      endpoint.  This patch fixes this issue by configuring endpoints
      enabled by class driver in cdns3_gadget_ep_enable and others just
      before status stage.
      
      Cc: stable@vger.kernel.org#v5.8+
      Fixes: 7733f6c3 ("usb: cdns3: Add Cadence USB3 DRD Driver")
      Reported-and-tested-by: NPeter Chen <peter.chen@nxp.com>
      Signed-off-by: NPawel Laszczak <pawell@cadence.com>
      Signed-off-by: NPeter Chen <peter.chen@nxp.com>
      52d39677
  2. 29 10月, 2020 1 次提交
    • P
      usb: cdns3: gadget: suspicious implicit sign extension · 5fca3f06
      Peter Chen 提交于
      The code:
      trb->length = cpu_to_le32(TRB_BURST_LEN(priv_ep->trb_burst_size)
      	       	| TRB_LEN(length));
      
      TRB_BURST_LEN(priv_ep->trb_burst_size) may be overflow for int 32 if
      priv_ep->trb_burst_size is equal or larger than 0x80;
      
      Below is the Coverity warning:
      sign_extension: Suspicious implicit sign extension: priv_ep->trb_burst_size
      with type u8 (8 bits, unsigned) is promoted in priv_ep->trb_burst_size << 24
      to type int (32 bits, signed), then sign-extended to type unsigned long
      (64 bits, unsigned). If priv_ep->trb_burst_size << 24 is greater than 0x7FFFFFFF,
      the upper bits of the result will all be 1.
      
      To fix it, it needs to add an explicit cast to unsigned int type for ((p) << 24).
      Reviewed-by: NJun Li <jun.li@nxp.com>
      Signed-off-by: NPeter Chen <peter.chen@nxp.com>
      5fca3f06
  3. 28 10月, 2020 1 次提交
  4. 02 10月, 2020 18 次提交
  5. 24 9月, 2020 1 次提交
    • P
      usb: cdns3: gadget: free interrupt after gadget has deleted · 98df91f8
      Peter Chen 提交于
      The interrupt may occur during the gadget deletion, it fixes the
      below oops.
      
      [ 2394.974604] configfs-gadget gadget: suspend
      [ 2395.042578] configfs-gadget 5b130000.usb: unregistering UDC driver [g1]
      [ 2395.382562] irq 229: nobody cared (try booting with the "irqpoll" option)
      [ 2395.389362] CPU: 0 PID: 301 Comm: kworker/u12:6 Not tainted 5.8.0-rc3-next-20200703-00060-g2f13b83cbf30-dirty #456
      [ 2395.399712] Hardware name: Freescale i.MX8QM MEK (DT)
      [ 2395.404782] Workqueue: 2-0051 tcpm_state_machine_work
      [ 2395.409832] Call trace:
      [ 2395.412289]  dump_backtrace+0x0/0x1d0
      [ 2395.415950]  show_stack+0x1c/0x28
      [ 2395.419271]  dump_stack+0xbc/0x118
      [ 2395.422678]  __report_bad_irq+0x50/0xe0
      [ 2395.426513]  note_interrupt+0x2cc/0x38c
      [ 2395.430355]  handle_irq_event_percpu+0x88/0x90
      [ 2395.434800]  handle_irq_event+0x4c/0xe8
      [ 2395.438640]  handle_fasteoi_irq+0xbc/0x168
      [ 2395.442740]  generic_handle_irq+0x34/0x48
      [ 2395.446752]  __handle_domain_irq+0x68/0xc0
      [ 2395.450846]  gic_handle_irq+0x64/0x150
      [ 2395.454596]  el1_irq+0xb8/0x180
      [ 2395.457733]  __do_softirq+0xac/0x3b8
      [ 2395.461310]  irq_exit+0xc0/0xe0
      [ 2395.464448]  __handle_domain_irq+0x6c/0xc0
      [ 2395.468540]  gic_handle_irq+0x64/0x150
      [ 2395.472295]  el1_irq+0xb8/0x180
      [ 2395.475436]  _raw_spin_unlock_irqrestore+0x14/0x48
      [ 2395.480232]  usb_gadget_disconnect+0x120/0x140
      [ 2395.484678]  usb_gadget_remove_driver+0xb4/0xd0
      [ 2395.489208]  usb_del_gadget+0x6c/0xc8
      [ 2395.492872]  cdns3_gadget_exit+0x5c/0x120
      [ 2395.496882]  cdns3_role_stop+0x60/0x90
      [ 2395.500634]  cdns3_role_set+0x64/0xd8
      [ 2395.504301]  usb_role_switch_set_role.part.0+0x3c/0x90
      [ 2395.509444]  usb_role_switch_set_role+0x20/0x30
      [ 2395.513978]  tcpm_mux_set+0x60/0xf8
      [ 2395.517470]  tcpm_reset_port+0xa4/0xf0
      [ 2395.521222]  tcpm_detach.part.0+0x44/0x50
      [ 2395.525227]  tcpm_state_machine_work+0x8b0/0x2360
      [ 2395.529932]  process_one_work+0x1c8/0x470
      [ 2395.533939]  worker_thread+0x50/0x420
      [ 2395.537603]  kthread+0x148/0x168
      [ 2395.540830]  ret_from_fork+0x10/0x18
      [ 2395.544399] handlers:
      [ 2395.546671] [<000000008dea28da>] cdns3_wakeup_irq
      [ 2395.551375] [<000000009fee5c61>] cdns3_drd_irq threaded [<000000005148eaec>] cdns3_drd_thread_irq
      [ 2395.560255] Disabling IRQ #229
      [ 2395.563454] configfs-gadget gadget: unbind function 'Mass Storage Function'/000000000132f835
      [ 2395.563657] configfs-gadget gadget: unbind
      [ 2395.563917] udc 5b130000.usb: releasing '5b130000.usb'
      
      Fixes: 7733f6c3 ("usb: cdns3: Add Cadence USB3 DRD Driver")
      Cc: <stable@vger.kernel.org>
      Acked-by: NRoger Quadros <rogerq@ti.com>
      Signed-off-by: NPeter Chen <peter.chen@nxp.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      98df91f8
  6. 29 7月, 2020 1 次提交
  7. 24 7月, 2020 12 次提交
  8. 21 7月, 2020 1 次提交
  9. 10 7月, 2020 1 次提交
  10. 09 7月, 2020 2 次提交