pandora-kernel.git
13 years agoxHCI 1.0: TT_THINK_TIME set
Andiry Xu [Thu, 5 May 2011 10:14:05 +0000 (18:14 +0800)]
xHCI 1.0: TT_THINK_TIME set

xHCI 1.0 spec says the TT Think Time field shall be set to zero if the device
is not a High-speed hub.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxHCI 1.0: Block Interrupts for Isoch transfer
Andiry Xu [Thu, 5 May 2011 10:14:02 +0000 (18:14 +0800)]
xHCI 1.0: Block Interrupts for Isoch transfer

Currently an isoc URB is divided into multiple TDs, and every TD will
trigger an interrupt when it's processed. However, software can schedule
multiple TDs at a time, and it only needs an interrupt every URB.

xHCI 1.0 introduces the Block Event Interrupt(BEI) flag which allows Normal
and Isoch Transfer TRBs to place an Event TRB on an Event Ring but not
assert an intrrupt to the host, and the interrupt rate is significantly
reduced and the system performance is improved.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxHCI 1.0: Isoch endpoint CErr field set
Andiry Xu [Thu, 5 May 2011 10:14:00 +0000 (18:14 +0800)]
xHCI 1.0: Isoch endpoint CErr field set

xHCI 1.0 specification specifies that CErr does not apply to Isoch endpoints
and shall be set to '0' for Isoch endpoints.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxHCI 1.0: Control endpoint average TRB length field set
Andiry Xu [Thu, 5 May 2011 10:13:58 +0000 (18:13 +0800)]
xHCI 1.0: Control endpoint average TRB length field set

xHCI 1.0 specification indicates that software should set Average TRB Length
to '8' for control endpoints.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxHCI 1.0: Setup Stage TRB Transfer Type flag
Andiry Xu [Thu, 5 May 2011 10:13:56 +0000 (18:13 +0800)]
xHCI 1.0: Setup Stage TRB Transfer Type flag

Setup Stage Transfer Type field is added to indicate the presence and the
direction of the Data Stage TD, and determines the direction of the Status
Stage TD so the wLength length field should be ignored by the xHC.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoUSB: OTG: msm: Add PHY suspend support for MSM8960
Pavankumar Kondeti [Wed, 4 May 2011 04:49:49 +0000 (10:19 +0530)]
USB: OTG: msm: Add PHY suspend support for MSM8960

Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: OTG: msm: Configure PHY Analog and Digital voltage domains
Anji jonnala [Wed, 4 May 2011 04:49:48 +0000 (10:19 +0530)]
USB: OTG: msm: Configure PHY Analog and Digital voltage domains

Signed-off-by: Anji jonnala <anjir@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: OTG: msm: Implement charger detection
Pavankumar Kondeti [Wed, 4 May 2011 04:49:47 +0000 (10:19 +0530)]
USB: OTG: msm: Implement charger detection

Implement good battery algorithm defined in the battery charging V1.2 spec
for detecting different charging ports.  USB hardware is put into low power
mode when connected to a dedicated charging port.  vbus_draw and set_power
methods are implemented for determining the allowed current from Host in
different states (un-configured/suspend/configured).

The charger block is implemented using vendor specific registers and the
PHY used in MSM8960(28nm PHY) different from older targets like MSM8x60
and MSM7x30(45nm PHY).  The PHY vendor and product id registers are not
implemented in the above chipsets.  Hence PHY type is passed via platform
data.

Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: OTG: msm: vote for dayatona fabric clock
Anji jonnala [Wed, 4 May 2011 04:49:46 +0000 (10:19 +0530)]
USB: OTG: msm: vote for dayatona fabric clock

HSUSB core clock is derived from daytona fabric clock and for
HSUSB operational require minimum core clock at 55MHz. Since, HSUSB
cannot tolerate daytona fabric clock change in the middle of HSUSB
operational, vote for maximum Daytona fabric clock
while usb is operational

Signed-off-by: Anji jonnala <anjir@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: UHCI: Add support for GRLIB GRUSBHC controller
Jan Andersson [Fri, 6 May 2011 10:00:18 +0000 (12:00 +0200)]
USB: UHCI: Add support for GRLIB GRUSBHC controller

This patch adds support for the UHCI part of the GRLIB GRUSBHC controller
found on some LEON/GRLIB SoCs.

The UHCI HCD previously only supported controllers connected over PCI.
This patch adds support for the first non-PCI UHCI HC. I have tried to
replicate the solution used in ehci-hcd.c.

Tested on GR-LEON4-ITX board (LEON4/GRLIB with GRUSBHC) and x86 with Intel
UHCI HC.

Signed-off-by: Jan Andersson <jan@gaisler.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: UHCI: Support non-PCI host controllers
Jan Andersson [Fri, 6 May 2011 10:00:17 +0000 (12:00 +0200)]
USB: UHCI: Support non-PCI host controllers

This patch is part of a series that extend the UHCI HCD to support
non-PCI host controllers.

This patch also extends the uhci_{read,write}* functions to allow accesses
to registers not mapped into PCI I/O space. This extension also includes
the addition of a void __iomem pointer to the uhci structure.

A new Kconfig option is added to signal that the system has a non-PCI HC.
If this Kconfig option is set, uhci-hcd.c will include generic reset functions
for systems that do not make use of keyboard and mouse legacy support. PCI
controllers will still always use the reset functions from pci-quirks

This patch is followed by a patch that adds bus glue for the first non-PCI
UHCI HC.

Signed-off-by: Jan Andersson <jan@gaisler.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: UHCI: Wrap I/O register accesses
Jan Andersson [Fri, 6 May 2011 10:00:16 +0000 (12:00 +0200)]
USB: UHCI: Wrap I/O register accesses

This patch is part of a series that extend the UHCI HCD to support
non-PCI controllers.

This patch replaces in{b,w,l} and out{b,wl} with calls to local inline
functions. This is done so that the register access functions can be
extended to support register areas not mapped in PCI I/O space.

Signed-off-by: Jan Andersson <jan@gaisler.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: UHCI: Move PCI specific functions to uhci-pci.c
Jan Andersson [Fri, 6 May 2011 10:00:15 +0000 (12:00 +0200)]
USB: UHCI: Move PCI specific functions to uhci-pci.c

