cascardo/linux.git
11 years agousb: add driver for xsens motion trackers
Frans Klaver [Fri, 25 Jan 2013 16:05:44 +0000 (17:05 +0100)]
usb: add driver for xsens motion trackers

Signed-off-by: Frans Klaver <frans.klaver@xsens.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: misc: usb3503: Fix compiler warning
Dongjin Kim [Fri, 25 Jan 2013 16:53:03 +0000 (01:53 +0900)]
USB: misc: usb3503: Fix compiler warning

This patch fixes the compiler warning of uninitialized variable.

drivers/usb/misc/usb3503.c: In function ‘usb3503_probe’:
drivers/usb/misc/usb3503.c:215:13: warning: ‘mode’ may be used uninitialized
in this function [-Wuninitialized]

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoMerge tag 'xceiv-for-v3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Fri, 25 Jan 2013 17:09:46 +0000 (09:09 -0800)]
Merge tag 'xceiv-for-v3.9' of git://git./linux/kernel/git/balbi/usb into usb-next

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

Two new PHY drivers coming here: one for Samsung,
one for OMAP. Both architectures are adding USB3
support to mainline kernel.

The PHY layer now allows us to have mulitple PHYs
of the same type, which is necessary for platforms
which provide more than one USB peripheral port.

There's also a few cleanups here: removal of __dev*
annotations, conversion of a cast to to_delayed_work(),
and mxs-phy learns about ->set_suspend.

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./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./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./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: add dt support for dwc3 core
Kishon Vijay Abraham I [Fri, 25 Jan 2013 11:06:53 +0000 (16:36 +0530)]
usb: dwc3: core: add dt support for dwc3 core

Added dt support for dwc3 core and update the documentation with
device tree binding information. Getting a PHY is now done using
devm_usb_get_phy_by_phandle() for dt boot.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: phy: omap-usb2: enable 960Mhz clock for omap5
Kishon Vijay Abraham I [Fri, 25 Jan 2013 02:51:49 +0000 (08:21 +0530)]
usb: phy: omap-usb2: enable 960Mhz clock for omap5

"usb_otg_ss_refclk960m" is needed for usb2 phy present in omap5. For
omap4, the clk_get of this clock will fail since it does not have this
clock.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: omap: get phy by phandle for dt boot
Kishon Vijay Abraham I [Fri, 25 Jan 2013 02:33:26 +0000 (08:03 +0530)]
usb: musb: omap: get phy by phandle for dt boot

The OMAP glue has been modified to get PHY by phandle
for dt boot.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: omap: make use of the new PHY lib APIs
Kishon Vijay Abraham I [Fri, 25 Jan 2013 02:33:24 +0000 (08:03 +0530)]
usb: musb: omap: make use of the new PHY lib APIs

New PHY lib APIs like usb_add_phy_dev() and devm_usb_get_phy_dev() are
used in MUSB (OMAP), in order to make use of the binding information
provided in the board file (of OMAP platforms).

All the platforms should be modified similar to this to add and get the
PHY.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: phy: add a new driver for usb3 phy
Kishon Vijay Abraham I [Fri, 25 Jan 2013 02:51:48 +0000 (08:21 +0530)]
usb: phy: add a new driver for usb3 phy

Added a driver for usb3 phy that handles the interaction between usb phy
device and dwc3 controller.

This also includes device tree support for usb3 phy driver and
the documentation with device tree binding information is updated.

Currently writing to control module register is taken care in this
driver which will be removed once the control module driver is in place.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: start using the control module driver
Kishon Vijay Abraham I [Fri, 25 Jan 2013 10:24:00 +0000 (15:54 +0530)]
usb: start using the control module driver

Start using the control module driver for powering on the PHY and for
writing to the mailbox instead of writing to the control module
registers on their own.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: phy: add a new driver for usb part of control module
Kishon Vijay Abraham I [Fri, 25 Jan 2013 10:23:57 +0000 (15:53 +0530)]
usb: phy: add a new driver for usb part of control module

Added a new driver for the usb part of control module. This has an API
to power on the USB2 phy and an API to write to the mailbox depending on
whether MUSB has to act in host mode or in device mode.

Writing to control module registers for doing the above task which was
previously done in omap glue and in omap-usb2 phy will be removed.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: otg: add device tree support to otg library
Kishon Vijay Abraham I [Fri, 25 Jan 2013 02:33:25 +0000 (08:03 +0530)]
usb: otg: add device tree support to otg library

Added an API devm_usb_get_phy_by_phandle(), to get usb phy by passing a
device node phandle value. This function will return a pointer to
the phy on success, -EPROBE_DEFER if there is a device_node for the phandle,
but the phy has not been added, or a ERR_PTR() otherwise.

Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: otg: utils: add facilities in phy lib to support multiple PHYs of same type
Kishon Vijay Abraham I [Fri, 25 Jan 2013 02:33:22 +0000 (08:03 +0530)]
usb: otg: utils: add facilities in phy lib to support multiple PHYs of same type

