]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
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>
10 years agousb: dwc3: core: enable phy suspend quirk on non-FPGA
Felipe Balbi [Thu, 6 Nov 2014 17:31:00 +0000 (11:31 -0600)]
usb: dwc3: core: enable phy suspend quirk on non-FPGA

as it turns out, at least AM437x silicon (non-FPGA)
needs to enable PHY suspend quirk. So let's allow
for PHY suspend quirk to be used with non-FPGA
builds too.

Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: hid: add configfs support
Andrzej Pietrasiewicz [Thu, 6 Nov 2014 10:12:03 +0000 (11:12 +0100)]
usb: gadget: hid: add configfs support

Make the hid function available for gadgets composed with configfs.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_hid: use usb_gstrings_attach
Andrzej Pietrasiewicz [Thu, 6 Nov 2014 10:12:02 +0000 (11:12 +0100)]
usb: gadget: f_hid: use usb_gstrings_attach

Before configfs is integrated the usb_gstrings_attach() interface
must be used.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_hid: remove compatibility layer
Andrzej Pietrasiewicz [Thu, 6 Nov 2014 10:12:01 +0000 (11:12 +0100)]
usb: gadget: f_hid: remove compatibility layer

There are no old function interface users left, so remove it.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: hid: convert to new interface of f_hid
Andrzej Pietrasiewicz [Thu, 6 Nov 2014 10:12:00 +0000 (11:12 +0100)]
usb: gadget: hid: convert to new interface of f_hid

Use the new f_hid interface in order for the old to be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_hid: convert to new function interface with backward compatibility
Andrzej Pietrasiewicz [Thu, 6 Nov 2014 10:11:59 +0000 (11:11 +0100)]
usb: gadget: f_hid: convert to new function interface with backward compatibility

Converting hid to the new function interface requires converting
the USB hid's function code and its users.

This patch converts the f_hid.c to the new function interface.

The file can now be compiled into a separate usb_f_hid.ko module.

The old function interface is provided by means of a preprocessor
conditional directives. After all users are converted, the old interface
can be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: hid: mirror init operations in module cleanup
Andrzej Pietrasiewicz [Thu, 6 Nov 2014 10:11:58 +0000 (11:11 +0100)]
usb: gadget: hid: mirror init operations in module cleanup

So far platform driver has been unregistered first,
so just after that the usb composite is still available,
but there is no hid data any more.

Reverse the order so that first the usb composite becomes
unavailable and second the hid data goes away.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_hid: check return value of device_create
Andrzej Pietrasiewicz [Thu, 6 Nov 2014 10:11:57 +0000 (11:11 +0100)]
usb: gadget: f_hid: check return value of device_create

device_create() might fail, so check its return value and react
appropriately.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_hid: check return value of class_create
Andrzej Pietrasiewicz [Thu, 6 Nov 2014 10:11:56 +0000 (11:11 +0100)]
usb: gadget: f_hid: check return value of class_create

class_create() might fail, so check its return value and react
appropriately.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: phy: remove file names from heading comments
Sergei Shtylyov [Thu, 9 Oct 2014 20:02:12 +0000 (00:02 +0400)]
usb: phy: remove file names from heading comments

File names in the heading comments fell out of favor long ago, and these weren't
even changed when the drivers were moved from drivers/usb/otg/, so remove them
at last...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_midi: add configfs support
Andrzej Pietrasiewicz [Thu, 16 Oct 2014 11:33:31 +0000 (13:33 +0200)]
usb: gadget: f_midi: add configfs support

Make the midi function available for gadgets composed with configfs.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_midi: use usb_gstrings_attach
Andrzej Pietrasiewicz [Thu, 16 Oct 2014 11:33:30 +0000 (13:33 +0200)]
usb: gadget: f_midi: use usb_gstrings_attach