This patch is part of a series that extend the UHCI HCD to support
non-PCI controllers.

This patch moves PCI specific functions to uhci-pci.c and includes
this file in uhci-hcd.c. It also renames the function uhci_init to
uhci_pci_init.

uhci_init/uhci_pci_init is modified so that the port-detection logic
is kept in a new separate function uhci_count_ports() in uhci-hcd.c.

Signed-off-by: Jan Andersson <jan@gaisler.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: UHCI: Codingstyle fixes
Jan Andersson [Fri, 6 May 2011 10:00:14 +0000 (12:00 +0200)]
USB: UHCI: Codingstyle fixes

This patch is part of a series that extend the UHCI HCD to support
non-PCI host controllers.

This patch fixes the following warnings from checkpatch:

ERROR: switch and case should be at the same indent
+   switch (to_pci_dev(uhci_dev(uhci))->vendor) {
+       default:
[...]
+       case PCI_VENDOR_ID_GENESYS:
[...]
+       case PCI_VENDOR_ID_INTEL:

WARNING: static char array declaration should probably be static const char
+   static char bad_Asus_board[] = "A7V8X";

WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id
+static const struct pci_device_id uhci_pci_ids[] = { {

Signed-off-by: Jan Andersson <jan@gaisler.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: UHCI: Allow dynamic assignment of bus specific functions
Jan Andersson [Fri, 6 May 2011 10:00:13 +0000 (12:00 +0200)]
USB: UHCI: Allow dynamic assignment of bus specific functions

This patch is part of a series that extend the UHCI HCD to support
non-PCI controllers.

This patch changes calls to uhci_reset_hc, uhci_check_and_reset_hc,
configure_hc, resume_detect_interrupts_are_broken and
global_suspend_mode_is_broken so that they are made through pointers
in the uhci hcd struct. This will allow these functions to be replaced
with bus/arch specific functions.

Signed-off-by: Jan Andersson <jan@gaisler.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: UHCI: Remove PCI dependencies from uhci-hub
Jan Andersson [Fri, 6 May 2011 10:00:12 +0000 (12:00 +0200)]
USB: UHCI: Remove PCI dependencies from uhci-hub

This patch is part of a series that extend the UHCI HCD to support
non-PCI host controllers.

uhci-hub.c contained two PCI vendor checks for silicon quirks. Move
these checks into uhci-hcd.c and use bits in uhci_hcd structure to
mark that we need to use the quirks.

This patch is followed by other patches that will remove PCI
dependencies from uhci-hcd.c as well.

Signed-off-by: Jan Andersson <jan@gaisler.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agofsl/usb: Unused endpoint failure for USB gadget
Ramneek Mehresh [Wed, 4 May 2011 14:11:55 +0000 (19:41 +0530)]
fsl/usb: Unused endpoint failure for USB gadget

Though USB controller works without this most of the time, an issue was faced
where USB was configured as printer device and it was dropping first
packet(64 bytes) in full speed mode due to DATA PID mismatch.
The problem gets resolved once unused endpoints are configured as bulk.
As per P1020 RM (Table17-31, bits 19-18, bits 3-2) "When only one endpoint
(RX or TX, but not both) of an endpoint pair is used, the unused endpoint
should be configured as a bulk type endpoint." So according to the RM,
this patch is initializing TX and RX endpoints as bulk type

Signed-off-by: Suchit Lepcha <Suchit.Lepcha@freescale.com>
Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: ohci-s3c2410: return proper error if clk_get fails
Jingoo Han [Wed, 4 May 2011 23:46:07 +0000 (08:46 +0900)]
USB: ohci-s3c2410: return proper error if clk_get fails

Return PTR_ERR(clk) instead of -ENOENT if clk_get fails

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: ohci-s3c2410: fix checkpatch errors and warnings
Jingoo Han [Wed, 4 May 2011 07:45:47 +0000 (16:45 +0900)]
USB: ohci-s3c2410: fix checkpatch errors and warnings

This patch fixes the checkpatch errors ans warnings listed below:

ERROR: do not use assignment in if condition
WARNING: line over 80 characters
WARNING: braces {} are not necessary for single statement blocks
WARNING: space prohibited between function name and open parenthesis '('

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: ehci-au1xxx: fix suspend callback
Manuel Lauss [Thu, 5 May 2011 14:35:24 +0000 (16:35 +0200)]
USB: ehci-au1xxx: fix suspend callback

Remove a stray 'return 0' at the top of the suspend callback,
and move au1xxx_stop_ehc() out of the ehci spinlock since it takes
some time to complete.

Signed-off-by: Manuel Lauss <manuel.lauss@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: fix building musb drivers
Anatolij Gustschin [Thu, 5 May 2011 10:11:21 +0000 (12:11 +0200)]
usb: fix building musb drivers

Commit 3dacdf11 "usb: factor out state_string() on otg drivers"
broke building musb drivers since there is already another
otg_state_string() function in musb drivers, but with different
prototype. Fix musb drivers to use common otg_state_string(), too.

Also provide a nop for otg_state_string() if CONFIG_USB_OTG_UTILS
is not defined.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: EHCI: Add bus glue for GRLIB GRUSBHC controller
Jan Andersson [Tue, 3 May 2011 18:11:58 +0000 (20:11 +0200)]
USB: EHCI: Add bus glue for GRLIB GRUSBHC controller

This patch adds support for the GRLIB GRUSBHC EHCI controller from
Aeroflex Gaisler. The controller is typically found on LEON/GRLIB
SoCs.

Tested on GR-LEON4-ITX with with little endian interface and on
LEON3 system on GR-PCI-XC5V development board for big endian
controller.

Signed-off-by: Jan Andersson <jan@gaisler.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: EHCI: Support controllers with big endian capability regs
Jan Andersson [Tue, 3 May 2011 18:11:57 +0000 (20:11 +0200)]
USB: EHCI: Support controllers with big endian capability regs

The two first HC capability registers (CAPLENGTH and HCIVERSION)
are defined as one 8-bit and one 16-bit register. Most HC
implementations have selected to treat these registers as part
of a 32-bit register, giving the same layout for both big and
small endian systems.

This patch adds a new quirk, big_endian_capbase, to support
controllers with big endian register interfaces that treat
HCIVERSION and CAPLENGTH as individual registers.

Signed-off-by: Jan Andersson <jan@gaisler.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: OTG: msm: Clear in_lpm flag before enabling the IRQ in resume
Pavankumar Kondeti [Mon, 2 May 2011 06:26:33 +0000 (11:56 +0530)]
USB: OTG: msm: Clear in_lpm flag before enabling the IRQ in resume

The current code is clearing in_lpm flag after enabling the IRQ.
If IRQ comes immediately before in_lpm flag is set, it thinks that
hardware is in low power mode and disables the IRQ.  Fix this by
clearing in_lpm flag before enabling the IRQ.

Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: gadget: Initialize ep0 once while registering gadget in ci13xxx_udc
Anji jonnala [Mon, 2 May 2011 06:26:32 +0000 (11:56 +0530)]
USB: gadget: Initialize ep0 once while registering gadget in ci13xxx_udc

Some of the simulators may cache the ep0 maxpacket size to zero
if the ep0 dQh is not setup before enabling the pullup. Hence
Setup ep0 and initialize the dQh fields once while registering the
gadget(before enabling the pullup).

HSUSB Chipidea link controller spec says ep0 is enabled always
in the HW. Hence disabling and enabling the ep0 as a part of
reset interrupt is unneccesary.
Remove the disable/enable ep0 logic from reset interrupt handling.

Signed-off-by: Anji jonnala <anjir@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: gadget: Use ep0out for control OUT data phase in ci13xxx_udc
Pavankumar Kondeti [Mon, 2 May 2011 06:26:31 +0000 (11:56 +0530)]
USB: gadget: Use ep0out for control OUT data phase in ci13xxx_udc

The current code queue the control OUT data request to ep0in instead of
ep0out.  Check ep0_dir and use the correct control endpoint.

Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: gadget: Fix bug in endpoint feature request processing in ci13xxx_udc
Pavankumar Kondeti [Mon, 2 May 2011 06:26:30 +0000 (11:56 +0530)]
USB: gadget: Fix bug in endpoint feature request processing in ci13xxx_udc

The OUT endpoints are stored in 0 - hw_ep_max/2 and IN endpoints are
stored from hw_ep_max/2 - hw_ep_max in ci13xxx_ep array.  Retrieve
the IN endpoint correctly while processing endpoint feature requests.

Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: gadget: Fix unused variable warning in ci13xxx_udc
Pavankumar Kondeti [Mon, 2 May 2011 06:26:29 +0000 (11:56 +0530)]
USB: gadget: Fix unused variable warning in ci13xxx_udc

Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: gadget: Use bitwise AND operator to test flags in ci13xxx_udc
Pavankumar Kondeti [Mon, 2 May 2011 06:26:28 +0000 (11:56 +0530)]
USB: gadget: Use bitwise AND operator to test flags in ci13xxx_udc

Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: gadget: Fix typo (s/EBUSY/-EBUSY) in ci13xxx_udc
Pavankumar Kondeti [Mon, 2 May 2011 06:26:27 +0000 (11:56 +0530)]
USB: gadget: Fix typo (s/EBUSY/-EBUSY) in ci13xxx_udc

Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: gpio-vbus: ask for vbus_draw regulator before registering xceiv
Dmitry Eremin-Solenikov [Tue, 3 May 2011 08:46:46 +0000 (12:46 +0400)]
USB: gpio-vbus: ask for vbus_draw regulator before registering xceiv

Ask for vbus_draw regulator before registering tranceiver to disallow possible
race between registration and set_power/etc.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: ldusb: add several new devices
Michael Hund [Tue, 3 May 2011 17:12:00 +0000 (10:12 -0700)]
USB: ldusb: add several new devices

Added several new devices to ldusb and excluded them from the HID driver.

Signed-off-by: Michael Hund <mhund@ld-didactic.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: ehci: remove structure packing from ehci_def
Rabin Vincent [Wed, 27 Apr 2011 15:37:28 +0000 (21:07 +0530)]
USB: ehci: remove structure packing from ehci_def

As pointed out by Arnd Bergmann, in include/linux/usb/ehci_def.h, struct
ehci_caps is defined with __attribute__((packed)) for no good reason,
and this triggers undefined behaviour when using ARM's readl() on
pointers to elements of this structure:

http://lkml.kernel.org/r/201102021700.20683.arnd@arndb.de

The same problem exists with the other two structures in ehci_def.h too,
so remove the __attribute__((packed)) from all of them.

Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: Configure octeon2 glue logic for proper uSOF cycle period.
David Daney [Wed, 27 Apr 2011 17:54:22 +0000 (10:54 -0700)]
usb: Configure octeon2 glue logic for proper uSOF cycle period.

The reset value of the uSOF cycle period is incorrect.  Set it to
60,000 bits.  Without this, several commercial USB flash memory
devices and hubs fail to work properly.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: octeon2-common.c: Configure ports for proper electrical characteristics.
David Daney [Wed, 27 Apr 2011 17:54:21 +0000 (10:54 -0700)]
usb: octeon2-common.c: Configure ports for proper electrical characteristics.

Additional PHY tuning is needed to obtain compliant 'eye' diagram
electrical characteristics.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: octeon2-common: Don't reinitialize the clocks.
David Daney [Wed, 27 Apr 2011 17:54:20 +0000 (10:54 -0700)]
USB: octeon2-common: Don't reinitialize the clocks.

The UCTL clock initialization will cause the ehci and ohci blocks to
become inoperable if the clocks are reinitialized.

Check to see if the clocks have already been initialized.

Also use a mutex to protect the clock initialization code so that
there can be no attempt to use the clocks before they are fully
configured.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoMerge branch 'for-usb-next' of git+ssh://master.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Tue, 3 May 2011 00:05:19 +0000 (17:05 -0700)]
Merge branch 'for-usb-next' of git+ssh:///linux/kernel/git/sarah/xhci into usb-next

* 'for-usb-next' of git+ssh://master.kernel.org/pub/scm/linux/kernel/git/sarah/xhci:
  xhci 1.0: Set transfer burst last packet count field.
  xhci 1.0: Set transfer burst count field.
  xhci 1.0: Update TD size field format.
  xhci 1.0: Only interrupt on short packet for IN EPs.
  xhci: Remove sparse warning about cmd_status.
  usbcore: warm reset USB3 port in SS.Inactive state
  usbcore: Refine USB3.0 device suspend and resume
  xHCI: report USB3.0 portstatus comply with USB3.0 specification
  xHCI: Set link state support
  xHCI: Clear link state change support
  xHCI: warm reset support
  usb/ch9: use proper endianess for wBytesPerInterval
  xhci: Remove recursive call to xhci_handle_event
  xhci: Add an assertion to check for virt_dev=0 bug.
  xhci: Add rmb() between reading event validity & event data access.
  xhci: Make xHCI driver endian-safe

13 years agousb/isp1760: Improve urb queueing, get rid of BUG():s in normal code paths
Arvid Brodin [Tue, 26 Apr 2011 19:48:30 +0000 (21:48 +0200)]
usb/isp1760: Improve urb queueing, get rid of BUG():s in normal code paths

This patch replaces the code that handles qtds. Intead of directly allocating
chip mem and chip slot, enqueue the transfer in a list of queue heads. Use
a centralized function enqueue_qtds() to prioritize and enqueue transfers.

This removes all of the interrupt context BUG() calls when out of chip
mem or transfer slots. It also makes it possible to efficiently use the
dual-port mem on the chip for double-buffered transfers, which improve
transfer times to/from/between usb sticks by about 40 % on my HW.

With this patch it should also be possible to handle qtd scheduling outside
of the interrupt handler, for significantly improved kernel latency. I have
not implemented this since there are some locking issues which I haven't
had time to look at.

Signed-off-by: Arvid Brodin <arvid.brodin@enea.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/isp1760: Report correct urb status after unlink
Arvid Brodin [Tue, 26 Apr 2011 19:46:47 +0000 (21:46 +0200)]
usb/isp1760: Report correct urb status after unlink

This fixes a bug in my previous (2.6.38) patch series which caused
urb->status value to be wrong after unlink (broke usbtest 11, 12).

Signed-off-by: Arvid Brodin <arvid.brodin@enea.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/isp1760: Remove unneeded OR map and HcBufferStatus code
Arvid Brodin [Tue, 26 Apr 2011 19:48:02 +0000 (21:48 +0200)]
usb/isp1760: Remove unneeded OR map and HcBufferStatus code

Since we always set the OR flag for each transfer, we can just as well set all
these bits to 1 at init and be done with it. Also, HcBufferStatus can be set
at init as per the ISP1761 datasheet page 47 with no loss of performance.

Signed-off-by: Arvid Brodin <arvid.brodin@enea.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/isp1760: Clean up urb enqueueing
Arvid Brodin [Tue, 26 Apr 2011 19:47:37 +0000 (21:47 +0200)]
usb/isp1760: Clean up urb enqueueing

This collects urb enqueue code that was spread out all over the place
into a couple of more readable functions.

Signed-off-by: Arvid Brodin <arvid.brodin@enea.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/isp1760: Remove false error printout
Arvid Brodin [Tue, 26 Apr 2011 19:47:12 +0000 (21:47 +0200)]
usb/isp1760: Remove false error printout

This removes the "qh is 0" printout. qh == NULL if the urb has
been unlinked, so this condition is normal.

Signed-off-by: Arvid Brodin <arvid.brodin@enea.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: s3c-hsotg: Add copyright string
Anton Tikhomirov [Thu, 21 Apr 2011 08:06:43 +0000 (17:06 +0900)]
USB: s3c-hsotg: Add copyright string

Signed-off-by: Anton Tikhomirov <av.tikhomirov@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: s3c-hsotg: Fix hang up after reset
Anton Tikhomirov [Thu, 21 Apr 2011 08:06:42 +0000 (17:06 +0900)]
USB: s3c-hsotg: Fix hang up after reset

When File Storage gadget receives SET CONFIGURATION request it tries
to cancel all pending transfers. If some request is in progress,
gadget waits for its completion. This commit allows gadget to dequeue
invalid requests in progress left after reset.

Signed-off-by: Anton Tikhomirov <av.tikhomirov@samsung.com>
Reviewed-by: Kyoungil Kim<ki0351.kim@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: s3c-hsotg: Fix stall condition processing
Anton Tikhomirov [Thu, 21 Apr 2011 08:06:41 +0000 (17:06 +0900)]
USB: s3c-hsotg: Fix stall condition processing

The following should be done for requests after endpoint stall
condition is cleared:
1) 'in progress' request (if any) should be completed since
   Tx FIFO was flushed;
2) next request from queue (if any) should be started.

This commit does that.

Additionally set/clear stall condition code is fixed.

Signed-off-by: Anton Tikhomirov <av.tikhomirov@samsung.com>
Reviewed-by: Kyoungil Kim<ki0351.kim@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: s3c-hsotg: Fix control request processing
Anton Tikhomirov [Thu, 21 Apr 2011 08:06:40 +0000 (17:06 +0900)]
USB: s3c-hsotg: Fix control request processing

UDC driver does not need to generate reply to host if request is
delivered to gadget. This is gadget's responsibility. This commit
fixes that.

Signed-off-by: Anton Tikhomirov <av.tikhomirov@samsung.com>
Reviewed-by: Kyoungil Kim<ki0351.kim@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: s3c-hsotg: Fix interrupt cleaning code
Anton Tikhomirov [Thu, 21 Apr 2011 08:06:39 +0000 (17:06 +0900)]
USB: s3c-hsotg: Fix interrupt cleaning code

This commit does the following:
1) clears all pending interrupts before unmasking;
2) clears interrupts as soon as possible to avoid missing
   next coming that may occur during handling;
