Commit Graph

15 Commits

Author SHA1 Message Date
Pratyush Anand 08f0d96670 usb: dwc3: correct set_halt implementation for ep0
set_halt for ep0 is called to stall a deferred control responses by the
gadget.  We already have a function to stall default control endpoint.
This patch points set_halt for ep0 to the already available function.

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Michel Sanches <michel.sanches@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-07-02 10:02:07 +03:00
Paul Zimmerman 2c61a8efce usb: dwc3: add definitions for new registers
This patch adds definitions for some new registers that have been
added to later versions of the controller, up to v2.10a.

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-06-03 23:08:21 +03:00
Felipe Balbi b09bb64239 usb: dwc3: gadget: implement Global Command support
This will be used by the ep0 layer for implementing
Set SEL Standard Request.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-05-02 09:42:56 +03:00
Greg Kroah-Hartman 3d71769014 usb: dwc3: changes for v3.4 merge window
Here are the changes for v3.4 merge window.
 
 It includes a new glue layer for Samsung's Exynos platform, a simplification of
 memory management on DWC3 driver by using dev_xxx functions, a few
 optimizations to IRQ handling by dropping memcpy() and using bitshifts, a fix
 for TI's OMAP5430 TX Fifo Allocation, two fixes on USB2 test mode
 implementation (one on debugfs and one on ep0), and several minor changes such
 as whitespace cleanups, simplification of a few parts of the code, decreasing a
 long delay to something a bit saner, dropping a header which was included twice
 and so on.
 
 The highlight on this merge is the support for Samsung's Exynos platform,
 increasing the number of different users for this driver to three.
 
 Note that Samsung Exynos glue layer will only compile on platforms which
 provide implementation for the clk API for now. Once Samsung supports
 pm_runtime, that limitation can be dropped from the Makefile.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJPUJ2bAAoJEIaOsuA1yqREwOgP/2bG6rvPBMlGmXvvR40HNUXJ
 jXzkXcrTBrO172Fxl2P+mAgNFggMURrOdiyXwl7+2Ib0NM7sS9jwikuxos8DwuQv
 Ci0GgJtQySORIl5Sw29uB1W65aV2ieNBh/fN/52LwVOQYITt89GYK1DsRUWRN2V/
 0bw3OepckiAFN5gWRykIYIUXZs8DQa+L1qYc6fexZk7zZ+XrjdNba8RzGzsyUelD
 BB0eOj4E2Mda6Yp7kyiBRuTXVAUChNa5J0iCvXSnR8l2wppfXlmD2UD4Sfo/yxd5
 q25/rm1e1A4iKcPjSkhzTayQKrLWEgCxZK69sZXlEPG9qhA3iMjWDNBvEy6cV4bc
 bFFjwXAObX+bm+QDYqcD66iUZTPzEW149W/e5B7+XGk09NcCs/wqoA1jEgCLEHnv
 3rsG0RvsgtMdwmBYpO8zrhJPTFa6NAq9Qc4nLj3WefXP9Vkl5gpfneIcgYKB6x0q
 LHRQsLHBWl/hXClWAPflDJaGQqEt6hjkA3IqV03yTlMNuYxDNJy931J6Cz9a9Lu5
 Gr2By/bHVcADmt8WzituQsnLvQIzLLGl0U0lKpdl24I52roqMkZVj7XaWDojLVSq
 HZnbk+c3PdEXVIDNCz1QnCY/QojEhKkeR23LP3YD8L9KxcOu8DNyL1RKdYqx3Cnv
 vrqerutPusT6kGvaRQIk
 =4Z2+
 -----END PGP SIGNATURE-----

Merge tag 'dwc3-for-v3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

usb: dwc3: changes for v3.4 merge window

Here are the changes for v3.4 merge window.

It includes a new glue layer for Samsung's Exynos platform, a simplification of
memory management on DWC3 driver by using dev_xxx functions, a few
optimizations to IRQ handling by dropping memcpy() and using bitshifts, a fix
for TI's OMAP5430 TX Fifo Allocation, two fixes on USB2 test mode
implementation (one on debugfs and one on ep0), and several minor changes such
as whitespace cleanups, simplification of a few parts of the code, decreasing a
long delay to something a bit saner, dropping a header which was included twice
and so on.

The highlight on this merge is the support for Samsung's Exynos platform,
increasing the number of different users for this driver to three.

Note that Samsung Exynos glue layer will only compile on platforms which
provide implementation for the clk API for now. Once Samsung supports
pm_runtime, that limitation can be dropped from the Makefile.

Conflicts:
	drivers/usb/dwc3/gadget.c
2012-03-02 15:56:33 -08:00
Felipe Balbi 0fc9a1be09 usb: dwc3: gadget: use generic map/unmap routines
those routines have everything we need to map/unmap
USB requests and it's better to use them.

