]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
11 years agoMerge tag 'gadget-for-v3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Fri, 25 Jan 2013 17:08:05 +0000 (09:08 -0800)]
Merge tag 'gadget-for-v3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:
usb: gadget: patches for v3.9 merge window

finally getting rid of the old ->start()/->stop() methods
in favor of the better and improved ->udc_start()/->udc_stop().

There were surprisingly quite a few users left, but all of them
have been converted.

f_mass_storage removed some dead code, which is always great ;-)

There's also a big cleanup to the gadget framework from Sebastian
which gets us a lot closer to having only function drivers in
kernel and move over to configfs-based binding.

Other than these, there's the usual set of cleanups: s3c UDCs are
moving over to devm_regulator_bulk_get() API, at91_udc removed
an unnecessary check for work_pending() before scheduling and
there's the removal of an unused variable from uac2_pcm_trigger().

11 years agoMerge tag 'dwc3-for-v3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Fri, 25 Jan 2013 17:02:26 +0000 (09:02 -0800)]
Merge tag 'dwc3-for-v3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:
usb: dwc3: patches for v3.9 merge window

We're saving some extra memory now by being a lot
more conservative when allocating our event buffers.

Our default HIRD threshold value was mistakenly set
as one of the unsupported which would cause undefined
behavior. Turns out that it broke OMAP5 ES2.0, so we're
fixing it now by setting the maximum allowed HIRD
threshold (12).

Quite a few fixes to Isochronous transfers and scatter/gather
support from Pratyush.

We're also starting to support devicetree-based probe with
the latest changes from Kishon.

The usual set of cleanups also available: converting debugfs
regdump utility to regsets, better "compatible" strings for
Exynos platforms and the removal of the dependency for
Host and Gadget; now dwc3 can be compiled host-only, device-only,
and/or Dual-Role.

11 years agoMerge tag 'musb-for-v3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Fri, 25 Jan 2013 17:00:42 +0000 (09:00 -0800)]
Merge tag 'musb-for-v3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:
usb: musb: patches for v3.9 merge window

Mostly fixes all over which weren't urgent enough for
the late -rc cycle.

There is a Double Buffering fix for Host Mode TX,
a dependency fix for the transceiver driver, some
fixes to the error path and a fix for the use of
omap_musb_maibox.

Other than these fixes, there a removal duplicate
headers from the dsps glue layer and removal of
redundant assignments in omap2430_probe().

11 years agousb: dwc3: host: Change platform device ID for xhci-hcd to AUTO
Vivek Gautam [Fri, 25 Jan 2013 11:22:02 +0000 (16:52 +0530)]
usb: dwc3: host: Change platform device ID for xhci-hcd to AUTO

Multiple dwc3 controllers will try to allocate multiple xhci-hcd
interfaces.
Changing platform device IDs from NONE to AUTO to support
such cases.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: exynos/omap: Change platform device IDs for no_op_xceive to AUTO
Vivek Gautam [Fri, 25 Jan 2013 11:22:01 +0000 (16:52 +0530)]
usb: dwc3: exynos/omap: Change platform device IDs for no_op_xceive to AUTO

Multiple dwc3 probe calls try to allocate no_op_xceive platform
device. Having static IDs for these will throw sysfs error -EEXIST.
Changing these static platform device IDs to AUTO to enable
multiple dwc3 controller support on a SoC.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: core: stray statements are removed
Kishon Vijay Abraham I [Fri, 25 Jan 2013 03:00:55 +0000 (08:30 +0530)]
usb: dwc3: core: stray statements are removed

No functional change. Stray statements where removed from dwc3 core.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: core: enable the USB2 and USB3 phy in probe
Kishon Vijay Abraham I [Fri, 25 Jan 2013 03:00:54 +0000 (08:30 +0530)]
usb: dwc3: core: enable the USB2 and USB3 phy in probe

Enabled the USB2 and USB3 PHY in probe by calling usb_phy_set_suspend
and disabled the PHYs on driver removal. When PM is implemented this
will be optimized to enable the PHYs only when needed.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: omap: Add an API to write to dwc mailbox
Kishon Vijay Abraham I [Fri, 25 Jan 2013 03:00:49 +0000 (08:30 +0530)]
usb: dwc3: omap: Add an API to write to dwc mailbox

Add an API in the omap glue layer to write to the mailbox register which
can be used by comparator driver(twl). To pass the detection of the attached
device (signified by VBUS, ID) to the dwc3 core, dwc3 core has to write
to the mailbox regiter.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: omap: Remove explicit writes to SYSCONFIG register
Kishon Vijay Abraham I [Fri, 25 Jan 2013 03:00:48 +0000 (08:30 +0530)]
usb: dwc3: omap: Remove explicit writes to SYSCONFIG register

The runtime API's takes care of setting the SYSCONFIG register with
appropriate values. Hence explicit writes to SYSCONFIG register is
removed.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: omap: use runtime API's to enable clocks
Kishon Vijay Abraham I [Fri, 25 Jan 2013 03:00:47 +0000 (08:30 +0530)]
usb: dwc3: omap: use runtime API's to enable clocks

Before accessing any register, runtime API's should be invoked to enable
the clocks. runtime API's are added here to prevent abort during register
access.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: omap: use of_platform API to create dwc3 core pdev
Kishon Vijay Abraham I [Fri, 25 Jan 2013 03:00:46 +0000 (08:30 +0530)]
usb: dwc3: omap: use of_platform API to create dwc3 core pdev

Used of_platform_populate() to create dwc3 core platform_device
from device tree data.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: omap: use device_for_each_child to handle child removal
Kishon Vijay Abraham I [Fri, 25 Jan 2013 03:00:45 +0000 (08:30 +0530)]
usb: dwc3: omap: use device_for_each_child to handle child removal

Used device_for_each_child() to handle child device (dwc3 core) removal
during devexit of dwc3 omap. This is in preparation for creating the child
devices from subnode of dwc3 omap glue using of_platform_populate.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: exynos: fix compatible strings for the device
Vivek Gautam [Thu, 24 Jan 2013 13:45:30 +0000 (19:15 +0530)]
usb: dwc3: exynos: fix compatible strings for the device