3) removes ineffective interrupt cleaning code.

Signed-off-by: Anton Tikhomirov <av.tikhomirov@samsung.com>
Reviewed-by: Kyoungil Kim<ki0351.kim@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: s3c-hsotg: Fix core reset
Anton Tikhomirov [Thu, 21 Apr 2011 08:06:38 +0000 (17:06 +0900)]
USB: s3c-hsotg: Fix core reset

This patch fixes code responsible for core reset.

Signed-off-by: Anton Tikhomirov <av.tikhomirov@samsung.com>
Reviewed-by: Kyoungil Kim<ki0351.kim@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: extend ehci-fsl and fsl_udc_core driver for OTG operation
Anatolij Gustschin [Mon, 18 Apr 2011 20:02:00 +0000 (22:02 +0200)]
USB: extend ehci-fsl and fsl_udc_core driver for OTG operation

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Li Yang <leoli@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: add Freescale USB OTG Transceiver driver
Li Yang [Mon, 18 Apr 2011 20:01:59 +0000 (22:01 +0200)]
USB: add Freescale USB OTG Transceiver driver

Slightly reworked and cleaned up driver from Freescale LTIB
for MPC5121E. The driver has been ported to the current kernel,
proc interface "/proc/driver/fsl_usb2_otg" has been replaced by
sysfs interface.

Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: fsl_udc_core: support device mode of MPC5121E DR USB Controller
Anatolij Gustschin [Mon, 18 Apr 2011 20:01:58 +0000 (22:01 +0200)]
USB: fsl_udc_core: support device mode of MPC5121E DR USB Controller

