firefly-linux-kernel-4.4.55.git
13 years agousb: gadget: mv_udc: fix kernel panic on some platforms
Neil Zhang [Wed, 12 Oct 2011 08:49:26 +0000 (16:49 +0800)]
usb: gadget: mv_udc: fix kernel panic on some platforms

Some platforms will use usb to download images, the controller may not
be stopped correctly when start kernel. In some cases, it may have some
pending interrupts, and they will be triggered immediately when we finish
requesting irq in function probe. But we haven't finished the device
initialization at this time. So let's stop udc here to avoid this case
occurred.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: mv_udc: add section information
Neil Zhang [Wed, 12 Oct 2011 08:49:25 +0000 (16:49 +0800)]
usb: gadget: mv_udc: add section information

Tag the probe function as __devinit.
Tag the remove function as __devexit.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: mv_udc: refine the driver structure
Neil Zhang [Wed, 12 Oct 2011 08:49:24 +0000 (16:49 +0800)]
usb: gadget: mv_udc: refine the driver structure

This patch do the following things:

1. Add header and Copyright for marvell usb driver.
2. Add mv_usb.h in include/linux/platform_data, make the driver
   fits all the marvell platform using the same ChipIdea usb ip.
3. Some SOC may has mutiple clock sources, so let me define it
   in mv_usb_platform_data and give two helper functions named
   udc_clock_enable/udc_clock_disable to deal with the clocks.
4. Different SOCs will have some difference in PHY initialization,
   so we will remove file mv_udc_phy.c and add two funtions in
   mv_usb_platform_data, let the platform relative driver to realize it.
5. Rewrite probe function according to the modification list above. Find
   it will kernel panic when probe failed. The root cause is as follows:
When probe failed, the error handle may call device_unregister()
which in return will call gadget_release.In current code,
gadget_release have two issues:
1: the_controller is a NULL pointer.
2: if we free udc here, then the following code in probe
   will access NULL pointer.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: fix compile warning
Felipe Balbi [Thu, 13 Oct 2011 17:00:03 +0000 (20:00 +0300)]
usb: gadget: renesas_usbhs: fix compile warning

| drivers/usb/renesas_usbhs/fifo.c: In function ‘usbhsf_dma_prepare_push’:
| drivers/usb/renesas_usbhs/fifo.c:823:7: warning: cast from pointer \
to integer of different size [-Wpointer-to-int-cast]
| drivers/usb/renesas_usbhs/fifo.c: In function ‘usbhsf_dma_try_pop’:
| drivers/usb/renesas_usbhs/fifo.c:900:7: warning: cast from pointer \
to integer of different size [-Wpointer-to-int-cast]

Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: drop dependency
Felipe Balbi [Thu, 13 Oct 2011 16:45:17 +0000 (19:45 +0300)]
usb: gadget: renesas_usbhs: drop dependency

that driver can compile cleanly on x86 without
any issues.

Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: fixup driver compile style
Kuninori Morimoto [Thu, 13 Oct 2011 04:02:44 +0000 (21:02 -0700)]
usb: gadget: renesas_usbhs: fixup driver compile style

In current renesas-usbhs,
there was inconsistency about the style of kernel module or built-in.
This patch solve it.

[ balbi@ti.com : fix compile issue when building modules ]

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: bugfix: don't modify platform data
Kuninori Morimoto [Thu, 13 Oct 2011 04:02:22 +0000 (21:02 -0700)]
usb: gadget: renesas_usbhs: bugfix: don't modify platform data

renesas_usbhs has default callback functions and settings.
And it tried overwrite to platform private data
if platform doesn't have them.
So, if renesas_usbhs was compiled as module,
it will be hung-up on 2nd insmod.
This patch fixup it.
Special thanks to Bastian

Reported-by: Bastian Hecht <hechtb@googlemail.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: add mod_host support
Kuninori Morimoto [Tue, 11 Oct 2011 05:07:40 +0000 (22:07 -0700)]
usb: gadget: renesas_usbhs: add mod_host support

This is mod_host prototype support for renesas_usbhs driver.
It doesn't support USB-Hub, and USB-DMAC for now.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: usbhs_dcp_control_transfer_done() cares mod_host
Kuninori Morimoto [Tue, 11 Oct 2011 05:07:20 +0000 (22:07 -0700)]
usb: gadget: renesas_usbhs: usbhs_dcp_control_transfer_done() cares mod_host

CCPL setting is needed on only mod_gadget.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: add data/status stage handler
Kuninori Morimoto [Tue, 11 Oct 2011 05:07:08 +0000 (22:07 -0700)]
usb: gadget: renesas_usbhs: add data/status stage handler

mod_host needs data/status stage handler

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: add INTSTS1 interrupt support
Kuninori Morimoto [Tue, 11 Oct 2011 05:06:57 +0000 (22:06 -0700)]
usb: gadget: renesas_usbhs: add INTSTS1 interrupt support

mod_host use INTSTS1 interrupt

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: add usbhs_set_device_speed() support for host
Kuninori Morimoto [Tue, 11 Oct 2011 05:06:46 +0000 (22:06 -0700)]
usb: gadget: renesas_usbhs: add usbhs_set_device_speed() support for host

