linux-2.6-microblaze.git
5 years agoselftests: add test for USB over IP driver
Shuah Khan (Samsung OSG) [Thu, 31 May 2018 03:00:57 +0000 (21:00 -0600)]
selftests: add test for USB over IP driver

Add test for USB over IP driver. This test runs several tests on a device
specified in the -b <busid> argument and path to the usbip tools.

usbip_test.sh -b <busid> -p <usbip tools path>

e.g:
cd tools/testing selftests/drivers/usb/usbip
sudo ./usbip_test.sh -b 3-10.2 -p <yoursrctree>/tools/usb/usbip

This test should be run as root and user should build usbip tools before
running the test.

The usbip test isn't included in the Kselftest run as it requires user to
specify a device to run tests on.

Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: typec: fsusb302: no need to check return value of debugfs_create_dir()
Greg Kroah-Hartman [Thu, 31 May 2018 11:08:54 +0000 (13:08 +0200)]
USB: typec: fsusb302: no need to check return value of debugfs_create_dir()

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Clean up the fsusb302 driver to not care if the root directory was
created, as the code should work properly either way.

Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: gadget: udc: s3c2410_udc: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:31:07 +0000 (17:31 +0200)]
USB: gadget: udc: s3c2410_udc: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Felipe Balbi <balbi@kernel.org>
Cc: Li Yang <leoyang.li@nxp.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: gadget: udc: renesas_usb3: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:31:06 +0000 (17:31 +0200)]
USB: gadget: udc: renesas_usb3: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Felipe Balbi <balbi@kernel.org>
Cc: Simon Horman <horms+renesas@verge.net.au>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: gadget: udc: pxa27x_udc: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:31:05 +0000 (17:31 +0200)]
USB: gadget: udc: pxa27x_udc: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

There is also no need to keep the file dentries around at all, so remove
those variables from the device structure.

Cc: Daniel Mack <daniel@zonque.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Felipe Balbi <balbi@kernel.org>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: gadget: udc: gr_udc: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:31:04 +0000 (17:31 +0200)]
USB: gadget: udc: gr_udc: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

There is also no need to keep the file dentries around at all, so remove
those variables from the device structure.

Cc: Felipe Balbi <balbi@kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Jaejoong Kim <climbbb.kim@gmail.com>
Cc: Li Yang <leoyang.li@nxp.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: gadget: udc: bcm63xx_udc: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:31:03 +0000 (17:31 +0200)]
USB: gadget: udc: bcm63xx_udc: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

There is also no need to keep the file dentries around at all, so remove
those variables from the device structure.

Cc: Kevin Cernekee <cernekee@gmail.com>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: udc: atmel_usba_udc: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:31:02 +0000 (17:31 +0200)]
USB: udc: atmel_usba_udc: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

There is also no need to keep the file dentries around at all, so remove
those variables from the device structure.

Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Felipe Balbi <balbi@kernel.org>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: dwc3: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:31:01 +0000 (17:31 +0200)]
USB: dwc3: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: dwc2: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:31:00 +0000 (17:31 +0200)]
USB: dwc2: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: core: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:30:59 +0000 (17:30 +0200)]
USB: core: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Johan Hovold <johan@kernel.org>
Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: chipidea: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:30:58 +0000 (17:30 +0200)]
USB: chipidea: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: ehci-hcd: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:30:57 +0000 (17:30 +0200)]
USB: ehci-hcd: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: fhci-hcd: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:30:56 +0000 (17:30 +0200)]
USB: fhci-hcd: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

There is also no need to keep the file dentries around at all, so remove
those variables from the host controller structure.

Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: fotg210-hcd: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:30:55 +0000 (17:30 +0200)]
USB: fotg210-hcd: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Johan Hovold <johan@kernel.org>
Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@intel.com>
Cc: Vasyl Gomonovych <gomonovych@gmail.com>
Cc: Mariusz Skamra <mariuszx.skamra@intel.com>
Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: imx21-hcd: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:30:54 +0000 (17:30 +0200)]
USB: imx21-hcd: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: isp116x-hcd: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:30:53 +0000 (17:30 +0200)]
USB: isp116x-hcd: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Olav Kongas <ok@artecdesign.ee>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: ohci: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:30:52 +0000 (17:30 +0200)]
USB: ohci: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

There is also no need to keep the file dentries around at all, so remove
those variables from the host controller structure.

Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: uhci: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:30:51 +0000 (17:30 +0200)]
USB: uhci: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: mon: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 29 May 2018 15:30:50 +0000 (17:30 +0200)]
USB: mon: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

We do need to save the dentries for these files, so keep them around,
but no need to check if they are "valid" or not, as the code works just
as well either way.

Cc: Pete Zaitcev <zaitcev@kotori.zaitcev.us>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Cc: Fredrik Noring <noring@nocrew.org>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: mtu3: no need to check return value of debugfs_create_dir()
Greg Kroah-Hartman [Tue, 29 May 2018 15:30:49 +0000 (17:30 +0200)]
USB: mtu3: no need to check return value of debugfs_create_dir()

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: musb: clean up debugfs file and directory creation
Greg Kroah-Hartman [Tue, 29 May 2018 15:30:48 +0000 (17:30 +0200)]
USB: musb: clean up debugfs file and directory creation

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Because of this, lots of init functions do not need to have return
values, so this cleans up a lot of unused error handling code that never
could have triggered in the past.

Cc: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: typec: tcpm: no need to check return value of debugfs_create_dir()
Greg Kroah-Hartman [Tue, 29 May 2018 15:30:46 +0000 (17:30 +0200)]
USB: typec: tcpm: no need to check return value of debugfs_create_dir()

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Clean up the tcpm.c code to not care about this, turns out no one was
even checking the return value of this function, so it didn't matter.