Extend the FSL UDC driver to support MPC5121E DR USB Controller
operation in device mode. Add MPC5121E specific init/uninit
at probe and remove and isolate system interface register accesses
when running on MPC5121E SoC, as these registers are not available
on this platform. This patch relies on previous patch for supporting
big endian registers and descriptors access in the FSL UDC driver.
Additionally support endpoint FIFO status operation by providing
appropriate callback in endpoint ops structure.

Also flush cache for the req buffer used for GetStatus reply.
Without this, the correct reply to an endpoint GetStatus
is written to 'req', but doesn't make it out to the USB bus
since the buffer hasn't been flushed. This would cause the
USBCV Halt Endpoint test to fail (according to changelog in
Freescale LTIB driver code).

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Li Yang <leoli@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: fsl_udc_core: prepare for SoCs with BE registers and descriptors
Anatolij Gustschin [Mon, 18 Apr 2011 20:01:57 +0000 (22:01 +0200)]
USB: fsl_udc_core: prepare for SoCs with BE registers and descriptors

On some SoCs, the USB controller registers and descriptors can be big
or little endian, depending on the version of the chip. In order to be
able to run the same kernel binary on different versions of an SoC, the
BE/LE decision must be made at run time. Provide appropriate register
and descriptor accessors which are configurable at run time using the
configuration flags from fsl_usb2_platform_data data structure.

