summaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)Author
2018-10-05Merge tag 'usb-for-v4.20' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: USB for v4.20 With 63 non-merge commits, this is not a large merge window for USB peripheral. The largest changes go to the UVC gadget driver which a few folks have been improving. Apart from UVC changes, we have a few more devices being added to Renesas USB3 and DWC3 controller drivers and a couple minor bug fixes on other drivers. * tag 'usb-for-v4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: (63 commits) USB: net2280: Remove ->disconnect() callback from net2280_pullup() usb: dwc2: disable power_down on rockchip devices usb: gadget: udc: renesas_usb3: add support for r8a77990 dt-bindings: usb: renesas_usb3: add bindings for r8a77990 usb: gadget: udc: renesas_usb3: Add r8a774a1 support usb: gadget: udc: renesas_usb3: Fix b-device mode for "workaround" usb: dwc2: gadget: Add handler for WkupAlert interrupt usb: dwc2: gadget: enable WKUP_ALERT interrupt usb: dwc2: gadget: Program GREFCLK register usb: dwc2: gadget: Add parameters for GREFCLK register usb: dwc2: Add definitions for new registers usb: dwc2: Update target (u)frame calculation usb: dwc2: Add dwc2_gadget_dec_frame_num_by_one() function usb: dwc2: Add core parameter for service interval support usb: dwc2: Update registers definitions to support service interval usb: renesas_usbhs: add support for R-Car E3 dt-bindings: usb: renesas_usbhs: add bindings for r8a77990 usb: renesas_usbhs: rcar3: Use OTG mode for R-Car D3 Revert "usb: renesas_usbhs: set the mode by using extcon state for non-otg channel" usb: gadget: f_uac2: disable IN/OUT ep if unused ...
2018-10-05USB: net2280: Remove ->disconnect() callback from net2280_pullup()Alan Stern
The net2280 UDC driver invokes the gadget driver's ->disconnect() callback routine when the net2280_pullup() routine turns off the D+ pullup. This is now unnecessary, because the gadget core performs the callback on our behalf. This patch removes the unneeded callback. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-05usb: dwc2: disable power_down on rockchip devicesSolidHal
The bug would let the usb controller enter partial power down, which was formally known as hibernate, upon boot if nothing was plugged in to the port. Partial power down couldn't be exited properly, so any usb devices plugged in after boot would not be usable. Before the name change, params.hibernation was false by default, so _dwc2_hcd_suspend() would skip entering hibernation. With the rename, _dwc2_hcd_suspend() was changed to use params.power_down to decide whether or not to enter partial power down. Since params.power_down is non-zero by default, it needs to be set to 0 for rockchip devices to restore functionality. This bug was reported in the linux-usb thread: REGRESSION: usb: dwc2: USB device not seen after boot The commit that caused this regression is: 6d23ee9caa6790aea047f9aca7f3c03cb8d96eb6 Signed-off-by: SolidHal <hal@halemmerich.com> Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-05usb: gadget: udc: renesas_usb3: add support for r8a77990Yoshihiro Shimoda
Since r8a77990 (R-Car E3) doesn't have VBUS detect pin and number of ramif is 4, this patch adds a new renesas_usb3_priv variable for the SoC. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-05USB: serial: cypress_m8: remove set but not used variable 'iflag'YueHaibing
Fixes gcc '-Wunused-but-set-variable' warning: drivers/usb/serial/cypress_m8.c: In function 'cypress_set_termios': drivers/usb/serial/cypress_m8.c:866:18: warning: variable 'iflag' set but not used [-Wunused-but-set-variable] Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Johan Hovold <johan@kernel.org>
2018-10-05USB: serial: cypress_m8: fix interrupt-out transfer lengthJohan Hovold
Fix interrupt-out transfer length which was being set to the transfer-buffer length rather than the size of the outgoing packet. Note that no slab data was leaked as the whole transfer buffer is always cleared before each transfer. Fixes: 9aa8dae7b1fa ("cypress_m8: use usb_fill_int_urb where appropriate") Signed-off-by: Johan Hovold <johan@kernel.org>
2018-10-05USB: serial: ftdi_sio: add support for FT232R CBUS gpiosJohan Hovold
Enable support for cbus gpios on FT232R. The cbus configuration is stored in one word in the EEPROM at offset 0x0a (byte-offset 0x14) with the mux config for CBUS0, CBUS1, CBUS2 and CBUS3 in bits 0..3, 4..7, 8..11 and 12..15, respectively. Tested using FT232RL by configuring one cbus pin at a time. Signed-off-by: Johan Hovold <johan@kernel.org>
2018-10-05USB: serial: ftdi_sio: fix gpio name collisionsJohan Hovold
Drop the gpio line names, which cause gpiolib to complain loudly whenever a second ftdi gpiochip is registered: gpio gpiochip5: Detected name collision for GPIO name 'CBUS0' gpio gpiochip5: Detected name collision for GPIO name 'CBUS1' gpio gpiochip5: Detected name collision for GPIO name 'CBUS2' gpio gpiochip5: Detected name collision for GPIO name 'CBUS3' and also prevents the legacy sysfs interface from being used (as the line names are used as device names whenever they are set): sysfs: cannot create duplicate filename '/class/gpio/CBUS0' Until non-unique names are supported by gpiolib (without warnings and stack dumps), let's leave the gpio lines unnamed. Signed-off-by: Johan Hovold <johan@kernel.org>
2018-10-03signal: Distinguish between kernel_siginfo and siginfoEric W. Biederman
Linus recently observed that if we did not worry about the padding member in struct siginfo it is only about 48 bytes, and 48 bytes is much nicer than 128 bytes for allocating on the stack and copying around in the kernel. The obvious thing of only adding the padding when userspace is including siginfo.h won't work as there are sigframe definitions in the kernel that embed struct siginfo. So split siginfo in two; kernel_siginfo and siginfo. Keeping the traditional name for the userspace definition. While the version that is used internally to the kernel and ultimately will not be padded to 128 bytes is called kernel_siginfo. The definition of struct kernel_siginfo I have put in include/signal_types.h A set of buildtime checks has been added to verify the two structures have the same field offsets. To make it easy to verify the change kernel_siginfo retains the same size as siginfo. The reduction in size comes in a following change. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2018-10-02usb: gadget: fix spelling mistakeis "[En]queing" -> "[En]queuing"Colin Ian King
Trivial fix to spelling mistakes in debug warning messages Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-02usb: typec: remove set but not used variables 'snk_ma, min_mv'YueHaibing
Fixes gcc '-Wunused-but-set-variable' warning: drivers/usb/typec/tcpm/tcpm.c: In function 'tcpm_pd_select_pps_apdo': drivers/usb/typec/tcpm/tcpm.c:2212:39: warning: variable 'snk_ma' set but not used [-Wunused-but-set-variable] drivers/usb/typec/tcpm/tcpm.c: In function 'tcpm_pd_build_pps_request': drivers/usb/typec/tcpm/tcpm.c:2405:37: warning: variable 'min_mv' set but not used [-Wunused-but-set-variable] Signed-off-by: YueHaibing <yuehaibing@huawei.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-02usb: export firmware port location in sysfsBjørn Mork
The platform firmware "location" data is used to find port peer relationships. But firmware is an unreliable source, and there are real world examples of errors leading to missing or wrong peer relationships. Debugging this is currently hard. Exporting the location attribute makes it easier to spot mismatches between the firmware data and the real world. Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-02usb: hub: try old enumeration scheme first for high speed devicesZeng Tao
The new scheme is required just to support legacy low and full-speed devices. For high speed devices, it will slower the enumeration speed. So in this patch we try the "old" enumeration scheme first for high speed devices, and this is what Windows does since Windows 8. Signed-off-by: Zeng Tao <prime.zeng@hisilicon.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Reviewed-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-02usb: typec: tcpm: Fix APDO PPS order checking to be based on voltageAdam Thomson
Current code mistakenly checks against max current to determine order but this should be max voltage. This commit fixes the issue so order is correctly determined, thus avoiding failure based on a higher voltage PPS APDO having a lower maximum current output, which is actually valid. Fixes: 2eadc33f40d4 ("typec: tcpm: Add core support for sink side PPS") Cc: <stable@vger.kernel.org> Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-02usb: gadget: udc: renesas_usb3: Fix b-device mode for "workaround"Yoshihiro Shimoda
If the "workaround_for_vbus" is true, the driver will not call usb_disconnect(). So, since the controller keeps some registers' value, the driver doesn't re-enumarate suitable speed after the b-device mode is disabled. To fix the issue, this patch adds usb_disconnect() calling in renesas_usb3_b_device_write() if workaround_for_vbus is true. Fixes: 43ba968b00ea ("usb: gadget: udc: renesas_usb3: add debugfs to set the b-device mode") Cc: <stable@vger.kernel.org> # v4.14+ Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc2: gadget: Add handler for WkupAlert interruptGrigor Tovmasyan
Added interrupt handler for WkupAlert interrupt. This interrupt should initiate Remote Wake up. Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc2: gadget: enable WKUP_ALERT interruptGrigor Tovmasyan
WKUP_ALERT interrupt should be unmask when lpm mode is enabled. This interrupt is asserted when the device is in L1 for the duration mentioned in GREFCLK.SOF_CNN_WKUP_ALERT. This is used to alert SW to initiate Remote wake up so that the device resumes in time in order not to lose sync with the host frame number. Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc2: gadget: Program GREFCLK registerGrigor Tovmasyan
Added dwc2_gadget_program_ref_clk function to program GREFCLK register in device mode. Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc2: gadget: Add parameters for GREFCLK registerGrigor Tovmasyan
Added ref_clk_per and sof_cnt_wkup_alert parameters in dwc2_core_params struct and set default values. Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc2: Add definitions for new registersGrigor Tovmasyan
New registers were added to dwc otg core. GREFCLK - This register used to control ref_clk parameters. GINTSTS2 - New WKUP_ALERT interrupt was added. GINTMSK2 - Mask register for GINTSTS2. Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc2: Update target (u)frame calculationGrigor Tovmasyan
In service interval based scheduling target (u)frame must be set as a last frame in this the service interval. Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc2: Add dwc2_gadget_dec_frame_num_by_one() functionGrigor Tovmasyan
Added dwc2_gadget_dec_frame_num_by_one() function in gadget.c. This function will be used to calculate descriptor frame number field value. For service interval mode frame number in descriptor should point to last (u)frame in the interval. Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc2: Add core parameter for service interval supportGrigor Tovmasyan
Added core parameter for service interval based scheduling. Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc2: Update registers definitions to support service intervalGrigor Tovmasyan
Added GHWCFG4_SERVICE_INTERVAL_SUPPORTED and DCTL_SERVICE_INTERVAL_SUPPORTED bits definitions to support service interval based scheduling. Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: renesas_usbhs: add support for R-Car E3Yoshihiro Shimoda
This patch adds support for R-Car E3. This SoC needs to release the PLL reset by the UGCTRL register like R-Car D3. So, this patch adds a usbhs_of_match entry for this SoC with "USBHS_TYPE_RCAR_GEN3_WITH_PLL". Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: renesas_usbhs: rcar3: Use OTG mode for R-Car D3Yoshihiro Shimoda
Since R-Car D3 can use OTG mode, this patch changes the UGCTRL2 value to UGCTRL2_USB0SEL_OTG and UGCTRL2_VBUSSEL like other R-Car Gen3 SoCs. Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02Revert "usb: renesas_usbhs: set the mode by using extcon state for non-otg ↵Yoshihiro Shimoda
channel" This reverts commit cd14247d5c14b9b20bb3d3dfcaa899ca22c8dccc. R-Car D3 can use OTG mode in fact. So, the commit doesn't need anymore. Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: gadget: f_uac2: disable IN/OUT ep if unusedAndreas Pape
Via p_chmask/c_chmask the user can define whether uac2 shall support playback and/or capture. This has only effect on the created ALSA device, but not on the USB descriptor. This patch adds playback/capture descriptors dependent on that parameter. Signed-off-by: Andreas Pape <apape@de.adit-jv.com> Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02USB: gadget core: Issue ->disconnect() callback from usb_gadget_disconnect()Alan Stern
The gadget documentation doesn't state clearly whether a gadget driver's ->disconnect() callback should be invoked when the D+ pullup is turned off. Some UDC drivers do this and some don't. This patch settles the issue by making the core function usb_gadget_disconnect() issue the callback, so that UDC drivers don't need to worry about it. A description of the new behavior is added to the function's kerneldoc. Also, the patch removes a few superseded callbacks from other core routines. Future patches will remove the ->disconnect() calls from the UDC drivers that make them, as they are now unnecessary. Until all those patches are merged gadget drivers may receive extra ->disconnect() callbacks, but this should be harmless. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc3: Fix spelling of 'optimizations'Faisal Mehmood
'optimizations' was misspelled as 'optmizations'. Fixed it. It is a coding style change which should have no impact on runtime execution of code. Signed-off-by: Faisal Mehmood <f.m3hm00d@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: gadget: atmel: remove pointless retrieval of DT name propertyRob Herring
The name is always non-NULL and then is not used anywhere in this function, so remove it. Cc: Nicolas Ferre <nicolas.ferre@microchip.com> Cc: Felipe Balbi <balbi@kernel.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-usb@vger.kernel.org Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: gadget: fsl_udc_core: fixup struct_udc_setup documentationNicholas Mc Guire
The original implementation from commit b504882da539 ("USB: add Freescale high-speed USB SOC device controller driver") returned NULL on failure and an allocated + initialized struct fsl_udc on success. The current code introduced in commit 4365831dadfe ("USB: fsl_usb2_udc: Get max ep number from DCCPARAMS register") only provides partial initialization as well as returning 0 on success and -1 on failures. The function documentation is updated accordingly. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Fixes: 4365831dadfe ("USB: fsl_usb2_udc: Get max ep number from DCCPARAMS register") Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: gadget: fsl_udc_core: check allocation return value and cleanup on failureNicholas Mc Guire
The allocation with fsl_alloc_request() and kmalloc() were unchecked fixed this up with a NULL check and appropriate cleanup. Additionally udc->ep_qh_size was reset to 0 on failure of allocation. Similar udc->phy_mode is initially 0 (as udc_controller was allocated with kzalloc in fsl_udc_probe()) so reset it to 0 as well so that this function is side-effect free on failure. Not clear if this is necessary or sensible as fsl_udc_release() probably can not be called if fsl_udc_probe() failed - but it should not hurt. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Fixes: b504882da5 ("USB: add Freescale high-speed USB SOC device controller driver") Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: mtu3: disable vbus rise/fall interrupts of ltssmChunfeng Yun
The vbus rise & fall interrupts are used to enable and disable U3 function of device automatically, this cause some issues when class driver is initialized as deactivated, and will skip over software-controlled connect by pullup(), but UDC wants to keep disconnect until usb_gadget_activate() is called which calls pullup() if needed. So we disable vbus rise & fall interrupts and just use pullup() to enable & disable U3 function, and reset mtu3 state when disconnect instead when vbus fall. Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: renesas_usbhs: Add multiple clocks managementYoshihiro Shimoda
R-Car Gen3 needs to enable clocks of both host and peripheral. Since [eo]hci-platform disables the reset(s) when the drivers are removed, renesas_usbhs driver doesn't work correctly. To fix this issue, this patch adds multiple clocks management on this renesas_usbhs driver. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: renesas_usbhs: Add reset_controlYoshihiro Shimoda
R-Car Gen3 needs to deassert resets of both host and peripheral. Since [eo]hci-platform is possible to assert the reset(s) when the probing failed, renesas_usbhs driver doesn't work correctly regardless of finished probing. To fix this issue, this patch adds reset_control on this renesas_usbhs driver. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc3: gadget: Check ENBLSLPM before sending ep commandThinh Nguyen
When operating in USB 2.0 speeds (HS/FS), if GUSB2PHYCFG.ENBLSLPM or GUSB2PHYCFG.SUSPHY is set, it must be cleared before issuing an endpoint command. Current implementation only save and restore GUSB2PHYCFG.SUSPHY configuration. We must save and clear both GUSB2PHYCFG.ENBLSLPM and GUSB2PHYCFG.SUSPHY settings. Restore them after the command is completed. DWC_usb3 3.30a and DWC_usb31 1.90a programming guide section 3.2.2 Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc2: fix unbalanced use of external vbus-supplyFabrice Gasnier
When using external vbus supply regulator, it should be enabled synchronously with PWR bit in HPRT register. This also fixes unbalanced use of this optional regulator (This can be reproduced easily when unbinding the driver). Fixes: 531ef5ebea96 ("usb: dwc2: add support for host mode external vbus supply") Tested-by: Artur Petrosyan <arturp@synopsys.com> Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc2: fix call to vbus supply exit routine, call it unlockedFabrice Gasnier
dwc2_vbus_supply_exit() may call regulator_disable(). It shouldn't be called with interrupts disabled as it might sleep. This is seen with DEBUG_ATOMIC_SLEEP=y. Fixes: 531ef5ebea96 ("usb: dwc2: add support for host mode external vbus supply") Tested-by: Artur Petrosyan <arturp@synopsys.com> Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc2: fix a race with external vbus supplyFabrice Gasnier
There's a race with root hub resume, when using external vbus supply. Root hub gets resumed, but runtime pm autosuspend runs as external vbus supply isn't enabled. So, host never exit from power down properly. Initialize vbus external supply before, rater that after hub resume. Fixes: 531ef5ebea96 ("usb: dwc2: add support for host mode external vbus supply") Tested-by: Artur Petrosyan <arturp@synopsys.com> Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc2: get optional vbus-supply regulator onceFabrice Gasnier
Move devm_regulator_get_optional() call to probe routine. This avoids 'vbus-supply' regulator to be requested lots of times, upon each call to dwc2_vbus_supply_init(), e.g. like with runtime pm. Fixes: 531ef5ebea96 ("usb: dwc2: add support for host mode external vbus supply") Tested-by: Artur Petrosyan <arturp@synopsys.com> Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc3: add EXTCON dependency for qcomArnd Bergmann
Like the omap back-end, we get a link error with CONFIG_EXTCON=m when building the qcom back-end into the kernel: drivers/usb/dwc3/dwc3-qcom.o: In function `dwc3_qcom_probe': dwc3-qcom.c:(.text+0x13dc): undefined reference to `extcon_get_edev_by_phandle' dwc3-qcom.c:(.text+0x1b18): undefined reference to `devm_extcon_register_notifier' dwc3-qcom.c:(.text+0x1b9c): undefined reference to `extcon_get_state' Do the same thing as OMAP and add an explicit dependency on EXTCON. Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: gadget: udc: atmel: handle at91sam9rl PMCAlexandre Belloni
The at91sam9rl PMC is not quite the same as the at91sam9g45 one and now has its own compatible string. Add support for that. Fixes: 217bace8e548 ("ARM: dts: fix PMC compatible") Acked-by: Cristian Birsan <cristian.birsan@microchip.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: gadget: udc: fotg210-udc: Fix a sleep-in-atomic-context bug in ↵Jia-Ju Bai
fotg210_get_status() The driver may sleep in an interrupt handler. The function call path (from bottom to top) in Linux-4.17 is: [FUNC] fotg210_ep_queue(GFP_KERNEL) drivers/usb/gadget/udc/fotg210-udc.c, 744: fotg210_ep_queue in fotg210_get_status drivers/usb/gadget/udc/fotg210-udc.c, 768: fotg210_get_status in fotg210_setup_packet drivers/usb/gadget/udc/fotg210-udc.c, 949: fotg210_setup_packet in fotg210_irq (interrupt handler) To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC. If possible, spin_unlock() and spin_lock() around fotg210_ep_queue() can be also removed. This bug is found by my static analysis tool DSAC. Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc2: Disable all EP's on disconnectMinas Harutyunyan
Disabling all EP's allow to reset EP's to initial state. On disconnect disable all EP's instead of just killing all requests. Because of some platform didn't catch disconnect event, same stuff added to dwc2_hsotg_core_init_disconnected() function when USB reset detected on the bus. Changed from version 1: Changed lock acquire flow in dwc2_hsotg_ep_disable() function. Signed-off-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc3: exynos: Add support for Exynos5433 variant with all clocksMarek Szyprowski
DWC3 variant found in Exynos5433 SoCs requires keeping all DRD30/UHOST30 clocks enabled all the time the driver does any access to DWC3 registers, otherwise external abort happens. So far DWC3 hardware module worked with samsung,exynos5250-dwusb3 compatible only by luck when built into kernel: all DRD30 clocks were left enabled by bootloader and later kept enabled by the DRD PHY driver. However, if one tried to use Exnos DWC3 driver as a module or performed system suspend/resume cycle, external abort happened. This patch finally fixes this issue. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc3: exynos: Rework clock handling and prepare for new variantsMarek Szyprowski
Add per-variant list of clocks and manage them all together in the single array. This is a preparation for adding new variants of Exynos SoCs. No functional changes for existing Exynos SoCs. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: dwc3: exynos: Remove dead codeMarek Szyprowski
All supported Exynos variants provide respective generic PHY framework based drivers for controlling USB PHYs, so there is no point creating fake USB PHYs based on platform devices. While removing useless code, remove calls to runtime PM, which have no effect. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: phy: mxs: fix spelling mistake "stardard" -> "standard"Colin Ian King
Trivial fix to spelling mistake in dev_dbg message Acked-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-02usb: gadget: udc: Remove unnecessary parenthesesNathan Chancellor
Clang warns when multiple pairs of parentheses are used for a single conditional statement. drivers/usb/gadget/udc/mv_udc_core.c:188:33: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] while ((curr_dqh->curr_dtd_ptr == curr_dtd->td_dma)) { ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ drivers/usb/gadget/udc/mv_udc_core.c:188:33: note: remove extraneous parentheses around the comparison to silence this warning while ((curr_dqh->curr_dtd_ptr == curr_dtd->td_dma)) { ~ ^ ~ drivers/usb/gadget/udc/mv_udc_core.c:188:33: note: use '=' to turn this equality comparison into an assignment while ((curr_dqh->curr_dtd_ptr == curr_dtd->td_dma)) { ^~ = 1 warning generated. Link: https://github.com/ClangBuiltLinux/linux/issues/120 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>