Using specific chip in compatible strings. Newer SOCs can claim
device by using older string in the compatible list.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: ehci-s5p/ohci-exynos: Fix compatible strings for the device
Vivek Gautam [Thu, 24 Jan 2013 13:45:29 +0000 (19:15 +0530)]
usb: ehci-s5p/ohci-exynos: Fix compatible strings for the device

Using specific chip in compatible strings. Newer SOCs can claim
device by using older string in the compatible list.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: fix sign-extension bug in the hub driver
Alan Stern [Thu, 24 Jan 2013 20:04:13 +0000 (15:04 -0500)]
USB: fix sign-extension bug in the hub driver

This patch (as1646) fixes a long-standing bug in the USB hub driver.
Upon conversion from char to unsigned long, the bytes in the status
buffer are subject to unwanted sign extension.  The bytes should be
declared as u8 rather than char, to prevent this.

This effects of this bug are minimal.  The hub driver may end up doing
a little unnecessary extra work because it thinks events have occurred
on some ports when they really haven't.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: uhci: beautify source code
Chen Gang [Thu, 24 Jan 2013 01:41:45 +0000 (09:41 +0800)]
USB: uhci: beautify source code

  get rid of the line breaks in string constants.
  let comments within 80 with limitation.
  delete ' \' at the end of a statement.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: option: add and update Alcatel modems
Bjørn Mork [Wed, 23 Jan 2013 09:44:36 +0000 (10:44 +0100)]
USB: option: add and update Alcatel modems

Adding three currently unsupported modems based on information
from .inf driver files:

  Diag  VID_1BBB&PID_0052&MI_00
  AGPS  VID_1BBB&PID_0052&MI_01
  VOICE VID_1BBB&PID_0052&MI_02
  AT    VID_1BBB&PID_0052&MI_03
  Modem VID_1BBB&PID_0052&MI_05
  wwan  VID_1BBB&PID_0052&MI_06

  Diag  VID_1BBB&PID_00B6&MI_00
  AT    VID_1BBB&PID_00B6&MI_01
  Modem VID_1BBB&PID_00B6&MI_02
  wwan  VID_1BBB&PID_00B6&MI_03

  Diag  VID_1BBB&PID_00B7&MI_00
  AGPS  VID_1BBB&PID_00B7&MI_01
  VOICE VID_1BBB&PID_00B7&MI_02
  AT    VID_1BBB&PID_00B7&MI_03
  Modem VID_1BBB&PID_00B7&MI_04
  wwan  VID_1BBB&PID_00B7&MI_05

Updating the blacklist info for the X060S_X200 and X220_X500D,
reserving interfaces for a wwan driver, based on

  wwan VID_1BBB&PID_0000&MI_04
  wwan VID_1BBB&PID_0017&MI_06

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: misc: usb3503: add dt support
Dongjin Kim [Wed, 23 Jan 2013 17:47:10 +0000 (02:47 +0900)]
USB: misc: usb3503: add dt support

Added device tree support for usb3503 driver and add new document with device tree binding information.

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: UHCI: remove unused definition
Woody Suwalski [Wed, 23 Jan 2013 18:51:28 +0000 (13:51 -0500)]
USB: UHCI: remove unused definition

Remove an unused (and erroneous) definition from the UHCI driver.

Signed-off: Woody Suwalski <terraluna977@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: uhci: check buffer length to avoid memory overflow
Chen Gang [Wed, 23 Jan 2013 08:13:41 +0000 (16:13 +0800)]
USB: uhci: check buffer length to avoid memory overflow

  for function uhci_sprint_schedule:
    the buffer len is MAX_OUTPUT: 64 * 1024, which may not be enough:
      may loop UHCI_NUMFRAMES times (UHCI_NUMFRAMES is 1024)
      each time of loop may get more than 64 bytes
    so need check the buffer length to avoid memory overflow

  this patch fix it like this:
    at first, make enough room for buffering the exceeding contents
    judge the contents which written whether bigger than buffer length
    if bigger (the exceeding contents will be in the exceeding buffer)
      break current work flow, and return.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agousb: gadget: constify all struct usb_gadget_ops
Felipe Balbi [Thu, 24 Jan 2013 15:58:16 +0000 (17:58 +0200)]
usb: gadget: constify all struct usb_gadget_ops

Add the missing 'const' keyword to all struct
usb_gadget_ops in the gadget framework.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: mv_udc: fix the value of tranceiver
Chao Xie [Thu, 24 Jan 2013 06:38:30 +0000 (01:38 -0500)]
usb: gadget: mv_udc: fix the value of tranceiver

usally we will use udc->tranceiver == NULL or
udc->tranceiver != NULL.
So when failed to get the udc->tranceiver by usb_get_phy(), we
directly set udc->tranceiver to be NULL.
Then the source code will not need macro IS_ERR_OR_NULL() for
udc->tranceiver judgement. It can reduce the line size and make
the judgement simple.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: host: ehci-mv: remove unused variable
Chao Xie [Thu, 24 Jan 2013 06:38:29 +0000 (01:38 -0500)]
usb: host: ehci-mv: remove unused variable

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: otg: mv_otg: use devm_xxx for probe
Chao Xie [Thu, 24 Jan 2013 06:38:28 +0000 (01:38 -0500)]
usb: otg: mv_otg: use devm_xxx for probe

use devm_xxx for otg driver probe. So we do need care about
the resources release in driver remove or failure handling
in driver probe.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: mv_udc: fix the warning of mv_udc_remove
Chao Xie [Thu, 24 Jan 2013 06:38:27 +0000 (01:38 -0500)]
usb: gadget: mv_udc: fix the warning of mv_udc_remove

The __exit_p() will be NULL if MODULE is no defined.
It will cause the warning. Removing __exit_p to remove
the warning.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: mv_udc: use devm_xxx for probe
Chao Xie [Thu, 24 Jan 2013 06:38:26 +0000 (01:38 -0500)]
usb: gadget: mv_udc: use devm_xxx for probe

use devm_xxx for udc driver probe. So we do need care about
the resources release in driver remove or failure handling
in driver probe.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: completely remove ->start/->stop
Felipe Balbi [Thu, 24 Jan 2013 09:00:15 +0000 (11:00 +0200)]
usb: gadget: completely remove ->start/->stop

Those have been deprecated for a long time and
previous patches just converted all remaining
users of those.

