]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
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>
12 years agousb: gadget: mv_udc: refine the clock relative code
Neil Zhang [Wed, 30 Nov 2011 01:57:15 +0000 (09:57 +0800)]
usb: gadget: mv_udc: refine the clock relative code

Split the clock relative code from clock gating solution.
Then we can remove some duplicate code, make the code more clean.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: mv_udc: disable ISR when stopped
Neil Zhang [Wed, 30 Nov 2011 01:57:14 +0000 (09:57 +0800)]
usb: gadget: mv_udc: disable ISR when stopped

When device is stopped, there is no need to handle ISR.
Especially when otg switch to HOST mode.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: mv_udc: add otg relative code
Neil Zhang [Wed, 30 Nov 2011 01:57:13 +0000 (09:57 +0800)]
usb: gadget: mv_udc: add otg relative code

Add otg relative code, make it possible to switch between host and
device.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: Use kcalloc instead of kzalloc to allocate array
Thomas Meyer [Tue, 29 Nov 2011 21:08:00 +0000 (22:08 +0100)]
usb: gadget: Use kcalloc instead of kzalloc to allocate array

The advantage of kcalloc is, that will prevent integer overflows which could
result from the multiplication of number of elements and size and it is also
a bit nicer to read.

The semantic patch that makes this change is available
in https://lkml.org/lkml/2011/11/25/107

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Acked-by: Michal Nazarewicz <[4]mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: remove the_controller_link
Kuninori Morimoto [Fri, 25 Nov 2011 01:28:45 +0000 (17:28 -0800)]
usb: renesas_usbhs: remove the_controller_link

current renesas_usbhs is using new style udc_start/stop from
af1d7056a5c1e5eaaf807ddd1423101db84668d0
(usb: gadget: renesas: convert to new style).

with this patch we can finally remove the global "the_controller_link"

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: add test-mode support
Kuninori Morimoto [Fri, 25 Nov 2011 01:28:35 +0000 (17:28 -0800)]
usb: renesas_usbhs: add test-mode support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: call usbhsg_queue_pop() when pipe disable.
Kuninori Morimoto [Fri, 25 Nov 2011 01:28:26 +0000 (17:28 -0800)]
usb: renesas_usbhs: call usbhsg_queue_pop() when pipe disable.

When poping packet from queue, it needs correct end procedure.
This patch call usbhsg_queue_pop() in usbhsg_pipe_disable().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: send packet in necessary timing.
Kuninori Morimoto [Fri, 25 Nov 2011 01:28:17 +0000 (17:28 -0800)]
usb: renesas_usbhs: send packet in necessary timing.

Current renesas_usbhs driver always tries to send packet in end of recip handler.
But it breaks chapter 9 EndpointHalt test.
This patch fixup this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: add basic USB_REQ_GET_STATUS support
Kuninori Morimoto [Fri, 25 Nov 2011 01:28:04 +0000 (17:28 -0800)]
usb: renesas_usbhs: add basic USB_REQ_GET_STATUS support

This patch adds basic get-status support for chapter 9 test.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: add basic USB_REQ_SET_FEATURE support
Kuninori Morimoto [Fri, 25 Nov 2011 01:27:50 +0000 (17:27 -0800)]
usb: renesas_usbhs: add basic USB_REQ_SET_FEATURE support

This patch adds basic set-feature support for chapter 9 test.

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_is_stall()
Kuninori Morimoto [Fri, 25 Nov 2011 01:27:32 +0000 (17:27 -0800)]
usb: renesas_usbhs: add usbhs_pipe_is_stall()

This is preparation for chapter 9 test

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: renesas_usbhs: remove superfluous usbhs_lock from recip handler
Kuninori Morimoto [Fri, 25 Nov 2011 01:27:19 +0000 (17:27 -0800)]
usb: renesas_usbhs: remove superfluous usbhs_lock from recip handler

recip handler will call various functions which are holding
usbhs_lock.

This patch removes superfluous usbhs_lock from recip handler
to escape double lock.

[ balbi@ti.com : brushed up commit log a bit ]

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: rename usb_gadget_driver::speed to max_speed
Michal Nazarewicz [Sat, 19 Nov 2011 17:27:38 +0000 (18:27 +0100)]
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>
12 years agousb: gadget: replace usb_gadget::is_dualspeed with max_speed
Michal Nazarewicz [Sat, 19 Nov 2011 17:27:37 +0000 (18:27 +0100)]
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>
12 years agousb: gadget: renesas_usbhs: parameter cleanup for usbhsh_device_xx()
Kuninori Morimoto [Mon, 31 Oct 2011 07:49:09 +0000 (00:49 -0700)]
usb: gadget: renesas_usbhs: parameter cleanup for usbhsh_device_xx()

