Commit graph

14115 commits

Author SHA1 Message Date
Greg Kroah-Hartman 4d4bac4499 usb: patches for v3.20 merge window
Here's the big pull request for Gadgets and PHYs. It's
 a total of 217 non-merge commits with pretty much everything
 being touched.
 
 The most important bits are a ton of new documentation for
 almost all usb gadget functions, a new isp1760 UDC driver,
 several improvements to the old net2280 UDC driver, and
 some minor tracepoint improvements to dwc3.
 
 Other than that, a big list of minor cleanups, smaller bugfixes
 and new features all over the place.
 
 Signed-off-by: Felipe Balbi <balbi@ti.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJU0lRFAAoJEIaOsuA1yqRE17sP/R4iPwrPQGVQBaqg5AOHZGEe
 dKf9GqZZIPzNIs4146Ua5W/9d4U6zQKndy+fRQaNEVc2SR3Tm0IwOSokvSaC3FYr
 NEGHMoRnTWd/JWSVB/6sy0qn8rKRMbkxR7u9lG9M/JACUymn3NJfH4D0jq85ewPR
 0Tjv4g5wGnv3YEmnWgR5ieFgn0OxgUBiGUF7QufgMp7G3F2hjmeligBD0jt3w6tD
 G4oMHp+pRfPCcm8mcdiHoP3aXOtNJ824rI+b1EZkKBKeo7FxRDIe48Vl107XOpOB
 yUFnQVGZazh1Oi6Vxmh9O1mmjpNOir/4dni7gZfh1uGC7cJ7tSkOfbN4jH4Ycsay
 Ckt8XQkmf/z9VWTONsAkDwfPhnMbxCafz8Fi/UdOXsoR69YV1MKnt1zRN5dzgNq9
 7EIqDwPPJi6qwLACoqxVYknSmXQqhW8B0IMPpMqEByvR1mnIOWomlFot63AufMaQ
 +uS7JGJguUmMvkyP1FJRKcPsd9u4PYll5JzymPsvSB6xtDisVFqYb3BbfieZHpBn
 +/ZFqltT71pQ3TxIx2ZiTk1e91PiKJUbEQikV6TBiLhgtkpn2J8obHtF50K4+xHh
 wXOU3VHFd2ZONN+WB5F5EoVtZiwsd3pARr8QJRcVhdXltTWElJ2qsA4Z1+5QVhAy
 mqXYcwsvBe9C+5p2pYwR
 =bGMq
 -----END PGP SIGNATURE-----

Merge tag 'usb-for-v3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:

usb: patches for v3.20 merge window

Here's the big pull request for Gadgets and PHYs. It's
a total of 217 non-merge commits with pretty much everything
being touched.

The most important bits are a ton of new documentation for
almost all usb gadget functions, a new isp1760 UDC driver,
several improvements to the old net2280 UDC driver, and
some minor tracepoint improvements to dwc3.

Other than that, a big list of minor cleanups, smaller bugfixes
and new features all over the place.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-02-04 11:03:20 -08:00
Bin Liu 9298b4aad3 usb: musb: fix device hotplug behind hub
The commit 889ad3b "usb: musb: try a race-free wakeup" breaks device
hotplug enumeraitonn when the device is connected behind a hub while usb
autosuspend is enabled.

Adding finish_resume_work into runtime resume callback fixes the issue.

Also resume root hub is required to resume the bus from runtime suspend,
so move musb_host_resume_root_hub() back to its original location, where
handles RESUME interrupt.

Signed-off-by: Bin Liu <b-liu@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-02-04 11:16:47 -06:00
Roshan Pius 251a17f5af usb: dwc2: Fix a bug in reading the endpoint directions from reg.
According to  the DWC2 datasheet, the HWCFG1 register stores
the configured endpoint directions for endpoints 0-15 in bit positions
0-31.
==========================
Endpoint Direction (EpDir)
This 32-bit field uses two bits per endpoint to determine the endpoint
direction.
Endpoint
Bits [31:30]: Endpoint 15 direction
Bits [29:28]: Endpoint 14 direction
....
Bits [3:2]: Endpoint 1 direction
Bits[1:0]: Endpoint 0 direction (always BIDIR)
==========================

The DWC2 driver is currently interpreting the contents of the register
as directions for endpoints 1-15 which leads to an error in determining
the configured endpoint directions in the core because the first 2 bits
determine the direction of endpoint 0 and not 1.

This is based on testing/next branch in Felipe's git.

Signed-off-by: Roshan Pius <rpius@chromium.org>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-02-04 11:16:47 -06:00
Julius Werner 7fa40910e0 usb: Retry port status check on resume to work around RH bugs
The EHCI controller on the RK3288 SoC is violating basic parts of the
USB spec and thereby unable to properly resume a suspended port. It does
not start SOF generation within 3ms of finishing resume signaling, so
the attached device will drop of the bus again. This is a particular
problem with runtime PM, where accessing the device will trigger a
resume that immediately makes it unavailable (and reenumerate with a new
handle).

