pandora-kernel.git
9 years agousb: chipidea: add controller reset API
Peter Chen [Wed, 26 Nov 2014 05:44:32 +0000 (13:44 +0800)]
usb: chipidea: add controller reset API

Add controller reset API, currently it is used for device mode only.
It may be used for host/otg driver in future.

Ususally, we need this API for dual-role switch and back from hibernation
suspend to let the controller at default state.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: chipidea: remove flag CI_HDRC_REQUIRE_TRANSCEIVER
Peter Chen [Wed, 26 Nov 2014 05:44:31 +0000 (13:44 +0800)]
usb: chipidea: remove flag CI_HDRC_REQUIRE_TRANSCEIVER

Now, USB PHY is mandatory for chipidea core, the flag
CI_HDRC_REQUIRE_TRANSCEIVER is useless.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: chipidea: imx: add system power management support
Peter Chen [Wed, 26 Nov 2014 05:44:30 +0000 (13:44 +0800)]
usb: chipidea: imx: add system power management support

Add basic system power management support

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: chipidea: add system power management support
Peter Chen [Wed, 26 Nov 2014 05:44:29 +0000 (13:44 +0800)]
usb: chipidea: add system power management support

Add system power management support

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: chipidea: add hw_wait_phy_stable for getting stable status
Peter Chen [Wed, 26 Nov 2014 05:44:28 +0000 (13:44 +0800)]
usb: chipidea: add hw_wait_phy_stable for getting stable status

The phy needs some delay to output the stable status from low
power mode. And for OTGSC, the status inputs are debounced
using a 1 ms time constant, so, delay 2ms for controller to get
the stable status(like vbus and id) when the phy leaves low power.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: chipidea: remove the unnecessary delay after clear portsc.phcd
Peter Chen [Wed, 26 Nov 2014 05:44:27 +0000 (13:44 +0800)]
usb: chipidea: remove the unnecessary delay after clear portsc.phcd

The individual PHY driver should take this responsibility if it
needs to delay between clear portsc.phcd and let the phy leave
low power mode.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: chipidea: usbmisc_imx: Read MX53_USB_OTG_PHY_CTRL_1_OFFSET directly
Fabio Estevam [Wed, 26 Nov 2014 05:44:26 +0000 (13:44 +0800)]
usb: chipidea: usbmisc_imx: Read MX53_USB_OTG_PHY_CTRL_1_OFFSET directly

There is no need to do an intermediate step for reading the
MX53_USB_OTG_PHY_CTRL_1_OFFSET register.

Read it directly instead.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: chipidea: usbmisc_imx: Move the reading of USB_PHY_CTRL
Fabio Estevam [Wed, 26 Nov 2014 05:44:25 +0000 (13:44 +0800)]
usb: chipidea: usbmisc_imx: Move the reading of USB_PHY_CTRL

If 'evdo' property is not defined, then reading the MX25_USB_PHY_CTRL_OFFSET
register is an unneeded operation.

Move the reading of MX25_USB_PHY_CTRL_OFFSET inside the 'evdo' if block code,
where it is actually used.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: chipidea: ci_hdrc_imx.c: Remove unneeded OOM message
Fabio Estevam [Wed, 26 Nov 2014 05:44:24 +0000 (13:44 +0800)]
usb: chipidea: ci_hdrc_imx.c: Remove unneeded OOM message

MM core code already complains when devm_kzalloc() fails, so no need to print
the error locally.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: chipidea: core: Remove unneeded OOM message
Fabio Estevam [Wed, 26 Nov 2014 05:44:23 +0000 (13:44 +0800)]
usb: chipidea: core: Remove unneeded OOM message

MM core code already complains when devm_kzalloc() fails, so no need to print
the error locally.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: chipidea: using devm_request_irq to instead of request_irq
Peter Chen [Wed, 26 Nov 2014 05:44:22 +0000 (13:44 +0800)]
usb: chipidea: using devm_request_irq to instead of request_irq

Using devm_request_irq to instead of request_irq.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoMerge tag 'usb-for-v3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Tue, 25 Nov 2014 17:31:14 +0000 (09:31 -0800)]
Merge tag 'usb-for-v3.19' of git://git./linux/kernel/git/balbi/usb into usb-next

Felipe writes:

usb: patches for v3.19 merge window

This time, a very pull request with 216 non-merge
commits. Most of the commits contained here are
sparse or coccinelle fixes ranging from missing
'static' to returning 0 in case of errors.

More importantly, we have the removal the now
unnecessary 'driver' argument to ->udc_stop().

DWC2 learned about Dual-Role builds. Users of
this IP can now have a single driver built for
host and device roles.

DWC3 got support for two new HW platforms: Exynos7
and AMD.

The Broadcom USB 3.0 Device Controller IP is now
supported and so is PLX USB338x, which means DWC3
has lost is badge as the only USB 3.0 peripheral
IP supported on Linux.

Thanks for Tony Lindgren's work, we can now have
a distro-like kernel where all MUSB glue layers
can be built into the same kernel (statically
or dynamically linked) and it'll work in PIO (DMA
will come probably on v3.20).

Other than these, the usual set of cleanups and
non-critical fixes.

Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agoUSB: host: Remove ehci-octeon and ohci-octeon drivers
Alan Stern [Tue, 25 Nov 2014 11:28:46 +0000 (12:28 +0100)]
USB: host: Remove ehci-octeon and ohci-octeon drivers

Remove special-purpose octeon drivers and instead use ehci-platform
and ohci-platform as suggested with
http://marc.info/?l=linux-mips&m=140139694721623&w=2

[andreas.herrmann:
    fixed compile error]

Cc: David Daney <david.daney@cavium.com>
Cc: Alex Smith <alex.smith@imgtec.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: musb: Use IS_ENABLED for tusb6010
Tony Lindgren [Mon, 24 Nov 2014 19:05:06 +0000 (11:05 -0800)]
usb: musb: Use IS_ENABLED for tusb6010

