aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)AuthorFilesLines
2018-05-22USB: serial: pl2303: add support for tx xon/xoff flow controlFlorian Zumbiehl1-1/+15
Support hardware-level Xon/Xoff flow control in transmit direction with pl2303. I only know how to get the hardware to do IXON/!IXANY with ^S/^Q as control characters, so I preserve the old behaviour for all other cases. Signed-off-by: Florian Zumbiehl <[email protected]> [ johan: rewrite logic using pl2303_termios_change() helper ] Signed-off-by: Johan Hovold <[email protected]>
2018-05-21USB: serial: ftdi_sio: clean up flow control managementJohan Hovold1-58/+23
Clean up the somewhat convoluted hardware-assisted flow control handling. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2018-05-21USB: serial: ftdi_sio: drop unnecessary urb_ variable prefixesJohan Hovold1-42/+41
Drop urb_ prefixes from value and index variables used in control requests. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2018-05-21USB: serial: ftdi_sio: use non-underscore fixed typesJohan Hovold1-25/+25
Replace all __u types with their u counterparts throughout the driver (whose structures are not exported to user space). Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2018-05-21USB: serial: ftdi_sio: fix IXON/IXOFF mixupJohan Hovold1-6/+2
Since forever this driver has had IXON and IXOFF mixed up, and has used the latter rather than the former to enable hardware-assisted software flow control on output. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2018-05-21usb: dwc2: gadget: Fix coverity issueGrigor Tovmasyan1-1/+1
When _param is unsigned and the minimum value of range is 0, it gives the following warning: COVERITY NO_EFFECT: This less-than-zero comparison of an unsigned value is never true. Converting ._param to int to avoid this warning. Signed-off-by: Grigor Tovmasyan <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: gadget: udc: renesas_usb3: fix double phy_put()Yoshihiro Shimoda1-2/+0
This patch fixes an issue that this driver cause double phy_put() calling. This driver must not call phy_put() in the remove because the driver calls devm_phy_get() in the probe. Fixes: 279d4bc64060 ("usb: gadget: udc: renesas_usb3: add support for generic phy") Cc: <[email protected]> # v4.15+ Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: gadget: udc: renesas_usb3: disable the controller's irqs for reconnectingYoshihiro Shimoda1-0/+7
This patch fixes an issue that reconnection is possible to fail because unexpected state handling happens by the irqs. To fix the issue, the driver disables the controller's irqs when disconnected. Fixes: 746bfe63bba3 ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller") Cc: <[email protected]> # v4.5+ Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: gadget: udc: renesas_usb3: should fail if devm_phy_get() returns errorYoshihiro Shimoda1-3/+5
This patch fixes an issue that this driver ignores errors other than the non-existence of the device, f.e. a memory allocation failure in devm_phy_get(). So, this patch replaces devm_phy_get() with devm_phy_optional_get(). Reported-by: Simon Horman <[email protected]> Fixes: 279d4bc64060 ("usb: gadget: udc: renesas_usb3: add support for generic phy") Cc: <[email protected]> # v4.15+ Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: gadget: udc: renesas_usb3: should call devm_phy_get() before add udcYoshihiro Shimoda1-8/+8
This patch fixes an issue that this driver cannot call phy_init() if a gadget driver is alreadly loaded because usb_add_gadget_udc() might call renesas_usb3_start() via .udc_start. This patch also revises the typo (s/an optional/optional/). Fixes: 279d4bc64060 ("usb: gadget: udc: renesas_usb3: add support for generic phy") Cc: <[email protected]> # v4.15+ Signed-off-by: Yoshihiro Shimoda <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: gadget: udc: renesas_usb3: should call pm_runtime_enable() before add udcYoshihiro Shimoda1-1/+1
This patch fixes an issue that this driver causes panic if a gadget driver is already loaded because usb_add_gadget_udc() might call renesas_usb3_start() via .udc_start, and then pm_runtime_get_sync() in renesas_usb3_start() doesn't work correctly. Note that the usb3_to_dev() macro should not be called at this timing because the macro uses the gadget structure. Fixes: cf06df3fae28 ("usb: gadget: udc: renesas_usb3: move pm_runtime_{en,dis}able()") Cc: <[email protected]> # v4.15+ Signed-off-by: Yoshihiro Shimoda <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: gadget: udc: renesas_usb3: should remove debugfsYoshihiro Shimoda1-1/+7
This patch fixes an issue that this driver doesn't remove its debugfs. Fixes: 43ba968b00ea ("usb: gadget: udc: renesas_usb3: add debugfs to set the b-device mode") Cc: <[email protected]> # v4.14+ Signed-off-by: Yoshihiro Shimoda <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: Fix list_del corruption in dwc3_ep_dequeueMayank Rana1-1/+1
dwc3_ep_dequeue() waits for completion of End Transfer command using wait_event_lock_irq(), which will release the dwc3->lock while waiting and reacquire after completion. This allows a potential race condition with ep_disable() which also removes all requests from started_list and pending_list. The check for NULL r->trb should catch this but currently it exits to the wrong 'out1' label which calls dwc3_gadget_giveback(). Since its list entry was already removed, if CONFIG_DEBUG_LIST is enabled a 'list_del corruption' bug is thrown since its next/prev pointers are already LIST_POISON1/2. If r->trb is NULL it should simply exit to 'out0'. Fixes: cf3113d893d4 ("usb: dwc3: gadget: properly increment dequeue pointer on ep_dequeue") Cc: [email protected] # v4.12+ Signed-off-by: Mayank Rana <[email protected]> Signed-off-by: Jack Pham <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: dwc3_gadget_del_and_unmap_request() can be staticWei Yongjun1-1/+1
Fixes the following sparse warning: drivers/usb/dwc3/gadget.c:169:6: warning: symbol 'dwc3_gadget_del_and_unmap_request' was not declared. Should it be static? Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc2: pci: Fix error return code in dwc2_pci_probe()Wei Yongjun1-1/+3
Fix to return error code -ENOMEM from the alloc fail error handling case instead of 0, as done elsewhere in this function. Fixes: ecd29dabb2ba ("usb: dwc2: pci: Handle error cleanup in probe") Reviewed-by: Grigor Tovmasyan <[email protected]> Acked-by: Minas Harutyunyan <[email protected]> Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc2: WA for Full speed ISOC IN in DDMA mode.Artur Petrosyan2-0/+23
By clearing NAK status of EP, core will send ZLP to IN token and assert NAK interrupt relying on TxFIFO status only. The WA applies only to core versions from 2.72a to 4.00a (including both). Also for FS_IOT_1.00a and HS_IOT_1.00a. Signed-off-by: Artur Petrosyan <[email protected]> Signed-off-by: Minas Harutyunyan <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc2: dwc2_vbus_supply_init: fix error checkTomeu Vizoso1-5/+8
devm_regulator_get_optional returns -ENODEV if the regulator isn't there, so if that's the case we have to make sure not to leave -ENODEV in the regulator pointer. Also, make sure we return 0 in that case, but correctly propagate any other errors. Also propagate the error from _dwc2_hcd_start. Fixes: 531ef5ebea96 ("usb: dwc2: add support for host mode external vbus supply") Cc: Amelie Delaunay <[email protected]> Reviewed-by: Amelie Delaunay <[email protected]> Reviewed-by: Heiko Stuebner <[email protected]> Reviewed-by: Grigor Tovmasyan <[email protected]> Tested-by: Heiko Stuebner <[email protected]> Acked-by: Minas Harutyunyan <[email protected]> Signed-off-by: Tomeu Vizoso <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: gadget: f_phonet: fix pn_net_xmit()'s return typeLuc Van Oostenryck1-1/+1
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t', which is a typedef for an enum type, but the implementation in this driver returns an 'int'. Fix this by returning 'netdev_tx_t' in this driver too. Signed-off-by: Luc Van Oostenryck <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc2: Fix HiKey regression caused by power_down featureJohn Stultz1-0/+1
In 4.17-rc, commit 03ea6d6e9e1f ("usb: dwc2: Enable power down") caused the HiKey board to not correctly handle switching between usb-gadget and usb-host mode. Unplugging the OTG port would result in: [ 42.240973] dwc2 f72c0000.usb: dwc2_restore_host_registers: no host registers to restore [ 42.249066] dwc2 f72c0000.usb: dwc2_host_exit_hibernation: failed to restore host registers And the USB-host ports would not function. And plugging in the OTG port, we would see: [ 46.046557] WARNING: CPU: 3 PID: 6 at drivers/usb/dwc2/gadget.c:260 dwc2_hsotg_init_fifo+0x194/0x1a0 [ 46.055761] CPU: 3 PID: 6 Comm: kworker/u16:0 Not tainted 4.17.0-rc5-00030-ge67da8c #231 [ 46.055767] Hardware name: HiKey Development Board (DT) [ 46.055784] Workqueue: dwc2 dwc2_conn_id_status_change ... Thus, this patch sets the hisi params to disable the power_down flag by default, and gets thing working again. Cc: John Youn <[email protected]> Cc: Vardan Mikayelyan <[email protected]> Cc: Artur Petrosyan <[email protected]> Cc: Grigor Tovmasyan <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: [email protected] Signed-off-by: John Stultz <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc2: Fix kernel doc's warnings.Grigor Tovmasyan12-61/+215
Added descriptions for all not described parameters. Fix all kernel doc's warnings. Acked-by: Minas Harutyunyan <[email protected]> Signed-off-by: Grigor Tovmasyan <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: gadget: fsl: Introduce FSL_USB2_PHY_UTMI_DUAL for usb gadgetNikhil Badola1-0/+1
Introduce FSL_USB2_PHY_UTMI_DUAL in gadget driver for setting phy in SOCs with utmi dual phy Acked-by: Li Yang <[email protected]> Signed-off-by: Nikhil Badola <[email protected]> Tested-by: Tiago Brusamarello <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: dwc3_get_extcon() can be statickbuild test robot1-1/+1
Fix sparse warning Fixes: 5f0b74e54890 ("USB: dwc3: get extcon device by OF graph bindings") Reviewed-by: Andrzej Hajda <[email protected]> Signed-off-by: kbuild test robot <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: init req->{direction,epnum} from alloc_request()Felipe Balbi1-2/+1
We dont' need to touch req->direction or req->epnum from ep_queue(). It's enough that we initialize both fields from alloc_request() and just keep them for the entire lifetime of the request. No functional changes. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: initialize transfer index from send_gadget_ep_cmd()Felipe Balbi2-6/+1
Instead of *always* calling dwc3_gadget_ep_get_transfer_index() after sending a Start Transfer command, we can call it once from dwc3_send_gadget_ep_cmd() itself. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: assign resource_index inside get_transfer_index()Felipe Balbi3-10/+6
Instead of returning resource index number just to assign it to a field inside 'dep' which was passed as argument, we can assing dep->resource_index from inside dwc3_gadget_ep_get_transfer_index() itself. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: always start isochronous aligned to dep->intervalFelipe Balbi1-10/+5
We will *always* start transfer to the next uFrame number aligned to dep->interval. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: don't issue End Transfer if we have started reqsFelipe Balbi1-1/+3
In case we have many started requests and one of them in the middle is completed with Missed Isoc, let's not End Transfer as that would result in us loosing (possibly) many more intervals. Instead, let's allow the controller to go through its list of started requests. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: debug: decode uFrame from event tooFelipe Balbi1-3/+7
XferNotReady and XferInProgress give us the uFrame number we're currently in. Printing that out on tracepoints may help us find bugs in transfer scheduling. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: move dwc3_calc_trbs_left() in place of prototypeFelipe Balbi1-49/+47
Avoid a prototype when the function can be defined earlier. No functional changes, cleanup only. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: move set_xfer_resource() in place of prototypeFelipe Balbi1-13/+11
Instead of having a prototype for a function that's defined a few lines down, let's just move definition to the place where prototype was. No functional changes, cleanup only. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: remove a few more dwc argumentsFelipe Balbi1-8/+10
In a few places, the argument is completely unnecessary. On places where it's needed, we can get it from dep->dwc. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: combine modify & restore into single argumentFelipe Balbi1-22/+11
Those two arguments refer to a single bitfield in the register. In order to simplify the code, we can combine them into a single argument and expect caller to pass the correct action argument at all times. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: refactor dwc3_gadget_init_endpoints()Felipe Balbi1-87/+116
This just makes it slightly easier to read. No functional changes. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: split dwc3_gadget_ep_cleanup_completed_requests()Felipe Balbi1-24/+36
No functional changes, it just makes the code slightly easier to read. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: get rid of the length variableFelipe Balbi1-3/+1
Code is just as readable without it. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: reduce scope of ret variableFelipe Balbi1-1/+1
We can declare it inside list_for_each_entry_safe() loop and reduce its scope. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: one declaration per lineFelipe Balbi1-2/+3
Misc cleanup. No functional changes. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: simplify IOC handlingFelipe Balbi1-15/+10
We will only have event status of IOC when IOC bit is set in TRB. There's no need to check both bits. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: simplify short packet eventFelipe Balbi1-7/+1
We know that only OUT endpoints can trigger SHORT. We also know that count MUST be > 0 whenever SHORT triggers. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: trace: print out event status tooFelipe Balbi1-4/+16
This will make it easier to figure out the reason for the event. That information really helps debugging certain problems. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: simplify unaligned and zlp handlingFelipe Balbi1-4/+2
We can just call reclaim_trb_linear instead of reimplementing it. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: remove unnecessary 'chain' variableFelipe Balbi1-3/+1
Minor cleanup, no functional changes. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: remove PENDING handling from cleanup_completedFelipe Balbi1-14/+0
We are trying to kick transfers on Isochronous endpoints in a more controlled manner now. And this ended up rendering this piece of code unnecessary. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: split scatterlist and linear handlersFelipe Balbi1-26/+45
instead of having one big loop, let's split it down into two smaller handlers: one for linear buffers and one for scatterlist. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: simplify isoc case on cleanup_completed_requestsFelipe Balbi1-10/+3
Just a minor simplification, no functional changes. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: simplify queueing of isoc transfersFelipe Balbi1-12/+6
After all the previous changes, it's now a lot clearer how isoc transfers should be managed. We don't need to try to End Transfers from ep_queue since that's already done by cleanup_requests. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: remove duplicated missed isoc handlingFelipe Balbi3-35/+3
Now, this part of the code is duplicated and brings no extra value to the driver. Let's remove it. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: check for Missed Isoc from event statusFelipe Balbi2-5/+14
In case we get an event with status set to Missed Isoc, this means we have missed an isochronous interval and should issue End Transfer command and wait for the following XferNotReady. Let's do that early, rather than late. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: remove unnecessary 'ioc' variableFelipe Balbi1-6/+1
It's only written to, never read. We can remove it now. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: make cleanup_completed_requests() return nothingFelipe Balbi1-9/+4
We don't need to return a value anymore here. Let's remove it. Signed-off-by: Felipe Balbi <[email protected]>