Note, I do not think this code can be removed in a running system, as
the debugfs root directory will stick around, that should be fixed
someday...

Revieved-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>
5 years agophy: tegra: select USB_COMMON
Arnd Bergmann [Wed, 30 May 2018 21:33:50 +0000 (23:33 +0200)]
phy: tegra: select USB_COMMON

A built-in PHY driver cannot link against modular USB core code:

drivers/usb/phy/phy-tegra-usb.o: In function `tegra_usb_phy_probe':
phy-tegra-usb.c:(.text+0x6bc): undefined reference to `usb_get_dr_mode'

This uses a 'select' statement in Kconfig like we have for other such
PHY drivers.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agousb: hub: Per-port setting to reduce TRSTRCY to 10 ms
Nicolas Boichat [Mon, 28 May 2018 06:32:19 +0000 (14:32 +0800)]
usb: hub: Per-port setting to reduce TRSTRCY to 10 ms

Currently, the USB hub core waits for 50 ms after enumerating the
device. This was added to help "some high speed devices" to
enumerate (b789696af8 "[PATCH] USB: relax usbcore reset timings").

On some devices, the time-to-active is important, so we provide
a per-port option to reduce the time to what the USB specification
requires: 10 ms.

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agousb: hub: Per-port setting to use old enumeration scheme
Nicolas Boichat [Mon, 28 May 2018 06:32:18 +0000 (14:32 +0800)]
usb: hub: Per-port setting to use old enumeration scheme

The "old" enumeration scheme is considerably faster (it takes
~244ms instead of ~356ms to get the descriptor).

It is currently only possible to use the old scheme globally
(/sys/module/usbcore/parameters/old_scheme_first), which is not
desirable as the new scheme was introduced to increase compatibility
with more devices.

However, in our case, we care about time-to-active for a specific
USB device (which we make the firmware for), on a specific port
(that is pogo-pin based: not a standard USB port). This new
sysfs option makes it possible to use the old scheme on a single
port only.

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agousb: xhci: tegra: Fix runtime PM support
Jon Hunter [Wed, 30 May 2018 15:11:42 +0000 (16:11 +0100)]
usb: xhci: tegra: Fix runtime PM support

Fix silly mistake when enabling runtime PM support for the Tegra XHCI
driver. If runtime PM was enabled correctly for the XHCI device, then
we should call pm_runtime_get_sync() to enable the device.

Fixes: ee9e5f4c7825 ("usb: xhci: tegra: Add runtime PM support")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agousb: chipidea: Fix ULPI on imx51
Andrey Smirnov [Wed, 30 May 2018 17:34:14 +0000 (10:34 -0700)]
usb: chipidea: Fix ULPI on imx51