current mod_host used usbhs_device_alloc/free(),
but allocated variable was attached to each xx->hcpriv.
The intuitively clear name was not xxx_alloc/free() but xxx_attach/detach().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: parameter cleanup for usbhsh_endpoint_xx()
Kuninori Morimoto [Mon, 31 Oct 2011 07:48:59 +0000 (00:48 -0700)]
usb: gadget: renesas_usbhs: parameter cleanup for usbhsh_endpoint_xx()

current mod_host used usbhs_endpoint_alloc/free(),
but allocated variable was attached to each xx->hcpriv.
The intuitively clear name was not xxx_alloc/free() but xxx_attach/detach().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: parameter cleanup for usbhsh_xx_queue_push()
Kuninori Morimoto [Mon, 31 Oct 2011 07:48:46 +0000 (00:48 -0700)]
usb: gadget: renesas_usbhs: parameter cleanup for usbhsh_xx_queue_push()

This patch remove unneeded parameter from usbhsh_xx_queue_push()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: cleanup usbhsh_endpoint_xxx()
Kuninori Morimoto [Mon, 31 Oct 2011 07:48:22 +0000 (00:48 -0700)]
usb: gadget: renesas_usbhs: cleanup usbhsh_endpoint_xxx()

this patch cleanup
 - make sure static function
 - remove unneeded label
 - useless local variable were removed

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: adds spin lock area on mod_host
Kuninori Morimoto [Mon, 31 Oct 2011 07:48:35 +0000 (00:48 -0700)]
usb: gadget: renesas_usbhs: adds spin lock area on mod_host

spin lock was needed in mod_host.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: check device0 status when alloc
Kuninori Morimoto [Mon, 31 Oct 2011 07:48:00 +0000 (00:48 -0700)]
usb: gadget: renesas_usbhs: check device0 status when alloc

device0 was treated without checking in usbhsh_device_alloc().
but "udev->usbv" and "dev_set_drvdata()" will be overwritten
if device0  was multi-allocated.
This patch fixes this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: remove usbhsh_request list
Kuninori Morimoto [Mon, 31 Oct 2011 07:47:44 +0000 (00:47 -0700)]
usb: gadget: renesas_usbhs: remove usbhsh_request list

mod_host had usbhsh_request active/free list.
it was almost meaningless, and vainly complicated.
This patch remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: usbhs_set_device_config() care upphub/hubport
Kuninori Morimoto [Mon, 31 Oct 2011 07:47:34 +0000 (00:47 -0700)]
usb: gadget: renesas_usbhs: usbhs_set_device_config() care upphub/hubport

current usbhs_set_device_config() didn't care upphub/hubport.
This patch adds its value.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: cleanup usbhs_endpoint_disable()
Kuninori Morimoto [Mon, 31 Oct 2011 07:47:24 +0000 (00:47 -0700)]
usb: gadget: renesas_usbhs: cleanup usbhs_endpoint_disable()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: modify function name of usbhs_set_device_xx()
Kuninori Morimoto [Mon, 31 Oct 2011 07:47:13 +0000 (00:47 -0700)]
usb: gadget: renesas_usbhs: modify function name of usbhs_set_device_xx()

it was device configuration setting function, not only speed.
This patch modify function name usbhs_set_device_speed() -> usbhs_set_device_config()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: usbhsh_ureq_alloc/free() care urb->hcpriv
Kuninori Morimoto [Mon, 31 Oct 2011 07:47:01 +0000 (00:47 -0700)]
usb: gadget: renesas_usbhs: usbhsh_ureq_alloc/free() care urb->hcpriv

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: cleanup complicated ureq alloc/free
Kuninori Morimoto [Mon, 31 Oct 2011 07:46:50 +0000 (00:46 -0700)]
usb: gadget: renesas_usbhs: cleanup complicated ureq alloc/free