Thankfully, the persist feature is generally able to work around stuff
like that. Unfortunately, it doesn't quite work in this particular case
because the controller will turn off the CurrentConnectStatus bit for an
instant while the device is reconnecting, which causes the kernel to
conclude that it permanently disappeared. This patch adds a tiny retry
mechanism to the core port resume code which will catch this case and
shouldn't have any notable impact on other controllers.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-03 15:28:32 -08:00
Zhuang Jin Can 7671bd1e97 Revert "usb: Reset USB-3 devices on USB-3 link bounce"
This revert a82b76f7fa.

The commit causes an extra reset in remote wakeup as described in:
http://www.spinics.net/lists/linux-usb/msg119080.html

Signed-off-by: Zhuang Jin Can <jin.can.zhuang@intel.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-03 15:28:32 -08:00
Sergei Shtylyov 673016d9f7 uhci-hub: use HUB_CHAR_*
Fix  using the  bare number  to set the 'wHubCharacteristics' field of the Hub
Descriptor while the values are #define'd in <linux/usb/ch11.h>.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-03 15:28:32 -08:00
Kevin Hao c31316cb6c usb: kconfig: replace PPC_OF with PPC
The PPC_OF is a ppc specific option which is used to mean that the
firmware device tree access functions are available. Since all the
ppc platforms have a device tree, it is aways set to 'y' for ppc.
So it makes no sense to keep a such option in the current kernel.
Replace it with PPC

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-03 15:28:32 -08:00
Andy Shevchenko 518ca8d932 ehci-pci: disable for Intel MID platforms (update)
This is a follow up to the previously submitted commit cefa9a31a5 (ehci-pci:
disable for Intel MID platforms).

It includes the following changes:
- table and function are renamed to reflect this is not only about ChipIdea
- ChipIdea PCI driver (ci_hdrc_pci.c) gets the comment about the table in
  ehci-pci.c
- MIPS IDs removed from the list since it was discovered and tested on Intel
  MID platforms

Reviewed-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-03 15:28:31 -08:00
Christoph Jaeger 8333d3cd06 usb: gadget: Kconfig: use bool instead of boolean
Keyword 'boolean' for type definition attributes is considered
deprecated and, therefore, should not be used anymore.

See http://lkml.kernel.org/r/cover.1418003065.git.cj@linux.com
See http://lkml.kernel.org/r/1419108071-11607-1-git-send-email-cj@linux.com

Signed-off-by: Christoph Jaeger <cj@linux.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-02-02 14:58:10 -06:00
Dmitry Torokhov d9b2b19fc4 usb: musb: blackfin: remove incorrect __exit_p()
bfin_remove() is not (nor should it be) marked as __exit, so we should
not be using __exit_p() wrapper with it, otherwise unbinding through
sysfs does not work properly.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-02-02 13:04:55 -06:00
Greg Kroah-Hartman b3a54bf9ed Merge 3.19-rc7 into usb-next
We want the USB fixes in here to make merges easier.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-02 09:10:17 -08:00
Alan Stern c99197902d USB: fix use-after-free bug in usb_hcd_unlink_urb()
The usb_hcd_unlink_urb() routine in hcd.c contains two possible
use-after-free errors.  The dev_dbg() statement at the end of the
routine dereferences urb and urb->dev even though both structures may
have been deallocated.

This patch fixes the problem by storing urb->dev in a local variable
(avoiding the dereference of urb) and moving the dev_dbg() up before
the usb_put_dev() call.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Joe Lawrence <joe.lawrence@stratus.com>
Tested-by: Joe Lawrence <joe.lawrence@stratus.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-01-31 09:05:06 -08:00
Andy Shevchenko cefa9a31a5 ehci-pci: disable for Intel MID platforms
On some Intel MID platforms the ChipIdea USB controller is used. The EHCI PCI
is in conflict with the proper driver. The patch makes ehci-pci to be ignored
in favour of ChipIdea controller.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-01-31 09:05:06 -08:00
Andy Shevchenko e307ff0f78 usb: host: pci_quirks: joing string literals
The patch joins the string literals for happy debugging. There is no functional
change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-01-31 09:05:06 -08:00
Alan Stern 074f9dd55f USB: add flag for HCDs that can't receive wakeup requests (isp1760-hcd)
Currently the USB stack assumes that all host controller drivers are
capable of receiving wakeup requests from downstream devices.
However, this isn't true for the isp1760-hcd driver, which means that
it isn't safe to do a runtime suspend of any device attached to a
root-hub port if the device requires wakeup.

This patch adds a "cant_recv_wakeups" flag to the usb_hcd structure
and sets the flag in isp1760-hcd.  The core is modified to prevent a
direct child of the root hub from being put into runtime suspend with
wakeup enabled if the flag is set.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Nicolas Pitre <nico@linaro.org>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-01-31 09:05:06 -08:00
Alan Stern 3f2cee73b6 USB: usbfs: allow URBs to be reaped after disconnection
The usbfs API has a peculiar hole: Users are not allowed to reap their
URBs after the device has been disconnected.  There doesn't seem to be
any good reason for this; it is an ad-hoc inconsistency.

The patch allows users to issue the USBDEVFS_REAPURB and
USBDEVFS_REAPURBNDELAY ioctls (together with their 32-bit counterparts
on 64-bit systems) even after the device is gone.  If no URBs are
pending for a disconnected device then the ioctls will return -ENODEV
rather than -EAGAIN, because obviously no new URBs will ever be able
to complete.