Workaround introduced for i.MX53 in be9cae2479f48 ("usb: chipidea:
imx: Fix ULPI on imx53") seems to be applicable in case of i.MX51 as
well. Running latest kernel on ZII RDU1 Board (imx51-zii-rdu1.dts)
exhibits a kernel frozen on PORTSC access and applying the workaround
resolves the issue.

Fixes: be9cae2479f4 ("usb: chipidea: imx: Fix ULPI on imx53")
Cc: Peter Chen <peter.chen@nxp.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Chris Healy <cphealy@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Tested-By: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agousbip: usbip_detach: fix to check for invalid ports
Shuah Khan (Samsung OSG) [Wed, 30 May 2018 03:03:08 +0000 (21:03 -0600)]
usbip: usbip_detach: fix to check for invalid ports

usbip detach doesn't check for invalid ports and ports that are already
detached. It attempts to remove state file(s) without validating the port
and sends detach request to the driver for ports that are already detached.

Add check for invalid ports (port > maxports) and ports that are already
detached (status == VDEV_ST_NULL). Don't remove state files and don't send
detach request for invalid ports and ports that are already detached.

Add error and information messages that make sense.

Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agousbip: usbip_detach: Fix memory, udev context and udev leak
Shuah Khan (Samsung OSG) [Tue, 29 May 2018 22:13:03 +0000 (16:13 -0600)]
usbip: usbip_detach: Fix memory, udev context and udev leak

detach_port() fails to call usbip_vhci_driver_close() from its error
path after usbip_vhci_detach_device() returns failure, leaking memory
allocated in usbip_vhci_driver_open() and holding udev_context and udev
references. Fix it to call usbip_vhci_driver_close().

Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agousb: musb: remove an unused variable
Arnd Bergmann [Mon, 28 May 2018 15:34:35 +0000 (17:34 +0200)]
usb: musb: remove an unused variable

After the only users of this variable got removed, we now get a
warning about 'otg' being unused:

drivers/usb/musb/da8xx.c: In function 'da8xx_musb_interrupt':
drivers/usb/musb/da8xx.c:226:19: error: unused variable 'otg' [-Werror=unused-variable]

Fixes: d2852f2d3e6d ("usb: musb: remove references to default_a of struct usb_otg")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agousb: dwc3: Remove DEBUG define from Qualcomm DWC3 glue driver
Douglas Anderson [Fri, 25 May 2018 22:07:48 +0000 (15:07 -0700)]
usb: dwc3: Remove DEBUG define from Qualcomm DWC3 glue driver

It appears that a "#define DEBUG" was left in on the recent patch
landed for the Qualcomm DWC3 glue driver.  Let's remove it.

Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agousb: host: ohci: fix sfr kernel warning in ohci-at91 driver
Prasanthi Chellakumar [Fri, 25 May 2018 22:04:24 +0000 (15:04 -0700)]
usb: host: ohci: fix sfr kernel warning in ohci-at91 driver

The USB Host Controller driver 'ohci-at91.c' reads a Special Function
Register - OHCI Interrupt Configuration Register (AT91_SFR_OHCIICR)
for bits SUSPEND_A/B/C. These bits are defined in sama5d2 alone, so
sfr register mapping is done with compatible string "atmel,sama5d2-sfr".
This gives a kernel warning 'failed to find sfr node' with non sama5d2
cpus which is removed here, thus leaving it up to having a proper DTS.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agousb: core: message: remove extra endianness conversion in usb_set_isoch_delay
Ruslan Bilovol [Fri, 25 May 2018 16:11:40 +0000 (19:11 +0300)]
usb: core: message: remove extra endianness conversion in usb_set_isoch_delay

No need to do extra endianness conversion in
usb_set_isoch_delay because it is already done
in usb_control_msg()

Fixes: 886ee36e7205 ("usb: core: add support for USB_REQ_SET_ISOCH_DELAY")
Cc: Dmytro Panchenko <dmytro.panchenko@globallogic.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: stable <stable@vger.kernel.org> # v4.16+
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agousbip: dynamically allocate idev by nports found in sysfs
Michael Grzeschik [Fri, 25 May 2018 14:23:46 +0000 (16:23 +0200)]
usbip: dynamically allocate idev by nports found in sysfs

As the amount of available ports varies by the kernels build
configuration. To remove the limitation of the fixed 128 ports
we allocate the amount of idevs by using the number we get
from the kernel.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Acked-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoNFC: pn533: don't send USB data off of the stack
Greg Kroah-Hartman [Sun, 20 May 2018 13:19:46 +0000 (15:19 +0200)]
NFC: pn533: don't send USB data off of the stack

It's amazing that this driver ever worked, but now that x86 doesn't
allow USB data to be sent off of the stack, it really does not work at
all.  Fix this up by properly allocating the data for the small
"commands" that get sent to the device off of the stack.

We do this for one command by having a whole urb just for ack messages,
as they can be submitted in interrupt context, so we can not use
usb_bulk_msg().  But the poweron command can sleep (and does), so use
usb_bulk_msg() for that transfer.

Reported-by: Carlos Manuel Santos <cmmpsantos@gmail.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoMerge tag 'usb-serial-4.18-rc1' of https://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Thu, 31 May 2018 10:15:20 +0000 (12:15 +0200)]
Merge tag 'usb-serial-4.18-rc1' of https://git./linux/kernel/git/johan/usb-serial into usb-next

Johan writes:

USB-serial updates for v4.18-rc1

Here are the USB-serial updates for 4.18-rc1, including:

 - support for hardware-assisted XON/XOFF output flow control for pl2303
 - fix for a long-standing IXON/IXOFF mixup in ftdi_sio
 - blacklist of two apparently unused dwm-158 modem interfaces that
   confused some user space daemon (option)
 - add missing const to a tty helper currently used by USB serial only

Included are also various clean ups.

All have been in linux-next with no reported issues.

Signed-off-by: Johan Hovold <johan@kernel.org>
6 years agoMerge tag 'phy-for-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/kishon...
Greg Kroah-Hartman [Fri, 25 May 2018 16:02:08 +0000 (18:02 +0200)]
Merge tag 'phy-for-4.18' of git://git./linux/kernel/git/kishon/linux-phy into usb-next

Kishon writes:

phy: for 4.18

 *) Add PHY driver for the ATH79 USB PHY
 *) Add USB3 PHY driver for Mediatek XS-PHY
 *) Add QUSB/QMP V3 USB3 PHY Support for Qualcomm's SDM845
 *) Add runtime PM support for mapphone PHY driver
 *) Allow phy_pm_runtime_xxx API calls to accept NULL
 *) Other minor cleanups and fixes

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
6 years agousb: xhci: tegra: Add support for managing powergates
Jon Hunter [Wed, 16 May 2018 13:48:55 +0000 (14:48 +0100)]
usb: xhci: tegra: Add support for managing powergates

The Tegra XHCI controller requires that the XUSBA (for superspeed) and
XUSBC (for host) power-domains are enabled. Commit 8df127456f29
("soc/tegra: pmc: Enable XUSB partitions on boot") was added to force
on these power-domains if the XHCI driver is enabled while proper
power-domain support is added, to ensure the device did not hang on
boot. However, rather than forcing on these power-domains in the PMC
driver we can use the legacy Tegra powergate APIs to turn on these
power-domains during the probe of the Tegra XHCI driver.

In the near future we plan to move the Tegra XHCI driver to use the
generic PM domain framework for power-domains and so to prepare for
this only use the legacy Tegra powergate API if there is not PM
domain associated with device (ie. dev.pm_domain is NULL). Please
note that in the future the superspeed and host resets will be handled
by the generic PM domain provider and so these are only these are only
needed in the case where there is no generic PM domain.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: xhci: tegra: Add runtime PM support
Jon Hunter [Wed, 16 May 2018 13:48:54 +0000 (14:48 +0100)]
usb: xhci: tegra: Add runtime PM support

Add runtime PM support to the Tegra XHCI driver and move the function
calls to enable/disable the clocks, regulators and PHY into the runtime
PM callbacks.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: xhci: tegra: Prepare for adding runtime PM support
Jon Hunter [Wed, 16 May 2018 13:48:53 +0000 (14:48 +0100)]
usb: xhci: tegra: Prepare for adding runtime PM support

