]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
12 years agoMerge branch 'for-gadget/next' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Thu, 22 Dec 2011 22:05:01 +0000 (14:05 -0800)]
Merge branch 'for-gadget/next' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

* 'for-gadget/next' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: (24 commits)
  usb: dwc3: gadget: add support for SG lists
  usb: dwc3: gadget: don't force 'LST' always
  usb: dwc3: gadget: don't return anything on prepare trbs
  usb: dwc3: gadget: re-factor dwc3_prepare_trbs()
  usb: gadget: introduce support for sg lists
  usb: renesas: pipe: convert a long if into a XOR operation
  usb: gadget: remove useless depends on Kconfig
  usb: gadget: s3c-hsudc: remove the_controller global
  usb: gadget: s3c-hsudc: use release_mem_region instead of release_resource
  usb: gadget: s3c-hsudc: Add regulator handling
  usb: gadget: s3c-hsudc: use udc_start and udc_stop functions
  usb: gadget: s3c-hsudc: move device registration to probe
  usb: gadget: s3c-hsudc: add missing otg_put_transceiver in probe
  usb: gadget: s3c-hsudc: add __devinit to probe function
  usb: gadget: s3c-hsudc: move platform_data struct to global header
  USB: EHCI: Add Marvell Host Controller driver
  USB: OTG: add Marvell usb OTG driver support
  usb: gadget: mv_udc: drop ARCH dependency
  usb: gadget: mv_udc: fix bug in ep_dequeue
  usb: gadget: enlarge maxburst bit width.
  ...

12 years agoMerge branch 'for-next/dwc3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Thu, 22 Dec 2011 22:01:02 +0000 (14:01 -0800)]
Merge branch 'for-next/dwc3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

* 'for-next/dwc3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb:
  usb: dwc3: gadget: move us to Default State after reset

12 years agoMerge branch 'for-next/musb' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Thu, 22 Dec 2011 21:59:53 +0000 (13:59 -0800)]
Merge branch 'for-next/musb' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

* 'for-next/musb' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb:
  usb: musb: remove extern qualifier from musb_debug.h header
  usb: musb: cleanup kconfig
  usb: musb: trivial Kconfig cleanups
  musb: omap2430: avoid pm_runtime_disable()
  usb: musb: remove a bit of indentation
  usb: musb: trivial cleanup
  usb: musb: fix pm_runtime mismatch

12 years agoMerge branch 'for-next/xceiv' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Thu, 22 Dec 2011 21:58:59 +0000 (13:58 -0800)]
Merge branch 'for-next/xceiv' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

* 'for-next/xceiv' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb:
  usb: otg: trivial cleanups

12 years agousb: dwc3: gadget: add support for SG lists
Felipe Balbi [Mon, 28 Nov 2011 10:46:59 +0000 (12:46 +0200)]
usb: dwc3: gadget: add support for SG lists

add support for SG lists on dwc3 driver. With
this we can e.g. use VFS layer's SG lists on
storage gadgets so that we can start bigger
transfers and improve throughput.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: gadget: don't force 'LST' always
Felipe Balbi [Mon, 28 Nov 2011 10:27:17 +0000 (12:27 +0200)]
usb: dwc3: gadget: don't force 'LST' always

the LST bit is to be set on the last of a series
of consecutive TRBs. We had a workaround for a
problem where data would get corrupted but that
doesn't happen anymore. It's likely that it was
caused by some FPGA instability during development
phase.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: gadget: don't return anything on prepare trbs
Felipe Balbi [Mon, 28 Nov 2011 10:25:01 +0000 (12:25 +0200)]
usb: dwc3: gadget: don't return anything on prepare trbs

all that function does is setup a TRB to be sent
to HW later. There's no need to return anything
actually.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: gadget: re-factor dwc3_prepare_trbs()
Felipe Balbi [Tue, 22 Nov 2011 09:37:34 +0000 (11:37 +0200)]
usb: dwc3: gadget: re-factor dwc3_prepare_trbs()

In order to make it easier to add SG support,
let's split the big loop out to its own function.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: introduce support for sg lists
Felipe Balbi [Tue, 22 Nov 2011 09:11:50 +0000 (11:11 +0200)]
usb: gadget: introduce support for sg lists

Some controllers support scatter/gather transfers
and that might be very useful for some gadget drivers.

This means that we can make use of larger buffer
allocations which means we will have less completion
IRQs overtime, thus improving the perceived performance.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas: pipe: convert a long if into a XOR operation
Felipe Balbi [Wed, 21 Dec 2011 11:13:33 +0000 (13:13 +0200)]
usb: renesas: pipe: convert a long if into a XOR operation

This is just a minor optimization for the long
if we have on the driver.

When we want to check that one input is true
and the other must be false, the bitwise XOR
operator will achieve that for us.

Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: remove useless depends on Kconfig
Felipe Contreras [Tue, 20 Dec 2011 00:42:24 +0000 (02:42 +0200)]
usb: gadget: remove useless depends on Kconfig

Where are inside an 'if USB_GADGET'.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: s3c-hsudc: remove the_controller global
Heiko Stübner [Mon, 19 Dec 2011 18:43:35 +0000 (19:43 +0100)]
usb: gadget: s3c-hsudc: remove the_controller global

Instead use container_of to retrieve the s3c_hsudc from the
struct usb_gadget pointer.

[ balbi@ti.com : changed verbose container_of() into
an already provided helper 'to_hsudc()' ]

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: s3c-hsudc: use release_mem_region instead of release_resource
Heiko Stübner [Mon, 19 Dec 2011 18:42:52 +0000 (19:42 +0100)]
usb: gadget: s3c-hsudc: use release_mem_region instead of release_resource