Since there are no in-tree users and we don't
want any new users for them, let's obliterate
every piece of code related to those calls.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: s3c2410: convert to udc_start/udc_stop
Felipe Balbi [Thu, 24 Jan 2013 15:20:46 +0000 (17:20 +0200)]
usb: gadget: s3c2410: convert to udc_start/udc_stop

Mechanical change making use of the new (can we
still call it new ?) interface for registering
UDC drivers.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: pxa27x_udc: convert to udc_start/udc_stop
Felipe Balbi [Thu, 24 Jan 2013 15:16:39 +0000 (17:16 +0200)]
usb: gadget: pxa27x_udc: convert to udc_start/udc_stop

Mechanical change making use of the new (can we
still call it new ?) interface for registering
UDC drivers.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: pxa25x_udc: convert to udc_start/udc_stop
Felipe Balbi [Thu, 24 Jan 2013 15:11:44 +0000 (17:11 +0200)]
usb: gadget: pxa25x_udc: convert to udc_start/udc_stop

Mechanical change making use of the new (can we
still call it new ?) interface for registering
UDC drivers.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: pch_udc: convert to udc_start/udc_stop
Felipe Balbi [Thu, 24 Jan 2013 08:55:59 +0000 (10:55 +0200)]
usb: gadget: pch_udc: convert to udc_start/udc_stop

Mechanical change making use of the new (can we
still call it new ?) interface for registering
UDC drivers.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: omap_udc: convert to udc_start/udc_stop
Felipe Balbi [Thu, 24 Jan 2013 08:52:52 +0000 (10:52 +0200)]
usb: gadget: omap_udc: convert to udc_start/udc_stop

Mechanical change making use of the new (can we
still call it new ?) interface for registering
UDC drivers.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: m66592-udc: convert to udc_start/udc_stop
Felipe Balbi [Thu, 24 Jan 2013 08:49:17 +0000 (10:49 +0200)]
usb: gadget: m66592-udc: convert to udc_start/udc_stop

Mechanical change making use of the new (can we
still call it new ?) interface for registering
UDC drivers.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: fsl_udc_core: convert to udc_start/udc_stop
Felipe Balbi [Thu, 24 Jan 2013 08:43:52 +0000 (10:43 +0200)]
usb: gadget: fsl_udc_core: convert to udc_start/udc_stop

Mechanical change making use of the new (can we
still call it new ?) interface for registering
UDC drivers.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: goku_udc: convert to udc_start/udc_stop
Felipe Balbi [Thu, 24 Jan 2013 08:40:21 +0000 (10:40 +0200)]
usb: gadget: goku_udc: convert to udc_start/udc_stop

Mechanical change making use of the new (can we
still call it new ?) interface for registering
UDC drivers.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: fusb300_udc: convert to udc_start/udc_stop
Felipe Balbi [Thu, 24 Jan 2013 08:36:33 +0000 (10:36 +0200)]
usb: gadget: fusb300_udc: convert to udc_start/udc_stop

Mechanical change making use of the new (can we
still call it new ?) interface for registering
UDC drivers.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: amd5536udc: convert to udc_start/udc_stop
Felipe Balbi [Thu, 24 Jan 2013 08:28:39 +0000 (10:28 +0200)]
usb: gadget: amd5536udc: convert to udc_start/udc_stop

Mechanical change making use of the new (can we
still call it new ?) interface for registering
UDC drivers.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: gadget: change HIRD threshold to 12
Felipe Balbi [Thu, 24 Jan 2013 09:56:11 +0000 (11:56 +0200)]
usb: dwc3: gadget: change HIRD threshold to 12

First of all, that 28 value makes no sense as
HIRD threshold is a 4-bit value, second of all
it's causing issues for OMAP5.

Using 12 because commit cbc725b3 (usb: dwc3:
keep default hird threshold value as 4b1100)
had the intention of setting the maximum allowed
value of 0xc.

Also, original code has been wrong forever, so
this should be backported as far back as
possible.

Cc: <stable@vger.kernel.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: mv_udc: use udc_start and udc_stop functions
Chao Xie [Thu, 24 Jan 2013 06:38:25 +0000 (01:38 -0500)]
usb: gadget: mv_udc: use udc_start and udc_stop functions

This patches converts the driver into the new style start/stop
interface. As a result the driver no longer uses the static
global the_conroller variable.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agoUSB: Set usb port's DeviceRemovable according acpi information
Lan Tianyu [Mon, 21 Jan 2013 14:18:00 +0000 (22:18 +0800)]
USB: Set usb port's DeviceRemovable according acpi information

ACPI provide "_PLD" and "_UPC" aml methods to describe usb port
visibility and connectability. This patch is to add usb_hub_adjust_DeviceRemovable()
to adjust usb hub port's DeviceRemovable according ACPI information and invoke it in
the rh_call_control(). When hub descriptor request is issued at first time,
usb port device isn't created and usb port is not bound with acpi. So first
hub descriptor request is not changed based on ACPI information. After usb
port devices being created, call usb_hub_adjust_DeviceRemovable in the hub_configure()
and then set hub port's DeviceRemovable according ACPI information and this also works
for non-root hub.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agodrivers/usb/chipidea/core.c: adjust duplicate test
Julia Lawall [Mon, 21 Jan 2013 13:02:46 +0000 (14:02 +0100)]
drivers/usb/chipidea/core.c: adjust duplicate test

Delete successive tests to the same location.  In this case res has already
been tested for being NULL, and calling devm_request_and_ioremap will not
make it NULL.  On the other hand, devm_request_and_ioremap can return NULL
on failure.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@s exists@
local idexpression y;
expression x,e;
@@

*if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
 { ... when forall
   return ...; }
... when != \(y = e\|y += e\|y -= e\|y |= e\|y &= e\|y++\|y--\|&y\)
    when != \(XT_GETPAGE(...,y)\|WMI_CMD_BUF(...)\)
*if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
 { ... when forall
   return ...; }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agousb: gadget: fix two sparse warnings
Felipe Balbi [Fri, 18 Jan 2013 11:18:44 +0000 (13:18 +0200)]
usb: gadget: fix two sparse warnings

drivers/usb/gadget/u_serial.c:1291:5: sparse: symbol \
'userial_init' was not declared. Should it be static?
drivers/usb/gadget/zero.c:66:25: sparse: symbol \
'gzero_options' was not declared. Should it be static?

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: f_uac2: fix compile warning
Felipe Balbi [Thu, 17 Jan 2013 13:43:32 +0000 (15:43 +0200)]
usb: gadget: f_uac2: fix compile warning