This removes the ifdef clutter a bit and saves few lines.

It also makes it easier to detect the remaining places
where we have conditional building of code done based
on if defined for things like DMA.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: Allow multiple glue layers to be built in
Tony Lindgren [Mon, 24 Nov 2014 19:05:05 +0000 (11:05 -0800)]
usb: musb: Allow multiple glue layers to be built in

There's no reason any longer to keep it as a choice now that
the IO access has been fixed.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: Pass fifo_mode in platform data
Tony Lindgren [Mon, 24 Nov 2014 19:05:04 +0000 (11:05 -0800)]
usb: musb: Pass fifo_mode in platform data

This allows setting the correct fifo_mode when multiple
MUSB glue layers are built-in.

Cc: Fabio Baltieri <fabio.baltieri@linaro.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Apelete Seketeli <apelete@seketeli.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: Change end point selection to use new IO access
Tony Lindgren [Mon, 24 Nov 2014 19:05:03 +0000 (11:05 -0800)]
usb: musb: Change end point selection to use new IO access

This allows the endpoints to work when multiple MUSB glue
layers are built in.

Cc: Fabio Baltieri <fabio.baltieri@linaro.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Apelete Seketeli <apelete@seketeli.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: Change to use new IO access
Tony Lindgren [Mon, 24 Nov 2014 19:05:02 +0000 (11:05 -0800)]
usb: musb: Change to use new IO access

Change to use new IO access. This allows us to build in multiple
MUSB glue layers.

[ balbi@ti.com : switch to EXPORT_SYMBOL_GPL()
fix long lines ]

Cc: Fabio Baltieri <fabio.baltieri@linaro.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: Populate new IO functions for blackfin
Tony Lindgren [Mon, 24 Nov 2014 19:05:01 +0000 (11:05 -0800)]
usb: musb: Populate new IO functions for blackfin

Populate new IO functions for blackfin

Cc: Bryan Wu <cooloney@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: Populate new IO functions for tusb6010
Tony Lindgren [Mon, 24 Nov 2014 19:05:00 +0000 (11:05 -0800)]
usb: musb: Populate new IO functions for tusb6010

Let's populate the new IO functions for tusb6010 but not use
them yet.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: Add function pointers for IO access functions
Tony Lindgren [Mon, 24 Nov 2014 19:04:59 +0000 (11:04 -0800)]
usb: musb: Add function pointers for IO access functions

MUSB currently breaks badly if we try to build in support
for multiple platforms. This also happens if done as loadable
modules, which is not nice for distros.

Let's fix the issue by adding new struct musb_io for the IO
access functions that the platform code can populate. Note
that we don't want to use the current ops as that's really
platform_data and and set as a const.

This should allow eventually adding function pointers also
for the DMA code to struct musb_io, but that's a whole
different set of patches. For now, let's just fix the PIO
access.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: phy: Handle per-PHY event for connnect and disconnect events
Kiran Raparthy [Mon, 24 Nov 2014 17:24:59 +0000 (22:54 +0530)]
usb: phy: Handle per-PHY event for connnect and disconnect events

When usb is connected and enumerated in device mode or when
usb is disconnected, call usb_phy_set_event() from phy drivers
to handle per-PHY event.

[ toddpoynor@google.com : Original patch in Android ]

Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: Android Kernel Team <kernel-team@android.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Benoit Goby <benoit@android.com>
Cc: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Kiran Raparthy <kiran.kumar@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: remove early return on clock query
Dinh Nguyen [Mon, 24 Nov 2014 17:02:11 +0000 (11:02 -0600)]
usb: dwc2: remove early return on clock query

Since we have assigned clk=NULL, which is a valid clk, we should not
be returning when a clock node is not provide. Instead, we should return
only when we cannot enable the clock.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: Fix build warning when CONFIG_PM_SLEEP=n
Fabio Estevam [Wed, 19 Nov 2014 14:37:53 +0000 (12:37 -0200)]
usb: dwc2: Fix build warning when CONFIG_PM_SLEEP=n

Building with bcm2835_defconfig, which has CONFIG_PM_SLEEP=n causes the
following build warning:

drivers/usb/dwc2/platform.c:227:12: warning: 'dwc2_suspend' defined but not used [-Wunused-function]
drivers/usb/dwc2/platform.c:237:12: warning: 'dwc2_resume' defined but not used [-Wunused-function]

Annotate these functions with '__maybe_unused' to prevent the warnings.

Reported-by: Olof's autobuilder <build@lixom.net>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: udc: pxa25x: remove unnecessary NULL check
Felipe Balbi [Mon, 24 Nov 2014 14:40:01 +0000 (08:40 -0600)]
usb: gadget: udc: pxa25x: remove unnecessary NULL check

debugfs_remove() is safe against NULL pointers, so
let's remove the unnecessary NULL check before
calling it.

Reviewed-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: udc: lpc32xx: remove unnecessary NULL check
Felipe Balbi [Mon, 24 Nov 2014 14:39:10 +0000 (08:39 -0600)]
usb: gadget: udc: lpc32xx: remove unnecessary NULL check

debugfs_remove() is safe against NULL pointers, so
let's remove the unnecessary NULL check before
calling it.

Acked-by: Peter Chen <peter.chen@freeescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agoUSB: PCI-quirks: Deletion of unnecessary checks before the function call "pci_dev_put"
Markus Elfring [Fri, 21 Nov 2014 14:20:12 +0000 (15:20 +0100)]
USB: PCI-quirks: Deletion of unnecessary checks before the function call "pci_dev_put"