mod_host needs device speed setup function

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: make sure SOF packet sending-out control
Kuninori Morimoto [Tue, 11 Oct 2011 05:06:35 +0000 (22:06 -0700)]
usb: gadget: renesas_usbhs: make sure SOF packet sending-out control

It is enabled to set SOF packet output bit when USBRST bit was set.
And USBRST bit should be set 0 when SOF packet was output.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: support otg pin control
Kuninori Morimoto [Tue, 11 Oct 2011 05:06:12 +0000 (22:06 -0700)]
usb: gadget: renesas_usbhs: support otg pin control

some renesas_usbhs device is supporting OTG external device interface.
In that device, it is necessary to control PWEN/EXTLP on DVSTCTR.
This patch support it.
But renesas_usbhs driver doesn't have OTG support for now.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: disable pipe on top of interrupt
Kuninori Morimoto [Tue, 11 Oct 2011 05:05:51 +0000 (22:05 -0700)]
usb: gadget: renesas_usbhs: disable pipe on top of interrupt

When data read interrupt happened, the pipe is BUF which means "enable".
then, next un-necessary interrupt/token might be
issued again when all data were popped from fifo.
It will cause un-understandable bug.
This patch decides pipe disable on top of read interrupt.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: modify pipe sequence settings
Kuninori Morimoto [Tue, 11 Oct 2011 05:05:30 +0000 (22:05 -0700)]
usb: gadget: renesas_usbhs: modify pipe sequence settings

renesas_usbhs can manually set DATA0/DATA1.
This patch is prepare for mod_host support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: disable auto paket start on usbhs_pkt_push()
Kuninori Morimoto [Tue, 11 Oct 2011 05:04:53 +0000 (22:04 -0700)]
usb: gadget: renesas_usbhs: disable auto paket start on usbhs_pkt_push()

Automatically packet start by usbhs_pkt_push() was useful.
But the pushed packet will be called twice
if new packet was pushed on usbhs_pkt :: done callback.
(1st is called by usbhs_pkt_push(), 2nd is called by usbhsf_pkt_handler())

This patch disables automatic packet start,
and clarified packet start timing.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: move done callback to struct usbhs_pkt
Kuninori Morimoto [Tue, 11 Oct 2011 05:04:41 +0000 (22:04 -0700)]
usb: gadget: renesas_usbhs: move done callback to struct usbhs_pkt

transfer done function was registered in struct struct usbhs_pipe_info.
It was good for mod_gadget, but not good for mod_host.
This function move it to struct usbhs_pkt.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: add usbhs_pipe_name()
Kuninori Morimoto [Tue, 11 Oct 2011 05:04:23 +0000 (22:04 -0700)]
usb: gadget: renesas_usbhs: add usbhs_pipe_name()

pipe name is usefull function for mod_xxx

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: add device select support in usbhs_pipe_config_update()
Kuninori Morimoto [Tue, 11 Oct 2011 05:04:00 +0000 (22:04 -0700)]
usb: gadget: renesas_usbhs: add device select support in usbhs_pipe_config_update()

device select method will be used on mod_host

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: add struct usbhs_priv to packet done function
Kuninori Morimoto [Tue, 11 Oct 2011 05:03:39 +0000 (22:03 -0700)]
usb: gadget: renesas_usbhs: add struct usbhs_priv to packet done function

There was no method to get struct usbhs_priv when
packet transfer done function was called.
This patch allow that callback function receive it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: add usbhs_dcp_dir_for_host()
Kuninori Morimoto [Tue, 11 Oct 2011 05:02:57 +0000 (22:02 -0700)]
usb: gadget: renesas_usbhs: add usbhs_dcp_dir_for_host()

renesas_usbhs device needs special bit settings
if it was mod_host and dcp pipe.
This patch support it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: remove unneeded parameter from usbhs_mod_is_host()
Kuninori Morimoto [Tue, 11 Oct 2011 05:02:45 +0000 (22:02 -0700)]
usb: gadget: renesas_usbhs: remove unneeded parameter from usbhs_mod_is_host()

it was possible to get usbhs_mod from usbhs_priv.
this patch remove unneeded parameter.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: move usbhs_usbreq_get/set_val() to common.c
Kuninori Morimoto [Tue, 11 Oct 2011 05:02:33 +0000 (22:02 -0700)]
usb: gadget: renesas_usbhs: move usbhs_usbreq_get/set_val() to common.c

usbhs_usbreq_get/set_val() functions were in pipe.c file,
but it is irrelevant to pipe.
this patch move it to common.c

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: move usbhsp_type() to usbhs_pipe_type()
Kuninori Morimoto [Tue, 11 Oct 2011 05:02:21 +0000 (22:02 -0700)]
usb: gadget: renesas_usbhs: move usbhsp_type() to usbhs_pipe_type()

Pipe type check macro will be used in other files.
This patch move local macro to global macro.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: add usbhs_bus_get_speed()
Kuninori Morimoto [Tue, 11 Oct 2011 05:01:51 +0000 (22:01 -0700)]
usb: gadget: renesas_usbhs: add usbhs_bus_get_speed()

current mod_gadget had got usb speed on
usbhsg_irq_dev_state() which is status change interrupt callback function.
And the usb speed data was included in its parameter.