The patch also adds a new capability flag for
USBDEVFS_GET_CAPABILITIES to indicate that the reap-after-disconnect
feature is supported.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Chris Dickens <christopher.a.dickens@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-01-31 09:05:06 -08:00
Oliver Neukum 17136d4984 cdc-acm: kill unnecessary messages
Memory allocation failures are reported by a central facility.
No need to repeat the job.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-31 08:58:39 -08:00
Oliver Neukum 7e860a6e7a cdc-acm: add sanity checks
Check the special CDC headers for a plausible minimum length.
Another big operating systems ignores such garbage.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
CC: stable@vger.kernel.org
Reviewed-by: Adam Lee <adam8157@gmail.com>
Tested-by: Adam Lee <adam8157@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-31 08:58:38 -08:00
Greg Kroah-Hartman dd32174081 USB-serial fixes for v3.19-rc7
Just another device id for cp210x.
 
 Signed-off-by: Johan Hovold <johan@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJUy37ZAAoJEEEN5E/e4bSVCsUP+wct4+ilz2bPR2I9KwNO8uRu
 uiGyMJwHUv13lbLcDpu4vD0Izkp5EGEjXmOYeogVmtCZ/enjwvNdWVgUaSZWmzHU
 sh49frhzoShaJfW8mjazmGMJoma9t8CjKMkiYfIPSf5bfLykbCLiuGS7puwUq7Io
 SvZ5Kl/ZuwDpidzRlOFnm2k/8YoYF+eynycJCbAmjKNp37mZQLhJQfgJhWwl3p8w
 K+ssxD90r4/pRdkyP9j7YxarGkAb/fH0decVM2x72LDw3VZeSTeLacoqm2QeFBqt
 Pi6wRHZ1xiBSEaE7YMGHux8t889qlryYBPpHyVCCfVMptzsBsi5roT1s4KIqOZMC
 vYm19Q8Yjy/As0vG2dTga9BIS0uwbtEMlbx2yzf9ekjHApZojBa4JOixwWhQpvO3
 zFK6Sp6YinaSAE7nVUtQC3j839dL9zctiyMAi+CBoO7NH01UN1kWUIlhgpU4kKfX
 4Kk1QGS8skZ7nOr5+p2DhrVTC+xnjitMHmXYCZOKFy6TA8cZwYtCWetEGDFpRZO7
 pIIx6YSNjI+Me21BMaY9LxyPDADT72Md3g51HlRWSP78RgSfhGtmT91Wt/vVVTLG
 hK+mmd33cj4BhC2aY5XIRCvOvDPSRDn/lB7QsXPOYB8jcmUW4JSdwNZh3xKbq7DF
 QKVUbm8ucwDAjnscVNpI
 =2F/N
 -----END PGP SIGNATURE-----

Merge tag 'usb-serial-3.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-next

USB-serial fixes for v3.19-rc7

Just another device id for cp210x.

Signed-off-by: Johan Hovold <johan@kernel.org>
2015-01-30 17:38:43 -08:00
Greg Kroah-Hartman 0c1514a2c3 USB-serial updates for v3.20-rc1
Removal of dead code in mos7840 and a clean-up of the option blacklist
 handling.
 
 Signed-off-by: Johan Hovold <johan@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJUy3/BAAoJEEEN5E/e4bSVTt4QAKY0YCC55XHW7p/BZNx0orFb
 JK3EjIIaoIv4JQz4eqF+Xsnsw6vmI6YbqwZ32VWzYYNLn9Enyl7RwWfpCCSlSxNS
 pbP0eUwu9wZaC91ucDPw8L7FnhthzjUF7FMuciF/VR4vhJczKVM5QSFu6RTFffZL
 uvMuWD4z8waxtVhIq9i6gT+4hbNJSYV9vcHv/P4hXlDjDDwK7mgDBX/AG+3aJZS6
 2h2l45Uwb+c4/BYKUdd3ZLmyDAQfxXDMMEiquF+5WT2QRLTLwP6I7fPD3rHHPslR
 ZdzrtKkqWtcQVzyDEHUyCsRcijshhi7iYQ5+iJJYmB8OncY6EVAuQiM4Np7v5MX7
 CR/zU2BnaLxt2TikNVjPSKCPvSkU6ygGKOGBhsrUNdVH2H7CKNVa9L7/h+RXjK9F
 Gye8Z3jCKREUyosSbWrG0tScmv+Pe1h5nQUByYVo8ys2cIcpZcnfM3vQ6QVLqmdQ
 UHwPVozG7m61njXCJfp7KaRBX9055PhHaUF2bJWMwQpQSipB/X154XBnNHNiTLRw
 wjAfgi/a7blq3S09o8htFwuiCENCgoDtV8Niu+At72g9PeDvo47sWHNPmqdPGsUa
 hrB7wAPIcA4wkvfGYLPhdrFNJDfrPEB/MBYWYqDwluekEM6UMlsMBzJzeTBrb04T
 9xuY00N99wtX+fprat5N
 =NeuI
 -----END PGP SIGNATURE-----