this warning was introduced by previous patches,
fix it.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: f_acm: use usb_gstrings_attach()
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:23 +0000 (21:10 +0100)]
usb: gadget: f_acm: use usb_gstrings_attach()

Use usb_gstrings_attach() to assign strings in f_acm to assign strings
ids.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: composite: introduce usb_gstrings_attach()
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:22 +0000 (21:10 +0100)]
usb: gadget: composite: introduce usb_gstrings_attach()

The USB strings don't (yet) fully work in multiple configs/gadget
environment. The string id is assigned to the descriptor and the struct
usb_strings. We create a copy of the individual descriptor so we don't
clash if we use a function more than once. However, we have only one
struct usb_string for each string.

Currently each function which is used multiple times checks for
"id != 0" and only assigns string ids if it did not happen yet. This
works well if we use the same function multiple times as long as we do
it within the "one" gadget we have. Trouble starts once we use the same
function in a second gadget.

In order to solve this I introduce usb_gstrings_attach(). This function will
crate a copy all structs except for the strings which are not copied.
After the copy it will assign USB ids and attach it to cdev.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: export composite's setup & disconnect function
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:21 +0000 (21:10 +0100)]
usb: gadget: export composite's setup & disconnect function

The configfs can't use all of composite's hooks because ->bind() and
->unbind() has to be done a little differently. ->disconnect() and
->setup() on the hand can be recycled.
This patch exports them both so configfs can use them.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: factor out two helper functions from composite_bind()
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:20 +0000 (21:10 +0100)]
usb: gadget: factor out two helper functions from composite_bind()

This patch factors out two helper functions from composite_bind()
that is composite_dev_prepare() and its counterpart
composite_dev_cleanup().

This will be used by the configfs which requries a slightly different
bind/setup code because part of its configurations (i.e. config
descripts, cdev, …) are setup in advance and VID/PID and so one should
not be overwritten. Also the setup of ep0 endpoint can be delayed until
the UDC is assigned.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: udc-core: introduce UDC binding by name
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:19 +0000 (21:10 +0100)]
usb: gadget: udc-core: introduce UDC binding by name

This patch adds udc_attach_driver() which allows to bind an UDC which is
specified by name to a driver. The name of available UDCs can be
obtained from /sys/class/udc. This interface is intended for configfs
interface.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: add a forward pointer from usb_function to its "instance"
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:15 +0000 (21:10 +0100)]
usb: gadget: add a forward pointer from usb_function to its "instance"

We can have multiple usb_functions which origin is the same "instance".
Within one USB configuration there should be only one function of an
instance. This back pointer helps configfs to recoginze to which
instance a given usb_function belongs.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: multi: use function framework for ACM
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:10 +0000 (21:10 +0100)]
usb: gadget: multi: use function framework for ACM

This patch converts the acm_ms gadget to make use of the function
framework to request the ACM function.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: cdc2: use function framework for ACM
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:09 +0000 (21:10 +0100)]
usb: gadget: cdc2: use function framework for ACM

This patch converts the acm_ms gadget to make use of the function
framework to request the ACM function.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: acm_ms: use function framework for ACM
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:08 +0000 (21:10 +0100)]
usb: gadget: acm_ms: use function framework for ACM

This patch converts the acm_ms gadget to make use of the function
framework to request the ACM function.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: f_acm: convert to new function interface with backwards compatibility
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:07 +0000 (21:10 +0100)]
usb: gadget: f_acm: convert to new function interface with backwards compatibility

This patch converts f_acm into a module which uses the new function
interface. It also converts one of its users that is g_serial to make
use of it. The other users of it (g_nokia for instance) are still using
the old include file system and should not notice the change at all. So
they can be converter later independently.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: allocate & giveback serial ports instead hard code them
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:06 +0000 (21:10 +0100)]
usb: gadget: allocate & giveback serial ports instead hard code them

This patch removes gserial_setup() and gserial_cleanup() and adds
gserial_alloc_line() and gserial_free_line() to replace them.

The initial setup of u_serial happens now on module load time. A
maximum of four TTY ports can be requested which is the current limit.
In theory we could extend this limit, the hard limit is the number of
available endpoints.
alloc_tty_driver() is now called at module init time with the max
available ports. The per-line footprint here is on 32bit is 3 * size of
pointer + 60 bytes (for cdevs).
The remaining memory (struct gs_port) is allocated once a port is
requested.

With this change it is possible to load g_multi and g_serial at the same
time. GS0 receives the module that is loaded first, GS1 is received by
the next module and so on. With the configfs interface the port number
can be exported and the device node is more predictable. Nothing changes
for g_serial and friends as long as one module is used.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: composite: add usb_remove_function()
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:05 +0000 (21:10 +0100)]
usb: gadget: composite: add usb_remove_function()

This will be used to remove a single function from a given config. Right
now "ignore" that an error at ->bind() time and cleanup later during
composite_unbind() / remove_config().

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: u_serial: convert into a module
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:04 +0000 (21:10 +0100)]
usb: gadget: u_serial: convert into a module

Every user of u_serial has now to select the U_SERIAL symbol instead of
including the file.
There is one limition with this: ports and and gs_tty_driver are global
variables in u_serial. Since all users share them, there can be only one
user loaded at a time i.e. either g_serial or g_nokia.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: g_serial: split the three possible functions into three bind functions
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:03 +0000 (21:10 +0100)]
usb: gadget: g_serial: split the three possible functions into three bind functions

This patch factors out the three possible functions into three possible
bind functions which are passed as an argument to usb_add_config(). This
will ease the step by step converting of the individual functions to the
new function registration method.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: f_acm: remove empty function
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:02 +0000 (21:10 +0100)]
usb: gadget: f_acm: remove empty function

The significant part of this function was removed in 90f7976 ("USB:
Remove unsupported usb gadget drivers"). I would move this to function
bind time but I don't see the point in moving an empty function.
Therefore bye bye.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: convert source sink and loopback to new function interface
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:01 +0000 (21:10 +0100)]
usb: gadget: convert source sink and loopback to new function interface