When adding runtime PM support to the Tegra XHCI driver, it is desirable
to move the function calls to enable the clocks, regulators and PHY from
the tegra_xusb_probe into the runtime PM handlers. Currently, the
clocks, regulators and PHY are all enabled before we call
usb_create_hcd() in tegra_xusb_probe(), however, we cannot call
pm_runtime_get_sync() at this point because the platform device data is
not yet initialised. Fortunately, the function usb_create_hcd() can be
called before we enable the clocks, regulators and PHY and so prepare
for adding runtime PM support, by moving the call to usb_create_hcd()
before we enable the hardware.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb-storage: Add compatibility quirk flags for G-Technologies G-Drive
Alexander Kappner [Sat, 19 May 2018 04:50:16 +0000 (21:50 -0700)]
usb-storage: Add compatibility quirk flags for G-Technologies G-Drive

The "G-Drive" (sold by G-Technology) external USB 3.0 drive
 hangs on write access under UAS and usb-storage:

[  136.079121] sd 15:0:0:0: [sdi] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[  136.079144] sd 15:0:0:0: [sdi] tag#0 Sense Key : Illegal Request [current]
[  136.079152] sd 15:0:0:0: [sdi] tag#0 Add. Sense: Invalid field in cdb
[  136.079176] sd 15:0:0:0: [sdi] tag#0 CDB: Write(16) 8a 08 00 00 00 00 00 00 00 00 00 00 00 08 00 00
[  136.079180] print_req_error: critical target error, dev sdi, sector 0
[  136.079183] Buffer I/O error on dev sdi, logical block 0, lost sync page write
[  136.173148] EXT4-fs (sdi): mounted filesystem with ordered data mode. Opts: (null)
[  140.583998] sd 15:0:0:0: [sdi] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[  140.584010] sd 15:0:0:0: [sdi] tag#0 Sense Key : Illegal Request [current]
[  140.584016] sd 15:0:0:0: [sdi] tag#0 Add. Sense: Invalid field in cdb
[  140.584022] sd 15:0:0:0: [sdi] tag#0 CDB: Write(16) 8a 08 00 00 00 00 e8 c4 00 18 00 00 00 08 00 00
[  140.584025] print_req_error: critical target error, dev sdi, sector 3905159192
[  140.584044] print_req_error: critical target error, dev sdi, sector 3905159192
[  140.584052] Aborting journal on device sdi-8.

The proposed patch adds compatibility quirks. Because the drive requires two
quirks (one to work with UAS, and another to work with usb-storage), adding this
under unusual_devs.h and not just unusual_uas.h so kernels compiled without UAS
receive the quirk. With the patch, the drive works reliably on UAS and usb-
storage.
(tested on NEC Corporation uPD720200 USB 3.0 host controller).

Signed-off-by: Alexander Kappner <agk@godking.net>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb-storage: Add support for FL_ALWAYS_SYNC flag in the UAS driver
Alexander Kappner [Sat, 19 May 2018 04:50:15 +0000 (21:50 -0700)]
usb-storage: Add support for FL_ALWAYS_SYNC flag in the UAS driver

The ALWAYS_SYNC flag is currently honored by the usb-storage driver but not UAS
and is required to work around devices that become unstable upon being
queried for cache. This code is taken straight from:
drivers/usb/storage/scsiglue.c:284

Signed-off-by: Alexander Kappner <agk@godking.net>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@vger.kernel.org>
Acked-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: typec: wcove: Remove dependency on HW FSM
Heikki Krogerus [Thu, 24 May 2018 10:49:52 +0000 (13:49 +0300)]
usb: typec: wcove: Remove dependency on HW FSM

The USB Type-C PHY in Intel WhiskeyCove PMIC has build-in
USB Type-C state machine which we were relying on to
configure the CC lines correctly. This patch removes that
dependency and configures the CC line according to commands
from the port manager (tcpm.c) in wcove_set_cc().

This fixes an issue where USB devices attached to the USB
Type-C port do not get enumerated. When acting as
source/host, the HW FSM sometimes fails to configure the PHY
correctly.

Fixes: 3c4fb9f16921 ("usb: typec: wcove: start using tcpm for USB PD support")
Cc: stable@vger.kernel.org
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: roles: intel_xhci: Enable runtime PM
Heikki Krogerus [Thu, 24 May 2018 08:18:27 +0000 (11:18 +0300)]
usb: roles: intel_xhci: Enable runtime PM

This fixes an issue where the mux does not get configured
when the parent device is suspended. The registers for this
mux are mapped to the parent device MMIO (usually xHCI PCI
device), so in order for the driver to be able to program
the registers, the parent device must be resumed.

Reported-by: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
Fixes: f6fb9ec02be1 ("usb: roles: Add Intel xHCI USB role switch driver")
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: typec: fusb302: Fix debugfs issue
Heikki Krogerus [Thu, 24 May 2018 08:18:26 +0000 (11:18 +0300)]
usb: typec: fusb302: Fix debugfs issue

Removing the "fusb302" debugfs directory when unloading
the driver. That allows the driver to be loaded more then
one time. The directory will not get actually removed until
it is empty, so only after the last instance has been
removed.

This fixes an issue where the driver can't be re-loaded if
it has been unloaded as the "fusb302" debugfs directory
already exists.

Fixes: 76f0c53d08b9 ("usb: typec: fusb302: Move out of staging")
Signed-off-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>
6 years agoplatform: x86: intel_cht_int33fe: Fix dependencies
Heikki Krogerus [Thu, 24 May 2018 08:18:25 +0000 (11:18 +0300)]
platform: x86: intel_cht_int33fe: Fix dependencies

The driver will not probe unless bq24190 is loaded, so
making it a dependency.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: roles: intel_xhci: Always allow user control
Heikki Krogerus [Thu, 24 May 2018 08:18:24 +0000 (11:18 +0300)]
usb: roles: intel_xhci: Always allow user control