The pci_dev_put() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoUSB-SIS: Deletion of an unnecessary check before the function call "usb_put_dev"
Markus Elfring [Fri, 21 Nov 2014 14:50:44 +0000 (15:50 +0100)]
USB-SIS: Deletion of an unnecessary check before the function call "usb_put_dev"

The usb_put_dev() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoUSB-IP: Deletion of unnecessary checks before the function call "usb_put_dev"
Markus Elfring [Fri, 21 Nov 2014 15:33:18 +0000 (16:33 +0100)]
USB-IP: Deletion of unnecessary checks before the function call "usb_put_dev"

The usb_put_dev() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Valentina Manea <valentina.manea.m@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agohost: ehci-w90x900: fix error return code
Julia Lawall [Thu, 20 Nov 2014 17:34:01 +0000 (18:34 +0100)]
host: ehci-w90x900: fix error return code

Return a negative error code on failure.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostorage: Fix bus scan and multi-LUN support for SCM eUSCSI devices
Mark Knibbs [Sat, 8 Nov 2014 21:39:55 +0000 (21:39 +0000)]
storage: Fix bus scan and multi-LUN support for SCM eUSCSI devices

This patch does two things for SCM eUSCSI USB-SCSI converters:

1. SCM eUSCSI bridge devices are hard-wired to use SCSI ID 7. On connecting
the converter, access to that ID is attempted during the bus scan. Asking
the converter to issue INQUIRY commands to itself isn't very polite and
wastes time. Set this_id to 7 so __scsi_scan_target() skips it in the scan.

2. Enable multi-LUN support. eUSCSI devices don't support Get Max LUN
requests, returning an error (-32). [Different targets could have different
numbers of LUNs, so it wouldn't make sense to return a particular value in
response to Get Max LUN.]

usb_stor_scan_dwork() does this:
    /* For bulk-only devices, determine the max LUN value */
    if (us->protocol == USB_PR_BULK && !(us->fflags & US_FL_SINGLE_LUN)) {
            mutex_lock(&us->dev_mutex);
            us->max_lun = usb_stor_Bulk_max_lun(us);
            mutex_unlock(&us->dev_mutex);

It avoids calling usb_stor_Bulk_max_lun() if US_FL_SINGLE_LUN, but not for
US_FL_SCM_MULT_TARG. Since usb_stor_Bulk_max_lun() returns 0 in the error
case, us->max_lun was always set to 0.

[If the user doesn't want multi-LUN support (perhaps there are SCSI devices
which respond to commands on all LUNs?), the US_FL_SINGLE_LUN quirk can be
specified on the kernel command line.]

Signed-off-by: Mark Knibbs <markk@clara.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostorage: Enable multi-target mode as vendor driver does for SCM eUSCSI bridge
Mark Knibbs [Fri, 7 Nov 2014 22:02:19 +0000 (22:02 +0000)]
storage: Enable multi-target mode as vendor driver does for SCM eUSCSI bridge

usb_stor_euscsi_init() enables multi-target mode for SCM eUSB SCSI bridge
devices. The control message it sends has wLength = 1 and the byte sent is
0x01. While that works, the SCM Windows driver does it with wLength = 0. We
may as well match what the SCM driver does.

Signed-off-by: Mark Knibbs <markk@clara.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: ehci-orion: enable big-endian support
Marcin Wojtas [Wed, 12 Nov 2014 23:49:50 +0000 (00:49 +0100)]
usb: ehci-orion: enable big-endian support

This commit fixes ehci-orion operation in big-endian mode by enabling byteswap
when accessing registers using 'rdl' and 'wrl' macros.

Signed-off-by: Grzegorz Jaszczyk <jaz@semihalf.com>
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoUSB: cdc-acm: check for valid interfaces
Greg Kroah-Hartman [Fri, 7 Nov 2014 16:48:15 +0000 (08:48 -0800)]
USB: cdc-acm: check for valid interfaces

We need to check that we have both a valid data and control inteface for both
types of headers (union and not union.)

References: https://bugzilla.kernel.org/show_bug.cgi?id=83551
Reported-by: Simon Schubert <2+kernel@0x2c.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agocdc-acm: memory leak in error case
Oliver Neukum [Thu, 20 Nov 2014 13:54:35 +0000 (14:54 +0100)]
cdc-acm: memory leak in error case

If probe() fails not only the attributes need to be removed
but also the memory freed.

Reported-by: Ahmed Tamrawi <ahmedtamrawi@gmail.com>
Signed-off-by: Oliver Neukum <oneukum@suse.de>
CC: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: dwc3: return error code from the most recent call
Julia Lawall [Sat, 22 Nov 2014 14:56:47 +0000 (15:56 +0100)]
usb: dwc3: return error code from the most recent call

Copy-paste error from the previous block of error handling code.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e,e1;
@@

