Chao Xie [Mon, 25 Mar 2013 07:06:54 +0000 (03:06 -0400)]
usb: ehci: mv_ehci: remove unused clock
The origianl understanding of clock is wrong. The EHCI controller
only have one clock input.
Passing clock name by pdata is wrong. The clock is defined by device
iteself.
Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Chao Xie <chao.xie@marvell.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Chao Xie [Mon, 25 Mar 2013 07:06:53 +0000 (03:06 -0400)]
usb: otg: mv_otg: remove unused clock
The origianl understanding of clock is wrong. The OTG controller
only have one clock input.
Passing clock name by pdata is wrong. The clock is defined by device
iteself.
Signed-off-by: Chao Xie <chao.xie@marvell.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Chao Xie [Mon, 25 Mar 2013 07:06:52 +0000 (03:06 -0400)]
usb: gadget: mv_udc_core: remove unused clock
The origianl understanding of clock is wrong. The UDC controller
only have one clock input.
Passing clock name by pdata is wrong. The clock is defined by device
iteself.
Signed-off-by: Chao Xie <chao.xie@marvell.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: musb: gadget: use platform callback to enable vbus
On some platform configurations (like OMAP3+twl4030) it's the platform
code that enables VBUS, not OTG transceiver, so call vbus platform
callback instead, it will then call the transceiver if needed.
This fixes a use case where USB cable is plugged first and gadget
driver is loaded later after that.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: musb: omap2430: turn off vbus on cable disconnect
On USB_EVENT_ID event the musb glue enables VBUS by calling
omap2430_musb_set_vbus(musb, 1) that sets the session bit, but on
USB_EVENT_NONE reverse action is never made, and that breaks PM.
Disable VBUS on USB_EVENT_NONE to be sure musb session is ended
on cable unplug so that PM works.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: phy: twl4030-usb: check if vbus is driven by twl itself
At least on pandora, STS_VBUS gets set even when VBUS is driven by twl
itself. Reporting VBUS in this case confuses OMAP musb glue and charger
driver, so check if OTG VBUS charge pump is on before reporting VBUS
event to avoid this problem.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Fri, 22 Mar 2013 14:58:18 +0000 (16:58 +0200)]
usb: gadget: mv_udc_core: fix sparse warnings
fix the following sparse warnings:
drivers/usb/gadget/mv_udc_core.c:1850:6: warning: symbol 'irq_process_reset' was not declared. Should it be static?
drivers/usb/gadget/mv_udc_core.c:247:9: warning: context imbalance in 'done' - unexpected unlock
drivers/usb/gadget/mv_udc_core.c:1692:25: warning: context imbalance in 'handle_setup_packet' - unexpected unlock
Note that there are still other sparse warnings
which aren't trivial to fix, so I left them out:
drivers/usb/gadget/mv_udc_core.c:848:34: warning: incorrect type in argument 1 (different address spaces)
drivers/usb/gadget/mv_udc_core.c:848:34: expected void const volatile [noderef] <asn:2>*addr
drivers/usb/gadget/mv_udc_core.c:848:34: got unsigned int *<noident>
drivers/usb/gadget/mv_udc_core.c:849:42: warning: incorrect type in argument 2 (different address spaces)
drivers/usb/gadget/mv_udc_core.c:849:42: expected void volatile [noderef] <asn:2>*addr
drivers/usb/gadget/mv_udc_core.c:849:42: got unsigned int *<noident>
Acked-by: Neil Zhang <zhangwm@marvell.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Fri, 22 Mar 2013 14:47:52 +0000 (16:47 +0200)]
usb: gadget: net2280: fix sparse warnings
fix the following sparse warnings:
drivers/usb/gadget/net2280.c:2063:13: warning: Using plain integer as NULL pointer
drivers/usb/gadget/net2280.c:2321:68: warning: Using plain integer as NULL pointer
drivers/usb/gadget/net2280.c:2349:68: warning: Using plain integer as NULL pointer
drivers/usb/gadget/net2280.c:2371:68: warning: Using plain integer as NULL pointer
Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Thu, 21 Mar 2013 10:19:31 +0000 (12:19 +0200)]
usb: gadget: net2272: fix sparse warnings
Fix the following sparse warnings:
drivers/usb/gadget/net2272.c:916:13: warning: Using plain integer as NULL pointer
drivers/usb/gadget/net2272.c:1624:9: warning: Using plain integer as NULL pointer
drivers/usb/gadget/net2272.c:1552:30: warning: right shift by bigger than source value
Note that the last warning is an actual bug,
since ep->dma is a one bit value which is
shifted by one bit in code.
Felipe Balbi [Fri, 22 Mar 2013 07:14:25 +0000 (09:14 +0200)]
usb: gadget: mv_u3d: fix sparse warnings
Fix the following sparse warnings:
drivers/usb/gadget/mv_u3d_core.c: In function ‘mv_u3d_ep_queue’:
drivers/usb/gadget/mv_u3d_core.c:812:2: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
drivers/usb/gadget/mv_u3d_core.c:822:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
drivers/usb/gadget/mv_u3d_core.c:823:4: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
drivers/usb/gadget/mv_u3d_core.c:823:28: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
drivers/usb/gadget/mv_u3d_core.c: In function ‘mv_u3d_ep_dequeue’:
drivers/usb/gadget/mv_u3d_core.c:905:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
drivers/usb/gadget/mv_u3d_core.c: In function ‘mv_u3d_probe’:
drivers/usb/gadget/mv_u3d_core.c:1840:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
drivers/usb/gadget/mv_u3d_core.c:1855:51: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
drivers/usb/gadget/mv_u3d_core.c:1855:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
drivers/usb/gadget/mv_u3d_core.c:1858:53: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
drivers/usb/gadget/mv_u3d_core.c:1858:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
drivers/usb/gadget/mv_u3d_core.c: In function ‘mv_u3d_irq_process_tr_complete’:
drivers/usb/gadget/mv_u3d_core.c:163:21: warning: ‘remaining_length’ may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/usb/gadget/mv_u3d_core.c:125:28: note: ‘remaining_length’ was declared here
Felipe Balbi [Fri, 22 Mar 2013 07:12:23 +0000 (09:12 +0200)]
usb: gadget: mv_u3d: remove outdated selects
USB_GADGET_{DUAL,SUPER}SPEED symbols have
been removed by commit 85b8614 (usb: gadget:
get rid of USB_GADGET_{DUAL,SUPER}SPEED), for
some reason mv_u3d_core was lost.
usb: musb: gadget: clear gadget_driver when gadget is stopped
Some musb glue drivers use gadget_driver pointer to know if any gadget
drivers are loaded at some moment and base further decisions on it,
like to do runtime suspend/resume or not. Right now the pointer is
left alone on stop and OMAP musb glue later does wrong runtime_pm
decisions because of it.
Clear the gadget_driver pointer on remove, it's invalid after stop
anyway.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
As the usb transceiver driver usually starts first, it should already
have default_a variable set according to ID pin state, so don't
override it. In case default_a was not changed by trasceiver, it will
default to 0 and this code will work as before.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
On pandora, STS_USB interrupt doesn't arrive on USB host cable disconnect
for some reason while VBUS is driven by twl itself, but STS_HW_CONDITIONS
is updated correctly. It does work fine when PHY is powered down though.
To work around that we have to poll.
This patch also moves twl->linkstat update code to callers so that
changes can be handled in thread safe way (as polling work can trigger
at the same time as real irq now).
TI PSP kernels have similar workarounds, so (many?) more boards are likely
affected.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: phy: twl4030-usb: don't switch the phy on/off needlessly
With runtime_pm in place there is no longer need to turn the phy
on/off in OTG layer on cable connect/disconnect, OMAP glue does
this through otg.set_suspend() callback after it's called through
omap_musb_mailbox() on VBUS/ID interrupt. Not doing this will save
power when cable is connected but no gadget driver is loaded.
This will also have side effect of automatic USB charging no longer
working without twl4030_charger driver, because a regulator needed
for charging will no longer be enabled, so be sure to enable charger
driver if charging is needed.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
In some rare cases we may get multiple interrupts that will generate
duplicate omap_musb_mailbox() calls. This is a problem because each
VBUS/ID event generates runtime_pm call in OMAP glue code, causing
unbalanced gets or puts and breaking PM.
The same goes for initial state, glue already defaults to "no cable"
state, so only bother it if we have VBUS or ID.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Reviewed-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: phy: twl4030-usb: don't enable PHY during init
There is no need to do it, otg.set_suspend(false) (which itself
comes from runtime_pm OMAP glue calls) will enable it later anyway.
This used to be the place where things were enabled if booted with
cable connected before runtime_pm conversion, but now can be dropped.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Wed, 20 Mar 2013 12:18:28 +0000 (14:18 +0200)]
arm: tegra: fix Kconfig select clauses
USB_ULPI and USB_ULPI_VIEWPORT shouldn't really
be selected directly by anyone, but since Tegra
still needs some time before turning ulpi viewport
into a proper PHY driver, we need to keep the
selects in place.
This patch just fixes the conditional select
so that it will continue to build after merging
the latest PHY layer changes.
Acked-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Fabio Baltieri [Fri, 8 Mar 2013 02:27:09 +0000 (10:27 +0800)]
usb: phy: ab8500-usb: update irq handling code
Update irq handling code to notify all possible link status changes of
AB8500 and AB8505 to the ux500-musb glue driver. The additional event
codes will be used for pm-runtime implementation, and are defined in a
separate ux500-specific header.
This also modify the irq registration code to use devm_* helpers and
drop all non necessary fail path code.
Felipe Balbi [Fri, 15 Mar 2013 08:57:40 +0000 (10:57 +0200)]
usb: musb: omap2430: fix PHY error handling
PHY layer no longer returns NULL. It will
return -ENXIO when PHY layer isn't enabled
and we can use that to bail out instead of
request a probe deferral.
Felipe Balbi [Fri, 15 Mar 2013 08:54:59 +0000 (10:54 +0200)]
usb: gadget: mv_udc_core: fix PHY error handling
PHY layer no longer returns NULL. It will
return -ENXIO when PHY layer isn't enabled
and we can use that to bail out instead of
request a probe deferral.
Felipe Balbi [Fri, 15 Mar 2013 08:52:08 +0000 (10:52 +0200)]
usb: dwc3: fix PHY error handling
PHY layer no longer returns NULL. It will
return -ENXIO when PHY layer isn't enabled
and we can use that to bail out instead of
request a probe deferral.
Having twl4030_usb_phy_init() (detects if a cable is connected before
twl4030 is probed) in twl4030 probe makes cable connect events to be
missed by musb glue, since it gets loaded after twl4030. Having
twl4030_usb_phy_init as a usb_phy ops lets twl4030_usb_phy_init to be
called when glue is ready.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Tested-by: Grazvydas Ignotas <notasas@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Thu, 14 Mar 2013 15:59:06 +0000 (17:59 +0200)]
usb: phy: return -ENXIO when PHY layer isn't enabled
in cases where PHY layer isn't enabled, we want
to still return an error code (actually an error
pointer) so that our users don't need to cope with
either error pointer of NULL.
usb: musb: omap: add usb_phy_init in omap2430_musb_init
Some PHYs load too early (twl4030) making omap glue to miss cable connect events
if the board is booted with cable connected. So adding usb_phy_init in
omap2430_musb_init lets PHYs to report events once glue is ready.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Bhupesh Sharma [Fri, 1 Mar 2013 19:46:31 +0000 (20:46 +0100)]
usb: gadget: uvc: Make video streaming buffer size comply with USB3.0 SS
As per the USB3.0 specs, the bandwidth requirements of a UVC's video
streaming endpoint will change to support super-speed. These changes
will be dependent on whether the UVC video streaming endpoint is Bulk or
Isochronous:
- If video streaming endpoint is Isochronous:
As per Section 4.4.8.2 (Isochronous Transfer Bandwidth Requirements)
of the USB3.0 specs:
A SuperSpeed isochronous endpoint can move up to three burst
transactions of up to 16 maximum sized packets (3 * 16 * 1024 bytes)
per service interval.
- If video streaming endpoint is Bulk:
As per 4.4.6.1 (Bulk Transfer Data Packet Size) of the USB3.0 specs:
An endpoint for bulk transfers shall set the maximum data packet
payload size in its endpoint descriptor to 1024 bytes. It also
specifies the burst size that the endpoint can accept from or
transmit on the SuperSpeed bus. The allowable burst size for a bulk
endpoint shall be in the range of 1 to 16.
So, in the Isochronous case, we can define the USB request's buffer to
be equal to = (Maximum packet size) * (bMaxBurst + 1) * (Mult + 1), so
that the UDC driver can try to send out this buffer in one Isochronous
service interval.
The same computation will hold good for the Bulk case as the Mult
value is 0 here and we can have a USB request buffer of maximum
16 * 1024 bytes size, which can be sent out by the UDC driver as
per the Bulk bandwidth allocation on the USB3 bus.
This patch adds the above-mentioned support and is also USB2.0 backward
compliant.
Bhupesh Sharma [Fri, 1 Mar 2013 19:46:30 +0000 (20:46 +0100)]
usb: gadget: uvc: Delay the status stage when setting alternate setting 1
This patch adds the support in UVC webcam gadget design for providing
USB_GADGET_DELAYED_STATUS in response to a set_interface(alt setting 1)
command issue by the Host.
The current UVC webcam gadget design generates a STREAMON event
corresponding to a set_interface(alt setting 1) command from the Host.
This STREAMON event will eventually be routed to a real V4L2 device.
To start video streaming, it may be required to perform some register
writes to a camera sensor device over slow external busses like I2C or
SPI. So, it makes sense to ensure that we delay the STATUS stage of the
set_interface (alt setting 1) command.
Otherwise, a lot of ISOC IN tokens sent by the Host will be replied to
by zero-length packets by the webcam device. On certain Hosts this may
even lead to ISOC URBs been cancelled from the Host side.
So, as soon as we finish doing all the "streaming" related stuff on the
real V4L2 device, we call a STREAMON ioctl on the UVC side and from here
we call the 'usb_composite_setup_continue' function to complete the
status stage of the set_interface(alt setting 1) command.
Further, we need to ensure that we queue no video buffers on the UVC
webcam gadget, until we de-queue a video buffer from the V4L2 device.
So, the application should call the STREAMON on UVC side only when it
has dequeued sufficient buffers from the V4L2 side and queued them to
the UVC gadget.
Bhupesh Sharma [Fri, 1 Mar 2013 19:46:29 +0000 (20:46 +0100)]
usb: gadget: uvc: Add fix for UVC compliance test suite's assertion 6.1.25 failure
As per the UVC compliance test suite's assertion 6.1.25, the `iFunction`
field of the Interface Association Descriptor (IAD) should the match the
`iInterface` field of the standard Video Control (VC) Interface Descriptor for
this Video Interface Collection (VIC).
This mandatory case is captured in section 3.11 of the
USB Video Class Compliance specification revision 1.1
This patch fixes this test assertion's failure and has been tested on
Linux FC16, WinXP, WIN7 and WIN8 High speed and Super Speed hosts
for successful enumeration.
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com>
[Merged the association and control string descriptors] Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Bhupesh Sharma <bhupesh.sharma@st.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Bhupesh Sharma [Fri, 1 Mar 2013 19:46:28 +0000 (20:46 +0100)]
usb: gadget: uvc: Add fix for UVC compliance test suite assertion 6.3.90 failure
As per UVC compliance test specification's assertion number 6.3.90
related to 'Standard VS Isochronous Video Data Endpoint Descriptor Assertions',
the bits D3..2 of 'bmAttributes' field of Standard VS Isochronous Video Data
Endpoint Descriptor should be 01 (binary) to indicate that the
synchronization type is ASYNCHRONOUS.
This mandatory requirement has been captured in section 3.10.1.1 of the UVC
Video Class Specification version 1.1
Vivek Gautam [Thu, 14 Mar 2013 10:29:10 +0000 (15:59 +0530)]
usb: phy: samsung: Common out the generic stuff
Moving register and structure definitions to header file,
and keeping the generic functions to be used across
multiple PHYs in common phy helper driver under SAMSUNG_USBPHY,
and moving USB 2.0 PHY driver under SAMSUNG_USB2PHY.
Also allowing samsung PHY drivers be built as modules.
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> Acked-by: Kukjin Kim <kgene.kim@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
*dma_mask* is not set for devices created from dt data. So filled dma_mask
for dwc3_omap device here. And dwc3 core will copy the dma_mask from its
parent.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Chen Gang [Mon, 11 Mar 2013 10:28:02 +0000 (18:28 +0800)]
usb: gadget: s3c-hsudc: delete outdated comment
since commit d93e260 (usb: gadget: s3c-hsudc: use udc_start and udc_stop
functions) the 'driver' parameter has been deleted from
s3c_hsudc_stop_activity() but its documentation was left outdated. This
patch deletes the comment since it makes no sense anymore.
Signed-off-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Fri, 8 Mar 2013 11:22:58 +0000 (13:22 +0200)]
usb: phy: introduce ->set_vbus() method
this method will be used to enable or disable
the charge pump.
Whenever we have DRD devices, we need to be
able to turn VBUS on or off whenever we want.
Note that in the ideal case, this would be
controlled by the ID-pin Interrupt, but not
all devices have ID-pin properly routed since
manufacturers can choose to save that trace
if they're building a host-only product out
of a DRD IP.
This is also useful during debugging where
we might not have the proper cable hanging
around.
Felipe Balbi [Thu, 7 Mar 2013 08:45:56 +0000 (10:45 +0200)]
usb: otg: move usb_otg_state_string to usb-common.c
otg.c only had a single function definition
which might make more sense to be placed in
usb-common.c. While doing that, we also delete
otg.c since it's now empty.
Fabio Baltieri [Wed, 20 Feb 2013 08:53:39 +0000 (09:53 +0100)]
usb: musb: drop dangling CONFIG_USB_MUSB_DEBUG
CONFIG_USB_MUSB_DEBUG option was removed in
5c8a86e usb: musb: drop unneeded musb_debug trickery
to cleanup the code from driver specific debug facilities. This patch
drops the last references to the musb debug config option,
unconditionally enabling all debug code paths, thus letting that code
being dropped at compile time if not needed.
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
Vivek Gautam [Sat, 2 Mar 2013 13:25:24 +0000 (18:55 +0530)]
usb: dwc3: set 'mode' based on selected Kconfig choices
Now that machines may select dwc3's working mode (HOST only,
GADGET only or DUAL_ROLE) via Kconfig, let's set dwc3's mode
based on that, rather than fixing it to whatever hardware
says.
This way we can skip initializing Gadget/Host in case
we are using Host-only/Gadget-only mode respectively.
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: phy: mxs: use readl(), writel() instead of the _relaxed() versions
This patch converts the mxs-phy driver from readl_relaxed(), writel_relaxed()
to the plain readl(), writel() functions, which are available on all platforms.
This is done to enable compile time testing on non ARM platforms.
Reported-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
In DWC3 versions < 2.50a configured without
Hibernation mode enabled, there will be an
extra link status change interrupt if device
detects host-initiated U3 exit.
In that case, core will generate an unnecessary
U3 -> RESUME transition which should be ignored
by the driver.