Merge tag 'usb-serial-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-next

Johan writes:

USB-serial updates for v3.20-rc1

Removal of dead code in mos7840 and a clean-up of the option blacklist
handling.

Signed-off-by: Johan Hovold <johan@kernel.org>
2015-01-30 17:37:59 -08:00
Fabio Estevam 74379991f6 usb: phy: phy-generic: Fix USB PHY gpio reset
Since commit e9f2cefb0c ("usb: phy: generic: migrate to gpio_desc") a
kernel hang is observed on imx51-babbage board:

[    1.392824] ci_hdrc ci_hdrc.1: doesn't support gadget
[    1.397975] ci_hdrc ci_hdrc.1: EHCI Host Controller
[    1.403205] ci_hdrc ci_hdrc.1: new USB bus registered, assigned bus number 1
[    1.422335] ci_hdrc ci_hdrc.1: USB 2.0 started, EHCI 1.00
[    1.432962] hub 1-0:1.0: USB hub found
[    1.437119] hub 1-0:1.0: 1 port detected

This hang happens because the reset GPIO stays at logic level 0.

The USB PHY reset gpio is defined in the dts file as:

reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;

, which means it is active low, so what the gpio reset pin needs to do in this
case is the following:

- Go to logic level 0 to reset the USB PHY
- Stay at 0 for a bit
- Go back to logic level 1

When switching to gpiod API we need to following according to
Documentation/gpio/consumer.txt:

"The first thing a driver must do with a GPIO is setting its direction. If no
direction-setting flags have been given to gpiod_get*(), this is done by
invoking one of the gpiod_direction_*() functions:

	int gpiod_direction_input(struct gpio_desc *desc)
	int gpiod_direction_output(struct gpio_desc *desc, int value)"

Since no direction-setting flags have been given to devm_gpiod_get_optional()
in our case, we need to use gpiod_direction_output to comply with the gpiod API.

With this change the USB PHY reset performs a proper reset, the kernel boots
fine and USB host is functional.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:38:51 -06:00
Arnd Bergmann b7974de821 usb: dwc2: fix USB core dependencies
It is currently possible to configure the dwc2 driver as built-in
when host mode or dual-role is enabled, but the USB core is
a loadable module. This leads to a link failure:

drivers/built-in.o: In function `_dwc2_hcd_start':
:(.text+0x84538): undefined reference to `usb_hcd_resume_root_hub'
drivers/built-in.o: In function `_dwc2_hcd_urb_dequeue':
:(.text+0x84aa0): undefined reference to `usb_hcd_check_unlink_urb'
:(.text+0x84e4c): undefined reference to `usb_hcd_unlink_urb_from_ep'
:(.text+0x84e74): undefined reference to `usb_hcd_giveback_urb'
drivers/built-in.o: In function `dwc2_assign_and_init_hc':
:(.text+0x86b98): undefined reference to `usb_hcd_unmap_urb_for_dma'
drivers/built-in.o: In function `_dwc2_hcd_urb_enqueue':
:(.text+0x8717c): undefined reference to `usb_hcd_link_urb_to_ep'
:(.text+0x872f4): undefined reference to `usb_hcd_unlink_urb_from_ep'
drivers/built-in.o: In function `dwc2_host_complete':
:(.text+0x875d4): undefined reference to `usb_hcd_unlink_urb_from_ep'
:(.text+0x87600): undefined reference to `usb_hcd_giveback_urb'
drivers/built-in.o: In function `dwc2_hcd_init':
:(.text+0x87ba8): undefined reference to `usb_disabled'
:(.text+0x87d38): undefined reference to `usb_create_hcd'
:(.text+0x88094): undefined reference to `usb_add_hcd'
:(.text+0x880dc): undefined reference to `usb_put_hcd'
drivers/built-in.o: In function `dwc2_hcd_remove':
:(.text+0x8821c): undefined reference to `usb_remove_hcd'
:(.text+0x8823c): undefined reference to `usb_put_hcd'
drivers/built-in.o: In function `dwc2_hc_handle_tt_clear.isra.10':
:(.text+0x88e2c): undefined reference to `usb_hub_clear_tt_buffer'
drivers/built-in.o: In function `dwc2_hcd_qtd_add':
:(.text+0x8b554): undefined reference to `usb_calc_bus_time'

To fix the problem, this patch changes the dependencies so that
dwc2 host mode can only be enabled if either the USB core is
built-in or both USB and dwc2 are modules.

Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:36:44 -06:00
Yoshihiro Shimoda ffb9da6575 usb: renesas_usbhs: fix NULL pointer dereference in dma_release_channel()
This patch fixes an issue that the following commit causes NULL
pointer dereference in dma_release_channel().
 "usb: renesas_usbhs: add support for requesting DT DMA"
 (commit id abd2dbf6bb)

The usbhsf_dma_init_dt() should set fifo->{t,r}x_chan to NULL if
dma_request_slave_channel_reason() returns IS_ERR value.
Otherwise, usbhsf_dma_quit() will call dma_release_channel(), and then
NULL pointer dereference happens.

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
Reported-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:35:37 -06:00
Robert Jarzmik 0f4ff5f1f9 usb: phy: generic: fix the vbus interrupt request
Declare the interrupt as "one shot" so that it is masked until the end
of the threaded handler. This prevents the irq core from spitting out an
error :
  "Threaded irq requested with handler=NULL and !ONESHOT for irq 63"