In order to add configfs support the usb_gstrings_attach must be used.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_midi: remove compatibility layer
Andrzej Pietrasiewicz [Thu, 16 Oct 2014 11:33:29 +0000 (13:33 +0200)]
usb: gadget: f_midi: remove compatibility layer

There are no old f_midi interface users left, so remove it.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: midi: convert to new interface of f_midi
Andrzej Pietrasiewicz [Thu, 16 Oct 2014 11:33:28 +0000 (13:33 +0200)]
usb: gadget: midi: convert to new interface of f_midi

Use the new f_midi interface so that the old can be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_midi: convert to new function interface with backward compatibility
Andrzej Pietrasiewicz [Thu, 16 Oct 2014 11:33:27 +0000 (13:33 +0200)]
usb: gadget: f_midi: convert to new function interface with backward compatibility

Converting midi to the new function interface requires converting
the USB midi's function code and its users.

This patch converts the f_midi.c to the new function interface.
The file can now be compiled into a separate usb_f_midi.ko module.

The old function interface is provided by means of a preprocessor
conditional directives. After all users are converted, the old interface
can be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_midi: check kstrdup() return value
Andrzej Pietrasiewicz [Thu, 16 Oct 2014 11:33:26 +0000 (13:33 +0200)]
usb: gadget: f_midi: check kstrdup() return value

kstrdup() might fail, so check its return value and react appropriately.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_midi: enable use of the index parameter
Andrzej Pietrasiewicz [Thu, 16 Oct 2014 11:33:25 +0000 (13:33 +0200)]
usb: gadget: f_midi: enable use of the index parameter

The soundcard index to use for the ALSA device creation is passed as a
parameter to f_midi_bind_config(), but is assigned to midi->index only
after the call to f_midi_register_card(midi). So no matter what is passed
to f_midi_bind_config(), the actual index for snd_card_new() is always 0.
This probably works ok if at the moment of f_midi's bind there are no
other snd_cards, but if there are, it is not possible to bind f_midi.

This patch moves the assignment to a place before the call to
f_midi_register_card(midi).

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: Kconfig: enable separate compilation of uac1/uac2 functions
Andrzej Pietrasiewicz [Thu, 16 Oct 2014 11:16:28 +0000 (13:16 +0200)]
usb: gadget: Kconfig: enable separate compilation of uac1/uac2 functions

uac1 and uac2 functions are available through the configfs interface
and it should be possible to build them without building their legacy
gadgets.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: ep0: remove unnecessary break after return
Jingoo Han [Tue, 4 Nov 2014 01:37:30 +0000 (10:37 +0900)]
usb: dwc3: ep0: remove unnecessary break after return

Fix the following checkpatch warning.

  WARNING: break is not useful after a goto or return

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: musb: try a race-free wakeup
Sebastian Andrzej Siewior [Mon, 27 Oct 2014 18:06:19 +0000 (19:06 +0100)]
usb: musb: try a race-free wakeup

Attaching a keyboard, using it as a wakeup via
|for f in $(find /sys/devices/ocp.3/47400000.usb -name wakeup)
|do
| echo enabled > $f
|done

going into standby
|  echo standby >  /sys/power/state

and now a wake up by a pressing a key.
What happens is that the system wakes up but the USB device is dead. The
USB stack tries to send a few control URBs but nothing comes back.
Eventually it gaves up and the device remains dead:
|[  632.559678] PM: Wakeup source USB1_PHY
|[  632.581074] PM: noirq resume of devices complete after 21.261 msecs
|[  632.607521] PM: early resume of devices complete after 10.360 msecs
|[  632.616854] net eth2: initializing cpsw version 1.12 (0)
|[  632.704126] net eth2: phy found : id is : 0x4dd074
|[  636.704048] libphy: 4a101000.mdio:00 - Link is Up - 1000/Full
|[  638.444620] usb 1-1: reset low-speed USB device number 2 using musb-hdrc
|[  653.713435] usb 1-1: device descriptor read/64, error -110
|[  669.093435] usb 1-1: device descriptor read/64, error -110
|[  669.473424] usb 1-1: reset low-speed USB device number 2 using musb-hdrc
|[  684.743436] usb 1-1: device descriptor read/64, error -110
|[  690.065097] PM: resume of devices complete after 57450.744 msecs
|[  690.076601] PM: Finishing wakeup.
|[  690.076627] Restarting tasks ...

