summaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea
AgeCommit message (Collapse)AuthorFilesLines
2012-09-12usb: chipidea: udc: don't stall endpoint if request list is empty in ↵Michael Grzeschik1-4/+1
isr_tr_complete_low When attaching an imx28 or imx53 in USB gadget mode to a Windows host and starting a rndis connection we see this message every 4-10 seconds: g_ether gadget: high speed config #2: RNDIS Analysis shows that each time this message is printed, the rndis connection is re-establish due to a reset because of a stalled endpoint (ep 0, dir 1). The endpoint is stalled because the reqeust complete bit on that endpoint is set, but in isr_tr_complete_low() the endpoint request list (mEp->qh.queue) is empty. This patch removed this check, because the code doesn't take the following situation into account: The loop over all endpoints in isr_tr_complete_handler() will call ep_nuke() on both ep0/dir0 and ep/dir1 in the first loop. Pending reqeusts will be flushed and completed here. There seems to be a race condition, the request is nuked, but the request complete bit will be set, too. The subsequent check (in ep0/dir1's loop cycle) for endpoint request list (mEp->qh.queue) empty will fail. Both other mainline chipidea drivers (mv_udc_core.c and fsl_udc_core.c) don't have this check. Cc: stable <stable@vger.kernel.org> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-12usb: chipidea: cleanup dma_pool if udc_start() failsMarc Kleine-Budde1-8/+15
If udc_start() fails the qh_pool dma-pool cannot be closed because it's still in use. This patch factors out the dma_pool_free() loop into destroy_eps() and calls it in the error path of udc_start(), too. Cc: stable <stable@vger.kernel.org> Reviewed-by: Richard Zhao <richard.zhao@freescale.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-12usb: chipidea: udc: fix error path in udc_start()Marc Kleine-Budde1-1/+1
This patch fixes the error path of udc_start(). Now NULL is used to unset the peripheral with otg_set_peripheral(). Cc: stable <stable@vger.kernel.org> Reviewed-by: Richard Zhao <richard.zhao@freescale.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-12usb: chipidea: udc: add pullup fuction, needed by the uvc gadgetMichael Grzeschik1-4/+17
Add function to physicaly enable or disable of pullup connection on the USB-D+ line. The uvc gaget will fail, if this function is not implemented. Cc: stable <stable@vger.kernel.org> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-12usb: chipidea: udc: fix setup of endpoint maxpacket sizeMichael Grzeschik1-1/+7
This patch changes the setup of the endpoint maxpacket size. All non control endpoints are initialized with an undefined ((unsigned short)~0) maxpacket size. The maxpacket size of Endpoint 0 will be kept at CTRL_PAYLOAD_MAX. Some gadget drivers check for the maxpacket size before they enable the endpoint, which leads to a wrong state in these drivers. Cc: stable <stable@vger.kernel.org> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-10usb: chipidea: fix and improve dependencies if usb host or gadget support is ↵Marc Kleine-Budde1-4/+5
built as module Since commit "5e0aa49 usb: chipidea: use generic map/unmap routines", the udc part of the chipidea driver needs the generic usb gadget helper functions. If the chipidea driver with udc support is built into the kernel and usb gadget is built a module, the linking of the kernel fails with: drivers/built-in.o: In function `_hardware_dequeue': drivers/usb/chipidea/udc.c:527: undefined reference to `usb_gadget_unmap_request' drivers/usb/chipidea/udc.c:1269: undefined reference to `usb_gadget_unmap_request' drivers/usb/chipidea/udc.c:1821: undefined reference to `usb_del_gadget_udc' drivers/usb/chipidea/udc.c:443: undefined reference to `usb_gadget_map_request' drivers/usb/chipidea/udc.c:1774: undefined reference to `usb_add_gadget_udc' This patch changes the dependencies, so that udc support can only be activated if the linux gadget support (USB_GADGET) is builtin or both chipidea driver and USB_GADGET are modular. Same dependencies for the chipidea host support and the linux host side USB support (USB). While there, fix the indention of chipidea the help text. Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09usb: chipidea: add imx platform driverRichard Zhao2-0/+201
This patch supports only the host-mode functionality so far. Signed-off-by: Richard Zhao <richard.zhao@freescale.com> Signed-off-by: Marek Vasut <marex@denx.de> Cc: Peter Chen <peter.chen@freescale.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Felipe Balbi <balbi@ti.com> Tested-by: Subodh Nijsure <snijsure@grid-net.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09usb: chipidea: permit driver bindings pass phy pointerRichard Zhao4-4/+14
Sometimes, the driver bindings may know what phy they use. For example, when using device tree, the usb controller may have a phandler pointing to usb phy. Signed-off-by: Richard Zhao <richard.zhao@freescale.com> Reviewed-by: Marek Vasut <marex@denx.de> Acked-by: Felipe Balbi <balbi@ti.com> Tested-by: Subodh Nijsure <snijsure@grid-net.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09usb: chipidea: select USB_EHCI_ROOT_HUB_TT in USB_CHIPIDEA_HOST of KconfigRichard Zhao1-0/+1
ci13xxx host needs Root Hub Transaction Translators. Reported-by: Shawn Guo <shawn.guo@freescale.com> Signed-off-by: Richard Zhao <richard.zhao@freescale.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09USB: Chipidea: add ci13xxx device id managementRichard Zhao1-5/+16
We use ida_simple_get and ida_simple_remove to manage the ids. Signed-off-by: Richard Zhao <richard.zhao@freescale.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09USB: Chipidea: add unified ci13xxx_{add,remove}_device for platform driversRichard Zhao3-55/+56
Platform drivers do the similar things to add/remove ci13xxx device, so create a unified one. Signed-off-by: Richard Zhao <richard.zhao@freescale.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09USB: Chipidea: rename struct ci13xxx variables from udc to ciRichard Zhao4-406/+406
struct ci13xxx represent the controller, which may be device or host, so name its variables as ci. Signed-off-by: Richard Zhao <richard.zhao@freescale.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06USB: Chipidea: rename struct ci13xxx_udc_driver to struct ci13xxx_platform_dataRichard Zhao6-34/+34
This patch rename struct ci13xxx_udc_driver and var with the type. ci13xxx_platform_data reflect it's passed from platfrom driver. Signed-off-by: Richard Zhao <richard.zhao@freescale.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06usb: chipidea: msm: add remove methodFelipe Balbi1-6/+15
allow this driver to be removed too. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Richard Zhao <richard.zhao@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06usb: chipidea: msm: add missing section annotationFelipe Balbi1-1/+1
No functional changes, it will just free up some code if we don't have hotplug. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Richard Zhao <richard.zhao@freescale.com> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06usb: chipidea: drop useless arch-checkFelipe Balbi1-3/+5
msm glue layer compiles on all arches just fine. Let's drop the unnecessary ARCH check so we have easier compile tests. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Richard Zhao <richard.zhao@freescale.com> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06usb: chipidea: remove unneeded NULL checkAlexander Shishkin1-3/+0
As reported by Dan Carpenter, there is a NULL check in udc_start() that follows a dereference of the pointer that's being checked. However, at that point udc pointer shouldn't ever be NULL and if it is, the dereference should cause an oops. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Richard Zhao <richard.zhao@freescale.com> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-02usb: phy: fix return value check of usb_get_phyKishon Vijay Abraham I1-4/+5
usb_get_phy will return -ENODEV if it's not able to find the phy. Hence fixed all the callers of usb_get_phy to check for this error condition instead of relying on a non-zero value as success condition. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-06-25usb: otg: support for multiple transceivers by a single controllerKishon Vijay Abraham I1-1/+1
Add a linked list for keeping multiple PHY instances with different types so that we can have separate USB2 and USB3 PHYs on one single board. _get_phy_ has been changed so that the controller gets the transceiver by type. _remove_phy_ has been added to let the phy be removed from the phy list. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-06-25usb: otg: utils: rename function name in OTG utilsKishon Vijay Abraham I1-4/+4
_transceiver() in otg.c is replaced with _phy. usb_set_transceiver is replaced with usb_add_phy to make it similar to other usb standard function names like usb_add_hcd. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-05-15usb: chipidea: remove zero check of hw_ep_maxRichard Zhao1-1/+1
It's 0 for host only device. Signed-off-by: Richard Zhao <richard.zhao@freescale.com> Cc: Marek Vasut <marex@denx.de> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-15USB: CI13xxx: Use usb_put_hcd() on failure to drop HCDMarek Vasut1-1/+1
Use usb_put_hcd() call instead of usb_remove_hcd() as that's the appropriate call to drop hcd which failed registration. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-11usb: chipidea: drop unused field "device" from ci13xxx_epAlexander Shishkin2-3/+0
It was used as a shorthand for gadget's device in request mapping/unmapping code, but now it's not used any more. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-11usb: chipidea: use generic map/unmap routinesAlexander Shishkin3-35/+10
We're one of the remaining drivers to map/unmap requests by hand. Switch to using generic gadget routines for that instead. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-11usb: chipidea: add power_budget limit for ehci to platform dataAlexander Shishkin2-1/+9
Some implementations need this limitation to work correctly. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-11usb: chipidea: add host roleAlexander Shishkin8-9/+204
This adds EHCI host support to the chipidea driver. We want it to be part of the hdrc driver and not a standalone (sub-)driver module, as the structure of ehci-hcd.c suggests, so for chipidea controller we hack it to not provide platform-related code, but only the ehci hcd. The ehci-platform driver won't work for us here too, because the controller uses the same registers for both device and host mode and also otg-related bits, so it's not really possible to put ehci registers into a separate resource. This is not a pretty solution, but the alternative is exporting symbols from the chipidea driver to a ehci-chipidea driver and doing all the module refcounting. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-11usb: chipidea: use common definition for USBMODE bitsAlexander Shishkin3-8/+8
Some of the bits of USBMODE register are defined in <usb/ehci_def.h>, use them instead of having our own definitions. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-11usb: chipidea: drop unused msm register definitionsAlexander Shishkin1-3/+0
These definitions are unused, and the same registers are also defined in <linux/usb/msm_hsusb_hw.h>. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-11usb: chipidea: drop redundant NULL checkAlexander Shishkin1-3/+0
Currently, gadget can't be NULL in _gadget_stop_activity(). Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Reported-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-11usb: chipidea: isr_reset_handler fix missing lockingMichael Grzeschik1-1/+1
Move spin_lock under the done label, so the lock will also be pulled in the error paths. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> [rebased on top of the patchset] Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-11usb: chipidea: brush up structure definitionsAlexander Shishkin2-61/+120
Get rid of trailing comments in the structure definitions in favor of kernel-doc. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-11usb: chipidea: remove unused field "regs" from ci13xxxAlexander Shishkin2-2/+1
The old implementation used global hw_bank, the new implementation uses udc-local hw_bank. This field seems to be a leftover from previous coding experiments. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-11usb: chipidea: add support for rolesAlexander Shishkin7-115/+325
Add some generic code for roles and implement simple role switching based on ID pin state and/or a sysfs file. At this, we also rename the device to ci_hdrc, which is what it is. The "manual" switch is made into a sysfs file and not debugfs, because it might be useful even in non-debug context. For some boards, like sheevaplug, it seems to be the only way to switch roles without modifying the hardware, since the ID pin is always grounded. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-11usb: chipidea: split the driver code into unitsAlexander Shishkin12-1418/+1597
Split the driver into the following parts: * core -- resources, register access, capabilities, etc; * udc -- device controller functionality; * debug -- logging events. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-11usb: move ci13xxx and related code to drivers/usb/chipideaAlexander Shishkin6-0/+3536
Since chipidea is a dual role controller, it makes sense to move it to its own directory, where we can also have host, otg and platform code related to this controller. It also makes sense to break out the driver into several compilation units like udc, host, debugging code, etc. Firstly, let's move the udc and platform code to drivers/usb/chipidea. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>