This was introduced by commit "usb: phy: generic: add vbus support".

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:35:17 -06:00
Robert Jarzmik 9eb0797722 usb: phy: generic: fix the gpios to be optional
All the gpios, ie. reset-gpios and vbus-detect-gpio, should be optional
and not prevent the driver from working. Fix the regression in the
behavior introduced by commit "usb: phy: generic: migrate to gpio_desc".

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:35:15 -06:00
Gregory Herrero b4c2378df6 usb: dwc2: gadget: initialize controller in pullup callback
USB reset interrupt is no more used to reset the controller.
Thus, reset the controller in pullup callback as described by
Synopsys programming guide. Otherwise enumeration sometimes
fails when usb configuration is switched without physical
disconnection.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:34:19 -06:00
Mian Yousaf Kaukab f889f23d1c usb: dwc2: gadget: replace constants with defines
Defines are more readable and searchable than constants.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:34:11 -06:00
Mian Yousaf Kaukab fa4a8d722b usb: dwc2: gadget: fix phy interface configuration
hsotg->phyif is set in dwc2_gadget_init according to phy interface
width. Use it for configuration instead of hardcoded value.
Moreover, set USB turnaround time according to phy width.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:33:54 -06:00
Mian Yousaf Kaukab ccb34a9101 usb: dwc2: gadget: fix debug message for zlp
Print debug message according to zlp direction. Always saying
"Sending" is misleading.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:33:39 -06:00
Gregory Herrero 86e37bf9f5 usb: dwc2: gadget: don't modify pullup status during reset
Pullup doesn't need to be enabled during usb reset since it is
already enabled. This leads to shorter chirp-k duration if done
during usb reset.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:32:59 -06:00
Gregory Herrero 643cc4dee1 usb: dwc2: gadget: add reset flag in init function
Add a flag to request physical reset of the controller when
s3c_hsotg_core_init_disconnected is called.
During the usb reset, controller must not be fully reconfigured and
resetted. Else this leads to shorter chirp-k duration during
enumeration.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:32:41 -06:00
Mian Yousaf Kaukab 7d24c1b5a7 usb: dwc2: gadget: add unaligned buffers support
When using DMA, dwc2 requires buffers to be 4 bytes aligned. Use
bounce buffers if they are not.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:31:13 -06:00
Mian Yousaf Kaukab d7c747c590 usb: dwc2: gadget: remove hardcoded if (0) and if (1) checks
Remove dead code as well.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:30:55 -06:00
Gregory Herrero 58f7c43e06 usb: dwc2: gadget: fix a typo in comment
s3c_hsotg_process_req_feature comments was not correct

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:30:50 -06:00
Gregory Herrero 9e14d0a566 usb: dwc2: gadget: add TEST_MODE feature support
Handle SET_FEATURE TEST_MODE request sent by the host.
Slightly rework FEATURE request handling to allow parsing
other request types than Endpoint.
Also add a debugfs to change test mode value from user space.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:30:44 -06:00
Gregory Herrero c00dd4a6ec usb: dwc2: gadget: fix clear halt feature handling
When clearing HALT on an endpoint, req->complete of in progress
requests must be called with locks off. New request should only be
started if there is not already a pending request on the endpoint.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:30:29 -06:00
Gregory Herrero b46146d59f usb: dwc2: host: resume root hub on remote wakeup
When a remote wakeup happens during bus_suspend, hcd needs to resume
its root hub.

Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:29:38 -06:00
Arnd Bergmann fbba7db399 usb: musb: add omap-control dependency
The omap musb front-end calls into the phy driver directly
instead of using a generic phy interface, which causes a link
error when the specific driver is not built-in:

drivers/built-in.o: In function `omap2430_musb_disable':
usb/musb/omap2430.c:480: undefined reference to `omap_control_usb_set_mode'
drivers/built-in.o: In function `omap2430_musb_enable':
usb/musb/omap2430.c:466: undefined reference to `omap_control_usb_set_mode'
usb/musb/omap2430.c:447: undefined reference to `omap_control_usb_set_mode'
drivers/built-in.o: In function `omap_musb_set_mailbox':
usb/musb/omap2430.c:273: undefined reference to `omap_control_usb_set_mode'
usb/musb/omap2430.c:304: undefined reference to `omap_control_usb_set_mode'
drivers/built-in.o:(.debug_addr+0xbd9e0): more undefined references to `omap_control_usb_set_mode' follow

This adds an explicit dependency.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: ca784be36c ("usb: start using the control module driver")
Cc: <stable@vger.kernel.org> # v3.9+
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:36:29 -06:00
Arnd Bergmann a0cb12e2ed usb: musb: add generic usb phy dependencies
Multiple musb glue drivers depend on the generic usb phy support,
but fail to list it as a dependency in Kconfig. This results
in build erros like:

drivers/built-in.o: In function `am35x_remove':
:(.text+0xadacc): undefined reference to `usb_phy_generic_unregister'
drivers/built-in.o: In function `am35x_probe':
:(.text+0xae1c8): undefined reference to `usb_phy_generic_register'
:(.text+0xae244): undefined reference to `usb_phy_generic_unregister'
drivers/built-in.o: In function `jz4740_remove':
:(.text+0xaf648): undefined reference to `usb_phy_generic_unregister'
drivers/built-in.o: In function `jz4740_musb_init':
:(.text+0xaf694): undefined reference to `usb_phy_generic_register'