It seems that since we got woken up via MUSB_INTR_RESUME the
musb_host_finish_resume() callback is executed before the
resume-callbacks of the PHY and glue layer are invoked. If I delay it
until the glue layer resumed then I don't see this problem.

I also move musb_host_resume_root_hub() into that callback since I don't
see any reason in doing anything resume-link if there are still pieces
not restored.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: musb: core: check link status on resume
Sebastian Andrzej Siewior [Mon, 27 Oct 2014 18:06:18 +0000 (19:06 +0100)]
usb: musb: core: check link status on resume

The am335x-evmsk support two kinds of suspend:
- standby
  the USB device remains powered while the system goes into suspend

- mem
  the USB device becomes powerless while the system goes into suspend.

In the "standby" case the device resumes quickly. In the "mem" case the
system hangs for a few seconds. It seems to me that the USB-device has
no address (it was disconnected) and the USB stack thinks that it is
fully operational and GetPortStatus returns the status from before the
suspend so it is not a big help here.

This adds a check in the resume path to see if the device mode (A or B)
and the speed is the same. If the device went missing between
suspend/resume (VBUS went down) then MUSB seems to go into B mode and
HS/FS bits are cleared. In that case we clear the port1_status bits and
assume a disconnect. Once the stack learns this it does a "logical
disconnect" and removes the USB-device quickly. Should the device remain
connected during the suspend then MUSB will receives a "CONNECT" interrupt.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: exynos: remove non-DT support for Exynos Specific Glue layer
Jingoo Han [Tue, 4 Nov 2014 02:01:47 +0000 (11:01 +0900)]
usb: dwc3: exynos: remove non-DT support for Exynos Specific Glue layer

DWC3 Exynos Specific Glue layer can be used only for Exynos SoCs.
In addition, non-DT for EXYNOS SoCs is not supported from v3.11;
thus, there is no need to support non-DT for DWC3 Exynos Specific
Glue layer.

The 'linux/platform_data/dwc3-exynos.h' file has been used for
non-DT support. Thus, the 'dwc3-exynos.h' file is removed, because
it is not used anymore.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: renesas_usbhs: fix usbhs_pipe_clear() for DCP PIPE
Yoshihiro Shimoda [Tue, 4 Nov 2014 01:05:45 +0000 (10:05 +0900)]
usb: renesas_usbhs: fix usbhs_pipe_clear() for DCP PIPE

Since the DCPCTR doesn't have the ACLRM bit, the usbus_pipe_clear()
should not call the usbhsp_pipectrl_set() with ACLRM.
So, this patch fixes this issue to add the usbhs_fifo_clear_dcp()
in fifo.c because the controller needs the CFIFO to clear the
the DCP PIPE.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: renesas_usbhs: fix the timing of dcp_control_transfer_done
Yoshihiro Shimoda [Tue, 4 Nov 2014 01:05:44 +0000 (10:05 +0900)]
usb: renesas_usbhs: fix the timing of dcp_control_transfer_done

According to the datasheet, this driver should clear the INTSTS0.CTRT
bit before this controller detects the next stage transition. Otherwise,
the driver may not be able to clear the bit after the controller went to
the next stage transition. After that, the driver will not be able to
clear the INTSTS0.VALID, and a usb control transfer will not finish
finally.

If we use the testusb tool, it is easy to reproduce this issue:

 # testusb -a -t 10