This is in preparation for adding support for MPC5121E DR USB2 Controller
to the FSL UDC driver.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Li Yang <leoli@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: fix build of FSL MPH DR OF platform driver
Anatolij Gustschin [Mon, 18 Apr 2011 20:01:56 +0000 (22:01 +0200)]
USB: fix build of FSL MPH DR OF platform driver

When only FSL USB gadget driver is selected in the kernel
configuration the MPH DR OF driver for creation of FSL
USB platform devices from device tree won't be built.
As a result no USB platform devices for MPH DR USB controller
will be created at run time and no probing will be done in
the fsl_udc_core driver.

Add an entry to the Makefile to build the MPH DR OF
platform driver if CONFIG_USB_FSL_MPH_DR_OF is defined.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: ehci-fsl: add MPC5121E specific suspend and resume
Anatolij Gustschin [Mon, 18 Apr 2011 20:01:55 +0000 (22:01 +0200)]
USB: ehci-fsl: add MPC5121E specific suspend and resume

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoxhci 1.0: Set transfer burst last packet count field.
Sarah Sharp [Wed, 20 Apr 2011 00:43:33 +0000 (17:43 -0700)]
xhci 1.0: Set transfer burst last packet count field.

The xHCI 1.0 specification defines a new isochronous TRB field, called
transfer burst last packet count (TBLPC).  This field defines the number
of packets in the last "burst" of packets in a TD.  Only SuperSpeed
endpoints can handle more than one burst, so this is set to the number for
packets in a TD for all non-SuperSpeed devices (minus one, since the field
is zero based).

This patch should have no effect on host controllers that don't advertise
the xHCI 1.0 (0x100) version number in their hci_version field.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxhci 1.0: Set transfer burst count field.
Sarah Sharp [Fri, 8 Apr 2011 16:37:29 +0000 (09:37 -0700)]
xhci 1.0: Set transfer burst count field.

The xHCI 1.0 specification adds a new field to the fourth dword in an
isochronous TRB: the transfer burst count (TBC).  This field is only
non-zero for SuperSpeed devices.  Each SS endpoint sets the bMaxBurst
field in the SuperSpeed endpoint companion descriptor, which indicates how
many max-packet-sized "bursts" it can handle in one service interval.  The
device driver may choose to burst less max packet sized chunks each
service interval (which is defined by one TD).  The xHCI driver indicates
to the host controller how many bursts it needs to schedule through the
transfer burst count field.

This patch will only effect xHCI hosts that advertise 1.0 support (0x100)
in the HCI version field of their capabilities register.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxhci 1.0: Update TD size field format.
Sarah Sharp [Fri, 1 Apr 2011 21:01:30 +0000 (14:01 -0700)]
xhci 1.0: Update TD size field format.

