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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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;
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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().
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.
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>