In order to achieve that, we had to add a simple
change on how we allocate and use our setup buffer;
we cannot allocate it from coherent anymore otherwise
the generic map/unmap routines won't be able to easily
know that the GetStatus request already has a DMA
address.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-28 14:48:54 +02:00
Felipe Balbi 8598bde7fa usb: dwc3: gadget: re-factor Link state change to a function
Most link changes will, of course, happen with
the help of a matching host HW, but in some cases
we might want to debug very low level details about
the link and exposing this to debugfs sounds like
a good plan.

This is a preparation for such setup.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-06 11:48:24 +02:00
Felipe Balbi 04a9bfcd50 usb: dwc3: gadget: re-factor USB2 test mode to a function
There are some situations were we might need to
enable USB Test Modes without having access to a
Host stack. In such situations we cannot rely
solely on USB Control Messages to enable test
features.

For those cases, we will also allow test mode
to be enabled via debugfs and this patch is a
preparation for that.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-06 11:48:19 +02:00
Sebastian Andrzej Siewior e0ce0b0a0a usb: dwc3: ep0: use dwc3_request for ep0 requsts instead of usb_request
Instead of special functions and shortcuts for sending our internal
answers to the host we started doing what the gadget does and used the
public API for this. Since we only were using a few fields the
usb_request was enough. Later added the list handling in order to
synchronize the host / gadget events and now we require to have the
dwc3_request struct around our usb_request or else we touch memory that
does not belong to us. So this patch does this.

Reported-by: Partha Basak <p-basak2@ti.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:48:45 +02:00
Felipe Balbi 25b8ff68bf usb: dwc3: fix few coding style problems
There were a few coding style issues with this driver
which are now fixed:

drivers/usb/dwc3/debugfs.c:48: WARNING: Use #include \
	<linux/uaccess.h> instead of <asm/uaccess.h>
drivers/usb/dwc3/debugfs.c:484: ERROR: space required \
	before the open brace '{'
drivers/usb/dwc3/ep0.c:261: WARNING: line over 80 characters
drivers/usb/dwc3/ep0.c:287: WARNING: suspect code indent \
	for conditional statements (16, 23)
drivers/usb/dwc3/gadget.c:749: WARNING: line over 80 characters
drivers/usb/dwc3/gadget.c:1267: WARNING: line over 80 characters
drivers/usb/dwc3/gadget.h:116: WARNING: line over 80 characters
drivers/usb/dwc3/io.h:42: WARNING: Use #include \
	<linux/io.h> instead of <asm/io.h>

Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:48:29 +02:00
Felipe Balbi f80b45e75e usb: dwc3: move gadget prototypes to core.h
host prototypes are there, let's move gadget's
closer.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:48:13 +02:00
Felipe Balbi 67920bd7c9 usb: dwc3: always compile gadget side too
We can decide in runtime if that will be used
or not.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:48:13 +02:00
Felipe Balbi dc1c70a774 usb: dwc3: convert structures into bitshifts
our parameter structures need to be written to
HW, so instead of assuming little endian, we
convert those into bit shifts.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-10-04 10:25:56 -07:00
Sebastian Andrzej Siewior 49a25cc9a7 usb: dwc: remove "All rights reserved" statement.
Some people think that this line is not compatible with the GPL. The
statement was required due to the Buenos Aires Convention and is now
deprecated. I remove it because it is said that it is pointless nowdays.

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-10-04 10:25:52 -07:00
Randy Dunlap 096cb25d62 usb: fix dwc3 build when USB_GADGET_DWC3 is not enabled
Fix build error when CONFIG_USB_GADGET_DWC3 is not enabled:

ERROR: "dwc3_send_gadget_ep_cmd" [drivers/usb/dwc3/dwc3.ko] undefined!

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-24 15:06:53 -07:00
Felipe Balbi 72246da40f usb: Introduce DesignWare USB3 DRD Driver
The DesignWare USB3 is a highly
configurable IP Core which can be
instantiated as Dual-Role Device (DRD),
Peripheral Only and Host Only (XHCI)
configurations.

Several other parameters can be configured
like amount of FIFO space, amount of TX and
RX endpoints, amount of Host Interrupters,
etc.

The current driver has been validated with
a virtual model of version 1.73a of that core
and with an FPGA burned with version 1.83a
of the DRD core. We have support for PCIe
bus, which is used on FPGA prototyping, and
for the OMAP5, more adaptation (or glue)
layers can be easily added and the driver
is half prepared to handle any possible
configuration the HW engineer has chosen
considering we have the information on
one of the GHWPARAMS registers to do
runtime checking of certain features.

More runtime checks can, and should, be added
in order to make this driver even more flexible
with regards to number of endpoints, FIFO sizes,
transfer types, etc.

While this supports only the device side, for
now, we will add support for Host side (xHCI -
see the updated series Sebastian has sent [1])
and OTG after we have it all stabilized.

[1] http://marc.info/?l=linux-usb&m=131341992020339&w=2

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-22 16:03:11 -07:00