But this style works for mod_gadget,
but doesn't work for mod_host which
isn't interrupted when device status was changed.

This patch add usbhs_bus_get_speed() to solve this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: add bus control functions
Kuninori Morimoto [Tue, 11 Oct 2011 05:01:40 +0000 (22:01 -0700)]
usb: gadget: renesas_usbhs: add bus control functions

this patch add DVSTCTR control function for HOST support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: change usbhsc_bus_ctrl() to usbsc_set_buswait()
Kuninori Morimoto [Tue, 11 Oct 2011 05:01:28 +0000 (22:01 -0700)]
usb: gadget: renesas_usbhs: change usbhsc_bus_ctrl() to usbsc_set_buswait()

renesas_usbhs will have register DVSTCTR control function for HOST support.
This patch changes usbhsc_bus_ctrl() to usbsc_set_buswait(),
to remove DVSTCTR access from it,

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: tidyup INTENB0 method
Kuninori Morimoto [Tue, 11 Oct 2011 05:01:15 +0000 (22:01 -0700)]
usb: gadget: renesas_usbhs: tidyup INTENB0 method

This patch tidyup Interrupt Enable Register 0 (INTENB0)
which has relationship with picky BEMPENB/BRDYENB.

 - add explain comment
 - ignore nonsense 0 write case

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: struct usbhs_pipe hold handler
Kuninori Morimoto [Tue, 11 Oct 2011 05:00:59 +0000 (22:00 -0700)]
usb: gadget: renesas_usbhs: struct usbhs_pipe hold handler

packet handler had moved to struct usbhs_pipe from struct usbhsg_uep.
it is preparation of mod_host support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: each pipe hold maxpacket size
Kuninori Morimoto [Tue, 11 Oct 2011 05:00:42 +0000 (22:00 -0700)]
usb: gadget: renesas_usbhs: each pipe hold maxpacket size

Current renesas_usbhs pipe accessed DCPMAXP/PIPEMAXP register
to get own maxpacket size every time.
But maxpacket size isn't changed after pipe start,
and register access is too slow.

This patch adds new maxp variable to keep own maxpacket.
And un-used function are removed.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: remove desc from usbhs_pipe_malloc
Kuninori Morimoto [Tue, 11 Oct 2011 04:59:46 +0000 (21:59 -0700)]
usb: gadget: renesas_usbhs: remove desc from usbhs_pipe_malloc

Current usbhs_pipe_malloc() used usb_endpoint_descriptor to
get necessary information.
It was very good for mod_gadget which allocate pipe in runtime,
but is not good for mod_host which allocate pipe in initial timing.
This patch remove usb_endpoint_descriptor from usbhs_pipe_malloc()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: move USBHSF_PKT_xxx to pipe.c
Kuninori Morimoto [Tue, 11 Oct 2011 04:58:45 +0000 (21:58 -0700)]
usb: gadget: renesas_usbhs: move USBHSF_PKT_xxx to pipe.c

There is no longer necessity that USBHSF_PKT_xxx are in fifo.h.
it are used in only fifo.c now.
This patch move it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas_usbhs: add suspend/resume support
Kuninori Morimoto [Tue, 11 Oct 2011 04:58:19 +0000 (21:58 -0700)]
usb: gadget: renesas_usbhs: add suspend/resume support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: storage: add superspeed support
Felipe Balbi [Wed, 3 Aug 2011 11:33:27 +0000 (14:33 +0300)]
usb: gadget: storage: add superspeed support

this patch adds superspeed descriptors for the
storage gadgets.

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: fix typo for default U1/U2 exit latencies
Felipe Balbi [Mon, 10 Oct 2011 06:43:44 +0000 (09:43 +0300)]
usb: gadget: fix typo for default U1/U2 exit latencies

s/DEFULT/DEFAULT/, no functional changes.

Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: r8a66597: convert to new style
Felipe Balbi [Mon, 10 Oct 2011 14:18:51 +0000 (17:18 +0300)]
usb: gadget: r8a66597: convert to new style

convert to new style UDC registration and remove
the global 'the_controller' pointer.

Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: renesas: convert to new style
Felipe Balbi [Mon, 10 Oct 2011 14:11:20 +0000 (17:11 +0300)]
usb: gadget: renesas: convert to new style

using udc_start()/udc_stop() as we should.

Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: net2280: convert to new style
Felipe Balbi [Mon, 10 Oct 2011 07:37:17 +0000 (10:37 +0300)]
usb: gadget: net2280: convert to new style

with this patch we can finally remove the global
"the_controller" pointer.

Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: net2272: convert to new style
Felipe Balbi [Mon, 10 Oct 2011 07:33:47 +0000 (10:33 +0300)]
usb: gadget: net2272: convert to new style

with this patch we can finally remove the global
"the controller" pointer.

Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: langwell: convert to new style
Felipe Balbi [Sat, 8 Oct 2011 10:17:34 +0000 (13:17 +0300)]
usb: gadget: langwell: convert to new style

with this patch we can finally remove the global
"the_controller" pointer.

Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: langwell: don't use the_controller when it's not needed
Felipe Balbi [Sat, 8 Oct 2011 10:08:01 +0000 (13:08 +0300)]
usb: gadget: langwell: don't use the_controller when it's not needed