This adds the ones that are missing.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:35:56 -06:00
Peter Chen 3f6dd4feda usb: udc-core: add is_selfpowered sys entry
The user can read it through sys entry.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:35:48 -06:00
Peter Chen dadac9861f usb: musb: gadget: use common is_selfpowered
Delete private selfpowered variable, and use common one.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:35:43 -06:00
Peter Chen bcdea50312 usb: dwc3: gadget: use common is_selfpowered
Delete private selfpowered variable, and use common one.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:35:40 -06:00
Peter Chen 716013b0ab usb: gadget: pch_udc: set value for common is_selfpowered
Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:35:36 -06:00
Peter Chen d618c368ef usb: gadget: atmel_usba_udc: set value for common is_selfpowered
Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:35:32 -06:00
Peter Chen d4a1c47946 usb: gadget: net2272: use common is_selfpowered
Delete private selfpowered variable, and use common one.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:35:27 -06:00
Peter Chen b3764dd1a3 usb: gadget: s3c2410_udc: set value for common is_selfpowered
Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:35:23 -06:00
Peter Chen c8678d9f28 usb: gadget: net2280: use common is_selfpowered
Delete private selfpowered variable, and use common one.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:35:18 -06:00
Peter Chen 0bcff9eaa8 usb: gadget: r8a66597-udc: set value for common is_selfpowered
Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:35:13 -06:00
Peter Chen 58ae8e0b14 usb: gadget: omap_udc: set value for common is_selfpowered
Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:35:04 -06:00
Peter Chen 4651fcf329 usb: gadget: fsl_udc_core: set value for common is_selfpowered
fsl udc core assumes itself always self powered, so set is_selfpowered
is 1.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:34:25 -06:00
Peter Chen d60d939221 usb: gadget: lpc32xx_udc: use common is_selfpowered
Delete private selfpowered variable, and use common one.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:34:18 -06:00
Peter Chen 5d9cb6afc4 usb: gadget: dummy_hcd: set value for common is_selfpowered
Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:33:01 -06:00
Peter Chen 4605437e33 usb: gadget: bdc_udc: set value for common is_selfpowered
Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:32:54 -06:00
Peter Chen a17fd41206 usb: renesas_usbhs: gadget: set value for common is_selfpowered
Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:32:51 -06:00
Peter Chen 7301971f50 usb: gadget: at91_udc: use common is_selfpowered
Delete private selfpowered variable, and use common one.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:32:45 -06:00
Peter Chen 1009f9a36d usb: chipidea: udc: add set_selfpowered gaget ops
The gadget power property will be used at get_status request.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:32:37 -06:00
Felipe Balbi 5c7b3b02de usb: dwc3: gadget: add missing spin_lock()
commit 8e74475b0e (usb: dwc3: gadget: use udc-core's
reset notifier) added support for the new UDC core's
reset notifier to dwc3 but while at it, it removed
a spin_lock() from dwc3_reset_gadget() which might
cause an unbalanced spin_unlock() further down the line

