summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/ci13xxx_udc.c
Commit message (Collapse)AuthorAgeFilesLines
* usb: move ci13xxx and related code to drivers/usb/chipideaAlexander Shishkin2012-05-111-2983/+0
| | | | | | | | | | | | | 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>
* usb: gadget: ci13xxx: print basic device info when probingAlexander Shishkin2012-05-111-0/+3
| | | | | | | | Report basic information about capabilities and register addresses on probe. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: gadget: ci13xxx: don't use "advance" feature when setting addressAlexander Shishkin2012-05-111-10/+12
| | | | | | | | | | | | | | | | Newer versions of the chipidea controller support the "advance" setting of usb address, which means instead of setting it immediately, deferring it till the status completion. Unfortunately, older versions of the controller don't have this feature, so in order to support those too, we simply don't use it. It's about 4 lines of extra code, and isn't in any way critical to performance. While at it, change the return value of the hw_usb_set_address() to void, since it can't fail in any measurable way. With this patch, ci13xxx_udc driver works with the chipidea controller in kirkwood (feroceon SoC), as found in, for example, sheevaplug. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: gadget: ci13xxx: get rid of local tracing for goodAlexander Shishkin2012-05-111-65/+0
| | | | | | | There is no point in having tracing output in the kernel these days. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* USB: gadget: ci13xx_udc: fix potential crash in irq handlerGreg Kroah-Hartman2012-05-101-3/+1
| | | | | | | | | | | | | | | | As pointed out by Dan Carpenter, we should not be trying to call dev_err() on a structure that was previously determined to be NULL, that's just foolish and asking for trouble. So just delete the message, it's not going to do anyone any good to have it anyway. This problem was caused by 0f089094cde5: "usb: gadget: ci13xxx: replace home-brewed logging with dev_{err,warn,info}" Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: gadget: ci13xxx: convert to new styleAlexander Shishkin2012-05-091-81/+39
| | | | | | | | Finally, convert to the new style framework, using udc_start/udc_stop methods. Since there is no need in the global _udc pointer, remove it. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: gadget: ci13xxx: move endpoint (de-)initialization to probe/removeAlexander Shishkin2012-05-091-81/+80
| | | | | | | | | | | Currently, endpoints are initialized in gadget start/stop methods, however for the new style gadgets it is expected that bind() can be called before controller's start(), and we need endpoints already initialized at that point. So, move endpoint initialization to controller's probe before we switch to the "new style" gadget framework. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: gadget: ci13xxx: replace home-brewed logging with dev_{err,warn,info}Alexander Shishkin2012-05-091-93/+76
| | | | | | | | | | | | | | | Logging output in the driver is mostly done using custom err/warn/info macros which rely on the existence of the global variable _udc, which is a global reference to the udc controller structure. This reference will have to go in order to allow us to have more than one chipidea udc in the system. Thus, replace custom macros with dev_{err,warn,info} using the platform device where possible. The trace() macro, which is a nop by default is left for tracing purposes. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: gadget: ci13xxx: convert to platform deviceAlexander Shishkin2012-05-091-4/+74
| | | | | | | | | | | | Let's break ci13xxx driver into a separate udc driver and platform drivers _pci and _msm, which will create a platform device for each pci (or msm) device found. The approach was introduced by Felipe in dwc3 driver and there seems to be no reason not to use it. msm related code is only compile-tested. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: gadget: ci13xxx: redo register accessAlexander Shishkin2012-05-091-128/+165
| | | | | | | | | | | Use lookup table instead of conditional macrodefinitions of register addresses. With two different possible register layouts and different register offsets, it's easiest to build a table with register addresses at probe time, based on the information supplied from the platform and device capabilities. This way we get rid of branch-per-register-access. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: gadget: ci13xxx: move global variables inside struct ci13xxxAlexander Shishkin2012-05-091-231/+231
| | | | | | | | Make global variables that are specific for each UDC instance part of struct ci13xxx. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: gadget: ci13xxx: drop needless parensAlexander Shishkin2012-05-091-4/+4
| | | | | | | Small and self-evident cleanup. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: gadget: ci13xxx: rename register layoutsAlexander Shishkin2012-05-081-131/+121
| | | | | | | | | | | | | | | | | | | | | | Currently, the register prefixes in the driver seem to be mixed: the capability registers are the ones that contain capability information, such as number of hardware endpoints, while the registers that are used to program the controller are called operational registers. Normally, capability registers start at 0x100 offset of the register window and are followed by operational registers. In some versions, however, capability registers start at 0x0 offset. This patch renames the register and adjusts their offsets appropriately, leaving the possibility of having a non-standard capability offset. I couldn't find any mentions of the TESTMODE register anywhere, so I suspect it might only be enabled in chipidea internal versions of the controller and I'm really inclined to remove it from the driver or at least hiding it behind a config option. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: gadget: ci13xxx: initialize ep0{out,in} dynamicallyAlexander Shishkin2012-05-081-19/+29
| | | | | | | | Change ep0{out,in} macros into dynamically assigned pointers in gadget initialization time. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: gadget: ci13xxx: fix ep list removal in gadget unregistering codeAlexander Shishkin2012-05-081-1/+1
| | | | | | | | | Since ep0{out,in} are never on gadget's ep_list, there's no need to try to unlink them, even more so because ep_list linkage is not initialized for these endpoints. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Merge tag 'gadget-for-v3.5' of ↵Greg Kroah-Hartman2012-05-071-8/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next usb: gadget: patches for v3.5 This pull request is quite big, but mainly because there's a giant rework of the s3c_hsotg.c driver to make it friendlier for other users. Samsung Exynos platforms use the DesignWare Core USB2 IP from Synopsys so it's a bit unfair to have the driver work for Samsung platforms only. In short, the big rework is in preparation to make the driver more reusable. Another big rework in this pull request came from Ido, where he's removing the redundant pointer for the endpoint descriptor from the controller driver's own endpoint representation. The same pointer is available through the generic struct usb_ep structure. Also on this pull request is the conversion of a few extra controller drivers to the new style registration, which allows multiple controllers to be available on the same platform and helps remove global pointers from those drivers. Together with those big changes, there's the usual fixes and cleanups to gadget drivers. Nothing major.
| * usb: gadget: Update ci13xxx_udc to use usb_endpoint_descriptor inside the ↵Ido Shayevitz2012-05-041-8/+7
| | | | | | | | | | | | | | | | | | struct usb_ep Remove redundant pointer to struct usb_endpoint_descriptor. Signed-off-by: Ido Shayevitz <idos@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
* | USB: ci13xxx_udc.c: remove err() usageGreg Kroah-Hartman2012-04-271-16/+19
|/ | | | | | | | | err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Merge tag 'gadget-for-v3.4' of ↵Greg Kroah-Hartman2012-03-011-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next USB: Gadget: changes for 3.4 This merge is rather big. Here's what it contains: For am5536udc we have just simple coding style fixes. Nothing that has any potential to cause any issues going forward. With mv_udc, there's only one single change removing an unneeded NULL check. at91_udc also only saw a single change this merge window, and that's only removing a duplicated header. The Renesas controller has a few more involved changes. Support for SUDMAC was added, there's now a special handling of IRQ resources for when the IRQ line is shared between Renesas controller and SUDMAC, we also had a bug fix where Renesas controller would sleep in atomic context while doing DMA transfers from a tasklet. There were also a set of minor cleanups. The FSL UDC also had a scheduling in atomic context bug fix, but that's all. Thanks to Sebastian, the dummy_hcd now works better than ever with support for scatterlists and streams. Sebastian also added SuperSpeed descriptors to the serial gadgets. The highlight on this merge is the addition of a generic API for mapping and unmapping usb_requests. This will avoid code duplication on all UDC controllers and also kills all the defines for DMA_ADDR_INVALID which UDC controllers sprinkled around. A few of the UDC controllers were already converted to use this new API. Conflicts: drivers/usb/dwc3/gadget.c
| * usb: gadget: Clear usb_endpoint_descriptor inside the struct usb_ep on disableIdo Shayevitz2012-02-241-0/+1
| | | | | | | | | | | | | | | | | | This fix a bug in f_serial, which expect the ep->desc to be NULL after disabling an endpoint. Cc: stable@vger.kernel.org Signed-off-by: Ido Shayevitz <idos@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
* | usb: otg: Convert all users to pass struct usb_otg for OTG functionsHeikki Krogerus2012-02-271-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the otg functions so that they receive struct otg instead of struct usb_phy as parameter and converts all users of these functions to pass the otg member of their usb_phy. Includes fixes to IMX code from Sascha Hauer. [ balbi@ti.com : fixed a compile warning on ehci-mv.c ] Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Igor Grinberg <grinberg@compulab.co.il> Acked-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Acked-by: Li Yang <leoli@freescale.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Reviewed-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* | usb: Convert all users to new usb_phyHeikki Krogerus2012-02-271-5/+5
|/ | | | | | | | | | | | | | | Use the new usb_phy_* functions with transceiver operations instead of the old otg functions. Includes fixes from Sascha Hauer. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Acked-by: Li Yang <leoli@freescale.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Reviewed-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: rename usb_gadget_driver::speed to max_speedMichal Nazarewicz2011-12-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This commit renames the “speed” field of the usb_gadget_driver structure to “max_speed”. This is so that to make it more apparent that the field represents the maximum speed gadget driver can support. This also make the field look more like fields with the same name in usb_gadget and usb_composite_driver structures. All of those represent the *maximal* speed given entity supports. After this commit, there are the following fields in various structures: * usb_gadget::speed - the current connection speed, * usb_gadget::max_speed - maximal speed UDC supports, * usb_gadget_driver::max_speed - maximal speed gadget driver supports, and * usb_composite_driver::max_speed - maximal speed composite gadget supports. Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: replace usb_gadget::is_dualspeed with max_speedMichal Nazarewicz2011-12-121-2/+5
| | | | | | | | | | This commit replaces usb_gadget's is_dualspeed field with a max_speed field. [ balbi@ti.com : Fixed DWC3 driver ] Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* USB: ci13xxx_udc: handle controllers with less than 16 EPsMarc Kleine-Budde2011-12-121-2/+14
| | | | | | | | | | | | | | The ci13xxx_udc driver checks the number of endpoints in the udc controller, however some routines expect that the hardware has 16 bidirectional endpoints. This patch improves the driver to work on controllers with less than 16 endpoints like the udc controller found on freescale's mx23 and mx28. Tested-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
* USB: ci13xxx_udc: make suspend and resume in gadget driver optionalMarc Kleine-Budde2011-12-121-7/+4
| | | | | | | | | | Some gadget drivers don't implement suspend and/or resume functions. Instead of changing the gadget drivers, make suspend and resume in ci13xxx_udc (following other udc drivers) optional. Tested-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
* USB: ci13xxx_udc: fix debug trace codeMarc Kleine-Budde2011-11-141-3/+3
| | | | | | | | | | | | | | | | This patch fixes the following compile errors that show up if switching on the debug trace code: drivers/usb/gadget/ci13xxx_udc.c: In function 'ci13xxx_wakeup': drivers/usb/gadget/ci13xxx_udc.c:2517:3: error: 'dev' undeclared (first use in this function) drivers/usb/gadget/ci13xxx_udc.c:2517:3: note: each undeclared identifier is reported only once for each function it appears in drivers/usb/gadget/ci13xxx_udc.c: In function 'udc_probe': drivers/usb/gadget/ci13xxx_udc.c:2867:2: error: 'name' undeclared (first use in this function) Tested-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: ci13xxx_udc: fix deadlock during rmmodMarc Kleine-Budde2011-11-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The inline documentation of _gadget_stop_activity() states that the function should be called holding the udc->lock. This however will result in a deadlock, because _gadget_stop_activity() takes the udc->lock. During normal operation _gadget_stop_activity() is always called unlocked, but in ci13xxx_stop() it's called locked, this results in the following deadlock during rmmod of a gadget driver. This patch fixes the deadlock by calling _gadget_stop_activity() always unlocked, the inline documentation is adjusted accordingly. ============================================= [ INFO: possible recursive locking detected ] 3.1.0-rc6+ #159 --------------------------------------------- rmmod/121 is trying to acquire lock: (udc_lock){-.-...}, at: [<c0229048>] _gadget_stop_activity+0x18/0x154 but task is already holding lock: (udc_lock){-.-...}, at: [<c02291e0>] ci13xxx_stop+0x5c/0x164 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(udc_lock); lock(udc_lock); *** DEADLOCK *** May be due to missing lock nesting notation 2 locks held by rmmod/121: #0: (udc_lock#2){+.+.+.}, at: [<c02286c0>] usb_gadget_unregister_driver+0x34/0x88 #1: (udc_lock){-.-...}, at: [<c02291e0>] ci13xxx_stop+0x5c/0x164 stack backtrace: [<c000d41c>] (unwind_backtrace+0x0/0xf0) from [<c0056f94>] (check_deadlock.clone.24+0x284/0x2c4) [<c0056f94>] (check_deadlock.clone.24+0x284/0x2c4) from [<c00589ac>] (validate_chain.clone.25+0x430/0x6fc) [<c00589ac>] (validate_chain.clone.25+0x430/0x6fc) from [<c0059bac>] (__lock_acquire+0x494/0x8f0) [<c0059bac>] (__lock_acquire+0x494/0x8f0) from [<c005a698>] (lock_acquire+0x98/0x1a8) [<c005a698>] (lock_acquire+0x98/0x1a8) from [<c02f12a4>] (_raw_spin_lock_irqsave+0x64/0xa0) [<c02f12a4>] (_raw_spin_lock_irqsave+0x64/0xa0) from [<c0229048>] (_gadget_stop_activity+0x18/0x154) [<c0229048>] (_gadget_stop_activity+0x18/0x154) from [<c0229234>] (ci13xxx_stop+0xb0/0x164) [<c0229234>] (ci13xxx_stop+0xb0/0x164) from [<c022867c>] (usb_gadget_remove_driver+0x88/0x98) [<c022867c>] (usb_gadget_remove_driver+0x88/0x98) from [<c02286f4>] (usb_gadget_unregister_driver+0x68/0x88) [<c02286f4>] (usb_gadget_unregister_driver+0x68/0x88) from [<c0065f2c>] (sys_delete_module+0x1fc/0x26c) [<c0065f2c>] (sys_delete_module+0x1fc/0x26c) from [<c00092a0>] (ret_fast_syscall+0x0/0x38) BUG: spinlock lockup on CPU#0, rmmod/121, c05b1644 [<c000d41c>] (unwind_backtrace+0x0/0xf0) from [<c01da000>] (do_raw_spin_lock+0x128/0x144) [<c01da000>] (do_raw_spin_lock+0x128/0x144) from [<c02f12c8>] (_raw_spin_lock_irqsave+0x88/0xa0) [<c02f12c8>] (_raw_spin_lock_irqsave+0x88/0xa0) from [<c0229048>] (_gadget_stop_activity+0x18/0x154) [<c0229048>] (_gadget_stop_activity+0x18/0x154) from [<c0229234>] (ci13xxx_stop+0xb0/0x164) [<c0229234>] (ci13xxx_stop+0xb0/0x164) from [<c022867c>] (usb_gadget_remove_driver+0x88/0x98) [<c022867c>] (usb_gadget_remove_driver+0x88/0x98) from [<c02286f4>] (usb_gadget_unregister_driver+0x68/0x88) [<c02286f4>] (usb_gadget_unregister_driver+0x68/0x88) from [<c0065f2c>] (sys_delete_module+0x1fc/0x26c) [<c0065f2c>] (sys_delete_module+0x1fc/0x26c) from [<c00092a0>] (ret_fast_syscall+0x0/0x38) Tested-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: ci13xxx_udc: fix logic to mark request dma addresses as invalidMichael Grzeschik2011-11-141-4/+8
| | | | | | | | | | | | | | | | | The current driver sets the request's dma addr (mReq->req.dma) to 0 to mark the DMA address as not valid. However some gadget drivers (e.g. gadgetfs) set the request's dma addr to DMA_ADDR_INVALID to mark the address as invalid. This leads to bogus data send because the ci13xxx_udc driver assumes the request has already been mapped. This patch fixes the problem, by using DMA_ADDR_INVALID instead of 0 to mark the request's DMA address as invalid. Tested-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: use usb_endpoint_maxp() instead of le16_to_cpu()Kuninori Morimoto2011-08-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now ${LINUX}/drivers/usb/* can use usb_endpoint_maxp(desc) to get maximum packet size instead of le16_to_cpu(desc->wMaxPacketSize). This patch fix it up Cc: Armin Fuerst <fuerst@in.tum.de> Cc: Pavel Machek <pavel@ucw.cz> Cc: Johannes Erdfelt <johannes@erdfelt.com> Cc: Vojtech Pavlik <vojtech@suse.cz> Cc: Oliver Neukum <oliver@neukum.name> Cc: David Kubicek <dave@awk.cz> Cc: Johan Hovold <jhovold@gmail.com> Cc: Brad Hards <bhards@bigpond.net.au> Acked-by: Felipe Balbi <balbi@ti.com> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Thomas Dahlmann <dahlmann.thomas@arcor.de> Cc: David Brownell <david-b@pacbell.net> Cc: David Lopo <dlopo@chipidea.mips.com> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Michal Nazarewicz <m.nazarewicz@samsung.com> Cc: Xie Xiaobo <X.Xie@freescale.com> Cc: Li Yang <leoli@freescale.com> Cc: Jiang Bo <tanya.jiang@freescale.com> Cc: Yuan-hsin Chen <yhchen@faraday-tech.com> Cc: Darius Augulis <augulis.darius@gmail.com> Cc: Xiaochen Shen <xiaochen.shen@intel.com> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Cc: OKI SEMICONDUCTOR, <toshiharu-linux@dsn.okisemi.com> Cc: Robert Jarzmik <robert.jarzmik@free.fr> Cc: Ben Dooks <ben@simtec.co.uk> Cc: Thomas Abraham <thomas.ab@samsung.com> Cc: Herbert Pötzl <herbert@13thfloor.at> Cc: Arnaud Patard <arnaud.patard@rtp-net.org> Cc: Roman Weissgaerber <weissg@vienna.at> Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Cc: Tony Olech <tony.olech@elandigitalsystems.com> Cc: Florian Floe Echtler <echtler@fs.tum.de> Cc: Christian Lucht <lucht@codemercs.com> Cc: Juergen Stuber <starblue@sourceforge.net> Cc: Georges Toth <g.toth@e-biz.lu> Cc: Bill Ryder <bryder@sgi.com> Cc: Kuba Ober <kuba@mareimbrium.org> Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: gadget: ci13xx_udc.c: fix compile warningSebastian Andrzej Siewior2011-07-051-2/+10
| | | | | | | | | | Fix the following compile warning: | usb/gadget/ci13xxx_udc.c: In function 'show_registers': | usb/gadget/ci13xxx_udc.c:1242:1: warning: the frame size of 2064 bytes is larger than 1024 bytes Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: ci13xx_udc: fix usb_ep_enable() callFelipe Balbi2011-07-011-2/+5
| | | | | | | | | commit 72c973d (usb: gadget: add usb_endpoint_descriptor to struct usb_ep) has introduced a compile error to ci13xxx_udc. Fix it. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: gadget: convert all users to the new udc infrastructureSebastian Andrzej Siewior2011-06-281-14/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | peripheral drivers are using usb_add_gadget()/usb_del_gadget() to register/unregister to the udc-core. The udc-core will take the first available gadget driver and attach function driver which is calling usb_gadget_register_driver(). This is the same behaviour we have right now. Only dummy_hcd was tested, the others were compiled tested. Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Anton Tikhomirov <av.tikhomirov@samsung.com> Cc: Ben Dooks <ben-linux@fluff.org> Cc: Dan Carpenter <error27@gmail.com> Cc: Darius Augulis <augulis.darius@gmail.com> Cc: Eric Miao <eric.y.miao@gmail.com> Cc: Jingoo Han <jg1.han@samsung.com> Cc: Kukjin Kim <kgene.kim@samsung.com> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Cc: Li Yang <leoli@freescale.com> Cc: Michael Hennerich <michael.hennerich@analog.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Pavankumar Kondeti <pkondeti@codeaurora.org> Cc: Roy Huang <roy.huang@analog.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Toshiharu Okada <toshiharu-linux@dsn.okisemi.com> Cc: Xiaochen Shen <xiaochen.shen@intel.com> Cc: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> Cc: Yuan-Hsin Chen <yhchen@faraday-tech.com> Cc: cxie4 <cxie4@marvell.com> Cc: linux-geode@lists.infradead.org Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: OTG: msm: Implement charger detectionPavankumar Kondeti2011-05-061-0/+10
| | | | | | | | | | | | | | | | | Implement good battery algorithm defined in the battery charging V1.2 spec for detecting different charging ports. USB hardware is put into low power mode when connected to a dedicated charging port. vbus_draw and set_power methods are implemented for determining the allowed current from Host in different states (un-configured/suspend/configured). The charger block is implemented using vendor specific registers and the PHY used in MSM8960(28nm PHY) different from older targets like MSM8x60 and MSM7x30(45nm PHY). The PHY vendor and product id registers are not implemented in the above chipsets. Hence PHY type is passed via platform data. Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: Initialize ep0 once while registering gadget in ci13xxx_udcAnji jonnala2011-05-031-14/+17
| | | | | | | | | | | | | | | | Some of the simulators may cache the ep0 maxpacket size to zero if the ep0 dQh is not setup before enabling the pullup. Hence Setup ep0 and initialize the dQh fields once while registering the gadget(before enabling the pullup). HSUSB Chipidea link controller spec says ep0 is enabled always in the HW. Hence disabling and enabling the ep0 as a part of reset interrupt is unneccesary. Remove the disable/enable ep0 logic from reset interrupt handling. Signed-off-by: Anji jonnala <anjir@codeaurora.org> Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: Use ep0out for control OUT data phase in ci13xxx_udcPavankumar Kondeti2011-05-031-6/+14
| | | | | | | | The current code queue the control OUT data request to ep0in instead of ep0out. Check ep0_dir and use the correct control endpoint. Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: Fix bug in endpoint feature request processing in ci13xxx_udcPavankumar Kondeti2011-05-031-1/+7
| | | | | | | | | The OUT endpoints are stored in 0 - hw_ep_max/2 and IN endpoints are stored from hw_ep_max/2 - hw_ep_max in ci13xxx_ep array. Retrieve the IN endpoint correctly while processing endpoint feature requests. Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: Fix unused variable warning in ci13xxx_udcPavankumar Kondeti2011-05-031-1/+1
| | | | | Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: Use bitwise AND operator to test flags in ci13xxx_udcPavankumar Kondeti2011-05-031-1/+1
| | | | | Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: Fix typo (s/EBUSY/-EBUSY) in ci13xxx_udcPavankumar Kondeti2011-05-031-1/+1
| | | | | Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: Add test mode support for ci13xxx_udcPavankumar Kondeti2011-02-251-6/+50
| | | | | | | | | Implement the test modes mentioned in 7.1.20 section of USB 2.0 specification. High-speed capable devices must support these test modes to facilitate compliance testing. Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: Implement remote wakeup in ci13xxx_udcPavankumar Kondeti2011-02-251-29/+95
| | | | | | | | | | | | | | | | This patch adds support for remote wakeup. The following things are handled: - Process SET_FEATURE/CLEAR_FEATURE control requests sent by host for enabling/disabling remote wakeup feature. - Report remote wakeup enable status in response to GET_STATUS control request. - Implement wakeup method defined in usb_gadget_ops for initiating remote wakeup. - Notify gadget driver about suspend and resume. Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: Implement hardware queuing in ci13xxx_udcPavankumar Kondeti2011-02-251-76/+100
| | | | | | | | | | | Chipidea USB controller provides a means (Add dTD TripWire semaphore) for safely adding a new dTD to an active endpoint's linked list. Make use of this feature to improve performance. Dynamically allocate and free dTD for supporting zero length packet termination. Honor no_interrupt flag set by gadget drivers. Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: Fix endpoint representation in ci13xxx_udcPavankumar Kondeti2011-01-221-128/+136
| | | | | | | | | | | | | Fix a bug where only half the number of endpoints supported by the hardware are exposed to gadget. If DEN filed in the DCCPARAMS register has 'N' then 'N' IN endpoints and 'N" OUT endpoints can be supported. But only 'N' bidirectional endpoints are added to the gadget ep_list. This patch also ensures that the data and handshake transactions of previous setup packet are flushed upon a new setup packet arrival on ep0. Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: Fix error path in ci13xxx_udc gadget probe functionPavankumar Kondeti2011-01-221-3/+1
| | | | | | | | | | Don't call gadget driver's unbind when bind is failed. Initialize udc->driver only after gadget driver bind is successful. Otherwise pull-up can be enabled upon VBUS session even when no gadget is bounded. Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: ci13xxx: don't assume that PAGE_SIZE is 4096Artem Leonenko2010-12-161-5/+5
| | | | | | | | | Page size for transaction descriptors for CI13XXX has nothing common with page size from MM. Using platform and configuration specific PAGE_SIZE is wrong. Signed-off-by: Artem Leonenko <tikkeri@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: ci13xxx: fix complete() callback for no_interrupt rq'sArtem Leonenko2010-12-161-3/+3
| | | | | | | | | | | | | | CI13xxx UDC driver doesn't call complete() callback for requests with flag no_interrupt set. Thus gadget drivers (like g_ether) are never notifed about successfully (or not) transmitted requests. As a result in case of g_ether and queued request with no_interrupt=1 fields g_ether is never notifed about sent packets and TX stalls. Solution: treat no_interrupt flag like all other UDC drivers do and call complete() callback for all requests. Signed-off-by: Artem Leonenko <tikkeri@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: update ci13xxx to work with g_etherArtem Leonenko2010-12-161-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is one nasty scenario when CI13xxx driver fails: a) two or more rx requests are queued (g_ether does that) b) rx request completed, interrupt fires and ci13xxx dequeues rq c) request complete() callback gets called and in turn it calls ep_queue() c1) in ep_queue() request gets added to the TAIL of the rx queue list d) ep gets primed with rq from (b) e) interrupt fires f) request gets popped from queue head for hw dequeue G) requets from queue head wasn't enqueued g1) isr_tr_complete_low() doesn't enqueue more requests and it doesn't prime EP, rx traffic stalls Solution: a) enque queued requests ASAP, i.e. before calling complete() callback. b) don't HW enqueue and prime endpoint with recently added request and use the oldest request in the queue. Fixed issues: a) ep_queue() may return an error code despite request was successfully added to the queue (if _hardware_enqueue() fails) b) Added requests are always processed in LIFO order, even if they are added in complete() callback c) Finally more than two and more queued requests are processed consistently, even if they were added in complete() callback The fix was successfully tested on MIPS based SoC with 4KEc CPU core and CI13612 USB core. Board successfully boots with NFS root using g_ether on ci13xxx udc. Signed-off-by: Artem Leonenko <tikkeri@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadgets: ci13xxx: fix probing of compiled-in gadget driversArtem Leonenko2010-12-161-1/+0
| | | | | | | | | Built-in gadget drivers have NULL-ifed unbind() function. Checking whether unbind() is NULL will never let any compiled into kernel driver attach. Signed-off-by: Artem Leonenko <tikkeri@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: Implement runtime PM for ci13xxx gadgetPavankumar Kondeti2010-12-101-0/+10
| | | | | | | | The actual suspend/resume work is delegated to bus glue driver, which is responsible for putting hardware in low power mode. Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
OpenPOWER on IntegriCloud