The xHCI 1.0 specification changes the format of the TD size field in
Normal and Isochronous TRBs.  The field in control TRBs is still set to
reserved zero.  Instead of representing the number of bytes left to
transfer in the TD (including the current TRB's buffer), it now represents
the number of packets left to transfer (*not* including this TRB).

See section 4.11.2.4 of the xHCI 1.0 specification for details.  The math
is basically copied straight from there.

Create a new function, xhci_v1_0_td_remainder(), that should be called for
all xHCI 1.0 host controllers.  The field location and maximum value is
still the same, so reuse the old function, xhci_td_remainder(), to handle
the bit shifting.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxhci 1.0: Only interrupt on short packet for IN EPs.
Sarah Sharp [Wed, 23 Mar 2011 23:26:26 +0000 (16:26 -0700)]
xhci 1.0: Only interrupt on short packet for IN EPs.

It doesn't make sense to set the interrupt on short packet (TRB_ISP) flag
for TRBs queued to endpoints that only receive packets from the host
controller (i.e. OUT endpoints).  Packets can only be short when they are
sent from a USB device.  Plus, the xHCI 1.0 specification forbids setting
the flag for anything but IN endpoints.

While we're at it, remove some of my snide remarks about the inefficiency
of event data TRBs.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxhci: Remove sparse warning about cmd_status.
Sarah Sharp [Thu, 28 Apr 2011 19:23:23 +0000 (12:23 -0700)]
xhci: Remove sparse warning about cmd_status.

Sparse complains about the arguments to xhci_evaluate_context_result() and
xhci_configure_endpoint_result():

  CHECK   drivers/usb/host/xhci.c
drivers/usb/host/xhci.c:1647:53: warning: incorrect type in argument 3 (different signedness)
drivers/usb/host/xhci.c:1647:53:    expected int *cmd_status
drivers/usb/host/xhci.c:1647:53:    got unsigned int [usertype] *[assigned] cmd_status
drivers/usb/host/xhci.c:1648:50: warning: incorrect type in argument 3 (different signedness)
drivers/usb/host/xhci.c:1648:50:    expected int *cmd_status
drivers/usb/host/xhci.c:1648:50:    got unsigned int [usertype] *[assigned] cmd_status

The command status is taken from the command completion event TRB, and
will always be a positive number.  Change the signature of
xhci_evaluate_context_result() and xhci_configure_endpoint_result() to
take a u32 for cmd_status.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agousbcore: warm reset USB3 port in SS.Inactive state
Andiry Xu [Wed, 27 Apr 2011 10:07:54 +0000 (18:07 +0800)]
usbcore: warm reset USB3 port in SS.Inactive state

Some USB3.0 devices go to SS.Inactive state when hot plug to USB3 ports.
Warm reset the port to transition it to U0 state.

This patch fixes the issue that Kingston USB3.0 flash drive can not be
recognized when hot plug to USB3 port.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agousbcore: Refine USB3.0 device suspend and resume
Andiry Xu [Wed, 27 Apr 2011 10:07:50 +0000 (18:07 +0800)]
usbcore: Refine USB3.0 device suspend and resume

In the past, we use USB2.0 request to suspend and resume a USB3.0 device.
Actually, USB3.0 hub does not support Set/Clear PORT_SUSPEND request,
instead, it uses Set PORT_LINK_STATE request. This patch makes USB3.0 device
suspend/resume comply with USB3.0 specification.

This patch fixes the issue that USB3.0 device can not be suspended when
connected to a USB3.0 external hub.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxHCI: report USB3.0 portstatus comply with USB3.0 specification
Andiry Xu [Wed, 27 Apr 2011 10:07:43 +0000 (18:07 +0800)]
xHCI: report USB3.0 portstatus comply with USB3.0 specification

USB3.0 specification has different wPortStatus and wPortChange definitions
from USB2.0 specification. Since USB3 root hub and USB2 root hub are split
now and USB3 hub only has USB3 protocol ports, we should modify the
portstatus and portchange report of USB3 ports to comply with USB3.0
specification.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxHCI: Set link state support
Andiry Xu [Wed, 27 Apr 2011 10:07:39 +0000 (18:07 +0800)]
xHCI: Set link state support

This patch adds support for Set Port Feature(PORT_LINK_STATE) request.

The most significant byte (bits 15..8) of the wIndex field specifies
the U state the host software wants to put the link connected to the
port into. This request is only valid when the PORT_ENABLE bit is set
and the PORT_LINK_STATE should not be above value '5' (Rx.Detect).

This request will be later used to replace the set/clear suspend USB3
protocol ports in hub driver.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxHCI: Clear link state change support
Andiry Xu [Wed, 27 Apr 2011 10:07:35 +0000 (18:07 +0800)]
xHCI: Clear link state change support

This patch adds support for Clear Port Feature(C_PORT_LINK_STATE)
request from usbcore.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxHCI: warm reset support
Andiry Xu [Wed, 27 Apr 2011 10:07:29 +0000 (18:07 +0800)]
xHCI: warm reset support

This patch adds warm reset support to xhci hub control.
It handles Set Port Feature(BH_PORT_RESET) and Clear Port Feature
(C_BH_PORT_RESET) request from usbcore.
Note warm reset is called BH reset some places in USB3.0 specification.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agousb/ch9: use proper endianess for wBytesPerInterval
Sebastian Andrzej Siewior [Mon, 11 Apr 2011 18:19:12 +0000 (20:19 +0200)]
usb/ch9: use proper endianess for wBytesPerInterval

while going through Tatyana's changes for the gadget framework I noticed
that this type is not defined as __le16.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxhci: Remove recursive call to xhci_handle_event
Matt Evans [Tue, 29 Mar 2011 02:41:02 +0000 (13:41 +1100)]
xhci: Remove recursive call to xhci_handle_event

Make the caller loop while there are events to handle, instead.

Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxhci: Add an assertion to check for virt_dev=0 bug.
Matt Evans [Tue, 29 Mar 2011 02:40:56 +0000 (13:40 +1100)]
xhci: Add an assertion to check for virt_dev=0 bug.

During a "plug-unplug" stress test on an NEC xHCI card, a null pointer
dereference was observed.  xhci_address_device() dereferenced a null
virt_dev (possibly an erroneous udev->slot_id?); this patch adds a WARN_ON &
message to aid debug if it can be recreated.

Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxhci: Add rmb() between reading event validity & event data access.
Matt Evans [Tue, 29 Mar 2011 02:40:51 +0000 (13:40 +1100)]
xhci: Add rmb() between reading event validity & event data access.

On weakly-ordered systems, the reading of an event's content must occur
after reading the event's validity.

Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agoxhci: Make xHCI driver endian-safe
Matt Evans [Tue, 29 Mar 2011 02:40:46 +0000 (13:40 +1100)]
xhci: Make xHCI driver endian-safe

This patch changes the struct members defining access to xHCI device-visible
memory to use __le32/__le64 where appropriate, and then adds swaps where
required.  Checked with sparse that all accesses are correct.

MMIO accesses use readl/writel so already are performed LE, but prototypes
now reflect this with __le*.

There were a couple of (debug) instances of DMA pointers being truncated to
32bits which have been fixed too.

Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
13 years agousb: factor out state_string() on otg drivers
Anatolij Gustschin [Fri, 15 Apr 2011 14:18:38 +0000 (16:18 +0200)]
usb: factor out state_string() on otg drivers

Provide common otg_state_string() and use
it in drivers.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/usbtest: fix test10 on superpseed
Sebastian Andrzej Siewior [Thu, 14 Apr 2011 14:17:21 +0000 (16:17 +0200)]
usb/usbtest: fix test10 on superpseed

dummy_hcd + g_zero:

|./testusb -a -s 1024 -v 1024 -t 10
| usbtest 2-1:3.0: subtest 14 error, status 0

with patch:
  ./testusb -a -t 10
|unknown speed   /proc/bus/usb/001/002
| dummy_udc dummy_udc: disabled ep-a
| dummy_udc dummy_udc: disabled ep-b
| dummy_udc dummy_udc: enabled ep-a (ep1in-bulk) maxpacket 1024
| dummy_udc dummy_udc: enabled ep-b (ep2out-bulk) maxpacket 1024
| zero gadget: source/sink enabled
| usbtest 1-1:3.0: TEST 10:  queue 32 control calls, 1000 times
| dummy_hcd dummy_hcd: timer fired with no URBs pending?
|/proc/bus/usb/001/002 test 10,    0.022370 secs

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/usbtest: print super on super speed
Sebastian Andrzej Siewior [Thu, 14 Apr 2011 13:45:42 +0000 (15:45 +0200)]
usb/usbtest: print super on super speed

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoxhci-hcd: Include <linux/slab.h> in xhci-pci.c
Ben Hutchings [Mon, 25 Apr 2011 15:54:28 +0000 (16:54 +0100)]
xhci-hcd: Include <linux/slab.h> in xhci-pci.c

Commit b02d0ed677acb3465e7600366f2353413bf24074 ('xhci: Change
hcd_priv into a pointer') added calls to kzalloc() and kfree() in
xhci-pci.c.  On most architectures <linux/slab.h> is indirectly
included, but on some it is not.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>,
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: core: Change usb_create_sysfs_intf_files()' return type to void
Michal Nazarewicz [Thu, 14 Apr 2011 15:47:09 +0000 (17:47 +0200)]
usb: core: Change usb_create_sysfs_intf_files()' return type to void

The usb_create_sysfs_intf_files() function always returned zero even
if it failed to create sysfs fails.  Since this is a desired behaviour
there is no need to return return code at all.  This commit changes
function's return type (form int) to void.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: add queued-unlinks test case to usbtest driver
Alan Stern [Thu, 14 Apr 2011 15:21:04 +0000 (11:21 -0400)]
USB: add queued-unlinks test case to usbtest driver

This patch (as1452b) adds a new test case to the usbtest driver.  Test
24 exercises the unlink-from-queue pathways in the host.  It queues a
user-specified number of bulk-OUT URBs of user-specified size, unlinks
the fourth- and second-from-last URBs in the queue, and then waits to
see if all the URBs complete in the expected way (except of course
that the unlinked URBs might complete normally, if they weren't
unlinked soon enough).

This new test has confirmed the existence of a bug in the ehci-hcd
driver, to be fixed by a separate patch.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: ehci: tegra: fix USB1 port reset issue
Jim Lin [Sun, 17 Apr 2011 08:58:25 +0000 (11:58 +0300)]
USB: ehci: tegra: fix USB1 port reset issue

Tegra USB1 port needs to issue Port Reset twice internally, otherwise it
fails to enumerate devices attached to it

Signed-off-by: Jim Lin <jilin@nvidia.com>
Signed-off-by: Olof Johansson <olofj@chromium.org>
[ squash two patches into one and minor style cleanups ]
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: ohci-s3c2410: use resource_size()
Jingoo Han [Thu, 14 Apr 2011 12:09:16 +0000 (21:09 +0900)]
USB: ohci-s3c2410: use resource_size()

This patch uses the resource_size help function instead of
manually calculating the resource size. It can reduce the chance
of introducing off-by-one errors.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: ohci-s3c2410: use __devinit and __devexit macros for probe and remove
Jingoo Han [Thu, 14 Apr 2011 12:09:37 +0000 (21:09 +0900)]
USB: ohci-s3c2410: use __devinit and __devexit macros for probe and remove

The __devinit and __devexit macros were added to probe and remove
functions. The macros move the probe and remove functions to the
devinit and devexit sections.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: gadget: storage_common: use kstrto*() [bug fix]
Michal Nazarewicz [Thu, 14 Apr 2011 09:55:43 +0000 (11:55 +0200)]
usb: gadget: storage_common: use kstrto*() [bug fix]

This commit fixes an embarrassing bug in the "storage_common:
use kstrto*()" patch which caused fsg_store_ro() to return
zero instead of the length of the consumed buffer.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/dummy_hcd: don't probe for udc if hcd failed
Sebastian Andrzej Siewior [Fri, 15 Apr 2011 18:37:06 +0000 (20:37 +0200)]
usb/dummy_hcd: don't probe for udc if hcd failed

the_controller is allocated in dummy_hcd_probe() and is NULL if the
allocation failed. The probe function of the udc driver is dereferencing
this pointer and fault.
Alan Stern suggested to abort the dummy_hcd driver probing so the module
is not loaded. The is abort-on-error has been also added to the udc
driver.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb/hcd: don't return 0 on error in usb_add_hcd()
Sebastian Andrzej Siewior [Thu, 14 Apr 2011 09:22:32 +0000 (11:22 +0200)]
usb/hcd: don't return 0 on error in usb_add_hcd()

If USB type detections fails, we run into default and return 0.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: renesas_usbhs: add autonomy mode
Kuninori Morimoto [Thu, 28 Apr 2011 07:41:20 +0000 (16:41 +0900)]
usb: renesas_usbhs: add autonomy mode

Current renesas_usbhs was designed to save power when USB is not connected.
And it assumed platform uses callback to notify connection/disconnection
by external interrupt.

But some SuperH / platform board doesn't have such feature.

This patch adds autonomy mode which detect USB connection/disconnection
by internal interrupt.
But power will be always ON when autonomy mode is selected.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: renesas_usbhs: use delayed_work instead of work_struct
Kuninori Morimoto [Thu, 28 Apr 2011 07:41:14 +0000 (16:41 +0900)]
usb: renesas_usbhs: use delayed_work instead of work_struct

This delay is used to overjump debounce.

And, this patch also move usbhsc_drvcllbck_notify_hotplug to global,
because it will be called from other files.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: renesas_usbhs: prevent NULL pointer crash
Kuninori Morimoto [Thu, 28 Apr 2011 07:41:07 +0000 (16:41 +0900)]
usb: renesas_usbhs: prevent NULL pointer crash

usbhs_status_get_each_irq/usbhs_irq_callback_update might be called
with mod == NULL

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: renesas_usbhs: add power control function
Kuninori Morimoto [Thu, 28 Apr 2011 07:41:02 +0000 (16:41 +0900)]
usb: renesas_usbhs: add power control function

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: renesas_usbhs: move pdev_to_priv to global
Kuninori Morimoto [Thu, 28 Apr 2011 07:40:54 +0000 (16:40 +0900)]
usb: renesas_usbhs: move pdev_to_priv to global

usbhs_pdev_to_priv function will be used in other files.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: renesas_usbhs: add error reason for usbhs_pipe_malloc
Kuninori Morimoto [Thu, 21 Apr 2011 05:10:24 +0000 (14:10 +0900)]
usb: renesas_usbhs: add error reason for usbhs_pipe_malloc

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: renesas_usbhs: remove callback when module removed.
Kuninori Morimoto [Thu, 21 Apr 2011 05:10:16 +0000 (14:10 +0900)]
usb: renesas_usbhs: remove callback when module removed.

The callback function which is called from platform must be removed
if module removed.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: renesas_usbhs: return error if wrong recip request
Kuninori Morimoto [Thu, 21 Apr 2011 05:10:12 +0000 (14:10 +0900)]
usb: renesas_usbhs: return error if wrong recip request

There are some USB Host which doesn't notice disconnection at once.
And it might try some request after reconnection with old settings.
Current renesas_usbhs will crash in such case.
This patch prevent this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: renesas_usbhs: modify spinlock method
Kuninori Morimoto [Thu, 21 Apr 2011 05:10:08 +0000 (14:10 +0900)]
usb: renesas_usbhs: modify spinlock method

Current renesas_usbhs driver was using spin_trylock to avoid
dead lock / nest lock.
But acording to CONFIG_DEBUG_SPINLOCK, it is BUG under UP environment.
This patch add usbhsg_trylock to avoid this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: renesas_usbhs: don't re-allocation pipe buffer
Kuninori Morimoto [Tue, 26 Apr 2011 00:21:35 +0000 (09:21 +0900)]
usb: renesas_usbhs: don't re-allocation pipe buffer

Because pipe buffer allocation is very picky and difficult,
current renesas_usbhs driver is not caring pipe re-allocation.

In this situation, driver will create new pipe without caring old pipe
if "usbhsg_ep_enable" is called after "usbhsg_ep_disable" on current driver.
This mean the limited pipe and buffer will be used as waste.
But it is possible to re-use same buffer to same pipe.

By this patch, driver will initialize pipe when it detected new connection or
new gadget, and doesn't try re-allocation for same pipe in above case.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: renesas_usbhs: modify fifo clear timing
Kuninori Morimoto [Thu, 21 Apr 2011 05:09:58 +0000 (14:09 +0900)]
usb: renesas_usbhs: modify fifo clear timing

Pipe buffer should be cleaned before using it,
but should NOT be cleaned in pipe "prepare" function.
Because the pipe might be working in such timing.
This patch fixup this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: g_printer required set interface request
Jonas Andersson [Mon, 21 Mar 2011 13:54:09 +0000 (14:54 +0100)]
USB: g_printer required set interface request

g_printer reqiured "set interface" request from host. Not all hosts send
this request.  This patch enable the interface when it get "set
configuration" request from host.

Signed-off-by: Jonas Andersson <jonas@microbit.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: dbpg gadget: dont mask out direction bit
Sven Schnelle [Wed, 23 Mar 2011 14:24:56 +0000 (15:24 +0100)]
USB: dbpg gadget: dont mask out direction bit

Stripping the direction bit off will produce an
invalid descriptor.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: dbgp gadget: set MaxpacketSize0
Sven Schnelle [Wed, 23 Mar 2011 20:24:55 +0000 (21:24 +0100)]
USB: dbgp gadget: set MaxpacketSize0

The current code doesn't set it, so linux complains about
it when connected, and ignores the device:

[104611.068082] usb 1-5: new high speed USB device using ehci_hcd and address 127
[104611.088368] usb 1-5: Invalid ep0 maxpacket: 0

Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: dbgp gadget: fix return value of dbgp_setup
Sven Schnelle [Wed, 23 Mar 2011 20:36:17 +0000 (21:36 +0100)]
USB: dbgp gadget: fix return value of dbgp_setup

Current code returns 0 even if it can't handle the request.
This leads to timeouts when an unhandled request is sent:

Bus 001 Device 003: ID 0525:c0de Netchip Technology, Inc.
Device Descriptor:
[..]
can't get device qualifier: Connection timed out
[..]

change the code to return EOPNOTSUPP in such cases.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: renesas_usbhs: Driver is depend on SuperH
Kuninori Morimoto [Fri, 15 Apr 2011 05:19:46 +0000 (14:19 +0900)]
usb: renesas_usbhs: Driver is depend on SuperH

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agousb: renesas_usbhs: fixup cast warning
Kuninori Morimoto [Thu, 14 Apr 2011 04:57:06 +0000 (13:57 +0900)]
usb: renesas_usbhs: fixup cast warning

This patch fixup cast warning on 64 bit compiler

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reported-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoUSB: documentation update for the pre_reset method
Alan Stern [Thu, 28 Apr 2011 14:45:24 +0000 (10:45 -0400)]
USB: documentation update for the pre_reset method

This patch (as1459) updates the documentation for the pre_reset method
in struct usb_driver.  When a driver is notified of an impending
reset, it must cancel all outstanding I/O and not start any new I/O
until it has been notified that the reset is complete.

As far as I know, most existing drivers that implement pre_reset do
this now.  The major exceptions appear to be the SpeedTouch and
CDC-WDM drivers.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>