Peter Stuge [Mon, 10 Oct 2011 01:34:54 +0000 (03:34 +0200)]
USB: ftdi_sio: Support TI/Luminary Micro Stellaris BD-ICDI Board
Some Stellaris evaluation kits have the JTAG/SWD FTDI chip onboard,
and some, like EK-LM3S9B90, come with a separate In-Circuit Debugger
Interface Board. The ICDI board can also be used stand-alone, for
other boards and chips than the kit it came with. The ICDI has both
old style 20-pin JTAG connector and new style JTAG/SWD 10-pin 1.27mm
pitch connector.
Tested with EK-LM3S9B90, where the BD-ICDI board is included.
Matthew Garrett [Thu, 6 Oct 2011 19:35:43 +0000 (15:35 -0400)]
USB: Fix runtime wakeup on OHCI
At least some OHCI hardware (such as the MCP89) fails to flag any change
in the host status register or the port status registers when receiving
a remote wakeup while in D3 state. This results in the controller being
resumed but no device state change being noticed, at which point the
controller is put back to sleep again. Since there doesn't seem to be any
reliable way to identify the state change, just unconditionally resume the
hub. It'll be put back to sleep in the near future anyway if there are no
active devices attached to it.
Signed-off-by: Matthew Garrett <mjg@redhat.com> Cc: stable <stable@vger.kernel.org> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sarah Sharp [Thu, 6 Oct 2011 18:54:23 +0000 (11:54 -0700)]
xHCI/USB: Make xHCI driver have a BOS descriptor.
To add USB 3.0 link power management (LPM), we need to know what the U1
and U2 exit latencies are for the xHCI host controller. External USB 3.0
hubs report these values through the SuperSpeed Capabilities descriptor in
the BOS descriptor. Make the USB 3.0 roothub for the xHCI host behave
like an external hub and return the BOS descriptors.
The U1 and U2 exit latencies will vary across each host controller, so we
need to dynamically fill those values in by reading the exit latencies out
of the xHC registers. Make the roothub code in the USB core handle
hub_control() returning the length of the data copied.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Felipe Balbi [Thu, 13 Oct 2011 17:27:54 +0000 (20:27 +0300)]
usb: gadget: mv_udc: fix compile warning
| drivers/usb/gadget/mv_udc_core.c: In function 'handle_setup_packet':
| drivers/usb/gadget/mv_udc_core.c:1556:6: warning: 'status' may be \
used uninitialized in this function
Neil Zhang [Wed, 12 Oct 2011 08:49:36 +0000 (16:49 +0800)]
usb: gadget: mv_udc: fix dtd dma confusion
The controller will prime failure sometimes when do the iperf test.
Add delay to wait controller release dtd dma before we free it.
Then the issue is gone.
Signed-off-by: Neil Zhang <zhangwm@marvell.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Neil Zhang [Wed, 12 Oct 2011 08:49:31 +0000 (16:49 +0800)]
usb: gadget: mv_udc: add missing spinlock in ep enable/disable
The ep enable / disable functions can be called from interrupt
context, and they are not race safe on SMP systems. The critical
data can be modified in more than one routing.
Make them race safe by using IRQ-safe spinlock functions.
Signed-off-by: Neil Zhang <zhangwm@marvell.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Neil Zhang [Wed, 12 Oct 2011 08:49:30 +0000 (16:49 +0800)]
usb: gadget: mv_udc: fix bug when handle setup package.
For the code doesn't restrict controller ep must be ep0, so we will go
through all the eps and check if there is a setup package received.
And also we just need to acknowledge the corresponding bit in
ENDPTSETUPSTAT register.
Signed-off-by: Neil Zhang <zhangwm@marvell.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
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>
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>
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]
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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>
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>
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>
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>
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>
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>
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().
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>
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.
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.
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>
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>