DCP data/status stage needs ureq to usbhs_pkt_push(),
but sometimes, there is no data stage.
In that case, allocated ureq was not freed,
Current ureq alloc/free pair were difficult to understand.
This patch removed unnecessary/un-understandable ureq alloc
from usbhsh_urb_enqueue(), and create simpler alloc/free pair.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: drop dependency for mod_gadget
Kuninori Morimoto [Mon, 31 Oct 2011 07:46:36 +0000 (00:46 -0700)]
usb: gadget: renesas_usbhs: drop dependency for mod_gadget

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: mass_storage: support multi-luns with different logic block size
Yuping Luo [Wed, 26 Oct 2011 02:13:10 +0000 (19:13 -0700)]
usb: gadget: mass_storage: support multi-luns with different logic block size

With Peiyu's patch "gadget: mass_storage: adapt logic block size to bound block
devices" (http://www.spinics.net/lists/linux-usb/msg50791.html), now mass storage
can adjust logic block size dynamically based on real devices.
Then there is one issue caused by it, if two luns have different logic block size,
mass storage can't work.
Let's check the current software flow:
1. get_next_command(): call received_cbw();
2. received_cbw(): update common->lun = cbw->Lun, but common->curlen is not updated;
3. do_scsi_command(): in READ_X and WRITE_X commands, common->data_size_from_cmnd is
updated by common->curlun->blkbits;
4. check_command(): update common->curlun according to common->lun
As you can see, the step 3 uses wrong common->curlun, then wrong common->curlun->blkbits.
If the two luns have same blkbits, there isn't issue. Otherwise, both will fail.
This patch moves the common->curlun update to step 1, then make sure step 3 gets right
blkbits and data_size_from_cmnd.

Cc: Peiyu Li <peiyu.li@csr.com>
Signed-off-by: YuPing Luo <yuping.luo@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: unified callback function
Kuninori Morimoto [Mon, 24 Oct 2011 09:25:48 +0000 (02:25 -0700)]
usb: gadget: renesas_usbhs: unified callback function

renesas_usbhs needs callback for notify hotplug.
but it were 2 methods which are almost same.
This patch unified these into one.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: add platform power control function
Kuninori Morimoto [Mon, 24 Oct 2011 02:57:10 +0000 (19:57 -0700)]
usb: gadget: renesas_usbhs: add platform power control function

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: tidyup the unit of detection_delay
Kuninori Morimoto [Mon, 24 Oct 2011 02:57:02 +0000 (19:57 -0700)]
usb: gadget: renesas_usbhs: tidyup the unit of detection_delay

detection_delay was assumed as msec

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: tidyup mod_host request variable name
Kuninori Morimoto [Mon, 24 Oct 2011 02:56:53 +0000 (19:56 -0700)]
usb: gadget: renesas_usbhs: tidyup mod_host request variable name

renesas_usbhs driver use "req" for struct usb_ctrlrequest,
and "ureq" for struct usbhsh_request

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: tidyup usbhs_sys_clock_ctrl() was local function
Kuninori Morimoto [Mon, 24 Oct 2011 02:56:41 +0000 (19:56 -0700)]
usb: gadget: renesas_usbhs: tidyup usbhs_sys_clock_ctrl() was local function

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: remove usbhs_sys_usb_ctrl()
Kuninori Morimoto [Mon, 24 Oct 2011 02:56:30 +0000 (19:56 -0700)]
usb: gadget: renesas_usbhs: remove usbhs_sys_usb_ctrl()

usbhs_sys_usb_ctrl() can collect into usbhs_sys_host/function_ctrl().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agousb: gadget: renesas_usbhs: remove usbhs_sys_hispeed_ctrl()
Kuninori Morimoto [Mon, 24 Oct 2011 02:55:47 +0000 (19:55 -0700)]
usb: gadget: renesas_usbhs: remove usbhs_sys_hispeed_ctrl()

usbhs_sys_hispeed_ctrl() can collect into usbhs_sys_host/function_ctrl().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
12 years agoUSB: ci13xxx_udc: handle controllers with less than 16 EPs
Marc Kleine-Budde [Mon, 10 Oct 2011 16:38:10 +0000 (18:38 +0200)]
USB: ci13xxx_udc: handle controllers with less than 16 EPs

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>
12 years agoUSB: ci13xxx_udc: make suspend and resume in gadget driver optional
Marc Kleine-Budde [Mon, 10 Oct 2011 16:38:09 +0000 (18:38 +0200)]
USB: ci13xxx_udc: make suspend and resume in gadget driver optional

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>