Trying to determine the USB port type with this mux is very
difficult. To simplify the situation, always allow user
control, even if the port is USB Type-C port.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: typec: Fix htmldocs warning
Heikki Krogerus [Mon, 21 May 2018 12:20:47 +0000 (15:20 +0300)]
usb: typec: Fix htmldocs warning

Fix htmldocs warning:

drivers/usb/typec/mux.c:186: warning: Function parameter or member 'mux' not described in
'typec_mux_unregister'

Reported-by: kbuild test robot <lkp@intel.com>
Fixes: bdecb33af34f ("usb: typec: API for controlling USB Type-C Multiplexers")
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousbip: vhci_sysfs: fix potential Spectre v1
Gustavo A. R. Silva [Sat, 19 May 2018 01:13:42 +0000 (20:13 -0500)]
usbip: vhci_sysfs: fix potential Spectre v1

pdev_nr and rhport can be controlled by user-space, hence leading to
a potential exploitation of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:
drivers/usb/usbip/vhci_sysfs.c:238 detach_store() warn: potential spectre issue 'vhcis'
drivers/usb/usbip/vhci_sysfs.c:328 attach_store() warn: potential spectre issue 'vhcis'
drivers/usb/usbip/vhci_sysfs.c:338 attach_store() warn: potential spectre issue 'vhci->vhci_hcd_ss->vdev'
drivers/usb/usbip/vhci_sysfs.c:340 attach_store() warn: potential spectre issue 'vhci->vhci_hcd_hs->vdev'

Fix this by sanitizing pdev_nr and rhport before using them to index
vhcis and vhci->vhci_hcd_ss->vdev respectively.

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: gadget: function: printer: avoid wrong list handling in printer_write()
Yoshihiro Shimoda [Mon, 21 May 2018 11:18:07 +0000 (20:18 +0900)]
usb: gadget: function: printer: avoid wrong list handling in printer_write()

When printer_write() calls usb_ep_queue(), a udc driver (e.g.
renesas_usbhs driver) may call usb_gadget_giveback_request() in
the udc .queue ops immediately. Then, printer_write() calls
list_add(&req->list, &dev->tx_reqs_active) wrongly. After that,
if we do unbind the printer driver, WARN_ON() happens in
printer_func_unbind() because the list entry is not removed.

So, this patch moves list_add(&req->list, &dev->tx_reqs_active)
calling before usb_ep_queue().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agotypec: tcpm: Provide fwnode pointer as part of psy_cfg
Adam Thomson [Tue, 22 May 2018 15:16:24 +0000 (16:16 +0100)]
typec: tcpm: Provide fwnode pointer as part of psy_cfg

For supply registration, provide fwnode pointer of the port device,
via the power_supply_config structure, to allow other psy drivers
to add us as a supplier. At present this only applies to DT
based platforms using the 'power-supplies' DT property, but in the
future should also work for ACPI platforms when the relevant support
is added to the power_supply core.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Suggested-by: Heikki Krogerus <heikki.krogerus@linux.intel.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>
6 years agopower: supply: Add fwnode pointer to power_supply_config struct
Adam Thomson [Tue, 22 May 2018 15:16:23 +0000 (16:16 +0100)]
power: supply: Add fwnode pointer to power_supply_config struct

To allow users of the power supply framework to be hw description
agnostic, this commit adds the ability to pass a fwnode pointer,
via the power_supply_config structure, to the initialisation code
of the core, instead of explicitly specifying of_ndoe. If that
fwnode pointer is provided then it will automatically resolve down
to of_node on platforms which support it, otherwise it will be NULL.

In the future, when ACPI support is added, this can be modified to
accommodate ACPI without the need to change calling code which
already provides the fwnode handle in this manner.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Suggested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: mtu3: fix warning of sleep in atomic context in notifier callback
Chunfeng Yun [Wed, 23 May 2018 08:53:20 +0000 (16:53 +0800)]
usb: mtu3: fix warning of sleep in atomic context in notifier callback

The notifier callbacks of extcon are called in atomic context, but the
callbacks will call regulator_enable()/regulator_disable() which may
sleep caused by mutex, so use work queue to call the sleep functions.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: mtu3: reset gadget when VBUS_FALL interrupt arises
Chunfeng Yun [Wed, 23 May 2018 08:53:19 +0000 (16:53 +0800)]
usb: mtu3: reset gadget when VBUS_FALL interrupt arises

When VBUS_FALL interrupt arises, it means U3 device is disconnected
with host, so need reset status of gadget

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: mtu3: avoid sleep in atomic context when enter test mode
Chunfeng Yun [Wed, 23 May 2018 08:53:18 +0000 (16:53 +0800)]
usb: mtu3: avoid sleep in atomic context when enter test mode

Use readl_poll_timeout_atomic() instead of readl_poll_timeout()
in atomic context

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: mtu3: clear test_mode flag when reset
Chunfeng Yun [Wed, 23 May 2018 08:53:17 +0000 (16:53 +0800)]
usb: mtu3: clear test_mode flag when reset

Clear test_mode flag when the gadget is reset by host, otherwise
will affect the next test item.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: mtu3: fix uncontinuous SeqN issue after disable EP
Chunfeng Yun [Wed, 23 May 2018 08:53:16 +0000 (16:53 +0800)]
usb: mtu3: fix uncontinuous SeqN issue after disable EP

Reset EP when disable it to reset data toggle for U2 EP, and
SeqN, flow control status etc for U3 EP, this can avoid
issue of uncontinuous SeqN

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: mtu3: re-enable controller to accept LPM request after LPM resume
Chunfeng Yun [Wed, 23 May 2018 08:53:15 +0000 (16:53 +0800)]
usb: mtu3: re-enable controller to accept LPM request after LPM resume