Since the previous code handled a data stage and a status stage in
the usbhsf_pio_try_push(), it may not clear the INTSTS0.CTRT at the
right timing.
So, this patch change the timing of usbhs_dcp_control_transfer_done()
to the usbhsg_irq_ctrl_stage().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: renesas_usbhs: gadget: fix the behavior of pullup
Takeshi Kihara [Tue, 4 Nov 2014 01:05:43 +0000 (10:05 +0900)]
usb: renesas_usbhs: gadget: fix the behavior of pullup

This patch fixes an issue that this driver always enable the D+ pullup
after it detected the VBUS connection even though this usb controller
can control the D+ pullup timing by software. So, this driver should
enable the D+ pullup after a gadget driver called usb_gadget_connect().

Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()
Kazuya Mizuguchi [Tue, 4 Nov 2014 01:05:42 +0000 (10:05 +0900)]
usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()

This patch fixes an issue that the NULL pointer dereference happens
when we uses g_audio driver. Since the g_audio driver will call
usb_ep_disable() in afunc_set_alt() before it calls usb_ep_enable(),
the uep->pipe of renesas usbhs driver will be NULL. So, this patch
adds a condition to avoid the oops.

Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Fixes: 2f98382dc (usb: renesas_usbhs: Add Renesas USBHS Gadget)
Cc: <stable@vger.kernel.org> # v3.0+
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc2: allow dwc2 to get built when USB_GADGET=m
Dinh Nguyen [Tue, 21 Oct 2014 20:31:42 +0000 (15:31 -0500)]
usb: dwc2: allow dwc2 to get built when USB_GADGET=m

This patch allows the gadget portion of the DWC2 driver to get built when
(!USB && USB_GADGET) condition is encountered.

Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: make HIRD threshold configurable
Huang Rui [Fri, 31 Oct 2014 03:11:18 +0000 (11:11 +0800)]
usb: dwc3: make HIRD threshold configurable

HIRD threshold should be configurable by different platforms.

From DesignWare databook:
When HIRD_Threshold[4] is set to 1b1 and HIRD value is greater than or
equal to the value in HIRD_Threshold[3:0], dwc3 asserts output signals
utmi_l1_suspend_n to put PHY into Deep Low-Power mode in L1.

When HIRD_Threshold[4] is set to 1b0 or the HIRD value is less than
HIRD_Threshold[3:0], dwc3 asserts output signals utmi_sleep_n on L1.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: add support for AMD Nolan platform
Huang Rui [Fri, 31 Oct 2014 03:11:17 +0000 (11:11 +0800)]
usb: dwc3: add support for AMD Nolan platform

This patch adds support for AMD Nolan (NL) FPGA and SoC platform.

Cc: Jason Chang <jason.chang@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agoPCI: Prevent xHCI driver from claiming AMD Nolan USB3 DRD device
Huang Rui [Fri, 31 Oct 2014 03:11:16 +0000 (11:11 +0800)]
PCI: Prevent xHCI driver from claiming AMD Nolan USB3 DRD device

The AMD Nolan (NL) SoC contains a DesignWare USB3 Dual-Role Device that can
be operated either as a USB Host or a USB Device.  In the AMD NL platform,
this device ([1022:7912]) has a class code of PCI_CLASS_SERIAL_USB_XHCI
(0x0c0330), which means the xhci driver will claim it.

But the dwc3 driver is a more specific driver for this device, and we'd
prefer to use it instead of xhci.  To prevent xhci from claiming the
device, change the class code to 0x0c03fe, which the PCI r3.0 spec defines
as "USB device (not host controller)".  The dwc3 driver can then claim it
based on its Vendor and Device ID.

Suggested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Jason Chang <jason.chang@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agoPCI: Add support for AMD Nolan USB3 DRD
Huang Rui [Fri, 31 Oct 2014 03:11:15 +0000 (11:11 +0800)]
PCI: Add support for AMD Nolan USB3 DRD

This patch adds PCI id for USB3 Dual-Role Device of AMD Nolan (NL) SoC.
It will be used for PCI quirks and DWC3 device driver.