in most cases, we can fetch our structure by
calling dev_get_drvdata().

Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: at91_udc: change french comments to english
Robert Schwebel [Thu, 6 Oct 2011 19:36:26 +0000 (21:36 +0200)]
usb: gadget: at91_udc: change french comments to english

While being there, change C++ style comments to /* */.

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: pxa25x: is_vbus_present is gone
Arnd Bergmann [Sat, 1 Oct 2011 20:03:33 +0000 (22:03 +0200)]
usb: gadget: pxa25x: is_vbus_present is gone

A recent commit obsoleted the is_vbus_present function, so
we must not use it any more.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: storage: fix mass storage gadgets to work with Synopsys UDC
Paul Zimmerman [Fri, 30 Sep 2011 22:26:06 +0000 (15:26 -0700)]
usb: gadget: storage: fix mass storage gadgets to work with Synopsys UDC

The Synopsys USB device controller requires all OUT transfer request
lengths to be aligned to max packet size. The mass storage gadgets do
not meet this requirement for Super Speed. The gadgets already have a
function which performs this alignment for CBW packets, so use it for
data packets too.

The alternative would be to implement bounce buffers in the DWC3
driver, but that could have a significant impact on performance.

This version is based upon a more-correct patch written by Alan
Stern.

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agoUSB: gadget: f_midi: allow a dynamic number of input and output ports
Daniel Mack [Wed, 28 Sep 2011 14:41:34 +0000 (16:41 +0200)]
USB: gadget: f_midi: allow a dynamic number of input and output ports

The code in the MIDI gadget was already sort of prepared for multi-port
configuration, so the streaming logic itself didn't need much tweaking.
However, the descriptors change when the number of ports do, and so some
rework of the the preparation algorithms were necessary.

Successfully tested on Linux and Max OS X hosts for both input and
output streams.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agoUSB: gadget: midi: refactor the device code
Daniel Mack [Wed, 28 Sep 2011 14:41:33 +0000 (16:41 +0200)]
USB: gadget: midi: refactor the device code

Make use of the newly added MIDI function in f_midi.c and strip down
the MIDI gadget code radically. Also use the generic framework function
to avoid code duplication and rename some symbols to bring them in sync
with other code in the gadget framework.

[ balbi@ti.com : fix Section mismatch warnings.
rebased on top of usb_speed_string() patch to
avoid conflicts. ]

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agoUSB: gadget: midi: add midi function driver
Daniel Mack [Wed, 28 Sep 2011 14:41:32 +0000 (16:41 +0200)]
USB: gadget: midi: add midi function driver

This patch adds f_midi.c to implement a USB gadget function that works
with the composite framework, so it can be combined with other USB
functions.

The code for the ALSA/MIDI logic was taken from the midi device gadget,
other parts have been rewritten to benefit from the dynamic descriptor
allocation features.

This was successfully tested on an OMAP3 board.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb gadget: fix langwell_udc.c build error
Randy Dunlap [Fri, 7 Oct 2011 20:57:42 +0000 (13:57 -0700)]
usb gadget: fix langwell_udc.c build error

Move function to fix langwell_udc.c build error:

drivers/usb/gadget/langwell_udc.c: In function 'show_langwell_udc':
drivers/usb/gadget/langwell_udc.c:1693:3: error: implicit declaration of function 'lpm_device_speed'
drivers/usb/gadget/langwell_udc.c: At top level:
drivers/usb/gadget/langwell_udc.c:2637:37: error: conflicting types for 'lpm_device_speed'
drivers/usb/gadget/langwell_udc.c:1693:20: note: previous implicit declaration of 'lpm_device_speed' was here

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Acked-by: Felipe Balbi <balbi@ti.com>
Cc: linux-usb@vger.kernel.org

13 years agousb: gadget: r8a66597-udc: add support for SUDMAC
Yoshihiro Shimoda [Fri, 30 Sep 2011 11:07:38 +0000 (20:07 +0900)]
usb: gadget: r8a66597-udc: add support for SUDMAC

SH7757 has a USB function with internal DMA controller (SUDMAC).
This patch supports the SUDMAC. The SUDMAC is incompatible with
general-purpose DMAC. So, it doesn't use dmaengine.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: r8a66597-udc: use dev_*() instead of printk()
Yoshihiro Shimoda [Fri, 30 Sep 2011 11:07:30 +0000 (20:07 +0900)]
usb: gadget: r8a66597-udc: use dev_*() instead of printk()

This patch also fix the balance of braces.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: r8a66597-udc: add function for external controller
Yoshihiro Shimoda [Fri, 30 Sep 2011 11:07:21 +0000 (20:07 +0900)]
usb: gadget: r8a66597-udc: add function for external controller

R8A66597 has the pin of WR0 and WR1. So, if one write-pin of CPU
connects to the pins, we have to change the setting of FIFOSEL
register in the controller. If we don't change the setting,
the controller cannot send the data of odd length.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agousb: gadget: r8a66597-udc: change prototype of r8a66597_write_fifo
Yoshihiro Shimoda [Fri, 30 Sep 2011 11:07:08 +0000 (20:07 +0900)]
usb: gadget: r8a66597-udc: change prototype of r8a66597_write_fifo

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
13 years agoUSB: fix ehci alignment error
Harro Haan [Mon, 10 Oct 2011 12:38:27 +0000 (14:38 +0200)]
USB: fix ehci alignment error