Fixes: 8e74475b0e (usb: dwc3: gadget: use udc-core's reset notifier)
Cc: <stable@vger.kernel.org> # v3.19
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:29:18 -06:00
Felipe Balbi 73815280a5 usb: dwc3: remove reliance on dev_vdbg()
By moving all dev_vdbg() to tracepoints, we
can finally get rid of dev_vdbg() usage from
dwc3.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 14:00:10 -06:00
Felipe Balbi 6bac4ff0a5 usb: dwc3: trace: add trace logs for core and gadget
Sometimes we want to just print a formatted
string without passing any extra data. The
following will be used for removing reliance
on dev_vdbg() from dwc3.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 13:56:10 -06:00
Felipe Balbi e9f2aa871c usb: dwc3: gadget: WARN() in case of unknown IRQ
if an unknown IRQ event is triggered, that means
the HW is really misbehaving. Instead of printing
a debug message, let's WARN() so users report
when that happens.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 13:56:10 -06:00
Felipe Balbi 4cd8f6d055 usb: dwc3: gadget: avoid variable shadowing
We already have both ret and dwc defined in this
same function.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 13:25:09 -06:00
Andrzej Pietrasiewicz 578d0b6b61 usb: gadget: uvc: comments for iterating over streaming hierarchy
The purpose of the functions and their parametrs might not be obvious
to the reader, so explain it.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 10:00:27 -06:00
Andrzej Pietrasiewicz 727968357e usb: gadget: uvc: use explicit type instead of void *
The first parameter of __uvcg_iter_strm_cls() is always used in
the context of struct uvcg_streaming_header, so change the
function prototype accordingly.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 10:00:21 -06:00
Peter Chen e235f7b86f usb: phy: mxs: add delay before set phyctrl.clkgate
There is a request from IC engineer that if we doesn't
set phypwd as 0xffffffff, we need to delay about five
32Khz cycles before set phy's pwd register, otherwise,
the wakeup signal may can't wake up controller.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:40:49 -06:00
Peter Chen efdbd3a5d6 usb: phy: mxs: do not set PWD.RXPWD1PT1 for low speed connection
At very rare cases, the SoF will not send out after resume with
low speed connection. The workaround is do not power down
PWD.RXPWD1PT1 bit during the suspend.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:40:46 -06:00
Li Jun 7b09e67639 usb: phy: mxs: refine mxs_phy_disconnect_line
For non-otg mode, we keep the usage of disconnect line between phy analog
and digital unchanging; for otg mode, at peripheral role, we keep the usage
unchanging too, at host role, the digital part needs to know dp/dm change
to respond device's data pulse when it is at low power mode.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:40:42 -06:00
Peter Chen dd811ba742 usb: phy: mxs: don't need IP fix for imx6sx
The RLT code has already done it, so no software operation is needed.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:40:39 -06:00
Laurent Pinchart d21daf1e90 usb: isp1760: Fix USB disabled check
The isp1760 driver registration function returns an error if USB is
disabled. This made sense when the driver only supported host
controllers, but now that it supports peripheral controllers host
support isn't mandatory anymore.

Fix this by returning an error only when both the HCD and UDC functions
are disabled, either through the kernel configuration or at runtime.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:39:51 -06:00
Laurent Pinchart 1f8d9b9b50 usb: isp1760: Remove duplicate usb_disabled() check
Both isp1760_register() and isp1761_pci_probe() check whether USB is
disabled by calling usb_disabled(), and bail out with an error if it is.
One check is enough, remove the PCI-specific check.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:39:47 -06:00
Laurent Pinchart 100832abf0 usb: isp1760: Make HCD support optional
Enable compilation of the isp1760 driver in pure host mode, pure device
mode, or dual-role mode.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:39:42 -06:00
Laurent Pinchart 7ef077a8ad usb: isp1760: Move driver from drivers/usb/host/ to drivers/usb/isp1760/
Now that this is DRD, it doesn't make sense to keep it under
drivers/usb/host.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:39:38 -06:00
Laurent Pinchart 0316ca6319 usb: isp1760: Add device controller support
The ISP1761 is a dual-mode host and device controller backward
compatible on the host side with the ISP1760. Add support for the device
controller.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:39:35 -06:00
Laurent Pinchart 9a66e13290 usb: isp1760: Move PORT1 configuration to core code
Configuring the mode of operation of port 1 doesn't belong to the HCD
code, as it's related to the soon to come UDC support. Move the
configuration to core code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:39:30 -06:00
Laurent Pinchart 5171446a3a usb: isp1760: Initialize the bus interface in core code
Although the corresponding register is part of the HCD register space,
processor bus initialization is not specific to the HCD. To prepare for
device controller support, move bus interface initialization to core
code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:39:26 -06:00
Laurent Pinchart 667c45c2f1 usb: isp1760: Set IRQF_SHARED flag in core code
The IRQF_SHARED flag needs to be set regardless of the bus type. Don't
require glue code to set it manually.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:39:22 -06:00
Laurent Pinchart 4b1a577d41 usb: isp1760: Move core code to isp1760-core.c
Move core device initialization to a central location in order to share
it with the device mode implementation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:39:16 -06:00
Laurent Pinchart e19c99e759 usb: isp1760: Reorganize header files
The isp1760-rhcd.h header contains PTD constants and structures only
useful for the HCD implementation. It also contains register definitions
that will be needed by common code when implementing support for the
ISP1761 device controller, but doesn't contain the isp1760_hcd structure
definition that will also be used by common code.

Move definitions to the right location and create an isp1760-regs.h to
store register definitions. No change other than moving definitions and
modifying indentation is performed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:39:12 -06:00
Laurent Pinchart ea0b1fabc7 usb: isp1760: Prefix driver data structures with isp1760_
The slotinfo and memory_chunk structures are specific to the driver and
defined in a header file. Prefix them with isp1760_ to avoid namespace
clashes.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:39:07 -06:00
Laurent Pinchart cdd36e872c usb: isp1760: Decouple usb_hdc and isp1760_priv
Allocate the driver private data structure manually instead of using the
usb_hcd private space. This will allow skipping hcd registration for the
isp1761 when used in device mode only.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:39:03 -06:00
Laurent Pinchart c770e00122 usb: isp1760: Refactor PCI initialization code
Move the initialization code out of the PCI probe function to a new
function in order to simplify and fix error handling.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:38:59 -06:00
Laurent Pinchart 10feee1446 usb: isp1760: Use the managed devm_ioremap_resource() API
This simplifies error and remove code paths.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:38:54 -06:00
Laurent Pinchart 4942e00e55 usb: isp1760: Pass resource pointer to isp1760_register
The function takes quite a few arguments, passing the resource pointer
instead of the start address and length simplifies it a bit.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:38:50 -06:00
Laurent Pinchart d69292a8f5 usb: isp1760: Remove busname argument to isp1760_register
The argument is unused, remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:38:46 -06:00
Laurent Pinchart 5a6356ac62 usb: isp1760: Prefix init_kmem_once and deinit_kmem_cache with isp1760_
The two functions are specific to the driver but have very generic
names, subject to collisions. Rename them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:38:41 -06:00
Laurent Pinchart 30573751da usb: isp1760: Fix indentation in probe error path
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:38:37 -06:00
Laurent Pinchart f0bdbb0ec6 usb: isp1760: Don't expose hcd to glue code from isp1760_register
The glue code probe functions don't need to access the hcd structure
anymore. Modify isp1760_register to return an integer error code instead
of the hcd pointer.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:38:33 -06:00
Laurent Pinchart 57f068bedc usb: isp1760: Manage device driver data in common code
Don't duplicate *_set_drvdata calls in glue code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:38:28 -06:00
Laurent Pinchart 10c73f09dc usb: isp1760: Move removal cleanup code to isp1760-hcd.c
The removal cleanup code is duplicated between the different bus glues.
Move it to a central location.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:38:24 -06:00
Laurent Pinchart c3cc40ccea usb: isp1760: Merge platform and OF glue codes
Both handle platform devices, merge them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:38:21 -06:00
Laurent Pinchart 5324713c99 usb: isp1760: Unmap I/O registers at platform device removal
The I/O registers are mapped in the HCD code but must be unmapped by
glue code. The OF and PCI glue code unmap them correctly but the
platform glue code is missing an iounmap() call. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:38:15 -06:00
Laurent Pinchart fcead8431d usb: isp1760: Retrieve pdev memory resource from hcd at remove time
The platform driver remove function needs to release the memory resource
requested at probe time. Instead of retrieving the resource from the
platform device, retrieve it from the usb_hcd. This mimics the behaviour
of the PCI and OF glues, and will make it easier to share code between
all three glue layers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:38:11 -06:00
Laurent Pinchart 8a8b96f487 usb: isp1760: Remove isp1760 glue structure
The structure is allocated for the sole purpose of holding a pointer to
the HCD and being stored in platform device driver data. Store the HCD
pointer directly instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:38:08 -06:00
Laurent Pinchart 7eb42c6e80 usb: isp1760: Use the gpio descriptor API
Switching to the managed gpio descriptor API simplifies both error and
cleanup code paths (by removing the need to free the gpio) and runtime
code (by removing manual handling of the active low flag). It also
permits handling the reset gpio entirely from within the HCD code,
sharing it between the different glue layers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:38:03 -06:00
Asaf Vertz 9fdd84d23c usb: gadget: zero: fix format string warnings
Fixed the following warnings (reported by cppcheck):
[drivers/usb/gadget/function/f_sourcesink.c:1217]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1261]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1305]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1349]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1393]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1437]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1476]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1520]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1564]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1608]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'