As the memory region is requested through request_mem_region
use the correct paired method to release it in the error path
and don't go "beneath the API".

Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: s3c-hsudc: Add regulator handling
Heiko Stübner [Mon, 19 Dec 2011 18:42:19 +0000 (19:42 +0100)]
usb: gadget: s3c-hsudc: Add regulator handling

The udc has three supplies: vdda (3.3V), vddi (1.2V) and vddosc (1.8-3.3V).
Turn these on and off on start and stop calls.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: s3c-hsudc: use udc_start and udc_stop functions
Heiko Stübner [Mon, 19 Dec 2011 18:41:45 +0000 (19:41 +0100)]
usb: gadget: s3c-hsudc: use udc_start and udc_stop functions

udc_start and udc_stop reduce code duplication in comparison to
start and stop generalising calls done by all drivers
(i.e. bind and unbind) and moving these calls to common code.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: s3c-hsudc: move device registration to probe
Heiko Stübner [Mon, 19 Dec 2011 18:41:05 +0000 (19:41 +0100)]
usb: gadget: s3c-hsudc: move device registration to probe

Instead of adding and deleting the gadget device in the start and stop
invocations. Use device_register in the probe method to initialize
and add the gadget device.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: s3c-hsudc: add missing otg_put_transceiver in probe
Heiko Stübner [Mon, 19 Dec 2011 18:40:28 +0000 (19:40 +0100)]
usb: gadget: s3c-hsudc: add missing otg_put_transceiver in probe

The number of get and put calls should always be equal.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: s3c-hsudc: add __devinit to probe function
Heiko Stübner [Mon, 19 Dec 2011 18:39:52 +0000 (19:39 +0100)]
usb: gadget: s3c-hsudc: add __devinit to probe function

Fixes possible section mismatch warnings.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: s3c-hsudc: move platform_data struct to global header
Heiko Stübner [Mon, 19 Dec 2011 18:39:15 +0000 (19:39 +0100)]
usb: gadget: s3c-hsudc: move platform_data struct to global header

Gadget drivers should be compilable on all architectures.
This patch removes one dependency on architecture-specific code.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: musb: remove extern qualifier from musb_debug.h header
Vladimir Zapolskiy [Mon, 19 Dec 2011 14:54:02 +0000 (16:54 +0200)]
usb: musb: remove extern qualifier from musb_debug.h header

This change removes confusing extern qualifier, which doesn't have any practical
sense there.

Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@nokia.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: gadget: move us to Default State after reset
Felipe Balbi [Tue, 20 Dec 2011 13:37:21 +0000 (15:37 +0200)]
usb: dwc3: gadget: move us to Default State after reset

After a bus reset, we should move our state to
Default, in order to be able to re-enumerate again.

I only managed to trigger this problem with g_ether
by removing the cable after a few transfers had been
completed.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: otg: trivial cleanups
Felipe Contreras [Tue, 20 Dec 2011 00:42:26 +0000 (02:42 +0200)]
usb: otg: trivial cleanups

Spaces to tabs, proper alignment, and start sentences as they should.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: musb: cleanup kconfig
Felipe Contreras [Tue, 20 Dec 2011 00:42:27 +0000 (02:42 +0200)]
usb: musb: cleanup kconfig

The whole thing depends on USB_MUSB_HDRC, just add an 'if'.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: musb: trivial Kconfig cleanups
Felipe Contreras [Tue, 20 Dec 2011 00:42:22 +0000 (02:42 +0200)]
usb: musb: trivial Kconfig cleanups

Shuffle the code a bit so the description is at the top.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agomusb: omap2430: avoid pm_runtime_disable()
Felipe Contreras [Mon, 19 Dec 2011 20:17:51 +0000 (22:17 +0200)]
musb: omap2430: avoid pm_runtime_disable()

These are handled by drivers core, and in a way that doesn't wake up the
devices.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: musb: remove a bit of indentation
Felipe Contreras [Mon, 19 Dec 2011 20:17:50 +0000 (22:17 +0200)]
usb: musb: remove a bit of indentation

And use dev instead of musb->controller.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: musb: trivial cleanup
Felipe Contreras [Mon, 19 Dec 2011 20:17:49 +0000 (22:17 +0200)]
usb: musb: trivial cleanup

enabled && driver || !enabled can be simplified to !enabled || driver.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: musb: fix pm_runtime mismatch
Felipe Contreras [Mon, 19 Dec 2011 20:01:54 +0000 (22:01 +0200)]
usb: musb: fix pm_runtime mismatch

In musb_init_controller() there's a pm_runtime_put(), but there's no
pm_runtime_get(), which creates a mismatch that causes the driver to
sleep when it shouldn't.

This was introduced in 7acc619[1], but it wasn't triggered in my setup
until 18a2689[2] was merged to Linus' branch at point df0914[3]. IOW;
when PM is working as it was supposed to.

However, it seems most of the time this is used in a way that keeps the
counter above 0, so nobody noticed. Also, it seems to depend on the
configuration used in versions before 3.1, but not later (or in it).

I found the problem by loading isp1704_charger before any usb gadgets:
http://article.gmane.org/gmane.linux.kernel/1226122

All versions after 2.6.39 are affected.

[1] usb: musb: Idle path retention and offmode support for OMAP3
[2] OMAP2+: musb: hwmod adaptation for musb registration
[3] Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6

Cc: stable@vger.kernel.org
Cc: Hema HK <hemahk@ti.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agoUSB: EHCI: Add Marvell Host Controller driver
Neil Zhang [Tue, 20 Dec 2011 05:20:23 +0000 (13:20 +0800)]
USB: EHCI: Add Marvell Host Controller driver

