Commit graph

118 commits

Author SHA1 Message Date
Wei Yongjun 481d30427e usb: gadget: dummy_hcd: fix error return code in init()
Fix to return -ENOMEM in the kzalloc() error handling case instead
of 0(following platform_device_add_data() will overwrite it to 0), as
done elsewhere in this function.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-05-15 17:25:31 +03:00
Sachin Kamat a0c67276ee usb: gadget: dummy_hcd: Remove redundant platform_set_drvdata()
Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-05-15 17:21:09 +03:00
Felipe Balbi 814cf212f9 usb: gadget: dummy: fix sparse warning
fix the following sparse warning:

drivers/usb/gadget/dummy_hcd.c:1912:12: warning: symbol 'usb3_bos_desc' was not declared. Should it be static?

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-27 13:18:58 +02:00
Felipe Balbi f7162e9e1c usb: gadget: dummy_hcd: don't assign gadget.dev.release directly
udc-core provides a better way to handle release
methods, let's use it.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:17:47 +02:00
Felipe Balbi 42c82fb4d1 usb: gadget: dummy_hcd: don't touch gadget.dev.driver
udc-core now handles that for us, which means
we can remove it from our driver.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:17:34 +02:00
Felipe Balbi 7bce401cc6 usb: gadget: drop now unnecessary flag
We don't need the ->register_my_device flag
anymore because all UDC drivers have been
properly converted.

Let's remove every history of it.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:16:55 +02:00
Felipe Balbi 002cb13f4a usb: gadget: dummy_hcd: let udc-core manage gadget->dev
By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:16:43 +02:00
Sebastian Andrzej Siewior 1d16638e3b usb: gadget: dummy: fix enumeration with g_multi
If we do have endpoints named like "ep-a" then bEndpointAddress is
counted internally by the gadget framework.

If we do have endpoints named like "ep-1" then bEndpointAddress is
assigned from the digit after "ep-".

If we do have both, then it is likely that after we used up the
"generic" endpoints we will use the digits and thus assign one
bEndpointAddress to multiple endpoints.

This theory can be proofed by using the completely enabled g_multi.
Without this patch, the mass storage won't enumerate and times out
because it shares endpoints with RNDIS.

This patch also adds fills up the endpoints list so we have in total
endpoints 1 to 15 in + out available while some of them are restricted
to certain types like BULK or ISO. Without this change the nokia gadget
won't load because the system does not provide enough (BULK) endpoints
but it did before ep-a - ep-f were removed.

Cc: stable@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-12-13 11:58:46 +02:00
Sebastian Andrzej Siewior b100a2f34d usb: gadget: dummy_hcd: remove global the_controller variable
The one thing that makes two UDCs+HCDs impossible is the global
the_controller variable. This patch changes this. After device
allocation we allocate the "the_controller" variable and pass it as
platform_data to the UDC and its companion.
We can have now multiple instances dummy hcd and therefore I change the
limit from one to two. I was able to test this with g_ncm adn g_zero:

|# lsusb
|Bus 001 Device 002: ID 0525:a4a0 Netchip Technology, Inc. Linux-USB "Gadget Zero"
|Bus 002 Device 002: ID 0525:a4a1 Netchip Technology, Inc. Linux-USB Ethernet Gadget
|Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
|Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I was able to start testusb -a and ifconfig usb[01] up with no complains.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-10-31 15:18:01 +02:00
Sebastian Andrzej Siewior c7a1db457b usb: gadget: dummy_hcd: add setup / cleanup of multiple HW intances
This patch creates & adds multiple instances of the HCD and UDC. We have
a new module option "num" which says how many emulated UDCs + HCDs we
want. The default value is one and currently the maximum is one as well.
This will change soon.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-10-31 15:17:07 +02:00
Sebastian Andrzej Siewior b2113136a5 usb: gadget: dummy_hdc: prepare for multiple instances
This patch replaces the single pdev variable by an array. One change:
The device id is no longer -1 (i.e. none) but 0.
This is prepation work for multiple instances of the dummy_hcd + udc
which should help to test gadget framework with multiple UDCs.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-10-31 15:16:47 +02:00
Greg Kroah-Hartman 2bcb132c69 Merge 3.6-rc6 into usb-next
This resolves the merge problems with:
	drivers/usb/dwc3/gadget.c
	drivers/usb/musb/tusb6010.c