After the controller receives a LPM request, it will reject the LPM
request, and need software to re-enable it after LPM resume if the
controller doesn't remote wakeup from L1 automatically

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: debugfs: add debugfs interface to enable compliance mode for a port
Mathias Nyman [Mon, 21 May 2018 13:40:06 +0000 (16:40 +0300)]
xhci: debugfs: add debugfs interface to enable compliance mode for a port

Enable compliance transition for a port by writing "compliance" to the
ports portsc file in debugfs.
port must be "Not-connected" and Link must be in RxDetect state to enable
compliance mode.

Only needed for host that have CTC flag set.
Allows state transitioning to compliance at 1st LFPS timeout.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: debugfs: add usb ports to xhci debugfs
Mathias Nyman [Mon, 21 May 2018 13:40:05 +0000 (16:40 +0300)]
xhci: debugfs: add usb ports to xhci debugfs

Add ports/portxx/portsc for each xHC hardware usb port to debugfs.
Showing the content of the port status and control register for
each port (PORTSC)

Portxx is numbered starting from 1 for historical reasons to better
match port numbering shown by lsusb and other places.

Ports in debugfs are in the order XHC controller has them,
In most cases USB2 ports come first, followed by USB3 ports.
i.e. USB2 ports are port01-portxx, and USB3 portxx-portmax.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: xhci-mem: remove port_arrays and the code initializing them
Mathias Nyman [Mon, 21 May 2018 13:40:04 +0000 (16:40 +0300)]
xhci: xhci-mem: remove port_arrays and the code initializing them

As we are now using the new port strtuctes the port_arrays
are no longer needed, remove them completely

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci-mtk: use xhci hub structures to get number of ports in roothubs
Mathias Nyman [Mon, 21 May 2018 13:40:03 +0000 (16:40 +0300)]
xhci-mtk: use xhci hub structures to get number of ports in roothubs

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: xhci-hub: use port structure members instead of xhci_get_ports()
Mathias Nyman [Mon, 21 May 2018 13:40:02 +0000 (16:40 +0300)]
xhci: xhci-hub: use port structure members instead of xhci_get_ports()

xhci_get_ports() is one of the last functions using port_arrays in
xhci-hub.c. We get the same data directly from hub and port structures
instead, so convert and remove both xhci_get_ports() and port_arrays from
all function that no longer need it.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: use port structures instead of port arrays in xhci.c functions
Mathias Nyman [Mon, 21 May 2018 13:40:01 +0000 (16:40 +0300)]
xhci: use port structures instead of port arrays in xhci.c functions

get rid of port iomem arrays and use port structures in the following
functions:
xhci_find_raw_port_number()
xhci_disable_port_wake_on_bits()
xhci_set_usb2_hardware_lpm()
xhci_all_ports_seen_u0()
compliance_mode_recovery()

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: change xhci_test_and_clear_bit() to use new port structure
Mathias Nyman [Mon, 21 May 2018 13:40:00 +0000 (16:40 +0300)]
xhci: change xhci_test_and_clear_bit() to use new port structure

Don't use pointers to port array and port index as function parameters
in xhci_test_and_clear_bit(), just use a pointer to the right port
structure.

xhci_test_and_clear_bit() was the last port_array user in
xhci_get_port_status() and handle_port_status(), so remove the
port_array from them as well.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: change xhci_set_link_state() to work with port structures
Mathias Nyman [Mon, 21 May 2018 13:39:59 +0000 (16:39 +0300)]
xhci: change xhci_set_link_state() to work with port structures

Remove old iomem port array and index as parameters, just
send a ponter to a port strucure instread

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: rename faked_port_index to hcd_portnum
Mathias Nyman [Mon, 21 May 2018 13:39:58 +0000 (16:39 +0300)]
xhci: rename faked_port_index to hcd_portnum

hcd_portnum is a better desctiption than faked_port_index, and
is in line with the name the port structure uses.

No functional changes

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: xhci-ring: use port structures for port event handler
Mathias Nyman [Mon, 21 May 2018 13:39:57 +0000 (16:39 +0300)]
xhci: xhci-ring: use port structures for port event handler

use port structures in the port event handler.
Getting the right hcd and hcd portnumber from the hardware port number
is a lot easier with port structures, and allows us to remove a lot
of the previous code, including the find_faked_portnum_from_hw_index()
function

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: xhci-hub: use new port structures for cas and wake mask functions.
Mathias Nyman [Mon, 21 May 2018 13:39:56 +0000 (16:39 +0300)]
xhci: xhci-hub: use new port structures for cas and wake mask functions.

Use port structures instead of mmio port arrays for
xhci_port_missing_cas_quirk() and xhci_set_remote_wake_mask() in
xhci-hub.c

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: xhci-hub: use new port structures to get port address instead of port array
Mathias Nyman [Mon, 21 May 2018 13:39:55 +0000 (16:39 +0300)]
xhci: xhci-hub: use new port structures to get port address instead of port array

Use the new port structures for functions in xhci-hub.c to get
port mmio address of portsc register instead of the port array

xhci_get_port_io_addr() is no longer needeed and is removed.
Plan is to get rid of the mmio port array completely.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: Add helper to get xhci roothub from hcd
Mathias Nyman [Mon, 21 May 2018 13:39:54 +0000 (16:39 +0300)]
xhci: Add helper to get xhci roothub from hcd

quick way to get the xhci roothub and thus all the ports
belonging to a certain hcd

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: set hcd pointers for xhci usb2 and usb3 roothub structures
Mathias Nyman [Mon, 21 May 2018 13:39:53 +0000 (16:39 +0300)]
xhci: set hcd pointers for xhci usb2 and usb3 roothub structures