Signed-off-by: Jason Chang <jason.chang@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: add disable usb2 suspend phy quirk
Huang Rui [Fri, 31 Oct 2014 03:11:14 +0000 (11:11 +0800)]
usb: dwc3: add disable usb2 suspend phy quirk

This patch adds disable usb2 suspend phy quirk, and some special platforms
can configure that if it is needed.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: add disable usb3 suspend phy quirk
Huang Rui [Fri, 31 Oct 2014 03:11:13 +0000 (11:11 +0800)]
usb: dwc3: add disable usb3 suspend phy quirk

This patch adds disable usb3 suspend phy quirk, and some special platforms
can configure that if it is needed.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: add Tx de-emphasis quirk
Huang Rui [Fri, 31 Oct 2014 03:11:12 +0000 (11:11 +0800)]
usb: dwc3: add Tx de-emphasis quirk

This patch adds Tx de-emphasis quirk, and the Tx de-emphasis value is
configurable according to PIPE3 specification.

Value Description
0 -6dB de-emphasis
1 -3.5dB de-emphasis
2 No de-emphasis
3 Reserved

It can be configured on DT or platform data.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: set SUSPHY bit for all cores
Huang Rui [Tue, 28 Oct 2014 11:54:35 +0000 (19:54 +0800)]
usb: dwc3: set SUSPHY bit for all cores

It is recommended to set USB3 and USB2 SUSPHY bits to '1' after the core
initialization is completed above the dwc3 revision 1.94a.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: add rx_detect to polling lfps quirk
Huang Rui [Tue, 28 Oct 2014 11:54:33 +0000 (19:54 +0800)]
usb: dwc3: add rx_detect to polling lfps quirk

This patch adds RX_DETECT to Polling.LFPS control quirk, and some special
platforms can configure that if it is needed.

[ balbi@ti.com : added DeviceTree binding documentation ]

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: add lfps filter quirk
Huang Rui [Tue, 28 Oct 2014 11:54:32 +0000 (19:54 +0800)]
usb: dwc3: add lfps filter quirk

This patch adds LFPS filter quirk, and some special platforms can configure
that if it is needed.

[ balbi@ti.com : added DeviceTree binding documentation ]

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: add delay phy power change quirk
Huang Rui [Tue, 28 Oct 2014 11:54:31 +0000 (19:54 +0800)]
usb: dwc3: add delay phy power change quirk

This patch adds delay PHY power change from P0 to P1/P2/P3 when link state
changing from U0 to U1/U2/U3 respectively, and some special platforms can
configure that if it is needed.

[ balbi@ti.com : added DeviceTree binding documentation ]

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: add delay p1p2p3 quirk
Huang Rui [Tue, 28 Oct 2014 11:54:30 +0000 (19:54 +0800)]
usb: dwc3: add delay p1p2p3 quirk

This patch adds delay P0 to P1/P2/P3 quirk for U2/U2/U3, and some special
platforms can configure that if it is needed.

[ balbi@ti.com : added DeviceTree binding documentation ]

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: add request p1p2p3 quirk
Huang Rui [Tue, 28 Oct 2014 11:54:29 +0000 (19:54 +0800)]
usb: dwc3: add request p1p2p3 quirk

This patch adds request P1/P2/P3 quirk for U2/U2/U3, and some special
platforms can configure that if it is needed.

[ balbi@ti.com : added DeviceTree binding documentation ]

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: add P3 in U2 SS inactive quirk
Huang Rui [Tue, 28 Oct 2014 11:54:28 +0000 (19:54 +0800)]
usb: dwc3: add P3 in U2 SS inactive quirk

This patch adds P3 in U2 SS inactive quirk, and some special platforms can
configure that if it is needed.

[ balbi@ti.com : added DeviceTree binding documentation ]

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: add u2exit lfps quirk
Huang Rui [Tue, 28 Oct 2014 11:54:27 +0000 (19:54 +0800)]
usb: dwc3: add u2exit lfps quirk