The Kirkwood gave an unaligned memory access error on
line 742 of drivers/usb/host/echi-hcd.c:
"ehci->last_periodic_enable = ktime_get_real();"

Signed-off-by: Harro Haan <hrhaan@gmail.com>
Cc: stable <stable@kernel.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: ftdi_sio: add PID for Sony Ericsson Urban
Hakan Kvist [Mon, 3 Oct 2011 11:41:15 +0000 (13:41 +0200)]
USB: ftdi_sio: add PID for Sony Ericsson Urban

Add PID 0xfc8a, 0xfc8b for device Sony Ericsson Urban

Signed-off-by: Hakan Kvist <hakan.kvist@sonyericsson.com>
Signed-off-by: Oskar Andero <oskar.andero@sonyericsson.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: Add module.h to various dwc3 drivers
Paul Gortmaker [Fri, 30 Sep 2011 22:08:59 +0000 (18:08 -0400)]
usb: Add module.h to various dwc3 drivers

These files uses the full set of MODULE_ macros and so need to
include module.h directly.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc3: convert structures into bitshifts
Felipe Balbi [Fri, 30 Sep 2011 07:58:51 +0000 (10:58 +0300)]
usb: dwc3: convert structures into bitshifts

our parameter structures need to be written to
HW, so instead of assuming little endian, we
convert those into bit shifts.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc3: gadget: allow clock gating to work
Felipe Balbi [Fri, 30 Sep 2011 07:58:50 +0000 (10:58 +0300)]
usb: dwc3: gadget: allow clock gating to work

The dwc3 core has internal clock gating support.

Let's allow that to happen by clearing the disable
bit in GCTL register.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc3: core: cache GHWPARAMS* registers
Felipe Balbi [Fri, 30 Sep 2011 07:58:49 +0000 (10:58 +0300)]
usb: dwc3: core: cache GHWPARAMS* registers

cache the contents of GHWPARAMS* registers in
our device structure for easy access.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc3: add struct dwc3_hwparams
Felipe Balbi [Fri, 30 Sep 2011 07:58:48 +0000 (10:58 +0300)]
usb: dwc3: add struct dwc3_hwparams

That structure will hold a copy of readonly
GHWPARAMS* registers for ease accessing by
the driver.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc3: gadget: implement streams support
Felipe Balbi [Fri, 30 Sep 2011 07:58:47 +0000 (10:58 +0300)]
usb: dwc3: gadget: implement streams support

The following patch adds support for streams
to dwc3 driver.

While at that, also fix one small issue on
endpoint disable where we should clear all
flags not only ENABLED.

Reviewied-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc3: gadget: add support for Bursts
Felipe Balbi [Fri, 30 Sep 2011 07:58:46 +0000 (10:58 +0300)]
usb: dwc3: gadget: add support for Bursts

We already have the value from gadget drivers,
just need to pass it to our controller.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc3: gadget: fix DMA offset calculation
Paul Zimmerman [Fri, 30 Sep 2011 07:58:45 +0000 (10:58 +0300)]
usb: dwc3: gadget: fix DMA offset calculation

Fix offset calculation in dwc3_trb_dma_offset()

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc3: gadget: make DWC3_EP_WEDGE do the right thing
Paul Zimmerman [Fri, 30 Sep 2011 07:58:44 +0000 (10:58 +0300)]
usb: dwc3: gadget: make DWC3_EP_WEDGE do the right thing

This makes DWC3_EP_WEDGE do the right thing, which is
prevent DWC3_EP_WEDGE from ever being cleared by a
ClearFeature(HALT) command.

[ balbi@ti.com : allowed set_wedge to send SetHalt command
to controller ]

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc3: gadget: driver should not wait for RxFIFO to drain
Paul Zimmerman [Fri, 30 Sep 2011 07:58:43 +0000 (10:58 +0300)]
usb: dwc3: gadget: driver should not wait for RxFIFO to drain

An older version of the databook said to wait for the FIFO to
drain, but that has been removed from the newer databooks.

Waiting for RxFIFO to drain caused problems when testing against
one of the host controllers available in the market.

After talking to one of the RTL engineers, he stated that we
should _not_ wait for RxFIFO to drain.

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc3: gadget: fix DEPSTARTCFG for non-EP0 EPs
Paul Zimmerman [Fri, 30 Sep 2011 07:58:42 +0000 (10:58 +0300)]
usb: dwc3: gadget: fix DEPSTARTCFG for non-EP0 EPs

DEPSTARTCFG for non-EP0 EPs must only be sent once per config

[ balbi@ti.com : changed config_start to start_config_issued ]

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc: remove "All rights reserved" statement.
Sebastian Andrzej Siewior [Fri, 30 Sep 2011 07:58:41 +0000 (10:58 +0300)]
usb: dwc: remove "All rights reserved" statement.

Some people think that this line is not compatible with the GPL. The
statement was required due to the Buenos Aires Convention and is now
deprecated. I remove it because it is said that it is pointless nowdays.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc3: ep0: fix debug output
Sebastian Andrzej Siewior [Fri, 30 Sep 2011 07:58:40 +0000 (10:58 +0300)]
usb: dwc3: ep0: fix debug output