Allows us to know the correct hcd a xhci roothub and its ports
belong to.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: Create new structures to store xhci port information
Mathias Nyman [Mon, 21 May 2018 13:39:52 +0000 (16:39 +0300)]
xhci: Create new structures to store xhci port information

Current way of having one array telling only the port speed,
and then two separate arrays with mmio addresses for usb2 and usb3 ports
requeres helper functions to transate  hw to hcd, and hcd to hw port
numbers, and is hard to expand.

Instead create a structure describing a port, including the mmio address,
the port hardware index, hcd port index, and a pointer to the roothub
it belongs to.

Create one array containing all port structures in the same order the
hardware controller sees them. Then add an array of port pointers to
each xhci hub structure pointing to the ports that belonging to the
roothub.

This way we can easily convert hw indexed port events to usb core
hcd port numbers, and vice versa usb core hub hcd port numbers
to hw index and mmio address.

Other benefit is that we can easily find the parent hcd and xhci
structure of a port structure. This is useful in debugfs where
we can give one port structure pointer as parameter and get both
the correct mmio address and xhci lock needed to set some port
parameter.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: hisilicon: support HiSilicon STB xHCI host controller
Jianguo Sun [Mon, 21 May 2018 13:39:51 +0000 (16:39 +0300)]
xhci: hisilicon: support HiSilicon STB xHCI host controller

This commit adds support for HiSilicon STB xHCI host controller.
There are two xHCI host controllers on HiSilicon STB SoCs. Each
one requires additional configuration before exposing interface
compliant with xHCI.

Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Jianguo Sun <sunjianguo1@huawei.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agodt-bindings: usb: add bindings doc for HiSilicon STB xHCI host controller
Jianguo Sun [Mon, 21 May 2018 13:39:50 +0000 (16:39 +0300)]
dt-bindings: usb: add bindings doc for HiSilicon STB xHCI host controller

This commit adds bindings doc for HiSilicon STB xHCI host controller.

Signed-off-by: Jianguo Sun <sunjianguo1@huawei.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: xhci: dbc: Add SPDX identifiers to dbc files
Lu Baolu [Mon, 21 May 2018 13:39:49 +0000 (16:39 +0300)]
usb: xhci: dbc: Add SPDX identifiers to dbc files

Update the xhci dbc files with the correct SPDX license identifiers.

Fixes: dfba2174dc42 ("usb: xhci: Add DbC support in xHCI driver")
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Philippe Ombredanne <pombredanne@nexB.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoMerge tag 'usb-for-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Thu, 24 May 2018 15:46:53 +0000 (17:46 +0200)]
Merge tag 'usb-for-v4.18' of git://git./linux/kernel/git/balbi/usb into usb-next

usb: changes for v4.18 merge window

A total of 98 non-merge commits, the biggest part being in dwc3 this
time around with a large refactoring of dwc3's transfer handling code.

We also have a new driver for Aspeed virtual hub controller.

Apart from that, just a list of miscellaneous fixes all over the place.

6 years agousb: musb: gadget: fix to_musb_ep() to not return NULL
Bin Liu [Mon, 21 May 2018 13:42:22 +0000 (08:42 -0500)]
usb: musb: gadget: fix to_musb_ep() to not return NULL

UDC core ensures the usb_ep parameter passed in is not NULL, so
checking if (ep != NULL) is pointless.

Convert to_musb_ep() to a simple macro to not directly return NULL to
avoid warnings from code static analysis tools.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: gadget: fix to_musb_request() to not return NULL
Bin Liu [Mon, 21 May 2018 13:42:21 +0000 (08:42 -0500)]
usb: musb: gadget: fix to_musb_request() to not return NULL

The gadget function drivers should ensure the usb_request parameter
passed in is not NULL. UDC core doesn't check if it is NULL, so MUSB
driver shouldn't have to check it either.

Convert to_musb_request() to a simple macro to not directly return NULL
to avoid warnings from code static analysis tools.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoUSB: musb: dsps: propagate device-tree node
Johan Hovold [Mon, 21 May 2018 13:42:20 +0000 (08:42 -0500)]
USB: musb: dsps: propagate device-tree node

To be able to use DSPS-based controllers with device-tree descriptions
of the USB topology, we need to associate the glue device's device-tree
node with the child controller device.

Note that this can also be used to eventually let USB core manage
generic phys.

Also note that the other glue drivers will require similar changes to be
able to describe their buses in DT.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: disable otg protocol support
Bin Liu [Mon, 21 May 2018 13:42:19 +0000 (08:42 -0500)]
usb: musb: disable otg protocol support

As decided in the discussion [1] we are deleting the otg protocol
support from the musb drivers.

First this patch disables the flags for enabling the otg protocols. We
will later gradually delete the otg protocol code from the musb drivers.

[1] https://www.spinics.net/lists/linux-usb/msg167003.html

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: remove references to default_a of struct usb_otg
Bin Liu [Mon, 21 May 2018 13:42:18 +0000 (08:42 -0500)]
usb: musb: remove references to default_a of struct usb_otg

musb drivers do not use the otg fsm framework, so referencing to
otg->default_a doesn't have any effect, so remove the references.

But tusb6010 glue driver uses it locally to control the vbus power, so
keep the references in tusb6010 only.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: break the huge isr musb_stage0_irq() into small functions
Bin Liu [Mon, 21 May 2018 13:42:17 +0000 (08:42 -0500)]
usb: musb: break the huge isr musb_stage0_irq() into small functions

musb_stage0_irq() is 400+ lines long. Break its interrupt events
handling into each individual functions to make it easy to read.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: remove unused members in struct musb_hdrc_config
Bin Liu [Mon, 21 May 2018 13:42:16 +0000 (08:42 -0500)]
usb: musb: remove unused members in struct musb_hdrc_config