This patch adds support for EHCI compliant HSUSB Host controller found
on Marvell Socs.

It fits both OTG and SPH controller on marvell Socs, including
PXA9xx/MMP2/MMP3/MGx.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agoUSB: OTG: add Marvell usb OTG driver support
Neil Zhang [Tue, 20 Dec 2011 05:20:22 +0000 (13:20 +0800)]
USB: OTG: add Marvell usb OTG driver support

This driver is for ChipIdea USB OTG controller on Marvell Socs.
PXA9xx/MMP2/MMP3/MGx all have this USB OTG controller.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: mv_udc: drop ARCH dependency
Neil Zhang [Tue, 20 Dec 2011 05:20:21 +0000 (13:20 +0800)]
usb: gadget: mv_udc: drop ARCH dependency

This patch do the following things:
1. Change the Kconfig information.
2. Rename the driver name.
3. Don't do any type cast to io memory.
4. Add dummy stub for clk framework.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: mv_udc: fix bug in ep_dequeue
Neil Zhang [Tue, 20 Dec 2011 05:20:20 +0000 (13:20 +0800)]
usb: gadget: mv_udc: fix bug in ep_dequeue

According to ChipIdea's SPEC, we cannot touch curr_dtd_ptr in dqh
directly, use prime endpoint instead.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: enlarge maxburst bit width.
Yu Xu [Mon, 19 Dec 2011 09:33:03 +0000 (17:33 +0800)]
usb: gadget: enlarge maxburst bit width.

For super speed bulk transfer, the max burst size
is 16, so that 4 bits of maxburst cannot store it.

Signed-off-by: Yu Xu <yuxu@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: mv_udc: rewrite queue_dtd according to spec
Neil Zhang [Thu, 15 Dec 2011 11:26:39 +0000 (19:26 +0800)]
usb: gadget: mv_udc: rewrite queue_dtd according to spec

Rewrite function queue_dtd according to ChipIdea's reference manual.
Remove all unnecessary logic, it will enhance the performance.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: mv_udc: fix readl error
Neil Zhang [Thu, 15 Dec 2011 11:26:38 +0000 (19:26 +0800)]
usb: gadget: mv_udc: fix readl error

readl expected 'const volatile void *' as the argument.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: silence a gcc warning
Dan Carpenter [Thu, 15 Dec 2011 11:31:37 +0000 (14:31 +0300)]
usb: renesas_usbhs: silence a gcc warning

Gcc complains about this printk:
drivers/usb/renesas_usbhs/mod_gadget.c:188:3: warning: format ‘%x’
expects argument of type ‘unsigned int’, but argument 3 has type
‘dma_addr_t’ [-Wformat]

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: tidyup for smatch warnings
Kuninori Morimoto [Thu, 15 Dec 2011 09:53:18 +0000 (01:53 -0800)]
usb: renesas_usbhs: tidyup for smatch warnings

This patch tidyup below smatch complaint

drivers/usb/renesas_usbhs/mod_host.c +642 usbhsh_queue_done()
 warn: variable dereferenced before check 'urb' (see line 636)

Special thanks to Dan

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agoMerge branch 'for-next/gadget' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Tue, 13 Dec 2011 17:37:40 +0000 (09:37 -0800)]
Merge branch 'for-next/gadget' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

* 'for-next/gadget' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: (50 commits)
  usb: renesas_usbhs: show error reason on usbhsh_urb_enqueu()
  usb: renesas_usbhs: add force packet remove method
  usb: renesas_usbhs: care usb_hcd_giveback_urb() status
  usb: renesas_usbhs: add usbhsh_is_running()
  usb: renesas_usbhs: disable attch irq after device attached
  usb: renesas_usbhs: care pipe sequence
  usb: renesas_usbhs: add usbhs_pipe_attach() method
  usb: renesas_usbhs: add usbhsh_endpoint_detach_all() for error case
  usb: renesas_usbhs: modify device attach method
  usb: renesas_usbhs: pop packet when urb dequeued
  usb: renesas_usbhs: add lost error value when enqueue
  usb: gadget: mv_udc: replace some debug info
  usb: gadget: mv_udc: refine suspend/resume function
  usb: gadget: mv_udc: refine the clock relative code
  usb: gadget: mv_udc: disable ISR when stopped
  usb: gadget: mv_udc: add otg relative code
  usb: gadget: Use kcalloc instead of kzalloc to allocate array
  usb: renesas_usbhs: remove the_controller_link
  usb: renesas_usbhs: add test-mode support
  usb: renesas_usbhs: call usbhsg_queue_pop() when pipe disable.
  ...

12 years agousb: renesas_usbhs: show error reason on usbhsh_urb_enqueu()
Kuninori Morimoto [Fri, 9 Dec 2011 02:31:53 +0000 (18:31 -0800)]
usb: renesas_usbhs: show error reason on usbhsh_urb_enqueu()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: add force packet remove method
Kuninori Morimoto [Fri, 9 Dec 2011 02:31:37 +0000 (18:31 -0800)]
usb: renesas_usbhs: add force packet remove method

Packet should be force removed when reset/detach

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: care usb_hcd_giveback_urb() status
Kuninori Morimoto [Fri, 9 Dec 2011 02:31:11 +0000 (18:31 -0800)]
usb: renesas_usbhs: care usb_hcd_giveback_urb() status

Without this patch, USB host hub shows error when cable was detached

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: add usbhsh_is_running()
Kuninori Morimoto [Fri, 9 Dec 2011 02:30:23 +0000 (18:30 -0800)]
usb: renesas_usbhs: add usbhsh_is_running()