This patch converts the f_sourcesink and f_loopback file to the USB-function
module. Both functions shares a few common utility functions which are
currently implemented in g_zero.c itself. This patch moves the common
code into the sourcesink file and creates one module out of the the two
functions (source sink and loop back).
The g_zero gadget is function specific to source sink and loop back to
set a few options. This Symbol dependency enforces a modul load right
now.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: add some infracture to register/unregister functions
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:10:00 +0000 (21:10 +0100)]
usb: gadget: add some infracture to register/unregister functions

This patch provides an infrastructure to register & unregister a USB
function. This allows to turn a function into a module and avoid the
'#include "f_.*.c"' magic and we get a clear API / cut between the bare
gadget and its functions.
The concept is simple:
Each function defines the DECLARE_USB_FUNCTION_INIT macro whith an unique
name of the function and two allocation functions.
- one to create an "instance". The instance holds the current configuration
  set. In case there are two usb_configudations with one function there will
  be one instance and two usb_functions
- one to create an "function" from the instance.

The name of the instance is used to automaticaly load the module if it the
instance is not yet available.
The usb_function callbacks are slightly modified and extended:
- usb_get_function()
  creates a struct usb_function inclunding all pointers (bind,
  unbind,…). It uses the "instance" to map its configuration. So we can
  have _two_ struct usb_function, one for each usb_configuration.
- ->unbind()
  Since the struct usb_function was not allocated in ->bind() it should
  not kfree()d here. This function should only reverse what happens in
  ->bind() that is request cleanup and the cleanup of allocated
  descriptors.
- ->free_func()
  a simple kfree() of the struct usb_function

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: move loopback's config descriptor out of f_loopback
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:09:59 +0000 (21:09 +0100)]
usb: gadget: move loopback's config descriptor out of f_loopback

f_loopback should only include the bare function but it also includes
the config descriptor. This patch moves the config descriptor into
zero.c, the only user of this function.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: move source sink's config descriptor out of f_sourcesink
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:09:58 +0000 (21:09 +0100)]
usb: gadget: move source sink's config descriptor out of f_sourcesink

f_sourcesink should only include the bare function but it also includes
the config descriptor. This patch moves the config descriptor into
zero.c, the only user of this function.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: provide a wrapper around SourceSink's setup function
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:09:57 +0000 (21:09 +0100)]
usb: gadget: provide a wrapper around SourceSink's setup function

The setup request can be sent to an interface/endpoint or to the device
itself. If it is sent to an interface / endpoint then we forward it to
the function that is mapped to that interface / endpoint.
If the device is the target of the setup request then we forward it to the
->setup() callback of the currently active configuration.
In case of the sourcesink function the requests are function specific
but are sent to the device.
This patch introduces a setup wrapper at configuration level which
forwards the request to the function. By using this wrapper we can keep
the function specific code within the function file and we need just a
hint at config level to forward the request.
The here introduced global variable will be moved into the gadget (which
combines the two functions) in a later patch.
SourceSink is currently the only function using ->setup() at config level.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: remove u32 castings of address passed to readl()
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:09:56 +0000 (21:09 +0100)]
usb: gadget: remove u32 castings of address passed to readl()

Removes a couple of:
|drivers/usb/gadget/s3c-hsudc.c: In function 's3c_hsudc_epin_intr':
|drivers/usb/gadget/s3c-hsudc.c:438:2: warning: passing argument 1 of '__raw_readl' makes pointer from integer without a cast
|arch/arm/include/asm/io.h:104:19: note: expected 'const volatile void *' but argument is of type 'unsigned int'

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: composite: don't call driver's unbind() if bind() failed
Sebastian Andrzej Siewior [Sun, 23 Dec 2012 20:09:55 +0000 (21:09 +0100)]
usb: gadget: composite: don't call driver's unbind() if bind() failed

Lets assume nokia_bind() starts with "return -EINVAL". After loading the
gadget we end up with:

|udc dummy_udc.0: registering UDC driver [g_nokia]
|BUG: unable to handle kernel NULL pointer dereference at 00000040
|IP: [<c11f9555>] __list_add+0x25/0xf0
|Call Trace:
| [<c12d4e21>] rollback_registered+0x21/0x40
| [<c12d513f>] unregister_netdevice_queue+0x4f/0xa0
| [<c12d5259>] unregister_netdev+0x19/0x30
| [<f81335b2>] gphonet_cleanup+0x32/0x50 [g_nokia]
| [<f8133f1c>] nokia_unbind+0x1c/0x2a [g_nokia]
| [<f802509f>] __composite_unbind.constprop.10+0x4f/0xb0 [libcomposite]
| [<f80255be>] composite_bind+0x1ae/0x230 [libcomposite]
| [<c129e576>] usb_gadget_probe_driver+0xc6/0x1b0
| [<f8024aba>] usb_composite_probe+0x7a/0xa0 [libcomposite]

That is crash from nokia_unbind() invoked via nokia_bind(). This crash
will look different we if make it until usb_string_ids_tab() before we
enter an error condition in the probe function.
nokia_bind_config() tries to clean up which is IMHO the right thing to
do. Leaving things as-is and hoping that its unbind() will clean it up
is kinda backwards. Especially since the bind function never succeeded so
it can't know how much it needs to clean up.
This fixes the behaviour by not calling the driver's unbind function if
its bind function failed.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agoUSB: storage: avoid scanning other targets for single target device
Ming Lei [Sat, 19 Jan 2013 11:30:30 +0000 (19:30 +0800)]
USB: storage: avoid scanning other targets for single target device

This patch sets scsi_host->max_id as 1 if the device's quirk
flag of US_FL_SCM_MULT_TARG isn't set, because there are only 6
mass storage devices marked as mutiple targets from unusual_devs.h.

This patch is a small optimization about scanning targets, and
avoid scanning other 7 non-existed targets for single target
device.

Signed-off-by: Ming Lei <ming.lei@canonical.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agousb: Create link files between child device and usb port device.
Lan Tianyu [Sat, 19 Jan 2013 17:53:33 +0000 (01:53 +0800)]
usb: Create link files between child device and usb port device.

To show the relationship between usb port and child device,
add link file "port" under usb device's sysfs directoy and
"device" under usb port device's sysfs directory. They are linked
to each other.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agousb: Add "portX/connect_type" attribute to expose usb port's connect type
Lan Tianyu [Sat, 19 Jan 2013 17:53:32 +0000 (01:53 +0800)]
usb: Add "portX/connect_type" attribute to expose usb port's connect type