Use "ep0in" and "ep0out" instead "ep1in" and "ep0out" which is confusing
and not consistent with the remaining output.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc3: ep0: remove second giveback in error case
Sebastian Andrzej Siewior [Fri, 30 Sep 2011 07:58:39 +0000 (10:58 +0300)]
usb: dwc3: ep0: remove second giveback in error case

We already give requests back in dwc3_ep0_stall_and_restart() so
doing it again here will most likely corrupt the list.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc3: ep0: fix debug message
Felipe Balbi [Fri, 30 Sep 2011 07:58:38 +0000 (10:58 +0300)]
usb: dwc3: ep0: fix debug message

The way it was before was really meaningless.
Now it looks saner.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc3: ep0: ignore direction on 2-stage transfer
Felipe Balbi [Fri, 30 Sep 2011 07:58:37 +0000 (10:58 +0300)]
usb: dwc3: ep0: ignore direction on 2-stage transfer

We don't need to care about direction on a two stage
transfer.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: dwc3: ep0: Make USB30CV happy with SetAddress
Felipe Balbi [Fri, 30 Sep 2011 07:58:36 +0000 (10:58 +0300)]
usb: dwc3: ep0: Make USB30CV happy with SetAddress

According to USB 3.0 Specification, a SetAddress()
while device is in Configured State has an unspecified
behavior (see Section 9.4.6). Still USB30CV wasn't
happy with my Stall reply.

To make that thing happy, just accept the SetAddress()
always. No problems have been observed thus far.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: add quirk for Logitech C300 web cam
Jon Levell [Thu, 29 Sep 2011 19:42:52 +0000 (20:42 +0100)]
USB: add quirk for Logitech C300 web cam

My webcam is a Logitech C300 and I get "chipmunk"ed squeaky sound.
The following trivial patch fixes it.

Signed-off-by: Jon Levell <linuxusb@coralbark.net>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agouser namespace: usb: make usb urbs user namespace aware (v2)
Serge Hallyn [Mon, 26 Sep 2011 15:45:18 +0000 (10:45 -0500)]
user namespace: usb: make usb urbs user namespace aware (v2)

Add to the dev_state and alloc_async structures the user namespace
corresponding to the uid and euid.  Pass these to kill_pid_info_as_uid(),
which can then implement a proper, user-namespace-aware uid check.

Changelog:
Sep 20: Per Oleg's suggestion: Instead of caching and passing user namespace,
uid, and euid each separately, pass a struct cred.
Sep 26: Address Alan Stern's comments: don't define a struct cred at
usbdev_open(), and take and put a cred at async_completed() to
ensure it lasts for the duration of kill_pid_info_as_cred().

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: message: cleanup min_t() cast in usb_sg_init()
Dan Carpenter [Tue, 27 Sep 2011 06:25:19 +0000 (09:25 +0300)]
USB: message: cleanup min_t() cast in usb_sg_init()

"length" is type size_t so the cast to unsigned int truncates the
upper bytes.  This isn't an issue in real life (I've checked the
callers) but it's a bit messy.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: qcserial: add device ID for "HP un2430 Mobile Broadband Module"
Rigbert Hamisch [Tue, 27 Sep 2011 08:46:43 +0000 (10:46 +0200)]
USB: qcserial: add device ID for "HP un2430 Mobile Broadband Module"

add device ID for "HP un2430 Mobile Broadband Module"

Signed-off-by: Rigbert Hamisch <rigbert@gmx.de>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/core/devio.c: Check for printer class specific request
Matthias Dellweg [Sun, 25 Sep 2011 12:26:25 +0000 (14:26 +0200)]
usb/core/devio.c: Check for printer class specific request

In the usb printer class specific request get_device_id the value of
wIndex is (interface << 8 | altsetting) instead of just interface.
This enables the detection of some printers with libusb.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Matthias Dellweg <2500@gmx.de>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: pid_ns: ensure pid is not freed during kill_pid_info_as_uid
Serge Hallyn [Mon, 26 Sep 2011 15:18:29 +0000 (10:18 -0500)]
USB: pid_ns: ensure pid is not freed during kill_pid_info_as_uid

Alan Stern points out that after spin_unlock(&ps->lock) there is no
guarantee that ps->pid won't be freed.  Since kill_pid_info_as_uid() is
called after the spin_unlock(), the pid passed to it must be pinned.

Reported-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: UHCI: improve comments and logic for root-hub suspend
Alan Stern [Mon, 26 Sep 2011 15:25:26 +0000 (11:25 -0400)]
USB: UHCI: improve comments and logic for root-hub suspend

This patch (as1488) improves the comments and logic in uhci-hcd's
suspend routine.  The existing comments are hard to understand and
don't give a good idea of what's really going on.

The question of whether EGSM (Enter Global Suspend Mode) and RD
(enable Resume Detect interrupts) can be useful when they're not both
set is difficult.  The spec doesn't give any details on how they
interact with system wakeup, although clearly they are meant to be
used together.  To be safe, the patch changes the subroutine so that
neither bit gets set unless they both do.  There shouldn't be any
functional changes from this; only systems that are designed badly or
broken in some way need to avoid using those bits.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: Update USB default wakeup settings
Alan Stern [Mon, 26 Sep 2011 15:23:38 +0000 (11:23 -0400)]
USB: Update USB default wakeup settings