The following members in struct musb_hdrc_config are not used,
so remove them.

soft_con
utm_16
big_endian
mult_bulk_tx
mult_bulk_rx
high_iso_tx
high_iso_rx
dma
dma_channels
dyn_fifo_size
vendor_ctrl
vendor_stat
vendor_req
dma_req_chan
musb_hdrc_eps_bits

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: remove duplicated port mode enum
Bin Liu [Mon, 21 May 2018 13:42:15 +0000 (08:42 -0500)]
usb: musb: remove duplicated port mode enum

include/linux/usb/musb.h already defines enum for musb port mode, so
remove the duplicate in musb_core.h and use the definition in musb.h.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: dsps: remove duplicated get_musb_port_mode()
Bin Liu [Mon, 21 May 2018 13:42:14 +0000 (08:42 -0500)]
usb: musb: dsps: remove duplicated get_musb_port_mode()

musb_core already has musb_get_mode(), so remove the duplicate from
musb_dsps.c.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: remove duplicated quirks flag
Bin Liu [Mon, 21 May 2018 13:42:13 +0000 (08:42 -0500)]
usb: musb: remove duplicated quirks flag

Both musb_io and musb_platform_ops in struct musb define a quirks flag
for the same purpose.  Let's remove the one in struct musb_io, and use
that in struct musb_platform_ops instead.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: remove some register access wrapper functions
Bin Liu [Mon, 21 May 2018 13:42:12 +0000 (08:42 -0500)]
usb: musb: remove some register access wrapper functions

The following wrappers were defined because of Blackfin support. Now
Blackfin support is removed, these wrappers are no longer needed, so
remove them.

musb_write_txfifosz
musb_write_txfifoadd
musb_write_rxfifosz
musb_write_rxfifoadd
musb_write_ulpi_buscontrol
musb_read_txfifosz
musb_read_txfifoadd
musb_read_rxfifosz
musb_read_rxfifoadd
musb_read_ulpi_buscontrol
musb_read_hwvers

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: remove adjust_channel_params() callback from musb_platform_ops
Bin Liu [Mon, 21 May 2018 13:42:11 +0000 (08:42 -0500)]
usb: musb: remove adjust_channel_params() callback from musb_platform_ops

Now Blackfin support is removed, nobody uses adjust_channel_params() any
more, so remove it from struct musb_platform_ops.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: remove readl/writel from struct musb_platform_ops
Bin Liu [Mon, 21 May 2018 13:42:10 +0000 (08:42 -0500)]
usb: musb: remove readl/writel from struct musb_platform_ops

Now Blackfin support is removed, we no longer need function pointers for
musb_readl() and musb_writel().

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: merge musbhsdma.h into musbhsdma.c
Bin Liu [Mon, 21 May 2018 13:42:09 +0000 (08:42 -0500)]
usb: musb: merge musbhsdma.h into musbhsdma.c

Now Blackfin support is removed, header musbhsdma.h is only included in
musbhsdma.c. So let's merge the content in musbhsdma.h to musbhsdma.c
and delete musbhsdma.h.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoUSB: serial: pl2303: add support for tx xon/xoff flow control
Florian Zumbiehl [Sun, 20 May 2018 00:23:12 +0000 (02:23 +0200)]
USB: serial: pl2303: add support for tx xon/xoff flow control

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 <florz@florz.de>
[ johan: rewrite logic using pl2303_termios_change() helper ]
Signed-off-by: Johan Hovold <johan@kernel.org>
6 years agotty: add missing const to termios hw-change helper
Johan Hovold [Mon, 21 May 2018 11:08:44 +0000 (13:08 +0200)]
tty: add missing const to termios hw-change helper

Add missing const qualifiers to the parameters of the termios hw-change
helper, which is used by a few USB serial drivers. This specifically
allows the pl2303 driver to use const arguments in one of its helper as
well.

Cc: Jiri Slaby <jslaby@suse.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
6 years agoUSB: serial: ftdi_sio: clean up flow control management
Johan Hovold [Fri, 18 May 2018 13:25:50 +0000 (15:25 +0200)]
USB: serial: ftdi_sio: clean up flow control management

Clean up the somewhat convoluted hardware-assisted flow control
handling.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
6 years agoUSB: serial: ftdi_sio: drop unnecessary urb_ variable prefixes
Johan Hovold [Fri, 18 May 2018 13:25:49 +0000 (15:25 +0200)]
USB: serial: ftdi_sio: drop unnecessary urb_ variable prefixes

Drop urb_ prefixes from value and index variables used in control
requests.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
6 years agoUSB: serial: ftdi_sio: use non-underscore fixed types
Johan Hovold [Fri, 18 May 2018 13:25:48 +0000 (15:25 +0200)]
USB: serial: ftdi_sio: use non-underscore fixed types

Replace all __u types with their u counterparts throughout the driver
(whose structures are not exported to user space).

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
6 years agoUSB: serial: ftdi_sio: fix IXON/IXOFF mixup
Johan Hovold [Fri, 18 May 2018 13:25:47 +0000 (15:25 +0200)]
USB: serial: ftdi_sio: fix IXON/IXOFF mixup

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 <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
6 years agousb: dwc2: gadget: Fix coverity issue
Grigor Tovmasyan [Tue, 3 Apr 2018 11:22:25 +0000 (15:22 +0400)]
usb: dwc2: gadget: Fix coverity issue

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 <tovmasya@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: gadget: udc: renesas_usb3: fix double phy_put()
Yoshihiro Shimoda [Mon, 2 Apr 2018 12:21:31 +0000 (21:21 +0900)]
usb: gadget: udc: renesas_usb3: fix double phy_put()

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: <stable@vger.kernel.org> # v4.15+
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>