Some platforms provide usb port connect types through ACPI. This
patch is to add this new attribute to expose these information
to user space.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agousb: fix compilation error and warning of driver/usb/core/port.c on arm and blackfin
Lan Tianyu [Sat, 19 Jan 2013 14:30:19 +0000 (22:30 +0800)]
usb: fix compilation error and warning of driver/usb/core/port.c on arm and blackfin

This patch is to fix compilation error and warning on the arm and blackfin.
Add linux/slab.h head file to driver/usb/core/port.c. These are reported
from 0-DAY kernel build testing backend.

head:   6e30d7cba992d626c9d16b3873a7b90c700d0e95
commit: 6e30d7cba992d626c9d16b3873a7b90c700d0e95 [26/26] usb: Add driver/usb/core/(port.c,hub.h) files
config: make ARCH=arm at91_dt_defconfig

All error/warnings:

   drivers/usb/core/port.c: In function 'usb_port_device_release':
>> drivers/usb/core/port.c:25:2: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration]
   drivers/usb/core/port.c: In function 'usb_hub_create_port_device':
>> drivers/usb/core/port.c:38:2: error: implicit declaration of function 'kzalloc' [-Werror=implicit-function-declaration]
>> drivers/usb/core/port.c:38:40: error: 'GFP_KERNEL' undeclared (first use in this function)
   drivers/usb/core/port.c:38:40: note: each undeclared identifier is reported only once for each function it appears in
   cc1: some warnings being treated as errors

head:   6e30d7cba992d626c9d16b3873a7b90c700d0e95
commit: 6e30d7cba992d626c9d16b3873a7b90c700d0e95 [26/26] usb: Add driver/usb/core/(port.c,hub.h) files
config: make ARCH=blackfin BF526-EZBRD_defconfig

All warnings:

   drivers/usb/core/port.c: In function 'usb_port_device_release':
   drivers/usb/core/port.c:25:2: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration]
   drivers/usb/core/port.c: In function 'usb_hub_create_port_device':
   drivers/usb/core/port.c:38:2: error: implicit declaration of function 'kzalloc' [-Werror=implicit-function-declaration]
>> drivers/usb/core/port.c:38:11: warning: assignment makes pointer from integer without a cast [enabled by default]
   cc1: some warnings being treated as errors

Reported-by: Fengguang Wu <wfg@linux.intel.com>
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agousb: Add driver/usb/core/(port.c,hub.h) files
Lan Tianyu [Fri, 11 Jan 2013 12:10:38 +0000 (20:10 +0800)]
usb: Add driver/usb/core/(port.c,hub.h) files

This patch is to create driver/usb/core/(port.c,hub.h) files and move usb
port related code into port.c.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: c67x00-ll-hpi.c: signedness bug in ll_recv_msg()
Dan Carpenter [Fri, 18 Jan 2013 07:41:38 +0000 (10:41 +0300)]
USB: c67x00-ll-hpi.c: signedness bug in ll_recv_msg()

The callers expect this function to return zero on success or -EIO if it
times out.  The type should be int instead of unsigned short.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: io_ti: kill custom closing_wait implementation
Johan Hovold [Mon, 14 Jan 2013 15:52:58 +0000 (16:52 +0100)]
USB: io_ti: kill custom closing_wait implementation

Kill custom closing_wait implementation and let the tty layer handle it
instead.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: io_ti: query hardware-buffer status in chars_in_buffer
Johan Hovold [Mon, 14 Jan 2013 15:52:57 +0000 (16:52 +0100)]
USB: io_ti: query hardware-buffer status in chars_in_buffer

Query hardware-buffer status in chars_in_buffer should the write fifo be
empty.

This is needed to make the tty layer wait for hardware buffers to drain
on close.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: serial: grab disconnect mutex in chars_in_buffer
Johan Hovold [Mon, 14 Jan 2013 15:52:56 +0000 (16:52 +0100)]
USB: serial: grab disconnect mutex in chars_in_buffer

Grab disconnect mutex in chars_in_buffer before checking disconnected
flag or calling driver specific function.

This allows subdrivers to query any hardware buffer status without
having to handle the locking themselves.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: io_ti: use tty-port drain delay
Johan Hovold [Mon, 14 Jan 2013 15:52:55 +0000 (16:52 +0100)]
USB: io_ti: use tty-port drain delay

Use tty-port drain delay rather than custom implementation in
chase_port.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: io_ti: move write-fifo flushing to close
Johan Hovold [Mon, 14 Jan 2013 15:52:54 +0000 (16:52 +0100)]
USB: io_ti: move write-fifo flushing to close

Move write-fifo flushing from chase_port to close where it belongs.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoMerge 3.8-rc4 into usb-next
Greg Kroah-Hartman [Fri, 18 Jan 2013 17:17:17 +0000 (09:17 -0800)]
Merge 3.8-rc4 into usb-next

This pulls in all of the -rc4 fixes into usb-next to sync things up.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agousb: dwc3: remove dwc3 dependency on host AND gadget.
Vivek Gautam [Tue, 15 Jan 2013 10:39:21 +0000 (16:09 +0530)]
usb: dwc3: remove dwc3 dependency on host AND gadget.

DWC3 controller curretly depends on USB && USB_GADGET.
Some hardware may like to use only host feature on dwc3,
or only gadget feature.

So, removing this dependency of USB_DWC3 on USB and USB_GADGET.
Adding the mode of operaiton of DWC3 also here
HOST/GADGET/DUAL_ROLE based on which features are enabled.

[ balbi@ti.com :
. make sure we have default modes for all possible Kernel
configurations.
. Remove the config -> menuconfig change as it's unnecessary
. switch over to IS_ENABLED() ]

CC: Doug Anderson <dianders@chromium.org>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: gadget: req->queued must be forced to false in cleanup
Pratyush Anand [Mon, 14 Jan 2013 10:29:38 +0000 (15:59 +0530)]
usb: dwc3: gadget: req->queued must be forced to false in cleanup

I am not sure, why I found it during SG debugging. But, I noticed that
even when req_queued list was empty, there were some request in
request_list having queued flag true. If I run test second time, it
first removes all request from request_list and hence busy_slot was
wrongly incremented.

