1. 02 Oct, 2020 16 commits
  2. 24 Sep, 2020 14 commits
    • Cristian Birsan's avatar
      ARM: dts: at91: sam9x60ek: enable usb device · 84b522e6
      Cristian Birsan authored
      Enable usb device for sam9x60ek board.
      Signed-off-by: default avatarCristian Birsan <cristian.birsan@microchip.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      84b522e6
    • Cristian Birsan's avatar
      usb: gadget: udc: atmel: update endpoint allocation for sam9x60 · 26b32424
      Cristian Birsan authored
      The DPRAM memory from the USB High Speed Device Port (UDPHS) hardware
      block was increased. This patch updates the endpoint allocation for sam9x60
      to take advantage of this larger memory. At the same time the
      constraint to allocate the endpoints in order was lifted. To handle old
      and new hardware in the same driver the ep_prealloc was added.
      Signed-off-by: default avatarCristian Birsan <cristian.birsan@microchip.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      26b32424
    • Cristian Birsan's avatar
      usb: gadget: udc: atmel: use 1 bank endpoints for control transfers · 5b041a30
      Cristian Birsan authored
      Use 1 bank endpoints for control transfers
      Signed-off-by: default avatarCristian Birsan <cristian.birsan@microchip.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      5b041a30
    • Cristian Birsan's avatar
      usb: gadget: udc: atmel: simplify endpoint allocation · 033b8966
      Cristian Birsan authored
      Simplify the endpoint allocation and cleanup the code.
      Signed-off-by: default avatarCristian Birsan <cristian.birsan@microchip.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      033b8966
    • Cristian Birsan's avatar
    • Claudiu Beznea's avatar
      usb: gadget: udc: atmel: use of_find_matching_node_and_match · 3a482178
      Claudiu Beznea authored
      Instead of trying to match every possible compatible use
      of_find_matching_node_and_match() and pass the compatible array.
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
      Signed-off-by: default avatarCristian Birsan <cristian.birsan@microchip.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      3a482178
    • Martin Blumenstingl's avatar
      usb: dwc2: Add missing cleanups when usb_add_gadget_udc() fails · e1c08cf2
      Martin Blumenstingl authored
      Call dwc2_debugfs_exit() and dwc2_hcd_remove() (if the HCD was enabled
      earlier) when usb_add_gadget_udc() has failed. This ensures that the
      debugfs entries created by dwc2_debugfs_init() as well as the HCD are
      cleaned up in the error path.
      
      Fixes: 207324a3 ("usb: dwc2: Postponed gadget registration to the udc class driver")
      Acked-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      e1c08cf2
    • Thinh Nguyen's avatar
      usb: dwc3: core: Print warning on unsupported speed · e518bdd9
      Thinh Nguyen authored
      The user may have more information to override the HW parameter to
      specify the maximum_speed. However, if the user specifies a
      maximum_speed that the controller doesn't support, print out a warning.
      Signed-off-by: default avatarThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      e518bdd9
    • Thinh Nguyen's avatar
      usb: dwc3: core: Properly default unspecified speed · b574ce3e
      Thinh Nguyen authored
      If the maximum_speed is not specified, default the device speed base on
      its HW capability. Don't prematurely check HW capability before
      validating the maximum_speed device property. The device property takes
      precedence in dwc->maximum_speed.
      
      Fixes: 0e1e5c47 ("usb: dwc3: add support for USB 2.0-only core configuration")
      Reported-by: default avatarChunfeng Yun <chunfeng.yun@mediatek.com>
      Signed-off-by: default avatarThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      b574ce3e
    • Nathan Chancellor's avatar
      usb: dwc2: Fix parameter type in function pointer prototype · 362b9398
      Nathan Chancellor authored
      When booting up on a Raspberry Pi 4 with Control Flow Integrity checking
      enabled, the following warning/panic happens:
      
      [    1.626435] CFI failure (target: dwc2_set_bcm_params+0x0/0x4):
      [    1.632408] WARNING: CPU: 0 PID: 32 at kernel/cfi.c:30 __cfi_check_fail+0x54/0x5c
      [    1.640021] Modules linked in:
      [    1.643137] CPU: 0 PID: 32 Comm: kworker/0:1 Not tainted 5.8.0-rc6-next-20200724-00051-g89ba619726de #1
      [    1.652693] Hardware name: Raspberry Pi 4 Model B Rev 1.2 (DT)
      [    1.658637] Workqueue: events deferred_probe_work_func
      [    1.663870] pstate: 60000005 (nZCv daif -PAN -UAO BTYPE=--)
      [    1.669542] pc : __cfi_check_fail+0x54/0x5c
      [    1.673798] lr : __cfi_check_fail+0x54/0x5c
      [    1.678050] sp : ffff8000102bbaa0
      [    1.681419] x29: ffff8000102bbaa0 x28: ffffab09e21c7000
      [    1.686829] x27: 0000000000000402 x26: ffff0000f6e7c228
      [    1.692238] x25: 00000000fb7cdb0d x24: 0000000000000005
      [    1.697647] x23: ffffab09e2515000 x22: ffffab09e069a000
      [    1.703055] x21: 4c550309df1cf4c1 x20: ffffab09e2433c60
      [    1.708462] x19: ffffab09e160dc50 x18: ffff0000f6e8cc78
      [    1.713870] x17: 0000000000000041 x16: ffffab09e0bce6f8
      [    1.719278] x15: ffffab09e1c819b7 x14: 0000000000000003
      [    1.724686] x13: 00000000ffffefff x12: 0000000000000000
      [    1.730094] x11: 0000000000000000 x10: 00000000ffffffff
      [    1.735501] x9 : c932f7abfc4bc600 x8 : c932f7abfc4bc600
      [    1.740910] x7 : 077207610770075f x6 : ffff0000f6c38f00
      [    1.746317] x5 : 0000000000000000 x4 : 0000000000000000
      [    1.751723] x3 : 0000000000000000 x2 : 0000000000000000
      [    1.757129] x1 : ffff8000102bb7d8 x0 : 0000000000000032
      [    1.762539] Call trace:
      [    1.765030]  __cfi_check_fail+0x54/0x5c
      [    1.768938]  __cfi_check+0x5fa6c/0x66afc
      [    1.772932]  dwc2_init_params+0xd74/0xd78
      [    1.777012]  dwc2_driver_probe+0x484/0x6ec
      [    1.781180]  platform_drv_probe+0xb4/0x100
      [    1.785350]  really_probe+0x228/0x63c
      [    1.789076]  driver_probe_device+0x80/0xc0
      [    1.793247]  __device_attach_driver+0x114/0x160
      [    1.797857]  bus_for_each_drv+0xa8/0x128
      [    1.801851]  __device_attach.llvm.14901095709067289134+0xc0/0x170
      [    1.808050]  bus_probe_device+0x44/0x100
      [    1.812044]  deferred_probe_work_func+0x78/0xb8
      [    1.816656]  process_one_work+0x204/0x3c4
      [    1.820736]  worker_thread+0x2f0/0x4c4
      [    1.824552]  kthread+0x174/0x184
      [    1.827837]  ret_from_fork+0x10/0x18
      
      CFI validates that all indirect calls go to a function with the same
      exact function pointer prototype. In this case, dwc2_set_bcm_params
      is the target, which has a parameter of type 'struct dwc2_hsotg *',
      but it is being implicitly cast to have a parameter of type 'void *'
      because that is the set_params function pointer prototype. Make the
      function pointer protoype match the definitions so that there is no
      more violation.
      
      Fixes: 7de1debc ("usb: dwc2: Remove platform static params")
      Link: https://github.com/ClangBuiltLinux/linux/issues/1107Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      362b9398
    • Mauro Carvalho Chehab's avatar
      usb: dwc3: simple: add support for Hikey 970 · b68d9251
      Mauro Carvalho Chehab authored
      This binding driver is needed for Hikey 970 to work,
      as otherwise a Serror is produced:
      
          [    1.837458] SError Interrupt on CPU0, code 0xbf000002 -- SError
          [    1.837462] CPU: 0 PID: 74 Comm: kworker/0:1 Not tainted 5.8.0+ #205
          [    1.837463] Hardware name: HiKey970 (DT)
          [    1.837465] Workqueue: events deferred_probe_work_func
          [    1.837467] pstate: 20000005 (nzCv daif -PAN -UAO BTYPE=--)
          [    1.837468] pc : _raw_spin_unlock_irqrestore+0x18/0x50
          [    1.837469] lr : regmap_unlock_spinlock+0x14/0x20
          [    1.837470] sp : ffff8000124dba60
          [    1.837471] x29: ffff8000124dba60 x28: 0000000000000000
          [    1.837474] x27: ffff0001b7e854c8 x26: ffff80001204ea18
          [    1.837476] x25: 0000000000000005 x24: ffff800011f918f8
          [    1.837479] x23: ffff800011fbb588 x22: ffff0001b7e40e00
          [    1.837481] x21: 0000000000000100 x20: 0000000000000000
          [    1.837483] x19: ffff0001b767ec00 x18: 00000000ff10c000
          [    1.837485] x17: 0000000000000002 x16: 0000b0740fdb9950
          [    1.837488] x15: ffff8000116c1198 x14: ffffffffffffffff
          [    1.837490] x13: 0000000000000030 x12: 0101010101010101
          [    1.837493] x11: 0000000000000020 x10: ffff0001bf17d130
          [    1.837495] x9 : 0000000000000000 x8 : ffff0001b6938080
          [    1.837497] x7 : 0000000000000000 x6 : 000000000000003f
          [    1.837500] x5 : 0000000000000000 x4 : 0000000000000000
          [    1.837502] x3 : ffff80001096a880 x2 : 0000000000000000
          [    1.837505] x1 : ffff0001b7e40e00 x0 : 0000000100000001
          [    1.837507] Kernel panic - not syncing: Asynchronous SError Interrupt
          [    1.837509] CPU: 0 PID: 74 Comm: kworker/0:1 Not tainted 5.8.0+ #205
          [    1.837510] Hardware name: HiKey970 (DT)
          [    1.837511] Workqueue: events deferred_probe_work_func
          [    1.837513] Call trace:
          [    1.837514]  dump_backtrace+0x0/0x1e0
          [    1.837515]  show_stack+0x18/0x24
          [    1.837516]  dump_stack+0xc0/0x11c
          [    1.837517]  panic+0x15c/0x324
          [    1.837518]  nmi_panic+0x8c/0x90
          [    1.837519]  arm64_serror_panic+0x78/0x84
          [    1.837520]  do_serror+0x158/0x15c
          [    1.837521]  el1_error+0x84/0x100
          [    1.837522]  _raw_spin_unlock_irqrestore+0x18/0x50
          [    1.837523]  regmap_write+0x58/0x80
          [    1.837524]  hi3660_reset_deassert+0x28/0x34
          [    1.837526]  reset_control_deassert+0x50/0x260
          [    1.837527]  reset_control_deassert+0xf4/0x260
          [    1.837528]  dwc3_probe+0x5dc/0xe6c
          [    1.837529]  platform_drv_probe+0x54/0xb0
          [    1.837530]  really_probe+0xe0/0x490
          [    1.837531]  driver_probe_device+0xf4/0x160
          [    1.837532]  __device_attach_driver+0x8c/0x114
          [    1.837533]  bus_for_each_drv+0x78/0xcc
          [    1.837534]  __device_attach+0x108/0x1a0
          [    1.837535]  device_initial_probe+0x14/0x20
          [    1.837537]  bus_probe_device+0x98/0xa0
          [    1.837538]  deferred_probe_work_func+0x88/0xe0
          [    1.837539]  process_one_work+0x1cc/0x350
          [    1.837540]  worker_thread+0x2c0/0x470
          [    1.837541]  kthread+0x154/0x160
          [    1.837542]  ret_from_fork+0x10/0x30
          [    1.837569] SMP: stopping secondary CPUs
          [    1.837570] Kernel Offset: 0x1d0000 from 0xffff800010000000
          [    1.837571] PHYS_OFFSET: 0x0
          [    1.837572] CPU features: 0x240002,20882004
          [    1.837573] Memory Limit: none
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      b68d9251
    • Peter Chen's avatar
      usb: cdns3: gadget: free interrupt after gadget has deleted · 98df91f8
      Peter Chen authored
      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: default avatarRoger Quadros <rogerq@ti.com>
      Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      98df91f8
    • Thinh Nguyen's avatar
      usb: dwc3: gadget: END_TRANSFER before CLEAR_STALL command · d97c78a1
      Thinh Nguyen authored
      According the programming guide (for all DWC3 IPs), when the driver
      handles ClearFeature(halt) request, it should issue CLEAR_STALL command
      _after_ the END_TRANSFER command completes. The END_TRANSFER command may
      take some time to complete. So, delay the ClearFeature(halt) request
      control status stage and wait for END_TRANSFER command completion
      interrupt. Only after END_TRANSFER command completes that the driver
      may issue CLEAR_STALL command.
      
      Cc: stable@vger.kernel.org
      Fixes: cb11ea56 ("usb: dwc3: gadget: Properly handle ClearFeature(halt)")
      Signed-off-by: default avatarThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      d97c78a1
    • Thinh Nguyen's avatar
      usb: dwc3: gadget: Resume pending requests after CLEAR_STALL · c503672a
      Thinh Nguyen authored
      The function driver may queue new requests right after halting the
      endpoint (i.e. queue new requests while the endpoint is stalled).
      There's no restriction preventing it from doing so. However, dwc3
      currently drops those requests after CLEAR_STALL. The driver should only
      drop started requests. Keep the pending requests in the pending list to
      resume and process them after the host issues ClearFeature(Halt) to the
      endpoint.
      
      Cc: stable@vger.kernel.org
      Fixes: cb11ea56 ("usb: dwc3: gadget: Properly handle ClearFeature(halt)")
      Signed-off-by: default avatarThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      c503672a
  3. 20 Sep, 2020 10 commits