1. 23 7月, 2020 1 次提交
    • A
      usb: dwc2: override PHY input signals with usb role switch support · bc0f0d4a
      Amelie Delaunay 提交于
      This patch adds support for usb role switch to dwc2, by using overriding
      control of the PHY voltage valid and ID input signals.
      
      iddig signal (ID) can be overridden:
      - when setting GUSBCFG_FORCEHOSTMODE, iddig input pin is overridden with 1;
      - when setting GUSBCFG_FORCEDEVMODE, iddig input pin is overridden with 0.
      
      avalid/bvalid/vbusvalid signals can be overridden respectively with:
      - GOTGCTL_AVALOEN + GOTGCTL_AVALOVAL
      - GOTGCTL_BVALOEN + GOTGCTL_BVALOVAL
      - GOTGCTL_VBVALEN + GOTGCTL_VBVALOVAL
      
      It is possible to determine valid sessions thanks to usb role switch:
      - if USB_ROLE_NONE then !avalid && !bvalid && !vbusvalid
      - if USB_ROLE_DEVICE then !avalid && bvalid && vbusvalid
      - if USB_ROLE_HOST then avalid && !bvalid && vbusvalid
      Acked-by: NMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: NAmelie Delaunay <amelie.delaunay@st.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      bc0f0d4a
  2. 15 7月, 2020 2 次提交
  3. 03 7月, 2020 1 次提交
  4. 24 6月, 2020 1 次提交
  5. 18 6月, 2020 1 次提交
  6. 15 3月, 2020 1 次提交
  7. 11 2月, 2020 2 次提交
  8. 15 1月, 2020 2 次提交
    • J
      usb: dwc2: Fix IN FIFO allocation · 644139f8
      John Keeping 提交于
      On chips with fewer FIFOs than endpoints (for example RK3288 which has 9
      endpoints, but only 6 which are cabable of input), the DPTXFSIZN
      registers above the FIFO count may return invalid values.
      
      With logging added on startup, I see:
      
      	dwc2 ff580000.usb: dwc2_hsotg_init_fifo: ep=1 sz=256
      	dwc2 ff580000.usb: dwc2_hsotg_init_fifo: ep=2 sz=128
      	dwc2 ff580000.usb: dwc2_hsotg_init_fifo: ep=3 sz=128
      	dwc2 ff580000.usb: dwc2_hsotg_init_fifo: ep=4 sz=64
      	dwc2 ff580000.usb: dwc2_hsotg_init_fifo: ep=5 sz=64
      	dwc2 ff580000.usb: dwc2_hsotg_init_fifo: ep=6 sz=32
      	dwc2 ff580000.usb: dwc2_hsotg_init_fifo: ep=7 sz=0
      	dwc2 ff580000.usb: dwc2_hsotg_init_fifo: ep=8 sz=0
      	dwc2 ff580000.usb: dwc2_hsotg_init_fifo: ep=9 sz=0
      	dwc2 ff580000.usb: dwc2_hsotg_init_fifo: ep=10 sz=0
      	dwc2 ff580000.usb: dwc2_hsotg_init_fifo: ep=11 sz=0
      	dwc2 ff580000.usb: dwc2_hsotg_init_fifo: ep=12 sz=0
      	dwc2 ff580000.usb: dwc2_hsotg_init_fifo: ep=13 sz=0
      	dwc2 ff580000.usb: dwc2_hsotg_init_fifo: ep=14 sz=0
      	dwc2 ff580000.usb: dwc2_hsotg_init_fifo: ep=15 sz=0
      
      but:
      
      	# cat /sys/kernel/debug/ff580000.usb/fifo
      	Non-periodic FIFOs:
      	RXFIFO: Size 275
      	NPTXFIFO: Size 16, Start 0x00000113
      
      	Periodic TXFIFOs:
      		DPTXFIFO 1: Size 256, Start 0x00000123
      		DPTXFIFO 2: Size 128, Start 0x00000223
      		DPTXFIFO 3: Size 128, Start 0x000002a3
      		DPTXFIFO 4: Size 64, Start 0x00000323
      		DPTXFIFO 5: Size 64, Start 0x00000363
      		DPTXFIFO 6: Size 32, Start 0x000003a3
      		DPTXFIFO 7: Size 0, Start 0x000003e3
      		DPTXFIFO 8: Size 0, Start 0x000003a3
      		DPTXFIFO 9: Size 256, Start 0x00000123
      
      so it seems that FIFO 9 is mirroring FIFO 1.
      
      Fix the allocation by using the FIFO count instead of the endpoint count
      when selecting a FIFO for an endpoint.
      Acked-by: NMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: NJohn Keeping <john@metanate.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      644139f8
    • M
      usb: dwc2: Fix Stalling a Non-Isochronous OUT EP · 6070636c
      Minas Harutyunyan 提交于
      Stalling a Non-Isochronous OUT Endpoint flow changed according
      programming guide.
      In dwc2_hsotg_ep_sethalt() function for OUT EP should not be set STALL bit.
      Instead should set SGOUTNAK in DCTL register. Set STALL bit should be
      set only after GOUTNAKEFF interrupt asserted.
      Signed-off-by: NMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6070636c
  9. 09 8月, 2019 1 次提交
    • J
      usb: dwc2: gadget: Fix kill_all_requests race · 37bea42f
      John Keeping 提交于
      When a gadget is disabled, kill_all_requests() can be called
      simultaneously from both a user process via dwc2_hsotg_pullup() and from
      the interrupt handler if the hardware detects disconnection.
      
      Since we drop the lock in dwc2_hsotg_complete_request() in order to call
      the completion handler, this means that the list is modified
      concurrently and leads to an infinite loop in kill_all_requests().
      
      Replace the foreach loop with a while-not-empty loop in order to remove
      the danger of this concurrent modification.
      
      Note: I observed this with threadirqs, I'm not sure if it can be
      triggered without threaded interrupts.
      Signed-off-by: NJohn Keeping <john@metanate.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      37bea42f
  10. 06 6月, 2019 2 次提交
  11. 03 5月, 2019 8 次提交
  12. 07 2月, 2019 2 次提交
  13. 17 1月, 2019 1 次提交
  14. 11 12月, 2018 1 次提交
    • M
      usb: dwc2: Fix disable all EP's on disconnect · 4fe4f9fe
      Minas Harutyunyan 提交于
      Disabling all EP's allow to reset EP's to initial state.
      Introduced new function dwc2_hsotg_ep_disable_lock() which
      before calling dwc2_hsotg_ep_disable() function acquire
      hsotg->lock and release on exiting.
      From dwc2_hsotg_ep_disable() function removed acquiring
      hsotg->lock.
      In dwc2_hsotg_core_init_disconnected() function when USB
      reset interrupt asserted disabling all ep’s by
      dwc2_hsotg_ep_disable() function.
      This updates eliminating sparse imbalance warnings.
      
      Reverted changes in dwc2_hostg_disconnect() function.
      Introduced new function dwc2_hsotg_ep_disable_lock().
      Changed dwc2_hsotg_ep_ops. Now disable point to
      dwc2_hsotg_ep_disable_lock() function.
      In functions dwc2_hsotg_udc_stop() and dwc2_hsotg_suspend()
      dwc2_hsotg_ep_disable() function replaced by
      dwc2_hsotg_ep_disable_lock() function.
      In dwc2_hsotg_ep_disable() function removed acquiring
      of hsotg->lock.
      
      Fixes: dccf1bad ("usb: dwc2: Disable all EP's on disconnect")
      Signed-off-by: NMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      4fe4f9fe
  15. 26 11月, 2018 2 次提交
  16. 02 10月, 2018 7 次提交
  17. 30 7月, 2018 3 次提交
  18. 17 7月, 2018 1 次提交
  19. 19 6月, 2018 1 次提交