It is possible to judge whether renesas_usbhs driver is running,
by checking attch irq mask.
This patch adds usbhsh_is_running() to check it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: disable attch irq after device attached
Kuninori Morimoto [Fri, 9 Dec 2011 02:29:22 +0000 (18:29 -0800)]
usb: renesas_usbhs: disable attch irq after device attached

attch interrupt might happen infinitely on some USB hub (self power?).
This patch disable attch irq after device attached,
and enable it again when detach irq happen.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: care pipe sequence
Kuninori Morimoto [Fri, 9 Dec 2011 02:28:54 +0000 (18:28 -0800)]
usb: renesas_usbhs: care pipe sequence

driver has to re-use the limited pipe for each device/endpoint
when it is USB host hub mode, since number of pipe has limitation.

Then, each pipe should care own pipe sequence for next packet.
This patch adds sequence control.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: add usbhs_pipe_attach() method
Kuninori Morimoto [Fri, 9 Dec 2011 02:28:24 +0000 (18:28 -0800)]
usb: renesas_usbhs: add usbhs_pipe_attach() method

driver has to re-use the limited pipe for each device/endpoint
when it is USB host hub mode, since number of pipe has limitation.
This patch adds usbhsh_pipe_attach/detach() functions for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: add usbhsh_endpoint_detach_all() for error case
Kuninori Morimoto [Fri, 9 Dec 2011 02:27:49 +0000 (18:27 -0800)]
usb: renesas_usbhs: add usbhsh_endpoint_detach_all() for error case

This patch adds usbhsh_endpoint_detach_all() for error case.
usbhs_endpoitn_xxx() functions were moved to upper side in source code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: modify device attach method
Kuninori Morimoto [Fri, 9 Dec 2011 02:27:21 +0000 (18:27 -0800)]
usb: renesas_usbhs: modify device attach method

Current renesas_usbhs had been assigning udev to each urb.
It was executed even though it was device0.
For this reason, the device0 had to set the new device address
which has still not been assigned. (it will be assigned on next step).
Current renesas_usbhs used fixed address for it.
but it is not good for USB hub support.
This patch modifies this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agoMerge branch 'for-next/musb' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Mon, 12 Dec 2011 23:51:41 +0000 (15:51 -0800)]
Merge branch 'for-next/musb' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

* 'for-next/musb' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb:
  usb: musb: omap2430: fix compile warning
  usb: musb: fix pm_runtime calls while atomic
  usb: musb: drop ARCH dependency
  usb: musb: headers cleanup
  usb: musb: allow building USB_MUSB_TUSB6010 as a module
  usb: musb: use a Kconfig choice to pick the right DMA method
  usb: musb: omap2+: save and restore OTG_INTERFSEL
  usb: musb: omap2+: fix context api's
  usb: musb: ux500: optimize DMA callback routine

12 years agoMerge branch 'for-next/dwc3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Mon, 12 Dec 2011 23:19:40 +0000 (15:19 -0800)]
Merge branch 'for-next/dwc3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

* 'for-next/dwc3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: (392 commits)
  usb: dwc3: ep0: fix for possible early delayed_status
  usb: dwc3: gadget: fix stream enable bit
  usb: dwc3: ep0: fix GetStatus handling (again)
  usb: dwc3: ep0: use dwc3_request for ep0 requsts instead of usb_request
  usb: dwc3: use correct hwparam register for power mgm check
  usb: dwc3: omap: move to module_platform_driver
  usb: dwc3: workaround: missing disconnect event
  usb: dwc3: workaround: missing USB3 Reset event
  usb: dwc3: workaround: U1/U2 -> U0 transiton
  usb: dwc3: gadget: return early in dwc3_cleanup_done_reqs()
  usb: dwc3: ep0: handle delayed_status again
  usb: dwc3: ep0: push ep0state into xfernotready processing
  usb: dwc3: fix sparse errors
  usb: dwc3: fix few coding style problems
  usb: dwc3: move generic dwc3 code from gadget into core
  usb: dwc3: use a helper function for operation mode setting
  usb: dwc3: ep0: don't use ep0in for transfers
  usb: dwc3: ep0: use proper endianess in SetFeature for wIndex
  usb: dwc3: core: drop DWC3_EVENT_BUFFERS_MAX
  usb: dwc3: omap: add multiple instances support to OMAP
  ...

12 years agoUSB: Remove the duplicate definition of HUB_SET_DEPTH
Qinglin Ye [Sun, 11 Dec 2011 08:40:22 +0000 (16:40 +0800)]
USB: Remove the duplicate definition of HUB_SET_DEPTH

