Commit graph

495510 commits

Author SHA1 Message Date
Robert Jarzmik 0f4ff5f1f9 usb: phy: generic: fix the vbus interrupt request
Declare the interrupt as "one shot" so that it is masked until the end
of the threaded handler. This prevents the irq core from spitting out an
error :
  "Threaded irq requested with handler=NULL and !ONESHOT for irq 63"

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This adds an explicit dependency.

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

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

This adds the ones that are missing.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:32:37 -06:00
Peter Chen 80b2502cea usb: gadget: introduce is_selfpowered for usb_gadget
Whether the gadget is selfpowerwed or not can be determined by composite
core, so we can use a common entry to indicate if the self-powered
is supported by gadget, and the related private variable at individual
udc driver can be deleted.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:39:38 -06:00