In order to add support for multipe PHY's of the same type, new API's
for adding PHY and getting PHY has been added. Now the binding
information for the PHY and controller should be done in platform file
using usb_bind_phy API. And for getting a PHY, the device pointer of the
USB controller and an index should be passed. Based on the binding
information that is added in the platform file, usb_get_phy_dev will return the
appropriate PHY.
Already existing API's to add and get phy by type is not removed. These
API's are deprecated and will be removed once all the platforms start to
use the new API.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: otg: add an api to bind the usb controller and phy
Kishon Vijay Abraham I [Fri, 25 Jan 2013 02:33:21 +0000 (08:03 +0530)]
usb: otg: add an api to bind the usb controller and phy

In order to support platforms which has multiple PHY's (of same type) and
which has multiple USB controllers, a new design is adopted wherin the binding
information (between the PHY and the USB controller) should be passed to the
PHY library from platform specific file (board file).
So added a new API to pass the binding information.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.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: phy: samsung: Remove __devinit, __devexit_p and __exit annotations
Vivek Gautam [Mon, 21 Jan 2013 14:00:12 +0000 (19:30 +0530)]
usb: phy: samsung: Remove __devinit, __devexit_p and __exit annotations

Dropping __devinit, __devexit_p, __exit annotations since they are
nop and no longer supported.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agoUSB: ohci-exynos: Add phy driver support
Vivek Gautam [Tue, 22 Jan 2013 13:00:43 +0000 (18:30 +0530)]
USB: ohci-exynos: Add phy driver support

Adding the phy-driver to ohci-exynos. Keeping the platform data
for continuing the smooth operation for boards which still uses it

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agoUSB: ehci-s5p: Add phy driver support
Vivek Gautam [Tue, 22 Jan 2013 13:00:42 +0000 (18:30 +0530)]
USB: ehci-s5p: Add phy driver support

Adding the phy driver to ehci-s5p. Keeping the platform data
for continuing the smooth operation for boards which still uses it

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: phy: samsung: Add host phy support to samsung-phy driver
Vivek Gautam [Tue, 22 Jan 2013 13:00:41 +0000 (18:30 +0530)]
usb: phy: samsung: Add host phy support to samsung-phy driver

This patch adds host phy support to samsung-usbphy driver and
further adds support for samsung's exynos5250 usb-phy.

Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agoARM: EXYNOS: Update & move usb-phy types to generic include layer
Vivek Gautam [Tue, 22 Jan 2013 13:00:40 +0000 (18:30 +0530)]
ARM: EXYNOS: Update & move usb-phy types to generic include layer

Updating the names of usb-phy types to more generic names:
USB_PHY_TYPE_DEIVCE & USB_PHY_TYPE_HOST; and further update
its dependencies.

Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.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: phy: samsung: Add support to set pmu isolation
Vivek Gautam [Tue, 15 Jan 2013 06:10:25 +0000 (11:40 +0530)]
usb: phy: samsung: Add support to set pmu isolation

Adding support to parse device node data in order to get
required properties to set pmu isolation for usb-phy.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: phy: mv-otg: use to_delayed_work instead of cast
Cesar Eduardo Barros [Tue, 4 Dec 2012 22:21:12 +0000 (20:21 -0200)]
usb: phy: mv-otg: use to_delayed_work instead of cast

Directly casting a work_struct pointer to a delayed_work is risky if the
work member of struct delayed_work is ever moved from being the first
member.

Instead, use the inline function to_delayed_work(), which does the same
cast in a safer way (using container_of).

Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: phy: s3c-hsotg: adding phy driver support
Praveen Paneri [Wed, 14 Nov 2012 10:27:16 +0000 (15:57 +0530)]
usb: phy: s3c-hsotg: adding phy driver support

Adding the transceiver to hsotg driver. Keeping the platform data
for continuing the smooth operation for boards which still uses it

Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: phy: samsung: Introducing usb phy driver for hsotg
Praveen Paneri [Fri, 23 Nov 2012 10:33:06 +0000 (16:03 +0530)]
usb: phy: samsung: Introducing usb phy driver for hsotg

This driver uses usb_phy interface to interact with s3c-hsotg. Supports
phy_init and phy_shutdown functions to enable/disable usb phy. Support
will be extended to host controllers and more Samsung SoCs.

Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: phy: mxs-phy: add set_suspend API
Peter Chen [Thu, 10 Jan 2013 08:35:53 +0000 (16:35 +0800)]
usb: phy: mxs-phy: add set_suspend API

It needs to call set_suspend during USB suspend/resume

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>