Cc: <stable@vger.kernel.org>
Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: gadget: fix scatter gather implementation
Pratyush Anand [Mon, 14 Jan 2013 10:29:37 +0000 (15:59 +0530)]
usb: dwc3: gadget: fix scatter gather implementation

To work with scatter gather properly, fixes have been done in number of
functions. I will explain requirement of each fixes one by one.

start_slot: used to retrieve all request of SG during cleanup

dwc3_gadget_giveback: We need to skip link TRB if it was one of the
intermediate TRB of SG.

dwc3_prepare_one_trb: We need to track all submitted TRBs during
cleanup. Since, all TRBs would be serially allocated, so we can just
keep starting slot info and we can always find rest of them. We need to
pass sg node number, so that we cab appropriately program ISOC_FIRST/ISOC,
Chain etc.

dwc3_prepare_trbs: last_one should be set when it is last node
of SG as well as last node of request_list.

__dwc3_cleanup_done_trbs: It has been prepared after re-factorization of
dwc3_cleanup_done_reqs. It is called for each TRB of SG.

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: gadget: no need to pass params in case of UPDATE_TRANSFER
Pratyush Anand [Mon, 14 Jan 2013 10:29:36 +0000 (15:59 +0530)]
usb: dwc3: gadget: no need to pass params in case of UPDATE_TRANSFER

UPDATE_TRANSFER does not need any parameters. So, no need to prepare it.

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: gadget: fix skip LINK_TRB on ISOC
Pratyush Anand [Mon, 14 Jan 2013 10:29:35 +0000 (15:59 +0530)]
usb: dwc3: gadget: fix skip LINK_TRB on ISOC

When we reach to link trb, we just need to increase free_slot and then
calculate TRB. Return is not correct, as it will cause wrong TRB DMA
address to fetch in case of update transfer.

Cc: <stable@vger.kernel.org>
Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: gadget: fix isoc END TRANSFER Condition
Pratyush Anand [Mon, 14 Jan 2013 10:29:34 +0000 (15:59 +0530)]
usb: dwc3: gadget: fix isoc END TRANSFER Condition

There were still some corner cases where isoc transfer was not able to
restart, specially when missed isoc does not happen , and in fact gadget does
not queue any new request during giveback.

Cleanup function calls giveback first, which provides a way to queue
another request to gadget. But gadget did not had any data. So , it did
not call ep_queue. To twist it further, gadget did not queue till
cleanup for last queued TRB is called. If we ever reach this scenario,
we must call END TRANSFER, so that we receive a new  xfernotready with
information about current microframe number.

Also insure that there is no request submitted to core when issuing END
TRANSFER.

Cc: <stable@vger.kernel.org> # v3.8
Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: gadget: correct return from ep_queue
Pratyush Anand [Mon, 14 Jan 2013 10:29:33 +0000 (15:59 +0530)]
usb: dwc3: gadget: correct return from ep_queue

Its better to return from each if condition as they are mutually
exclusive.

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: gadget: fix missed isoc
Pratyush Anand [Mon, 14 Jan 2013 10:29:32 +0000 (15:59 +0530)]
usb: dwc3: gadget: fix missed isoc

There are two reasons to generate missed isoc.

1. when the host does not poll for all the data.
2. because of application-side delays that prevent all the data from
being transferred in programmed microframe.

Current code was able to handle first case only.  This patch handles
scenario 2 as well.Scenario 2 sometime may occur with complex gadget
application, however it can be easily reproduced for testing purpose as
follows:

a. use isoc binterval as 1 in f_sourcesink.
b. use pattern=0
c. introduce a delay of 150us deliberately in source_sink_complete, so
that after few frames it lands into scenario 2.
d. now run testusb 16 (isoc in  test). You will notice that if this
patch is not applied then isoc transfer is not able to recover after
first missed.

Current patch's approach is as under:

If missed isoc occurs and there is no request queued then issue END
TRANSFER, so that core generates next xfernotready and we will issue a
fresh START TRANSFER.
If there are still queued request then wait, do not issue either END or
UPDATE TRANSFER, just attach next request in request_list during giveback.
If any future queued request is successfully transferred then we will issue
UPDATE TRANSFER for all request in the request_list.

Cc: <stable@vger.kernel.org> # v3.6 v3.7 v3.8
Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: Enable usb2 LPM only when connected as usb2.0
Pratyush Anand [Mon, 14 Jan 2013 10:29:31 +0000 (15:59 +0530)]
usb: dwc3: Enable usb2 LPM only when connected as usb2.0

Synopsys says:
The HIRD Threshold field must be set to ‘0’ when the device core is
operating in super speed mode.

This patch implements above statement.

Cc: <stable@vger.kernel.org> # v3.6 v3.7 v3.8
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: debugfs: convert our regdump to use regsets
Felipe Balbi [Fri, 18 Jan 2013 08:21:34 +0000 (10:21 +0200)]
usb: dwc3: debugfs: convert our regdump to use regsets

regset is a generic implementation of regdump
utility through debugfs.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: gadget: don't redefine 'ret'
Felipe Balbi [Thu, 13 Dec 2012 14:12:00 +0000 (16:12 +0200)]
usb: dwc3: gadget: don't redefine 'ret'

we have an extra 'ret' variable shadowing a previous
definition. Remove it.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: exynos: use devm_ functions
Jingoo Han [Tue, 13 Nov 2012 02:20:49 +0000 (11:20 +0900)]
usb: dwc3: exynos: use devm_ functions

The devm_ functions allocate memory that is released when a driver
detaches. This makes the code smaller and a bit simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: decrease event buffer size
Felipe Balbi [Fri, 7 Dec 2012 19:42:03 +0000 (21:42 +0200)]
usb: dwc3: decrease event buffer size

Currently we're allocating an entire page to
serve as our event buffer. Provided our events
are 4 bytes long, it's very unlikely we will
even trigger 1k events at once.

Even in the worst case scenario where every
endpoint triggers one event and we still have
a couple of error events, that would still
be less than 40 events.

In order to cope with future versions of the
IP which could (or could not) increase the
amount of possible events to trigger
simultaneously, we're using an arbitrary size
of 64 events for our event buffer.

We're saving 3840 bytes by doing so.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agoLinux 3.8-rc4 v3.8-rc4
Linus Torvalds [Fri, 18 Jan 2013 03:25:45 +0000 (19:25 -0800)]
Linux 3.8-rc4