if (IS_ERR(e)) {
  ...
(
  ret = PTR_ERR(e);
|
*  ret = PTR_ERR(e1);
)
  ...
  return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: ss_ep_in_comp_desc can be static
kbuild test robot [Mon, 24 Nov 2014 14:31:23 +0000 (22:31 +0800)]
usb: gadget: ss_ep_in_comp_desc can be static

drivers/usb/gadget/legacy/printer.c:222:34: sparse: symbol 'ss_ep_in_comp_desc' was not declared. Should it be static?
drivers/usb/gadget/legacy/printer.c:234:34: sparse: symbol 'ss_ep_out_comp_desc' was not declared. Should it be static?

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: function: delete an unnecessary check before rndis_add_hdr()
Markus Elfring [Fri, 21 Nov 2014 13:51:43 +0000 (14:51 +0100)]
usb: gadget: function: delete an unnecessary check before rndis_add_hdr()

The rndis_add_hdr() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: gadget: rework suspend/resume code to correctly restore gadget state
Marek Szyprowski [Fri, 21 Nov 2014 14:14:49 +0000 (15:14 +0100)]
usb: dwc2: gadget: rework suspend/resume code to correctly restore gadget state

Suspend/resume code assumed that the gadget was always started and
enabled to connect to usb bus. This means that the actual state of the
gadget (started/stopped or connected/disconnected) was not correctly
preserved on suspend/resume cycle. This patch fixes this issue.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: gadget: add mutex to serialize init/deinit calls
Marek Szyprowski [Fri, 21 Nov 2014 14:14:48 +0000 (15:14 +0100)]
usb: dwc2: gadget: add mutex to serialize init/deinit calls

This patch adds mutex, which protects initialization and
deinitialization procedures against suspend/resume methods. This mutex
will be needed by the updated suspend/resume calls, which tracks gadget
state.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: gadget: rework disconnect event handling
Marek Szyprowski [Fri, 21 Nov 2014 14:14:47 +0000 (15:14 +0100)]
usb: dwc2: gadget: rework disconnect event handling

This patch adds a call to s3c_hsotg_disconnect() from 'end session'
interrupt (GOTGINT_SES_END_DET) to correctly notify gadget subsystem
about unplugged usb cable. DISCONNINT interrupt cannot be used for this
purpose, because it is asserted only in host mode.

To avoid reporting disconnect event more than once, a disconnect call has
been moved from USB_REQ_SET_ADDRESS handling function to SESSREQINT
interrupt. This way driver ensures that disconnect event is reported
either when usb cable is unplugged or every time the host starts a new
session. To handle devices which has been synthesized without
SRP support, connected state is set in ENUMDONE interrupt.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc3: exynos: Add provision for AXI UpScaler clock on exynos7
Vivek Gautam [Fri, 21 Nov 2014 13:35:47 +0000 (19:05 +0530)]
usb: dwc3: exynos: Add provision for AXI UpScaler clock on exynos7

DWC3 controller on Exynos7 SoC has separate control for
AXI UpScaler which connects DWC3 DRD controller to AXI bus.
Get the gate clock for the same to control it across power
cycles.

Suggested-by: Anton Tikhomirov <av.tikhomirov@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc3: exynos: Add provision for suspend clock
Vivek Gautam [Fri, 21 Nov 2014 13:35:46 +0000 (19:05 +0530)]
usb: dwc3: exynos: Add provision for suspend clock

DWC3 controller on Exynos SoC series have separate control for
suspend clock which replaces pipe3_rx_pclk as clock source to
a small part of DWC3 core that operates when SS PHY is in its
lowest power state (P3) in states SS.disabled and U3.

Suggested-by: Anton Tikhomirov <av.tikhomirov@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc3: exynos: Remove local variable for clock from probe
Vivek Gautam [Fri, 21 Nov 2014 13:35:45 +0000 (19:05 +0530)]
usb: dwc3: exynos: Remove local variable for clock from probe

There's no need to keep one local variable for clock, and
then assign the same to 'clk' member of dwc3_exynos.
Just cleaning it up.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: phy: introduce usb_phy_set_event interface
Kiran Raparthy [Fri, 21 Nov 2014 06:01:20 +0000 (11:31 +0530)]
usb: phy: introduce usb_phy_set_event interface

PHY drivers require a generic interface to handle per-PHY events.

usb_phy_set_event interface sets event to phy event.
PHY drivers call this interface for each phy event.

Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: Android Kernel Team <kernel-team@android.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Arve Hj�nnev�g <arve@android.com>
Cc: Benoit Goby <benoit@android.com>
[Original patch in Android from Todd]
Cc: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Kiran Raparthy <kiran.kumar@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: net2280: Fix superspeed dma_done()
Mario Schuknecht [Sun, 16 Nov 2014 20:21:45 +0000 (21:21 +0100)]
usb: gadget: net2280: Fix superspeed dma_done()

Parameter three in function call dma_done() is incorrect.
Move use of variable 'tmp' after if-condition.

Signed-off-by: Mario Schuknecht <mario.schuknecht@dresearch-fe.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: at91_udc: move prepare clk into process context
Ronald Wahl [Wed, 19 Nov 2014 15:37:27 +0000 (16:37 +0100)]
usb: gadget: at91_udc: move prepare clk into process context

Commit 7628083227b6bc4a7e33d7c381d7a4e558424b6b (usb: gadget: at91_udc:
prepare clk before calling enable) added clock preparation in interrupt
context. This is not allowed as it might sleep. Also setting the clock
rate is unsafe to call from there for the same reason. Move clock
preparation and setting clock rate into process context (at91udc_probe).

Signed-off-by: Ronald Wahl <ronald.wahl@raritan.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: <stable@vger.kernel.org> # v3.17+
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: atmel_usba_udc: remove release function
Bo Shen [Wed, 19 Nov 2014 09:19:06 +0000 (17:19 +0800)]
usb: gadget: atmel_usba_udc: remove release function

As the driver call usb_add_gadget_udc --> usb_add_gadget_udc_release
with NULL as release parameter, so it will use usb_udc_no_release.
So, the release in driver won't used, remove it.

And at the same time, in the usb_add_gadget_udc_release will set the
gadget name, so remove it also in driver.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: at91_udc: remove unused release function
Bo Shen [Wed, 19 Nov 2014 09:19:05 +0000 (17:19 +0800)]
usb: gadget: at91_udc: remove unused release function

As the driver call usb_add_gadget_udc --> usb_add_gadget_udc_release
with NULL as release parameter, so it will use usb_udc_no_release.
So, the release in driver won't used, remove it.

And at the same time, in the usb_add_gadget_udc_release will set the
gadget name, so remove it also in driver.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: add USB3 support to the printer driver
Jorge Ramirez-Ortiz [Tue, 18 Nov 2014 20:11:54 +0000 (15:11 -0500)]
usb: gadget: add USB3 support to the printer driver

Add SS descriptors to support the capabilities provided by USB3 controller
drivers; unit tests run using a PLX 3380 [max transfer speed measured of 1Gbps]

This driver shall fallback to lower operating modes when the higher ones are
not available.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: phy: propagate __of_usb_find_phy()'s error on failure
Arjun Sreedharan [Thu, 20 Nov 2014 15:53:36 +0000 (21:23 +0530)]
usb: phy: propagate __of_usb_find_phy()'s error on failure

When __of_usb_find_phy() fails, it returns -ENODEV - its
error code has to be returned by devm_usb_get_phy_by_phandle().
Only when the former function succeeds and try_module_get()
fails should -EPROBE_DEFER be returned.

[ balbi@ti.com : remove trailing whitespace ]

Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc3: keystone: fix error return code
Julia Lawall [Thu, 20 Nov 2014 17:33:58 +0000 (18:33 +0100)]
usb: dwc3: keystone: fix error return code

Return a negative error code on failure.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc3: trace: don't save pointers
Felipe Balbi [Thu, 20 Nov 2014 16:12:32 +0000 (10:12 -0600)]
usb: dwc3: trace: don't save pointers

There was another instance where we were
holding pointers which could be long gone.

Fix that by caching only values pointed to
by such pointer.

Because no crash has been observed, this patch
will be sent on v3.19 merge window, instead of
-rc.

Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: core: Disable the Interrupts till BABBLE is fully handled
George Cherian [Fri, 14 Nov 2014 08:24:46 +0000 (13:54 +0530)]
usb: musb: core: Disable the Interrupts till BABBLE is fully handled

Disable the MUSB interrupts till MUSB is recovered fully from BABBLE
condition. There are chances that we could get multiple interrupts
till the time the babble recover work gets scheduled. Sometimes
this could even end up in an endless loop making MUSB itself unusable.

Reported-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: musb_cppi41: recognize HS devices in hostmode
Sebastian Andrzej Siewior [Thu, 13 Nov 2014 17:28:47 +0000 (18:28 +0100)]
usb: musb: musb_cppi41: recognize HS devices in hostmode

There is a poll loop for max 25us for HS devices. Now guess what, I
tested it in gadget mode and forgot about the little detail. Nobody seem
to have it noticed…
This patch adds the missing logic for hostmode so it is recognized in
host and device mode properly.

Fixes: 50aea6fca771 ("usb: musb: cppi41: fire hrtimer according to
programmed channel length")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: replace hard coded registers with defines
Roman Byshko [Mon, 10 Nov 2014 20:53:32 +0000 (21:53 +0100)]
usb: musb: replace hard coded registers with defines

musb registers can be dumped using the file regdump
which is created in debugfs. Up to now  hard coded
register addresses are used for that. Different glue
layers however have different register addresses. The
patch addresses this issue by substituting bare register
addresses with defines.

Signed-off-by: Roman Byshko <rbyshko@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: core: make sure musb is in RPM_ACTIVE on resume
Sebastian Andrzej Siewior [Thu, 13 Nov 2014 17:33:08 +0000 (18:33 +0100)]
usb: musb: core: make sure musb is in RPM_ACTIVE on resume

On am335x-evm with musb in host mode and using it as a wakeup source the
following happens once the CPU comes out of suspend to ram:
|PM: Wakeup source MPU_WAKE
|PM: noirq resume of devices complete after 15.453 msecs
|PM: early resume of devices complete after 2.222 msecs
|PM: resume of devices complete after 507.351 msecs
|Restarting tasks ...
|------------[ cut here ]------------
|WARNING: CPU: 0 PID: 322 at drivers/usb/core/urb.c:339 usb_submit_urb+0x494/0x4c8()
|URB cc0db380 submitted while active
|[<c0348e64>] (usb_submit_urb) from [<c0340f94>] (hub_activate+0x2b8/0x49c)
|[<c0340f94>] (hub_activate) from [<c03411dc>] (hub_resume+0x14/0x1c)
|[<c03411dc>] (hub_resume) from [<c034be10>] (usb_resume_interface.isra.4+0xdc/0x110)
|[<c034be10>] (usb_resume_interface.isra.4) from [<c034beb0>] (usb_resume_both+0x6c/0x13c)
|[<c034beb0>] (usb_resume_both) from [<c034cca4>] (usb_runtime_resume+0x10/0x14)
|[<c034cca4>] (usb_runtime_resume) from [<c02bbd80>] (__rpm_callback+0x2c/0x60)
|[<c02bbd80>] (__rpm_callback) from [<c02bbdd4>] (rpm_callback+0x20/0x74)
|[<c02bbdd4>] (rpm_callback) from [<c02bcc48>] (rpm_resume+0x380/0x548)
|[<c02bcc48>] (rpm_resume) from [<c02bcb00>] (rpm_resume+0x238/0x548)
|[<c02bcb00>] (rpm_resume) from [<c02bd08c>] (__pm_runtime_resume+0x64/0x94)
|[<c02bd08c>] (__pm_runtime_resume) from [<c034b5a4>] (usb_autopm_get_interface+0x18/0x5c)
|[<c034b5a4>] (usb_autopm_get_interface) from [<c03438b8>] (hub_thread+0x10c/0x115c)
|[<c03438b8>] (hub_thread) from [<c005a70c>] (kthread+0xbc/0xd8)
|---[ end trace 036aa5fe78203142 ]---
|hub 1-0:1.0: activate --> -16
|hub 2-0:1.0: activate --> -16

The reason for this backtrace is the attempt of the USB code to resume
the HUB twice and thus enqueue the status URB twice.
Alan Stern was a great help by explaining how the USB code supposed to
work and what is most likely the problem. The root problem is that after
resume the musb runtime-suspend state remains RPM_SUSPENDED.
According to git log it RPM was added for the omap2430 platform. If I
understand it correct the omap2430 invokes a get on musb once a cable is
connected and a put once the cable is gone. In between the device could
go auto-idle/off. Not sure what happens when the device goes into suspend
but then I guess it was gadget only.
On DSPS I see only a get in probe and put in remove function. This would
forbid RPM from working but then the devices enterns suspended state
anyway :)

To get rid of this warning, I set the device state to RPM_ACTIVE which
the expected state.

Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: <stable@vger.kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_hid: fix error handling in ghid_setup()
Dan Carpenter [Thu, 13 Nov 2014 06:20:59 +0000 (09:20 +0300)]
usb: gadget: f_hid: fix error handling in ghid_setup()

There were a two issues here.

1) We returned PTR_ERR(NULL) which means success if class_create()
   failed.