This patch (as1486) implements the kernel's new wakeup policy for USB
host controllers.  Since they don't generate wakeup requests on their
but merely forward requests from their root hubs toward the CPU, they
should be enabled for wakeup by default.

Also, to be compliant with both the old and new policies, root hubs
should not be enabled for remote wakeup by default.  Userspace must
enable it explicitly if it is desired.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/xhci: remove CONFIG_PCI in xhci.c's probe function
Sebastian Andrzej Siewior [Fri, 23 Sep 2011 21:20:02 +0000 (14:20 -0700)]
usb/xhci: remove CONFIG_PCI in xhci.c's probe function

This removes the need of ifdefs within the init function and with it the
headache about the correct clean without bus X but with bus/platform Y &
Z.
xhci-pci is only compiled if CONFIG_PCI is selected which can be
de-selected now without trouble. For now the result is kinda useless
because we have no other glue code. However, since nobody is using
USB_ARCH_HAS_XHCI then it should not be an issue :)

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/xhci: move xhci_gen_setup() away from -pci.
Sebastian Andrzej Siewior [Fri, 23 Sep 2011 21:20:01 +0000 (14:20 -0700)]
usb/xhci: move xhci_gen_setup() away from -pci.

xhci_gen_setup() is generic so it can be used to perform the bare xhci
setup even on non-pci based platform. The typedef for the function
pointer is moved into the headerfile

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/xhci: refactor xhci_pci_setup()
Sebastian Andrzej Siewior [Fri, 23 Sep 2011 21:20:00 +0000 (14:20 -0700)]
usb/xhci: refactor xhci_pci_setup()

xhci_pci_setup() is split into three pieces:

- xhci_gen_setup()
  The major remaining of xhci_pci_setup() is now containing the generic
  part of the xhci setup. It allocates the xhci struct, setup
  hcs_params? and friends, performs xhci_halt(), xhci_init and so one.
  It also obtains the quirks via a callback
- xhci_pci_quirks()
  It checks the origin of the xhci core and sets core specific quirks.
- xhci_pci_setup()
  PCI specific setup functions. Besides calling xhci_gen_setup() with
  xhci_pci_quirks() as an argument it performs PCI specific setup like
  obtaining the address of sbrn via a PCI config space.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/xhci: replace pci_*_consistent() with dma_*_coherent()
Sebastian Andrzej Siewior [Fri, 23 Sep 2011 21:19:59 +0000 (14:19 -0700)]
usb/xhci: replace pci_*_consistent() with dma_*_coherent()

pci_*_consistent() calls dma_*_coherent() with GFP_ATOMIC and requires
pci_dev struct. This is a preparion for later where we no longer have
the pci struct around.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/xhci: hide MSI code behind PCI bars
Sebastian Andrzej Siewior [Fri, 23 Sep 2011 21:19:58 +0000 (14:19 -0700)]
usb/xhci: hide MSI code behind PCI bars

The MSI related fuctionality requires a few structs which are not
available if CONFIG_PCI is not enabled. This is a prepartion to allow
xhci be built without CONFIG_PCI set.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/xhci: group MSI interrupt registration into its own function
Sebastian Andrzej Siewior [Fri, 23 Sep 2011 21:19:57 +0000 (14:19 -0700)]
usb/xhci: group MSI interrupt registration into its own function

This patch moves the complete MSI/MSI-X/Legacy dance into its own
function. There is however one difference: If the XHCI_BROKEN_MSI flag
is set then we don't free and register the irq, we simply return.
This is preparation for later PCI decouple.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/host: introduce USB_ARCH_HAS_XHCI
Felipe Balbi [Fri, 23 Sep 2011 21:19:56 +0000 (14:19 -0700)]
usb/host: introduce USB_ARCH_HAS_XHCI

to make it look like OHCI and EHCI, we introduce
that symbol and USB_XHCI_HCD depend on that
instead of PCI.

[bigeasy@linutronix.de: wire up USB_ARCH_HAS_HCD]

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoxHCI: fix debug message
Andiry Xu [Fri, 23 Sep 2011 21:19:55 +0000 (14:19 -0700)]
xHCI: fix debug message

Fix the debug message in xhci_address_device().

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoxHCI: AMD isoc link TRB chain bit quirk
Andiry Xu [Fri, 23 Sep 2011 21:19:54 +0000 (14:19 -0700)]
xHCI: AMD isoc link TRB chain bit quirk

Setting the chain (CH) bit in the link TRB of isochronous transfer rings
is required by AMD 0.96 xHCI host controller to successfully transverse
multi-TRB TD that span through different memory segments.

When a Missed Service Error event occurs, if the chain bit is not set in
the link TRB and the host skips TDs which just across a link TRB, the
host may falsely recognize the link TRB as a normal TRB. You can see
this may cause big trouble - the host does not jump to the right address
which is pointed by the link TRB, but continue fetching the memory which
is after the link TRB address, which may not even belong to the host,
and the result cannot be predicted.