The macro HUB_SET_DEPTH is defined twice in ch11.h (introduced by
commit 0eadcc0 "usb: USB3.0 ch11 definitions" and dbe79bb "USB 3.0
Hub Changes"), so remove the duplicate one in the USB 2.0 part.

Signed-off-by: Qinglin Ye <yestyle@gmail.com>
Cc: John Youn <John.Youn@synopsys.com>
Cc: Sergei Shtylyov <sshtylyov@mvista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agousb: musb: omap2430: fix compile warning
Felipe Balbi [Thu, 24 Nov 2011 13:42:10 +0000 (15:42 +0200)]
usb: musb: omap2430: fix compile warning

fix the following compile warning:

drivers/usb/musb/omap2430.c: In function 'musb_otg_notifier_work':
drivers/usb/musb/omap2430.c:279:3: warning: 'return' with a value, in
function returning void
drivers/usb/musb/omap2430.c:282:2: warning: 'return' with a value, in
function returning void

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: pop packet when urb dequeued
Kuninori Morimoto [Fri, 9 Dec 2011 02:26:07 +0000 (18:26 -0800)]
usb: renesas_usbhs: pop packet when urb dequeued

usbhsh_ureq_free() is not enough when urb dequeued.

Without this patch, the driver can not recognize re-connected
USB device after USB hub disconnected

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: add lost error value when enqueue
Kuninori Morimoto [Fri, 9 Dec 2011 02:25:37 +0000 (18:25 -0800)]
usb: renesas_usbhs: add lost error value when enqueue

usbhsh_urb_enqueue() didn't have error value when
usbhsh_device_attach() failed

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: musb: fix pm_runtime calls while atomic
Vikram Pandita [Fri, 12 Aug 2011 14:38:51 +0000 (07:38 -0700)]
usb: musb: fix pm_runtime calls while atomic

musb pm_runtime_get_sync call happens in intrrupt context on cable attach case
That can result in re-enabling the interrupts and cause side affects.

So move the code to a work queue.

Following is the error path hit on cable attach:

BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:802
in_atomic(): 0, irqs_disabled(): 0, pid: 18, name: irq/378-twl6030

Backtrace:
[<c00520f0>] (dump_backtrace+0x0/0x110) from [<c054f454>] (dump_stack+0x18/0x1c)
[<c054f43c>] (dump_stack+0x0/0x1c) from [<c007f59c>] (__might_sleep+0x130/0x134)
[<c007f46c>] (__might_sleep+0x0/0x134) from [<c02c2794>] (__pm_runtime_resume+0x94/0x98)
[<c02c2700>] (__pm_runtime_resume+0x0/0x98) from [<c033e7e4>] (musb_otg_notifications+0x9c/0x164)
[<c033e748>] (musb_otg_notifications+0x0/0x164) from [<c00b3df0>] (notifier_call_chain+0x4c/0x8c)
[<c00b3da4>] (notifier_call_chain+0x0/0x8c) from [<c00b44a8>] (__atomic_notifier_call_chain+0x40/0x54)
[<c00b4468>] (__atomic_notifier_call_chain+0x0/0x54) from [<c00b44dc>] (atomic_notifier_call_chain+0x20/0x28)
[<c00b44bc>] (atomic_notifier_call_chain+0x0/0x28) from [<c033f124>] (twl6030_usb_irq+0xc8/0xdc)
[<c033f05c>] (twl6030_usb_irq+0x0/0xdc) from [<c00d79f8>] (irq_thread_fn+0x24/0x40)
[<c00d79d4>] (irq_thread_fn+0x0/0x40) from [<c00d7b64>] (irq_thread+0x150/0x1d8)
[<c00d7a14>] (irq_thread+0x0/0x1d8) from [<c00adf70>] (kthread+0x94/0x98)
[<c00adedc>] (kthread+0x0/0x98) from [<c0094388>] (do_exit+0x0/0x720)

Tested with:
MUSB Device mode: Cold boot / Hot plug
MUSB Host mode: Cold boot / Hot plug

Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: musb: drop ARCH dependency
Felipe Balbi [Fri, 14 Oct 2011 07:22:29 +0000 (10:22 +0300)]
usb: musb: drop ARCH dependency

musb core driver and tusb6010 glue layer don't
depend on anything which is ARCH-specific. It
builds fine on x86 and ARM. Dropping the dependency
so we can compile-test on linux-next.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: musb: headers cleanup
Felipe Balbi [Fri, 14 Oct 2011 07:45:15 +0000 (10:45 +0300)]
usb: musb: headers cleanup

Remove a few unnecessary headers from a
few files.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: musb: allow building USB_MUSB_TUSB6010 as a module
Arnd Bergmann [Sun, 2 Oct 2011 14:45:47 +0000 (16:45 +0200)]
usb: musb: allow building USB_MUSB_TUSB6010 as a module

Commit 1376d92f9 "usb: musb: allow musb and glue layers to be modules"
made the USB_MUSB_TUSB6010 option modular, but actually building
the driver as a module does not work, so various randconfig builds
actually fail. This changes all code that depends on the
option to also check for modular builds, and exports the necessary
symbols.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: musb: use a Kconfig choice to pick the right DMA method
Arnd Bergmann [Sun, 2 Oct 2011 14:45:45 +0000 (16:45 +0200)]
usb: musb: use a Kconfig choice to pick the right DMA method

The logic to allow only one DMA driver in MUSB is currently
flawed, because it also allows picking no DMA driver at all
and also not selecting PIO mode.

Using a choice statement makes this foolproof for now and
also simplifies the Makefile.

Unfortunately, we will have to revisit this when we start
supporting multiple ARM platforms in a single kernel binary,
because at that point we will actually need to select
multiple DMA drivers and pick the right one at run-time.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: musb: omap2+: save and restore OTG_INTERFSEL
Hema HK [Wed, 7 Sep 2011 16:19:24 +0000 (09:19 -0700)]
usb: musb: omap2+: save and restore OTG_INTERFSEL

we need to save and restore OTG_INTERFSEL register
else we will be unable to function on resume after
OFF mode.

Reported-by: Devaraj Rangasamy <dev@ti.com>
Signed-off-by: Hema HK <hemahk@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: musb: omap2+: fix context api's
Vikram Pandita [Wed, 7 Sep 2011 16:19:23 +0000 (09:19 -0700)]
usb: musb: omap2+: fix context api's

RxFifoSz, TxFifoSz, RxFifoAddr, TxFifoAddr
are all indexed registers.

So before doing a context save or restore, INDEX register
should be set, then only one gets to the right register offset.

Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: musb: ux500: optimize DMA callback routine
Per Forlin [Wed, 17 Aug 2011 09:03:40 +0000 (11:03 +0200)]
usb: musb: ux500: optimize DMA callback routine

Skip the use of work queue and call musb_dma_completion() directly from
DMA callback context.

Here follows measurements on a Snowball board with ondemand governor active.

Performance using work queue:
(105 MB) copied, 6.23758 s, 16.8 MB/s
(105 MB) copied, 5.7151 s, 18.3 MB/s
(105 MB) copied, 5.83583 s, 18.0 MB/s
(105 MB) copied, 5.93611 s, 17.7 MB/s

Performance without work queue
(105 MB) copied, 5.62173 s, 18.7 MB/s
(105 MB) copied, 5.61811 s, 18.7 MB/s
(105 MB) copied, 5.57817 s, 18.8 MB/s
(105 MB) copied, 5.58549 s, 18.8 MB/s

Signed-off-by: Per Forlin <per.forlin@linaro.org>
Acked-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: ep0: fix for possible early delayed_status
Felipe Balbi [Thu, 8 Dec 2011 11:56:27 +0000 (13:56 +0200)]
usb: dwc3: ep0: fix for possible early delayed_status

There is a very small possibility (previously unimagined
by us) that the whole Mass Storage delayed status happens
rather early, before we even get our XferNotReady event.

In that case, we will be queueing a request to ep0 while
we're still on Setup Phase and we would be waiting for
another usb_ep_queue() forever.

Handle such cases by clearing dwc->delayed_status so that
we start control status from the next XferNotReady like
there was no wait for Delayed Status.

Tested against Linux 3.2-rc3 and USB30CV tool from USB-IF
(on a Windows XP with USB3 PCIe card).

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: gadget: fix stream enable bit
Felipe Balbi [Tue, 29 Nov 2011 11:11:21 +0000 (13:11 +0200)]
usb: dwc3: gadget: fix stream enable bit

ep->max_streams is a mere hint to the gadget
driver that 'ep' supports stream handling. Using
that as a decision variable for enabling streams
was my worst brain-fart to date.

Instead, we should check from the Superspeed
Endpoint Companion Descriptor if the endpoint
has requested streams. For that we need a little
re-factoring but it is now correct.

Debugged-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: ep0: fix GetStatus handling (again)
Felipe Balbi [Tue, 29 Nov 2011 08:35:47 +0000 (10:35 +0200)]
usb: dwc3: ep0: fix GetStatus handling (again)

previous commit fixed part of it but it was still
calling usb_ep_queue() from IRQ context without
loosing locks. That cannot be done otherwise we will
have a recursive locking.

Also, we need to assign the 'dep' pointer on
dwc->ep0_usb_req otherwise we will have a NULL
pointer dereference on dwc3_map_buffer_to_dma().

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: ep0: use dwc3_request for ep0 requsts instead of usb_request
Sebastian Andrzej Siewior [Fri, 25 Nov 2011 11:03:46 +0000 (12:03 +0100)]
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>
12 years agousb: dwc3: use correct hwparam register for power mgm check
Sebastian Andrzej Siewior [Thu, 24 Nov 2011 10:22:05 +0000 (11:22 +0100)]
usb: dwc3: use correct hwparam register for power mgm check

We mask the correct bits within the wrong register. The power
optimization mode is stored hwparam1 register and not in hwparam0.

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>
12 years agousb: dwc3: omap: move to module_platform_driver
Felipe Balbi [Fri, 18 Nov 2011 19:31:14 +0000 (21:31 +0200)]
usb: dwc3: omap: move to module_platform_driver

the new module_platform_driver macro is a helper
for modules which just register and unregister the
platform_driver. It allows us to delete a few
duplicated lines.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: workaround: missing disconnect event
Felipe Balbi [Fri, 14 Oct 2011 12:11:49 +0000 (15:11 +0300)]
usb: dwc3: workaround: missing disconnect event

DWC3 revisions <1.88a have an issue which would
case a missing Disconnect event if cable is
disconnected while there's a Setup packet
pending the FIFO.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: workaround: missing USB3 Reset event
Felipe Balbi [Fri, 14 Oct 2011 11:51:38 +0000 (14:51 +0300)]
usb: dwc3: workaround: missing USB3 Reset event

DWC3 revisions <1.90a have an issue which would cause
a missing USB3 Reset event. In such cases, it's
suggested that we follow the steps of a normal
USB3 Reset on Connection Done Event.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: workaround: U1/U2 -> U0 transiton
Felipe Balbi [Fri, 14 Oct 2011 10:00:30 +0000 (13:00 +0300)]
usb: dwc3: workaround: U1/U2 -> U0 transiton

RTL revisions <1.83a have an issue where, depending
on the link partner, the USB link might do multiple
entry/exit of low power states before a transfer
takes place causing degraded throughput.

The suggested workaround is to clear bits
12:9 of DCTL register if we see a transition
from U1|U2 to U0 and only re-enable that on
a transfer complete IRQ and we have no pending
transfers on any of the enabled endpoints.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: gadget: return early in dwc3_cleanup_done_reqs()
Sebastian Andrzej Siewior [Thu, 3 Nov 2011 09:32:20 +0000 (10:32 +0100)]
usb: dwc3: gadget: return early in dwc3_cleanup_done_reqs()

This patch avoids the compiler spitting out the following warning:
|drivers/usb/dwc3/gadget.c:1304: warning: 'trb' is used uninitialized \
in this function

This is only uninitialized if the list of to-cleanup TRBs is empty which
should not be the case because we call this functions once a transfer
completed so it should be on list.

In order to make the warning disappear we return early. This should
never happen and the WARN_ON_ONCE(1) is there in case it happens
so we can investigate what went wrong.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: ep0: handle delayed_status again
Sebastian Andrzej Siewior [Wed, 2 Nov 2011 12:30:45 +0000 (13:30 +0100)]
usb: dwc3: ep0: handle delayed_status again

Since the re-worked ep0 handling (which uses HW's hints to recognize the ep0
status) we lost the delayed status handling. This is used by the file and mass
storage gadget to gain some extra time so setup its internal status before it
can proceed further requests.
In particular the storage gadget does nothing on USB_REQ_SET_CONFIGURATION but
wakes up a thread which handles the request. If the udc driver continues ep0
handling before the thread did its work then then endpoint is not yet
configured and further requests will fail. Once the gadget is ready, it will
enqueue an empty packet which is used for synchronization.
In order to fix this issue, the patch does the following:
Set ->delayed_status once the delayed_status has been notices and do not
continue on the next XferNotReady event. We will continues ep0 processing once
the gadget enqueued the zero packet for synchronization.

A cleaner approach would be to enforce the gadget to enqueue an empty
(zero) request even for the status phase but this would do for now.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: ep0: push ep0state into xfernotready processing
Sebastian Andrzej Siewior [Wed, 2 Nov 2011 12:30:44 +0000 (13:30 +0100)]
usb: dwc3: ep0: push ep0state into xfernotready processing

We wait for the XferNotReady before we start the transfer and by then we
know ep0 state in which we supposed to be.
This is some cleanup work for the following patch in which we require to
know the ep0 state before the transfer completes.
While here, also change the argument to dwc3_ep0_do_control_status() so
we don't require the complete event structure but only the required
piece of information.

Inspired-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: fix sparse errors
Felipe Balbi [Fri, 4 Nov 2011 10:40:05 +0000 (12:40 +0200)]
usb: dwc3: fix sparse errors

sparse caught three mistakes on this driver,
fix them:

drivers/usb/dwc3/ep0.c:806:29: warning: duplicate const
drivers/usb/dwc3/debugfs.c:481:15: warning: symbol 'dwc3_debugfs_init' \
was not declared. Should it be static?
drivers/usb/dwc3/debugfs.c:518:16: warning: symbol 'dwc3_debugfs_exit' \
was not declared. Should it be static?

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: fix few coding style problems
Felipe Balbi [Fri, 4 Nov 2011 10:32:47 +0000 (12:32 +0200)]
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>
12 years agousb: dwc3: move generic dwc3 code from gadget into core
Sebastian Andrzej Siewior [Mon, 31 Oct 2011 21:25:41 +0000 (22:25 +0100)]
usb: dwc3: move generic dwc3 code from gadget into core

A few inits like the scale value or the removal of the DISSCRAMBLE is
done in the gadget code however it touches a general register.
Move this piece to the core.c file since it is likely to be requied by
both, parts of the core (device and host).

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: use a helper function for operation mode setting
Sebastian Andrzej Siewior [Mon, 31 Oct 2011 21:25:40 +0000 (22:25 +0100)]
usb: dwc3: use a helper function for operation mode setting

There are two where need to set operational mode:
- during initialization while we decide to run in host,device or DRD
  mode
- at runtime via the debugfs interface.

This patch provides a new function which sets the operational mode and
moves its initialiation to the mode switch instead in the gadget code
itself.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: ep0: don't use ep0in for transfers
Sebastian Andrzej Siewior [Thu, 20 Oct 2011 17:04:16 +0000 (19:04 +0200)]
usb: dwc3: ep0: don't use ep0in for transfers

In "usb: dwc3: remove special status request handling in ep0" I simplied
a few things and used the generic API for the status transfers. The bug
I introcuded here is that we queue now requests to dep[1] but we don't
clear that list in the stall+start case.
Actually we don't need to use dep[1] at all. We only did in the past to
talk to the correct endpoint (i.e. in or out). This is now take care of
in a diffent place within the ep0 code. So we could queue the in
transfers to dep[0] and don't use dep[1] at all.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: ep0: use proper endianess in SetFeature for wIndex
Sebastian Andrzej Siewior [Mon, 24 Oct 2011 09:09:39 +0000 (12:09 +0300)]
usb: dwc3: ep0: use proper endianess in SetFeature for wIndex

The first access was correct, the second was wrong.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: core: drop DWC3_EVENT_BUFFERS_MAX
Felipe Balbi [Mon, 24 Oct 2011 09:03:13 +0000 (12:03 +0300)]
usb: dwc3: core: drop DWC3_EVENT_BUFFERS_MAX

hardware will tell us how many event buffers we
need to support, so let's allocate the array
dynamically too.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: omap: add multiple instances support to OMAP
Felipe Balbi [Tue, 18 Oct 2011 10:58:30 +0000 (13:58 +0300)]
usb: dwc3: omap: add multiple instances support to OMAP

if we ever have an omap with multiple instances of
the DWC3 IP, we need unique names for them. In order
to achieve that, let's use the dwc3_get/put_device_id()
calls to give us an unique device identifier.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: move dwc3 device ID bitmap to core.c
Felipe Balbi [Tue, 18 Oct 2011 10:54:01 +0000 (13:54 +0300)]
usb: dwc3: move dwc3 device ID bitmap to core.c

if we want to support situations where we have
both SoC and PCIe versions of the IP on the same
platform, we need to have sequential numbers between
them, otherwise we will still have name collisions.

Because of that, we need to move dwc3_get/put_device_id()
to core.c and export that symbol to be used by glue
layers.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: remove special status request handling in ep0
Sebastian Andrzej Siewior [Tue, 18 Oct 2011 17:13:29 +0000 (19:13 +0200)]
usb: dwc3: remove special status request handling in ep0

The GetStatus (STD)-request is handled the driver and uses a tiny hack
to send the two bytes long answer. This patch removes the custom hack
uses the normal usb_ep_queue() for that.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: reset pending status flag in error case
Sebastian Andrzej Siewior [Tue, 18 Oct 2011 17:13:28 +0000 (19:13 +0200)]
usb: dwc3: reset pending status flag in error case

If we stall and restart we have to reset also this flag to 0 as there is
nothing pending anymore.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: host: remove unused includes
Sebastian Andrzej Siewior [Thu, 20 Oct 2011 16:43:10 +0000 (18:43 +0200)]
usb: dwc3: host: remove unused includes

None of these are required atm.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: debugfs: hold the lock in during mode change
Sebastian Andrzej Siewior [Thu, 20 Oct 2011 16:43:07 +0000 (18:43 +0200)]
usb: dwc3: debugfs: hold the lock in during mode change

The read and write operation is atomic and we need no locking around
this operations. What we need however is a lock that is held which
ensures that the content of the DWC3_GCTL has not been changed. With
this, the conten may have been change changed after the first but before
our write back.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: add a platform device alias
Sebastian Andrzej Siewior [Wed, 19 Oct 2011 17:39:50 +0000 (19:39 +0200)]
usb: dwc3: add a platform device alias

We can have three modules here: dwc3.ko, dwc3-omap.ko and dwc3-pci.ko.
The later have already ids-aliases for probing and is fine. The omap
module has alias for DT but lacks alias for the "native"
platform_device. Maybe we should get rid of it and stick to the DT name?
Both glue modules create a new device for which the dwc3.ko module is
responsible and that one lacks the platform alias.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: ep0: handle unexpected XferNotReady events
Felipe Balbi [Tue, 18 Oct 2011 15:00:26 +0000 (18:00 +0300)]
usb: dwc3: ep0: handle unexpected XferNotReady events

Sometimes the host might be trying to initiate Data or
Status phase for an older Control transfer. In such
situations we must STALL that transfer and restart
the state machine rather than letting such situation
go through the wire.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: debugfs: add support for changing port mode
Felipe Balbi [Mon, 17 Oct 2011 05:50:39 +0000 (08:50 +0300)]
usb: dwc3: debugfs: add support for changing port mode

This makes testing a lot easier when trying to
switch between host and device modes.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: ep0: SetAddress() won't be issued while Configured
Felipe Balbi [Sat, 15 Oct 2011 18:37:35 +0000 (21:37 +0300)]
usb: dwc3: ep0: SetAddress() won't be issued while Configured

I have talked to USB-IF about USB30CV issuing SetAddres()
with a device on Configured state and they have agreed on
changing USB30CV not to do so.

Adding back the STALL reply in such case and while at
that, also add a debugging message for an address which
is too large.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: depend on both Host and Gadget stacks
Felipe Balbi [Thu, 13 Oct 2011 07:16:50 +0000 (10:16 +0300)]
usb: dwc3: depend on both Host and Gadget stacks

now that we have host support, we must depend
on both sides.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: move gadget prototypes to core.h
Felipe Balbi [Wed, 12 Oct 2011 11:15:49 +0000 (14:15 +0300)]
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>
12 years agousb: dwc3: always compile gadget side too
Felipe Balbi [Wed, 12 Oct 2011 11:15:10 +0000 (14:15 +0300)]
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>
12 years agousb: dwc3: add xHCI Host support
Felipe Balbi [Wed, 12 Oct 2011 11:08:26 +0000 (14:08 +0300)]
usb: dwc3: add xHCI Host support

The Designware USB3 IP can be configured with
an internal xHCI. If we're running on such a
version, let's start the xHCI stack.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: fetch mode of operation from HW
Felipe Balbi [Wed, 12 Oct 2011 07:44:56 +0000 (10:44 +0300)]
usb: dwc3: fetch mode of operation from HW

There's no need to add driver_data for something
we can fetch from HW.

This also makes our id_table unnecessary - at least
for now -, so we also remove it on the same patch.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: calculate number of event buffers dynamically
Felipe Balbi [Wed, 12 Oct 2011 07:31:04 +0000 (10:31 +0300)]
usb: dwc3: calculate number of event buffers dynamically

This will allow us to only allocate memory when
we actually need.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: allow forcing a maximum speed
Felipe Balbi [Fri, 7 Oct 2011 19:55:04 +0000 (22:55 +0300)]
usb: dwc3: allow forcing a maximum speed

this is mainly for testing. In order to be able
to test if we're enumerating correctly on all
speeds, let that be controlled by a module
parameter.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: dwc3: gadget: don't disable endpoints on exit
Felipe Balbi [Fri, 7 Oct 2011 19:40:41 +0000 (22:40 +0300)]
usb: dwc3: gadget: don't disable endpoints on exit

when we remove the gadget driver, it will already
do that for us.

Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: mv_udc: replace some debug info
Neil Zhang [Wed, 30 Nov 2011 01:57:17 +0000 (09:57 +0800)]
usb: gadget: mv_udc: replace some debug info

replace some debug info, make it easy to use.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: mv_udc: refine suspend/resume function
Neil Zhang [Wed, 30 Nov 2011 01:57:16 +0000 (09:57 +0800)]
usb: gadget: mv_udc: refine suspend/resume function

This patch impletments system suspend/resume functions for Marvell
otg controller.
If OTG is enabled, OTG driver will do most of the work.
If not, we will check clock gating.
  If clock gating is enabled, the UDC will be start/stop automatically.
  If not, UDC will be start/stop in suspend/resume functions.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>