that had been seen in linux-next.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-16 20:42:46 -07:00
Sebastian Andrzej Siewior 3b9c1c5ba7 usb: gadget: dummy_hcd: add support for USB_DT_BOS on rh
Without a reply for USB_DT_BOS the USB3 mode does not work since
448b6eb1 ("USB: Make sure to fetch the BOS desc for roothubs.).

Cc: stable@vger.kernel.org #v3.5
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-06 19:52:26 +03:00
Sebastian Andrzej Siewior 1b68a4ca2d usb: gadget: dummy_hcd: fixup error probe path
If USB2 host controller probes fine but USB3 does not then we don't
remove the USB controller properly and lock up the system while the HUB
code will try to enumerate the USB2 controller and access memory which
is no longer available in case the dummy_hcd was compiled as a module.

This is a problem since 448b6eb1 ("USB: Make sure to fetch the BOS desc
for roothubs.) if used in USB3 mode because dummy does not provide this
descriptor and explodes later.

Cc: stable@vger.kernel.org # v3.5
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-06 19:52:25 +03:00
Alan Stern d0d860758b usb: gadget: dummy-hcd: remember to update driver pointer
This patch (as1599) fixes dummy-hcd to make it update the appropriate
driver pointer when a new gadget driver is bound or unbound.  Without
this change, the gadget driver's name doesn't appear in dev_printk
output.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-08-31 12:41:39 +03:00
Sasha Levin 72688dc95a usb: gadget: dummy_hcd: fix build when BUG is not set
Use WARN_ON() instead of __WARN, which also means we won't use any
internal macros.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-11 15:17:31 -07:00
Greg Kroah-Hartman 6a1e1d71d0 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.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJPp3l8AAoJEIaOsuA1yqRECjkP/3mScTFWEgjQsa7ynlYW6bfE
 9uI3yP0VPws8EK0MBIOeXOhz7z/x/of/9XEEvnVjqnVkXlYc23IEJactbc1sYHQY
 WsUyeuD6D+W5UHkomV0W8Xh1agVeW9QYDubQxI62KL81pWCC3MVa+BfW+430lrdi
 7FUxWykCByYu1VYNZYfaGFyKalkpOpIydFtAZp2ykawUJMyB1PPl+2uzA1u/zB9A
 Tm6E2Su+CzWp59/Udc64O25FhPo/g5GQWX2VbO1XneUrpNQgfihq6RjSi3hHYZdq
 NkeR0eWwc5KeWZfsfm57AErQlN97uP3fAUSHz9o6c5N9V7bW221sCh4ZH3s32+IB
 Dnps2WbW7IslUntYd1GyakfRILTrhMbg7GJZbmxdzWmIK6Pv0NLISPq4bZ64QJOH
 iqa8NtluN0m1DSwUNX7UBHQZ6Cj1X3xZIdAJvdg4IlqUJ+Q2UmgCG9/kloF1H0C3
 QnRXUEgbmMZ42sVVWEafUhwfEQTNFJyWd7OpFuyo8R3vARJg/miaEy7Lf+IqpRxD
 5WV6o/TVCL2c6lQP2NbJoCSr10K2VcHOJpUS8cYv6K+ZIyTbKvOh8rlArX2+/W3a
 YZtd+nfq2FyuRVxAasXwpsVCDT319LWt+Myq+9cl23+PyN54j+OnhHPJr15tBru1
 OB/Z6arXyc17Gq/Ng2ur
 =irDV
 -----END PGP SIGNATURE-----

Merge tag 'gadget-for-v3.5' of 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.
2012-05-07 09:49:32 -07:00
Sebastian Andrzej Siewior f99987bb26 usb: gadget: dummy_hcd: allow to free requests on disabled endpoints
ep->desc is set to NULL on endpoint disable. That means once an endpoint
is disabled it is not possible to free requests. In my target gadget I
first disable endpoints to make sure I have no requests on the fly and
then free frequests. On dummy I am leaking memory here.
Since I can't imagine a reason why it should be a bad thing, lets allow
to free requests on disabled endpoints. On removal of composite the ep0
request is removed so lets allow that here as well.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-05-04 15:53:04 +03:00
Felipe Balbi 15b120d670 usb: gadget: dummy: do not call pullup() on udc_stop()
pullup() is already called properly by udc-core.c and
there's no need to call it from udc_stop(), in fact that
will cause issues.

Cc: stable@vger.kernel.org
Reviewed-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-04-19 12:40:08 +03:00
David Howells 9ffc93f203 Remove all #inclusions of asm/system.h
Remove all #inclusions of asm/system.h preparatory to splitting and killing
it.  Performed with the following command:

perl -p -i -e 's!^#\s*include\s*<asm/system[.]h>.*\n!!' `grep -Irl '^#\s*include\s*<asm/system[.]h>' *`

Signed-off-by: David Howells <dhowells@redhat.com>
2012-03-28 18:30:03 +01:00
Dan Carpenter b1443ac0e4 usb: gadget: dummy_hcd: signedness bug in transfer()
"len" is unsigned so it's never less than zero.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-02 16:22:11 -08:00
Sebastian Andrzej Siewior 20edfbb6a1 usb: gadget: dummy_hcd: fix null-deref free req
_ep to ep is a pointer substraction so ep won't be zero unless _ep was
8. This was not intendent by the author, it was probably a typo while
checking for NULL of the argument.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-09 09:54:00 +02:00
Sebastian Andrzej Siewior 3cf0ad02e4 usb: gadget: dummy_hcd: don't assign ->desc on error case
If the stream check fails then we leave ep->desc assigend but we return
with an error code. The caller assumes the endpoint is not enabled
(which is the case) but it can not enable it again due to this
assigment.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-09 09:53:53 +02:00
Sebastian Andrzej Siewior 18f2cbaa2b usb: gadget: dummy_hcd: clean up checkpatch
This patch converts checkpatch output of
|./scripts/checkpatch.pl drivers/usb/gadget/dummy_hcd.c -file

from
|total: 22 errors, 174 warnings, 2642 lines checked

to
|total: 0 errors, 0 warnings, 2632 lines checked

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-01-24 11:42:42 +02:00
Sebastian Andrzej Siewior 59f08e6d20 usb: dummy_hcd: use usb_endpoint_type()
This patch makes use of usb_endpoint_type() instead of the open coding.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-01-24 11:40:46 +02:00
Sebastian Andrzej Siewior a54c979fed usb: gadget: dummy_hcd: complete stream support
dummy_hcd provides (alloc|free)_stream() callbacks but there are not
doing anything. The transfer side also lacks matching of streams. This
patch changes this and implements stream allocation / de-allocation
support and proper urb <=> req matching.
The UDC side exposes a limit of 16 streams. DWC3, the only USB3 UDC has
no limitations in this regard except that it _needs_ to know that
streams will be used at the ep_enable time. At the host side, there is
no real limit either: XHCI can allocate any number of streams as long as
it does not run out of memory. The UAS gadget currently requests 16
streams and the UAS host side fallbacks from the requested 256 down to
16 which is fine.
From the UASP point of view (the only specified user), the number of
used streams does not really matter. The only limitation is that the
host may not use a higher stream than the gadget requested and can deal
with.

The dummy stream support has been modelled after current UAS + XHCI +
DWC3 + UASP usage which helps me testing:
- the device announces that each ep supports 16 streams (even it could
  more than that).
- the device side looks into Companion descriptor at ep_enable time and
  enables them according to it.
- the host side tries to enable the requested number of streams but the
  upper limit is the Comanion descriptor. None (zero streams) is an
  error condition, less is okay.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-01-24 11:39:49 +02:00
Sebastian Andrzej Siewior d81f3e4f57 usb: gadget: dummy_hcd: make alloc/free streams static
There is no reason why dummy_alloc_streams() and dummy_free_streams()
are global. Make them static instead.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-01-24 11:25:32 +02:00
Sebastian Andrzej Siewior d262127c33 usb: gadget: dummy_hcd: rename dummy_udc_udpate_ep0() to dummy_udc_update_ep0()
This renames a function so "update" is spelled properly.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-01-24 11:25:31 +02:00
Sebastian Andrzej Siewior 14fce33a96 usb: gadget: dummy_hcd: add sg support
This patch adds sg support to dummy_hcd. It seems that uas is not able
to work with a hcd which does not support sg only based transfers.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-01-24 11:23:31 +02:00
Sebastian Andrzej Siewior a04ce20d9f usb: gadget: dummy_hcd: move the transfer part into its own function
This patch moves the part of the code which does the bare transfer into
its function. It is a preparion for the implementation of sg support.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-01-24 11:20:36 +02:00
Sebastian Andrzej Siewior c688419141 usb: gadget: dummy_hcd: initialize max_streams early
While playing with uasp I noticed that it does not work with dummy_hcd.
The problem is that uasp requires a stream capable endpoint which it is
requesting at bind time like every other gadget. dummy_hcd however
initializes the max_stream value after connect once it knows if it runs
at SS or not.
I don't think that it is might be wrong to initialize the stream
capability even at HS speed. The gadget may not use this descriptor at
HS speed so it should not cause any damage.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-01-24 11:19:56 +02:00
Michal Nazarewicz 7177aed44f usb: gadget: rename usb_gadget_driver::speed to max_speed
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>
2011-12-12 11:45:12 +02:00
Michal Nazarewicz d327ab5b6d usb: gadget: replace usb_gadget::is_dualspeed with max_speed
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>
2011-12-12 11:45:11 +02:00
Klaus Schwarzkopf 28c9fc68eb usb gadget: clean up FSF boilerplate text
remove the following two paragraphs as they are not needed:

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
License for more details.

You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,59
Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Signed-off-by: Klaus Schwarzkopf <schwarzkopf@sensortherm.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-09 16:00:09 -07:00
Kuninori Morimoto 29cc88979a USB: use usb_endpoint_maxp() instead of le16_to_cpu()
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>
2011-08-23 09:47:40 -07:00
Sebastian Andrzej Siewior aa07473943 usb: gadget: dummy_hcd: convert to new-style udc-probe
bind() and pull is moved to udc core, call callbacks are verified by the
upper layer.

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>
2011-07-01 14:31:14 -07:00
Sebastian Andrzej Siewior b5738413c9 usb: gadget: dummy_hcd: move selection of speed into ->pullup()
The configuration is static however we only know the speed after we have
connected with the other side.

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>
2011-07-01 14:31:13 -07:00
Sebastian Andrzej Siewior f8744d40ca usb: gadget: dummy_hcd: init is_otg in init_dummy_udc_hw()
This value is now assigned during bind(). The configuration depends on
static values assigned by dummy driver itself. So there is no need to
defer this assigment until one know the actuall speed since the
configuration is static and known early.

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>
2011-07-01 14:31:13 -07:00
Sebastian Andrzej Siewior 0fb5759952 usb: gadget: dummy_hcd: move ep initialisation HW setup
This is only required to be done once. There is no counter part to this
in ->stop() so there is no need to re-do it next time. While here also
init the max_stream size to 0 on SS speed.

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>
2011-07-01 14:31:12 -07:00
Sebastian Andrzej Siewior fc0b721f27 usb: gadget: dummy_hcd: move common bits of suspend/resume into one function
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>
2011-07-01 14:31:09 -07:00
Sebastian Andrzej Siewior 4baa74fe32 usb: gadget: remove net2280_set_fifo_mode()
This function has no user in my tree. It looks like it belongs to
net2280 but it somehow morphed into the dummy_hcd. So I remove it
before it spreads into more drivers.
After some digging I figured out that the only user was removed in

|commit 9079e91b5b
|Author: David Brownell <david-b@pacbell.net>
|Date:   Wed May 7 16:00:36 2008 -0700
|
|    USB: serial gadget: cleanup/reorg

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>
2011-07-01 14:31:08 -07:00
Sebastian Andrzej Siewior d8a14a85c7 usb: gadget: dummy_hcd: use less checks for USB_SPEED_SUPER
Taking the correct struct once avoids doing the speed dance.

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>
2011-07-01 14:31:08 -07:00
Sebastian Andrzej Siewior 719e52cbc7 usb: gadget: dummy_hcd: use gadget_to_dummy_hcd() where possible
gadget_to_dummy_hcd() already does the speed check, so
it's unnecessary to unroll that all the time.

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>
2011-07-01 14:31:07 -07:00
Sebastian Andrzej Siewior 99fd14080e usb: gadget: dummy_hcd: set gadget.is_otg before calling bind()
Before commit 53832daea ("usb: gadget: dummy_hcd: use the shared_hcd
infrastructure") the is_otg field was set in dummy_udc_probe(). It seems
to me that this field is used in gadget's bind function. Therefore I'm
moving it before the bind() callback is called.

Cc: Tatyana Brokhman <tlinder@codeaurora.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>
2011-07-01 14:31:07 -07:00
Sebastian Andrzej Siewior 2542787430 usb: gadget: dummy_hcd: use dummy_pullup() instead of open coding
The removed code does the same thing as dummy_pullup(). The only
difference is that in dummy_udc_stop() the first dummy_pullup()
did not call usb_hcd_poll_rh_status().

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>
2011-07-01 14:31:06 -07:00
Tatyana Brokhman 7eca4c5a8b usb: gadget: dummy_hcd: add 'is_high_speed' parameter
This patch adds a new module parameter to dummy_hcd
called is_high_speed.

When set to false the connected device will be forced
to operate in full-speed mode. By default, this parameter
is set to 'true'.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-01 14:27:06 -07:00
Tatyana Brokhman 1cd8fd2887 usb: gadget: dummy_hcd: add SuperSpeed support
This patch adds SS support to the dummy hcd module.
It may be used to test SS device when no (SS) HW is
available.

USB 3.0 hub includes 2 hubs - one HS and one SS. This
patch adds support for a SS root hub in the dummy_hcd
module.

A new module parameter was added: is_super_speed. When
set to true, a SS root hub will also be registered and
the connected device will be enumerated over the SS
root hub. The default of this parameter is false.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

[ balbi@ti.com : slight change to commit log
		 fixed one coding style issue ]

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-01 14:27:06 -07:00
Tatyana Brokhman cdfcbd2c4a usb: gadget: dummy_hcd: use the shared_hcd infrastructure
This patch is a preparation for adding SuperSpeed
support to dummy hcd.

It takes the master side fields out of the struct
dummy to a separate structure. The init process
was also modified to resemble the way it is
done by xHCI.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-01 14:27:05 -07:00
Tatyana Brokhman 7c884fe4d7 usb: gadget: coding style fix
fix the coding style of a few switches on the
gadget framework.

[ balbi@ti.com : add a commit log ]

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 11:19:40 -07:00
Sebastian Andrzej Siewior 0f91349b89 usb: gadget: convert all users to the new udc infrastructure
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>
2011-06-28 11:13:35 -07:00