2) If alloc_chrdev_region() failed then we should clean up before
   returning.

Also kernel style is to have "error handling" as opposed to "success
handling".  In the original code checking for "if (!status) " is
confusing and this bad style is what lead to bug #2.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_hid: use after free in hidg_alloc_inst()
Dan Carpenter [Thu, 13 Nov 2014 06:19:47 +0000 (09:19 +0300)]
usb: gadget: f_hid: use after free in hidg_alloc_inst()

We free "opts" on the error path and then dereference it.

Fixes: 21a9476a7ba8 ('usb: gadget: hid: add configfs support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: Add UDC driver for Broadcom USB3.0 device controller IP BDC
Ashwini Pahuja [Thu, 13 Nov 2014 18:22:32 +0000 (10:22 -0800)]
usb: gadget: Add UDC driver for Broadcom USB3.0 device controller IP BDC

This patch adds a UDC driver for Broadcom's USB3.0 Peripheral core named BDC.
BDC supports control traffic on ep0 and bulk/Int/Isoch traffic on all other
endpoints.

[ balbi@ti.com : fix build error on randconfig due to lack of
<linux/dmapool.h> ]

Signed-off-by: Ashwini Pahuja <ashwini.linux@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: Update Kconfig to support dual-role
Dinh Nguyen [Tue, 11 Nov 2014 17:13:40 +0000 (11:13 -0600)]
usb: dwc2: Update Kconfig to support dual-role

Update DWC2 kconfig and makefile to support dual-role mode. The platform
file will always get compiled for the case where the controller is directly
connected to the CPU. So for loadable modules, dwc2.ko is built for host,
peripheral, and dual-role mode. The PCI bus interface will be called
dwc2_pci.ko and the platform interface module will be called dwc2_platform.ko.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: move usb_disabled() call to host driver only
Dinh Nguyen [Tue, 11 Nov 2014 17:13:39 +0000 (11:13 -0600)]
usb: dwc2: move usb_disabled() call to host driver only

Since platform.c will get built for both Host and Gadget, if we leave the
usb_disabled() call in platform.c, it results in the following build error
when (!USB && USB_GADGET) condition is met.

ERROR: "usb_disabled" [drivers/usb/dwc2/dwc2_platform.ko] undefined!

Since usb_disabled() is mostly used to disable USB host functionality, move
the call the host portion for the DWC2 driver.

Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: gadget: Do not fail probe if there isn't a clock node
Dinh Nguyen [Tue, 11 Nov 2014 17:13:38 +0000 (11:13 -0600)]
usb: dwc2: gadget: Do not fail probe if there isn't a clock node

Since the dwc2 hcd driver is currently not looking for a clock node during
init, we should not completely fail if there isn't a clock provided.
By assigning clk = NULL, this allows the driver, when configured for dual-role
mode, to be able to continue loading the host portion of the driver when
a clock node is not specified.

Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: Update common interrupt handler to call gadget interrupt handler
Dinh Nguyen [Tue, 11 Nov 2014 17:13:37 +0000 (11:13 -0600)]
usb: dwc2: Update common interrupt handler to call gadget interrupt handler

Make dwc2_handle_common_intr call the gadget interrupt function when operating
in peripheral mode. Remove the spinlock functions in s3c_hsotg_irq as
dwc2_handle_common_intr() already has the spinlocks.

Move the registeration of the IRQ to common code for platform and PCI.

Remove duplicate interrupt conditions that was in gadget, as those are handled
by dwc2 common interrupt handler.

Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: Initialize the USB core for peripheral mode
Dinh Nguyen [Tue, 11 Nov 2014 17:13:36 +0000 (11:13 -0600)]
usb: dwc2: Initialize the USB core for peripheral mode

Initialize the USB driver to peripheral mode when a B-Device connector
is attached.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: convert to use dev_pm_ops API
Dinh Nguyen [Tue, 11 Nov 2014 17:13:35 +0000 (11:13 -0600)]
usb: dwc2: convert to use dev_pm_ops API

Update suspend/resume to use dev_pm_ops API.

Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: Move gadget probe function into platform code
Dinh Nguyen [Tue, 11 Nov 2014 17:13:34 +0000 (11:13 -0600)]
usb: dwc2: Move gadget probe function into platform code

This patch will aggregate the probing of gadget/hcd driver into platform.c.
The gadget probe funtion is converted into gadget_init that is now only
responsible for gadget only initialization. All the gadget resources are now
handled by platform.c

Since the host workqueue will not get initialized if the driver is configured
for peripheral mode only. Thus we need to check for wq_otg before calling
queue_work().

Also, we move spin_lock_init to common location for both host and gadget that
is either in platform.c or pci.c.

We also move suspend/resume code to common platform code.

Lastly, move the "samsung,s3c6400-hsotg" binding into dwc2_of_match_table.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: Update the gadget driver to use common dwc2_hsotg structure
Dinh Nguyen [Tue, 11 Nov 2014 17:13:33 +0000 (11:13 -0600)]
usb: dwc2: Update the gadget driver to use common dwc2_hsotg structure

Adds the gadget data structure and appropriate data structure pointers
to the common dwc2_hsotg data structure. To keep the driver data
dereference code looking clean, the gadget variable declares are only available
for peripheral and dual-role mode. This is needed so that the dwc2_hsotg data
structure can be used by the hcd and gadget drivers.

Updates gadget.c to use the dwc2_hsotg data structure and gadget pointers
that have been moved into the common dwc2_hsotg structure.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: add bus suspend/resume for dwc2
Kever Yang [Mon, 10 Nov 2014 13:09:43 +0000 (21:09 +0800)]
usb: dwc2: add bus suspend/resume for dwc2

Hcd controller needs bus_suspend/resume, dwc2 controller make
root hub generate suspend/resume signal with hprt0 register
when work in host mode.
After the root hub enter suspend, we can make controller enter
low power state with PCGCTL register.

We also update the lx_state for hsotg state.

This patch has tested on rk3288 with suspend/resume.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: renesas_usbhs: expand USB-DMAC channels for R-Car Gen2
Yoshihiro Shimoda [Mon, 10 Nov 2014 11:02:47 +0000 (20:02 +0900)]
usb: renesas_usbhs: expand USB-DMAC channels for R-Car Gen2

This patch expands USB-DMAC channels for R-Car Gen2 SoCs. The SoCs
have 4 channels. If d{2,3}_{t,x}x_id are not set, this driver never
uses the expanded USB-DMAC channels.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: renesas_usbhs: add a new macro for extending DnFIFOs
Yoshihiro Shimoda [Mon, 10 Nov 2014 11:02:46 +0000 (20:02 +0900)]
usb: renesas_usbhs: add a new macro for extending DnFIFOs

To extend DnFIFOs in the future, this patch adds a new macro because
some SoCs don't the "port" address for DnFIFOs.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: renesas_usbhs: standardize d{0,1}fifo control
Yoshihiro Shimoda [Mon, 10 Nov 2014 11:02:45 +0000 (20:02 +0900)]
usb: renesas_usbhs: standardize d{0,1}fifo control

To expand DnFIFOs in the future, this patch standardizes the d{0,1}fifo
control using new macros.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: renesas_usbhs: change d{0,1}fifo to dfifo array
Yoshihiro Shimoda [Mon, 10 Nov 2014 11:02:44 +0000 (20:02 +0900)]
usb: renesas_usbhs: change d{0,1}fifo to dfifo array

To extend DnFIFOs in the future, this patch changes d{0,1}fifo of
usbhs_fifo_info to dfifo array.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: midi: f_midi_alloc() can be static
Fengguang Wu [Wed, 12 Nov 2014 13:28:24 +0000 (21:28 +0800)]
usb: gadget: midi: f_midi_alloc() can be static

drivers/usb/gadget/function/f_midi.c:1072:21: sparse: symbol 'f_midi_alloc' was not declared. Should it be static?
drivers/usb/gadget/legacy/gmidi.c:118:30: sparse: symbol 'fi_midi' was not declared. Should it be static?
drivers/usb/gadget/legacy/gmidi.c:119:21: sparse: symbol 'f_midi' was not declared. Should it be static?

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_hid: hidg_alloc() can be static
Fengguang Wu [Wed, 12 Nov 2014 14:44:05 +0000 (22:44 +0800)]
usb: gadget: f_hid: hidg_alloc() can be static

drivers/usb/gadget/function/f_hid.c:852:21: sparse: symbol 'hidg_alloc' was not declared. Should it be static?

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: phy: fsl: Fix build errors
Felipe Balbi [Wed, 12 Nov 2014 14:31:40 +0000 (08:31 -0600)]
usb: phy: fsl: Fix build errors

commit e47d925 (usb: move the OTG state from
the USB PHY to the OTG structure) moved the
OTG state from struct usb_phy to struct usb_otg.

Unfortunately, even though I fixed quite a few
build regressions with that patch already, this
one was still missing.

Note that this driver still has other randconfig
build problems which I'll leave for driver author
to fix, as that's less trivial.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: host: ohci: omap: fix build breakage
Felipe Balbi [Sat, 8 Nov 2014 01:43:45 +0000 (19:43 -0600)]
usb: host: ohci: omap: fix build breakage

commit e47d925 (usb: move the OTG state
from the USB PHY to the OTG structure) moved
the OTG state field from struct usb_phy to
struct usb_otg but, even though I fixed many
other build breakages, I still missed one
on ohci-omap.c.

Fix the build breakage now.

drivers/usb/host/ohci-omap.c: In function ‘start_hnp’:
drivers/usb/host/ohci-omap.c:186:19: error: request for member ‘state’ in something not a structure or union
  hcd->usb_phy->otg.state = OTG_STATE_A_SUSPEND;

Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: atmel_usba_udc: use udc-core's reset notifier
Peter Chen [Thu, 6 Nov 2014 06:28:09 +0000 (14:28 +0800)]
usb: gadget: atmel_usba_udc: use udc-core's reset notifier

Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: bcm63xx_udc: use udc-core's reset notifier
Peter Chen [Thu, 6 Nov 2014 06:28:08 +0000 (14:28 +0800)]
usb: gadget: bcm63xx_udc: use udc-core's reset notifier

Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: r8a66597-udc: use udc-core's reset notifier
Peter Chen [Thu, 6 Nov 2014 06:28:07 +0000 (14:28 +0800)]
usb: gadget: r8a66597-udc: use udc-core's reset notifier

Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: amd5536udc: use udc-core's reset notifier
Peter Chen [Thu, 6 Nov 2014 06:28:06 +0000 (14:28 +0800)]
usb: gadget: amd5536udc: use udc-core's reset notifier

Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: pch_udc: use udc-core's reset notifier
Peter Chen [Thu, 6 Nov 2014 06:28:05 +0000 (14:28 +0800)]
usb: gadget: pch_udc: use udc-core's reset notifier

Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: fsl_qe_udc: use udc-core's reset notifier
Peter Chen [Thu, 6 Nov 2014 06:28:04 +0000 (14:28 +0800)]
usb: gadget: fsl_qe_udc: use udc-core's reset notifier

Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: mv_udc_core: use udc-core's reset notifier
Peter Chen [Thu, 6 Nov 2014 06:28:03 +0000 (14:28 +0800)]
usb: gadget: mv_udc_core: use udc-core's reset notifier

Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: at91_udc: use udc-core's reset notifier
Peter Chen [Thu, 6 Nov 2014 06:28:02 +0000 (14:28 +0800)]
usb: gadget: at91_udc: use udc-core's reset notifier

Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: fsl_udc_core: use udc-core's reset notifier
Peter Chen [Thu, 6 Nov 2014 06:28:01 +0000 (14:28 +0800)]
usb: gadget: fsl_udc_core: use udc-core's reset notifier

Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: m66592-udc: use udc-core's reset notifier
Peter Chen [Thu, 6 Nov 2014 06:28:00 +0000 (14:28 +0800)]
usb: gadget: m66592-udc: use udc-core's reset notifier

Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: pxa25x_udc: use udc-core's reset notifier
Peter Chen [Thu, 6 Nov 2014 06:27:59 +0000 (14:27 +0800)]
usb: gadget: pxa25x_udc: use udc-core's reset notifier

Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: chipidea: gadget: use udc-core's reset notifier
Peter Chen [Thu, 6 Nov 2014 06:27:58 +0000 (14:27 +0800)]
usb: chipidea: gadget: use udc-core's reset notifier

Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: net2272: use udc-core's reset notifier
Alan Stern [Thu, 6 Nov 2014 06:27:57 +0000 (14:27 +0800)]
usb: gadget: net2272: use udc-core's reset notifier

This patch adds support for the new udc-core reset notifier to the
net2272 driver.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: net2280: use udc-core's reset notifier
Alan Stern [Thu, 6 Nov 2014 06:27:56 +0000 (14:27 +0800)]
usb: gadget: net2280: use udc-core's reset notifier

This patch adds support for the new udc-core reset notifier to the
net2280 driver.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: dummy-hcd: use udc-core's reset notifier
Alan Stern [Thu, 6 Nov 2014 06:27:55 +0000 (14:27 +0800)]
usb: gadget: dummy-hcd: use udc-core's reset notifier

Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Peter chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: gadget: use udc-core's reset notifier
Felipe Balbi [Thu, 6 Nov 2014 06:27:54 +0000 (14:27 +0800)]
usb: musb: gadget: use udc-core's reset notifier

Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc3: gadget: use udc-core's reset notifier
Felipe Balbi [Thu, 6 Nov 2014 06:27:53 +0000 (14:27 +0800)]
usb: dwc3: gadget: use udc-core's reset notifier

Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: dbgp: Fix endpoint config after USB disconnect
Kyösti Mälkki [Mon, 3 Nov 2014 15:18:04 +0000 (17:18 +0200)]
usb: gadget: dbgp: Fix endpoint config after USB disconnect

SET_FEATURE request with DEBUG_MODE only worked the first time after module
initialisation. Per the USB 2.0 debug device specification, said request
is to be treated as if it were a SET_CONFIGURATION request, i.e. endpoint
must be re-configured.

As configure_endpoints() may now get called multiple times, move it outside
__init and move serial_alloc_tty() call into __init.

Code has assumption that endpoint mapping remains unchanged with consecutive
calls of configure_endpoints().

Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agophy: twl4030: Fix build breakage
Felipe Balbi [Fri, 7 Nov 2014 15:06:04 +0000 (09:06 -0600)]
phy: twl4030: Fix build breakage

commit e47d925 (usb: move the OTG state
from the USB PHY to the OTG structure) moved
the OTG state field from struct usb_phy to
struct usb_otg but, even though I fixed many
other build breakages, I still missed one
on phy-twl4030-usb.c.

Fix the build breakage now.

While at that, also a build warning introduced
by the same commit.

Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: pxa27x_udc: fix warning in non device-tree build
Robert Jarzmik [Wed, 29 Oct 2014 20:58:33 +0000 (21:58 +0100)]
usb: gadget: pxa27x_udc: fix warning in non device-tree build

The recent change bringing device-tree support triggers a warning in a
non device-tree build :
  drivers/usb/gadget/udc/pxa27x_udc.c:2405:28: warning: 'udc_pxa_dt_ids'
  defined but not used [-Wunused-variable]

Fix the warning with a preprocessor condition.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agoarm: boot: dts: am4372: enable dwc3 suspend PHY quirk
Felipe Balbi [Thu, 6 Nov 2014 17:32:35 +0000 (11:32 -0600)]
arm: boot: dts: am4372: enable dwc3 suspend PHY quirk

Whenever Suspend PHY bit is set on AM437x devices,
USB will not work due to Set EP Configuration command
always failing.

This was only found after a recent commit 2164a47 (usb:
dwc3: set SUSPHY bit for all cores, which will be merged
for v3.19) added a missing *required* step to dwc3
initialization. Synopsys Databook requires that we enable
Suspend PHY bit after initialization but that, unfortunately,
breaks AM437x.

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agoMerge 3.18-rc4 into usb-next.
Greg Kroah-Hartman [Mon, 10 Nov 2014 03:10:24 +0000 (12:10 +0900)]
Merge 3.18-rc4 into usb-next.

This resolves a conflict in drivers/usb/host/Kconfig

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoLinux 3.18-rc4
Linus Torvalds [Sun, 9 Nov 2014 22:55:29 +0000 (14:55 -0800)]
Linux 3.18-rc4