Reviewed-by: Amit Virdi <amit.virdi@st.com>
Signed-off-by: Asaf Vertz <asaf.vertz@tandemg.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:34:59 -06:00
Robert Baldyga 5e33f6fdf7 usb: gadget: ffs: add eventfd notification about ffs events
Add eventfd which notifies userspace about ep0 events and AIO completion
events. It simplifies using of FunctionFS with event loop, because now
we need to poll on single file (instead of polling on ep0 and eventfd's
supplied to AIO layer).

FunctionFS eventfd is not triggered if another eventfd is supplied to
AIO layer (in AIO request). It can be useful, for example, when we want
to handle AIO transations for chosen endpoint in separate thread.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:34:59 -06:00
Mario Schuknecht acba23fec5 usb: gadget: f_fs: Fix loop variable
Use if-loop variable 'epfile' instead of start variable 'epfiles'. Now the
correct endpoint file name is stored.

Signed-off-by: Mario Schuknecht <mario.schuknecht@dresearch-fe.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:34:59 -06:00
Mario Schuknecht df6738d0d2 usb: gadget: Fix os desc test
USB vendor type is encoded in field bmRequestType. Make test USB_TYPE_VENDOR
with bRequestType instead of bRequest.

Signed-off-by: Mario Schuknecht <mario.schuknecht@dresearch-fe.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:34:58 -06:00
Bin Liu cb83df77f3 usb: musb: cppi41: improve rx channel abort routine
1. set AUTOREQ to NONE at the beginning of teardown;

2. add delay for dma pipeline to drain;

3. Do not set USB_TDOWN bit for RX teardown.

  The CPPI hw has an issue that when tearing down a RX channel, if
  another RX channel is receiving data, the CPPI will lockup.

  To workaround the issue, do not set the CPPI TD bit. The steps before
  this point ensures the CPPI channel will be torn down properly.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:34:58 -06:00
Bin Liu 0149b07a9e usb: musb: cppi41: correct the macro name EP_MODE_AUTOREG_*
The macro EP_MODE_AUTOREG_* should be called EP_MODE_AUTOREQ_*, as they
are used for register AUTOREQ.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:34:58 -06:00
Yoshihiro Shimoda abd2dbf6bb usb: renesas_usbhs: add support for requesting DT DMA
This patch adds dma_request_slave_channel_reason() calling to request
dma slave channels for multiplatform environment.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:34:58 -06:00