This causes some big problems. Without the former patch I sent: "xHCI:
prevent infinite loop when processing MSE event", the system may hang.
With that patch applied, system does not hang, but the host still access
wrong memory address and isoc transfer will fail. With this patch,
isochronous transfer works as expected.

This patch should be applied to kernels as old as 2.6.36, which was when
the first isochronous support was added for the xHCI host controller.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousbcore: add sysfs support to xHCI usb2 hardware LPM
Andiry Xu [Fri, 23 Sep 2011 21:19:53 +0000 (14:19 -0700)]
usbcore: add sysfs support to xHCI usb2 hardware LPM

This patch adds sysfs support to xHCI usb2 hardware LPM, so developer can
enable and disable usb2 hardware LPM manually for test purpose.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoxHCI: set USB2 hardware LPM
Andiry Xu [Fri, 23 Sep 2011 21:19:52 +0000 (14:19 -0700)]
xHCI: set USB2 hardware LPM

If the device pass the USB2 software LPM and the host supports hardware
LPM, enable hardware LPM for the device to let the host decide when to
put the link into lower power state.

If hardware LPM is enabled for a port and driver wants to put it into
suspend, it must first disable hardware LPM, resume the port into U0,
and then suspend the port.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoxHCI: test USB2 software LPM
Andiry Xu [Fri, 23 Sep 2011 21:19:51 +0000 (14:19 -0700)]
xHCI: test USB2 software LPM

This patch tests USB2 software LPM for a USB2 LPM-capable device.

When a lpm-capable device is addressed, if the host also supports software
LPM, apply a test by putting the device into L1 state and resume it to see
if the device can do L1 suspend/resume successfully.

If the device fails to enter L1 or resume from L1 state, it may not
function normally and usbcore may disconnect and re-enumerate it. In this
case, store the device's Vid and Pid information, make sure the host will
not test LPM for it twice.

The test result is per device/host. Some devices claim to be lpm-capable,
but fail to enter L1 or resume. So the test is necessary.

The xHCI 1.0 errata has modified the USB2.0 LPM implementation. It redefines
the HIRD field to BESL, and adds another register Port Hardware LPM Control
(PORTHLPMC). However, this should not affect the LPM behavior on xHC which
does not implement 1.0 errata.

USB2.0 LPM errata defines a new bit BESL in the device's USB 2.0 extension
descriptor. If the device reports it uses BESL, driver should use BESL
instead of HIRD for it.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoxHCI: Check host USB2 LPM capability
Andiry Xu [Fri, 23 Sep 2011 21:19:51 +0000 (14:19 -0700)]
xHCI: Check host USB2 LPM capability

Check the host's USB2 LPM capability.

USB2 software LPM support is optional for xHCI 0.96 hosts. xHCI 1.0 hosts
should support software LPM, and may support hardware LPM.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoxHCI: Clear PLC for USB2 root hub ports
Andiry Xu [Fri, 23 Sep 2011 21:19:50 +0000 (14:19 -0700)]
xHCI: Clear PLC for USB2 root hub ports

When the link state changes, xHC will report a port status change event
and set the PORT_PLC bit, for both USB3 and USB2 root hub ports.

The PLC will be cleared by usbcore for USB3 root hub ports, but not for
USB2 ports, because they do not report USB_PORT_STAT_C_LINK_STATE in
wPortChange.

Clear it for USB2 root hub ports in handle_port_status().

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoxHCI: test and clear RWC bit
Andiry Xu [Fri, 23 Sep 2011 21:19:49 +0000 (14:19 -0700)]
xHCI: test and clear RWC bit

Introduce xhci_test_and_clear_bit() to clear RWC bit in PORTSC register.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoxHCI: set link state
Andiry Xu [Fri, 23 Sep 2011 21:19:48 +0000 (14:19 -0700)]
xHCI: set link state

Introduce xhci_set_link_state() to remove redundant codes.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousbcore: check device's LPM capability
Andiry Xu [Fri, 23 Sep 2011 21:19:48 +0000 (14:19 -0700)]
usbcore: check device's LPM capability

Check device's LPM capability by examining the bmAttibutes field of the
USB2.0 Extension Descriptor.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousbcore: get BOS descriptor set
Andiry Xu [Fri, 23 Sep 2011 21:19:47 +0000 (14:19 -0700)]
usbcore: get BOS descriptor set

This commit gets BOS(Binary Device Object Store) descriptor set for Super
Speed devices and High Speed devices which support BOS descriptor.

BOS descriptor is used to report additional USB device-level capabilities
that are not reported via the Device descriptor. By getting BOS descriptor
set, driver can check device's device-level capability such as LPM
capability.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: gadget: u_serial.c: fixed a brace coding style issue
Shaun Silk [Mon, 26 Sep 2011 01:26:43 +0000 (11:26 +1000)]
USB: gadget: u_serial.c: fixed a brace coding style issue

Signed-off-by: Shaun Silk <g0del@bigpond.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoEHCI : introduce a common ehci_setup
Matthieu CASTET [Sat, 2 Jul 2011 17:47:33 +0000 (19:47 +0200)]
EHCI : introduce a common ehci_setup

This allow to clean duplicated code in most of SOC driver.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org> # fixes 3.1 build error
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>