11 years agoUSB: misc: fixup smatch WARNING
Dongjin Kim [Sat, 12 Jan 2013 11:54:33 +0000 (20:54 +0900)]
USB: misc: fixup smatch WARNING

This patch fixes the warning,

6a099c63650e50ebf7d1259b859a3d230aec4207 [4/10] USB: misc: Add USB3503 High-Speed Hub Controller

drivers/usb/misc/usb3503.c:238 usb3503_probe() error: we previously assumed 'pdata' could be null (see line 196)

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agousb: misc: usb3503_probe() can be static
Fengguang Wu [Sat, 12 Jan 2013 05:15:09 +0000 (13:15 +0800)]
usb: misc: usb3503_probe() can be static

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Linus Torvalds [Thu, 17 Jan 2013 16:56:30 +0000 (08:56 -0800)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull more s390 patches from Martin Schwidefsky:
 "A couple of bug fixes: one of the transparent huge page primitives is
  broken, the sched_clock function overflows after 417 days, the XFS
  module has grown too large for -fpic and the new pci code has broken
  normal channel subsystem notifications."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
  s390/chsc: fix SEI usage
  s390/time: fix sched_clock() overflow
  s390: use -fPIC for module compile
  s390/mm: fix pmd_pfn() for thp

11 years agousb: musb: omap2430: fix wrong devm_kzalloc() result check
Sergei Shtylyov [Tue, 8 Jan 2013 19:11:14 +0000 (22:11 +0300)]
usb: musb: omap2430: fix wrong devm_kzalloc() result check

Commit 00a0b1d58af873d842580dcac55f3b156c3a4077 (usb: musb: omap: Add device
tree support for omap musb glue) assigns result of devm_kzalloc() call to
the 'config' variable but then checks for NULL the 'data' variable (already
checked after previous call). Thus we risk a kernel oops further when data
pointed by 'config' is written to by subsequent of_property_read_u32() calls
iff the allocation happens to fail...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: fix dependency on transceiver driver
Ming Lei [Fri, 4 Jan 2013 15:13:58 +0000 (23:13 +0800)]
usb: musb: fix dependency on transceiver driver

This patch let glue driver return -EPROBE_DEFER if the transceiver
is not readly, so we can support defer probe on musb to fix the
below error on 3.7-rc5 if transceiver drivers are built as module:

[   19.052490] unable to find transceiver of type USB2 PHY
[   19.072052] HS USB OTG: no transceiver configured
[   19.076995] musb-hdrc musb-hdrc.0.auto: musb_init_controller failed with status -19
[   19.089355] musb-hdrc: probe of musb-hdrc.0.auto rejects match -19
[   19.096771] driver: 'musb-omap2430': driver_bound: bound to device 'musb-omap2430'
[   19.105194] bus: 'platform': really_probe: bound device musb-omap2430 to driver musb-omap2430
[   19.174407] bus: 'platform': add driver twl4030_usb
[   19.179656] bus: 'platform': driver_probe_device: matched device twl4030_usb with driver twl4030_usb
[   19.202270] bus: 'platform': really_probe: probing driver twl4030_usb with device twl4030_usb
[   19.214172] twl4030_usb twl4030_usb: HW_CONDITIONS 0xc0/192; link 3
[   19.239624] musb-omap2430 musb-omap2430: musb core is not yet ready
[   19.246765] twl4030_usb twl4030_usb: Initialized TWL4030 USB module
[   19.254516] driver: 'twl4030_usb': driver_bound: bound to device 'twl4030_usb'
[   19.263580] bus: 'platform': really_probe: bound device twl4030_usb to driver twl4030_usb

Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Cc: <stable@vger.kernel.org> v3.8
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: core: fix failure path
Ming Lei [Fri, 4 Jan 2013 15:13:06 +0000 (23:13 +0800)]
usb: musb: core: fix failure path

In the fail1~fail5 failure path, pm_runtime_disable() should
be called to avoid 'Unbalanced pm_runtime_enable' error in
next probe() which may be triggered by defer probe or next
'modprobe musb_hdrc'.

Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Cc: <stable@vger.kernel.org> v3.8
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: Double buffering issues in host mode TX
supriya karanth [Fri, 4 Jan 2013 11:40:33 +0000 (17:10 +0530)]
usb: musb: Double buffering issues in host mode TX

Whenever an URB is programmed for transfer, the TXFIFO
is flushed. This results in valid packets of the
previous transfer to get flushed when double buffering
is enabled (The MUSB_TXCSR_FIFONOTEMPTY bit in TXCSR
is set indicating that a packet in the FIFO is yet to be sent)
For ex:- In Host mode Audio, noise is heard in the headset
when double buffering is enabled on the ISO endpoint.
The fifo flush is removed for double buffering case.
The fifo is now flushed only in cases of error or when
aborting a transfer.

Also, In Host MSC case, data toggle errors are seen when double
buffering is enabled on the bulk endpoint. Whenever an URB is
programmed for transfer, the data toggle is set manually
resulting in data toggle errors on the bus. Leave the data
toggle handling upto the hardware in the double buffering case.

Signed-off-by: supriya karanth <supriya.karanth@stericsson.com>
Signed-off-by: Praveena NADAHALLY <praveen.nadahally@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: omap2430: kill redundant assignments in omap2430_probe()
Sergei Shtylyov [Tue, 8 Jan 2013 19:13:40 +0000 (22:13 +0300)]
usb: musb: omap2430: kill redundant assignments in omap2430_probe()

Commit 00a0b1d58af873d842580dcac55f3b156c3a4077 (usb: musb: omap: Add device
tree support for omap musb glue) added assignments of the 'ret' variable to
-ENOMEM on *some* error paths of the calls to devm_kzalloc(), while that
variable was already pre-initialized for to that value, so these assignments
were completely redundant. Kill them, fixing overindented string, while at it.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: ux500: use clk_prepare_enable and clk_disable_unprepare
Fabio Baltieri [Mon, 7 Jan 2013 16:47:41 +0000 (17:47 +0100)]
usb: musb: ux500: use clk_prepare_enable and clk_disable_unprepare

This patch converts the module to use clk_prepare_enable and
clk_disable_unprepare variants as required by common clock framework.

Without this the system crash during probe function.

Cc: <stable@vger.kernel.org> # v3.7 v3.8
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>