This patch adds u2exit lfps quirk, and some special platforms can configure
that if it is needed.

[ balbi@ti.com : added DeviceTree binding documentation ]

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: add lpm erratum support
Huang Rui [Tue, 28 Oct 2014 11:54:26 +0000 (19:54 +0800)]
usb: dwc3: add lpm erratum support

When parameter DWC_USB3_LPM_ERRATA_ENABLE is enabled in Andvanced
Configuration of coreConsultant, it supports of xHCI BESL Errata Dated
10/19/2011 is enabled in host mode. In device mode it adds the capability
to send NYET response threshold based on the BESL value received in the LPM
token, and the threhold is configurable for each soc platform.

This patch adds an entry that soc platform is able to define the lpm
capacity with their own device tree or bus glue layer.

[ balbi@ti.com : added devicetree documentation, spelled threshold
completely, made sure threshold is only applied to
proper core revisions. ]

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: add disscramble quirk
Huang Rui [Tue, 28 Oct 2014 11:54:25 +0000 (19:54 +0800)]
usb: dwc3: add disscramble quirk

This patch adds disscramble quirk, and it only needs to be enabled at fpga
board on some vendor platforms.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: initialize platform data at pci glue layer
Huang Rui [Tue, 28 Oct 2014 11:54:24 +0000 (19:54 +0800)]
usb: dwc3: initialize platform data at pci glue layer

This patch initializes platform data at pci glue layer, and SoCs x86-based
platform vendor is able to define their flags in platform data at bus glue
layer. Then do some independent behaviors at dwc3 core level.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: add a flag to check if it is fpga board
Huang Rui [Tue, 28 Oct 2014 11:54:23 +0000 (19:54 +0800)]
usb: dwc3: add a flag to check if it is fpga board

Some chip vendor is on pre-silicon phase, which needs to use the simulation
board. It should have the same product and vendor id with the true soc, but
might have some minor different configurations.

Below thread discussion proposes to find a method to distinguish between
simulation board and soc.

http://marc.info/?l=linux-usb&m=141194772206369&w=2

In Andvanced Configuration of coreConsultant, there is the parameter of
DWC_USB_EN_FPGA. This bit has the function we need. And it would response as 7
bit of GHWPARAMS6 register. So it's able to check this functional bit to confirm
if works on FPGA board.

Reported-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: dwc3: enable hibernation if to be supported
Huang Rui [Tue, 28 Oct 2014 11:54:22 +0000 (19:54 +0800)]
usb: dwc3: enable hibernation if to be supported

It enables hibernation if the function is set in coreConsultant.

Suggested-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: chipidea: add support to the generic PHY framework
Antoine Tenart [Thu, 30 Oct 2014 17:41:19 +0000 (18:41 +0100)]
usb: chipidea: add support to the generic PHY framework

This patch adds support of the PHY framework for ChipIdea drivers.
Changes are done in both the ChipIdea common code and in the drivers
accessing the PHY. This is done by adding a new PHY member in
ChipIdea's structures and by taking care of it in the code.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: allow to supply the PHY in the drivers when using HCD
Antoine Tenart [Thu, 30 Oct 2014 17:41:16 +0000 (18:41 +0100)]
usb: allow to supply the PHY in the drivers when using HCD

This patch modify the generic code handling PHYs to allow them to be
supplied from the drivers. This adds checks to ensure no PHY was already
there when looking for one in the generic code. This also makes sure we
do not modify its state in the generic HCD functions, it was provided by
the driver.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: add support to the generic PHY framework in OTG
Antoine Tenart [Thu, 30 Oct 2014 17:41:15 +0000 (18:41 +0100)]
usb: add support to the generic PHY framework in OTG

This patch adds support of the PHY framework in OTG and keeps the USB
PHY compatibility. Here the only modification is to add PHY member in
the OTG structure, along with the USB PHY one.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>