Commit Graph

8700 Commits

Author SHA1 Message Date
Ming Lei ba5952e071 USB: ehci-omap: fix compile failure(v1)
The omap_ehci_init() is introduced in the below commit:

	commit 1a49e2ac9651df7349867a5cf44e2c83de1046af(EHCI:
	centralize controller initialization)

the local variable of 'pdev' inside omap_ehci_init() is used
but not defined, so fix the compiling failure.

Signed-off-by: Ming Lei <ming.lei@canonical.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 17:13:39 -07:00
Laxman Dewangan 7211974365 usb: host: tegra: pass correct pointer in ehci_setup()
The ehci_setup() require the pointer of usb_hcd.
Passing the correct pointer in place of ehci_hcd
pointer.

This is side effect of change:
commit 1a49e2ac96
Author: Alan Stern <stern@rowland.harvard.edu>

    EHCI: centralize controller initialization

[Although I checked for this specifically, obviously I missed some of
the calls.  In addition to the mistake in ehci-tegra.c that Laxman
fixed here, the same thing needs to be fixed in ehci-orion.c and
ehci-xls.c. -- Alan Stern]

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 17:13:39 -07:00
Kumar Gala 08d7660d45 USB: ehci-fsl: Update ifdef check to work on 64-bit ppc
We need to use CONFIG_FSL_SOC_BOOKE instead of CONFIG_PPC_85xx as
CONFIG_PPC_85xx isn't defined when we build support for 64-bit embedded
FSL PPC SoCs.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 17:11:12 -07:00
Ben Minerds f9943c2596 USB: serial: keyspan: Removed unrequired parentheses.
Changes to conform with checkpatch.sh script. - return is not a
function, parentheses not required. Removed 1 checkpatch.sh error.

Signed-off-by: Ben Minerds <puzzleduck@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 17:09:15 -07:00
Ben Minerds 878b5fd690 USB: serial: keyspan: Removed trailing whitespace.
Changes to conform with checkpatch.sh script. - trailing whitespace.
Removed 1 checkpatch.sh error.

Signed-off-by: Ben Minerds <puzzleduck@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 17:09:15 -07:00
Ben Minerds ddc04ae77f USB: serial: keyspan: Fixed space near open parenthesis.
Changes to conform with checkpatch.sh script. - space near open
parenthesis '('. Removed 2 checkpatch.sh errors.

Signed-off-by: Ben Minerds <puzzleduck@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 17:09:02 -07:00
Ben Minerds 40adac8143 USB: serial: keyspan: Fixed space around equals.
Changes to conform with checkpatch.sh script. - space around '='.
Removed 1 checkpatch.sh error.

Signed-off-by: Ben Minerds <puzzleduck@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 17:06:07 -07:00
Ben Minerds 2b982ab177 USB: serial: keyspan: Fix spacing around conditional.
Changes to conform with checkpatch.sh script. - spaces around '?' and
':'.  Removed 14 checkpatch.sh errors.

Signed-off-by: Ben Minerds <puzzleduck@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 17:06:07 -07:00
Greg Kroah-Hartman 6470cbc486 USB: Link PM fixes and Latency Tolerance Messaging
Hi Greg,
 
 Here's four bug fix patches for Link PM (LPM), which are marked for
 3.5-stable.  There's also three patches that turn on Latency Tolerance
 Messaging (LTM) for xHCI host controllers and USB 3.0 devices that support
 this low power feature.
 
 Please queue for 3.6.
 
 Sarah Sharp
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJP/WCWAAoJEBMGWMLi1Gc5AjEQAIYHfWi3rhkoTpyhTyYhmzqM
 /ZhAaeJXDe5VE1isfWK0mnzBz/X05MgpIxCck9CKMkcKZySJNkQFmK7iz6puGPVh
 GnMQ3QkDo+9JSa7TKEX77ZG+bMkEHcAO2XbZjQs2IDfTuz+BJmQ8gFdjQGfAt/l3
 KOU3k83Ci1gdtNgxqifQPBuo3o2l0L5Hn2E7XqFWQ8WUYYu1LWd2bZa/5dznq0hD
 4n+ylcK0gDPa9pl7vRsLT79misdLTsJoBfjvooOE2Ms/5QXeFWRppsYRFOla8V4K
 P2MjiXOCtZHN7GuxdLW776s5dZZyGZnbYNtTOSu0cOjheTC25KpmCm5XW/h5xMt3
 saM6mhkSq5ZweDaLXvqV5O+WTQ2ePnubBpqR7/tVWkeUxJoK06ENKZ10dhsqfZw9
 Wqcs4ze667Y3wjbBmAaF4b1bmEbhsJR/iAO2z3TLrfiAfYW3S5/4xCUCYujAXuff
 n1gD75pnJJK1g4hfwFKDDNxWJtXIVqOaLMvD1x5AcGCnCG43mteruFfcS9q66LfI
 uckf/PnQFAuqEx/J3dIava+yzZhNr0TMQp6aPtSCQUKgBukNf+/RRyB/pDGmYbC1
 XBwqIYtv7yQ4w0DVPKd4edPP8zB8E5XMlAY/a1xvxcIa/tFBBDbVh8efXKeKrJEL
 +smfSepLPwPzETe8YMNR
 =G1bL
 -----END PGP SIGNATURE-----

Merge tag 'for-usb-next-2012-07-11' of git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci into usb-next

USB: Link PM fixes and Latency Tolerance Messaging

Hi Greg,

Here's four bug fix patches for Link PM (LPM), which are marked for
3.5-stable.  There's also three patches that turn on Latency Tolerance
Messaging (LTM) for xHCI host controllers and USB 3.0 devices that support
this low power feature.

Please queue for 3.6.

Sarah Sharp
2012-07-16 16:58:30 -07:00
Alan Stern 43fe3a99d9 USB: EHCI: resolve some unlikely races
This patch (as1589) resolves some unlikely races involving system
shutdown or controller death in ehci-hcd:

	Shutdown races with both root-hub resume and controller
	resume.

	Controller death races with root-hub suspend.

A new bitflag is added to indicate that the controller has been shut
down (whether for system shutdown or because it died).  Tests are
added in the suspend and resume pathways to avoid reactivating the
controller after any sort of shutdown.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:56:48 -07:00
Alan Stern c4f3476436 USB: EHCI: fix up locking
This patch (as1588) adjusts the locking in ehci-hcd's various halt,
shutdown, and suspend/resume pathways.  We want to hold the spinlock
while writing device registers and accessing shared variables, but not
while polling in a loop.

In addition, there's no need to call ehci_work() at times when no URBs
can be active, i.e., in ehci_stop() and ehci_bus_suspend().

Finally, ehci_adjust_port_wakeup_flags() is called only in situations
where interrupts are enabled; therefore it can use spin_lock_irq
rather than spin_lock_irqsave.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:56:48 -07:00
Alan Stern f428907822 USB: EHCI: simplify isochronous scanning
This patch (as1587) simplifies ehci-hcd's scan_isoc() routine by
eliminating some local variables, declaring boolean-valued values as
bool rather than unsigned, changing variable names to make more sense,
and so on.

The logic at the end of the routine is cut down significantly.  The
scanning doesn't have to catch up all the way to where the hardware
is; it merely has to catch up to where the hardware was when the last
interrupt occurred.  If the hardware has made more progress since then
and issued another interrupt, a rescan will catch up to it.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:56:47 -07:00
Alan Stern 18aafe64d7 USB: EHCI: use hrtimer for the I/O watchdog
This patch (as1586) replaces the kernel timer used by ehci-hcd as an
I/O watchdog with an hrtimer event.

Unlike in the current code, the watchdog event is now always enabled
whenever any isochronous URBs are active.  This will prevent bugs
caused by the periodic schedule wrapping around with no completion
interrupts; the watchdog handler is guaranteed to scan the isochronous
transfers at least once during each iteration of the schedule.  The
extra overhead will be negligible: one timer interrupt every 100 ms.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:56:47 -07:00
Alan Stern 569b394f53 USB: EHCI: always scan each interrupt QH
This patch (as1585) fixes a bug in ehci-hcd's scheme for scanning
interrupt QHs.

Currently a single routine takes care of scanning everything on the
periodic schedule.  Whenever an interrupt occurs, it scans all
isochronous and interrupt URBs scheduled for frames that have elapsed
since the last scan.

This has two disadvantages.  The first is relatively minor: An
interrupt QH is likely to end up getting scanned multiple times,
particularly if the last scan was not fairly recent.  (The current
code avoids this by maintaining a periodic_stamp in each interrupt
QH.)

The second is more serious.  The periodic schedule wraps around.  If
the last scan occurred during frame N, and the next scan occurs when
the schedule has gone through an entire cycle and is back at frame N,
the scanning code won't look at any frames other than N.  Consequently
it won't see any QHs that completed during frame N-1 or earlier.

The patch replaces the entire frame-based approach for scanning
interrupt QHs with a new routine using a list-based approach, the same
as for async QHs.  This has a slight disadvantage, because it means
that all interrupt QHs have to be scanned every time.  But it is more
robust than the current approach.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:56:47 -07:00
Alan Stern 361aabf395 USB: EHCI: don't lose events during a scan
This patch (as1584) fixes a minor bug that has been present in
ehci-hcd since the beginning.

Scanning the schedules for URB completions is single-threaded.  If a
completion interrupt occurs while an URB is being given back, the
interrupt handler realizes that a scan is in progress on another CPU
and avoids starting a new one.

This means that completion events can be lost.  If an URB completes
after it has been scanned but while a scan is still in progress, the
driver won't notice and won't rescan the completed URB.

The patch fixes the problem by adding a new flag to indicate that
another scan is needed after the current scan is done.  The flag gets
set whenever a completion interrupt occurs while a scan is in
progress.  The rescan will see the completion, thus preventing it from
getting lost.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:56:47 -07:00
Alan Stern 32830f2076 USB: EHCI: use hrtimer for unlinking empty async QHs
This patch (as1583) changes ehci-hcd to use an hrtimer event for
unlinking empty (unused) async QHs instead of using a kernel timer.

The check for empty QHs is moved to a new routine, where it doesn't
require going through an entire scan of both the async and periodic
schedules.  And it can unlink multiple QHs at once, unlike the current
code.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:56:47 -07:00
Alan Stern 3c273a056b USB: EHCI: unlink multiple async QHs together
This patch (as1582) changes ehci-hcd's strategy for unlinking async
QHs.  Currently the driver never unlinks more than one QH at a time.
This can be inefficient and cause unnecessary delays, since a QH
cannot be reused while it is waiting to be unlinked.

The new strategy unlinks all the waiting QHs at once.  In practice the
improvement won't be very big, because it's somewhat uncommon to have
two or more QHs waiting to be unlinked at any time.  But it does
happen, and in any case, doing things this way makes more sense IMO.

The change requires the async unlinking code to be refactored
slightly.  Now in addition to the routines for starting and ending an
unlink, there are new routines for unlinking a single QH and starting
an IAA cycle.  This approach is needed because there are two separate
paths for unlinking async QHs:

	When a transfer error occurs or an URB is cancelled, the QH
	must be unlinked right away;

	When a QH has been idle sufficiently long, it is unlinked
	to avoid consuming DMA bandwidth uselessly.

In the first case we want the unlink to proceed as quickly as
possible, whereas in the second case we can afford to batch several
QHs together and unlink them all at once.  Hence the division of
labor.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:56:47 -07:00
Alan Stern 9d9387475a USB: EHCI: use hrtimer for the IAA watchdog
This patch (as1581) replaces the iaa_watchdog kernel timer used by
ehci-hcd with an hrtimer event, in keeping with the general conversion
to high-res timers.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:56:46 -07:00
Alan Stern 8c5bf7be56 USB: EHCI: don't refcount iso_stream structures
This patch (as1580) makes ehci_iso_stream structures behave more like
QHs, in that they will remain allocated until their isochronous
endpoint is disabled.  This will come in useful in the future, when
periodic bandwidth gets allocated as an altsetting is installed rather
than on-the-fly.

For now, the change to the ehci_iso_stream lifetimes means that each
structure is always deallocated at exactly one spot in
ehci_endpoint_disable() and never used again.  As a result, it is no
longer necessary to use reference counting on these things, and the
patch removes it.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:54:26 -07:00
Alan Stern 55934eb3b9 USB: EHCI: use hrtimer for (s)iTD deallocation
This patch (as1579) adds an hrtimer event to handle deallocation of
iTDs and siTDs in ehci-hcd.

Because of the frame-oriented approach used by the EHCI periodic
schedule, the hardware can continue to access the Transfer Descriptor
for isochronous (or split-isochronous) transactions for up to a
millisecond after the transaction completes.  The iTD (or siTD) must
not be reused before then.

The strategy currently used involves putting completed iTDs on a list
of cached entries and every so often returning them to the endpoint's
free list.  The new strategy reduces overhead by putting completed
iTDs back on the free list immediately, although they are not reused
until it is safe to do so.

When the isochronous endpoint stops (its queue becomes empty), the
iTDs on its free list get moved to a global list, from which they will
be deallocated after a minimum of 2 ms.  This delay is what the new
hrtimer event is for.

Overall this may not be a tremendous improvement over the current
code, but to me it seems a lot more clear and logical.  In addition,
it removes the need for each iTD to keep a reference to the
ehci_iso_stream it belongs to, since the iTD never needs to be moved
back to the stream's free list from the global list.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:54:25 -07:00
Alan Stern bf6387bcd1 USB: EHCI: use hrtimer for controller death
This patch (as1578) adds an hrtimer event to handle the death of an
EHCI controller.  When a controller dies, it doesn't necessarily stop
running right away.  The new event polls at 1-ms intervals to see when
all activity has safely stopped.  This replaces a busy-wait polling
loop in the current code.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:54:25 -07:00
Alan Stern df2022553d USB: EHCI: use hrtimer for interrupt QH unlink
This patch (as1577) adds hrtimer support for unlinking interrupt QHs
in ehci-hcd.  The current code relies on a fixed delay of either 2 or
55 us, which is not always adequate and in any case is totally bogus.
Thanks to internal caching, the EHCI hardware may continue to access
an interrupt QH for more than a millisecond after it has been unlinked.

In fact, the EHCI spec doesn't say how long to wait before using an
unlinked interrupt QH.  The patch sets the delay to 9 microframes
minimum, which ought to be adequate.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:54:25 -07:00
Alan Stern 314466101c USB: EHCI: use hrtimer for async schedule
This patch (as1576) adds hrtimer support for managing ehci-hcd's
async schedule.  Just as with the earlier change to the periodic
schedule management, two new hrtimer events take care of everything.

One event polls at 1-ms intervals to see when the Asynchronous
Schedule Status (ASS) flag matches the Asynchronous Schedule Enable
(ASE) value; the schedule's state must not be changed until it does.
The other event delays for 15 ms after the async schedule becomes
empty before turning it off.

The new events replace a busy-wait poll and a kernel timer usage.
They also replace the rather illogical method currently used for
indicating the async schedule should be turned off: attempting to
unlink the dedicated QH at the head of the async list.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:54:25 -07:00
Alan Stern 9671cd7a91 USB: EHCI: remove PS3 status polling
This patch (as1575) removes special code added for status polling of
the EHCI controller in PS3 systems.  While the controller is running,
the polling is now carried out by an hrtimer handler.  When the
controller is suspending or stopping, we use the same polling routine
as the old code -- but in neither case do we need to conclude that the
controller has died if the polling goes on for too long.

As a result the entire handshake_on_error_set_halt() routine is now
unused, so it is removed from the driver.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:54:25 -07:00
Alan Stern b015cb79ce USB: EHCI: return void instead of 0
This patch (as1574) changes the return type of multiple functions in
ehci-sched.c from int to void.  The values they return are now always
0, so there's no reason for them to return any value at all.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:54:24 -07:00
Alan Stern 3ca9aebac2 USB: EHCI: use hrtimer for the periodic schedule
This patch (as1573) adds hrtimer support for managing ehci-hcd's
periodic schedule.  There are two issues to deal with.

First, the schedule's state (on or off) must not be changed until the
hardware status has caught up with the current command.  This is
handled by an hrtimer event that polls at 1-ms intervals to see when
the Periodic Schedule Status (PSS) flag matches the Periodic Schedule
Enable (PSE) value.

Second, the schedule should not be turned off as soon as it becomes
empty.  Turning the schedule on and off takes time, so we want to wait
until the schedule has been empty for a suitable period before turning
it off.  This is handled by an hrtimer event that gets set to expire
10 ms after the periodic schedule becomes empty.

The existing code polls (for up to 1125 us and with interrupts
disabled!) to check the status, and doesn't implement a delay before
turning off the schedule.  Furthermore, if the polling fails then the
driver decides that the controller has died.  This has caused problems
for several people; some controllers can take 10 ms or more to turn
off their periodic schedules.

This patch fixes these issues.  It also makes the "broken_periodic"
workaround unnecessary; there is no longer any danger of turning off
the periodic schedule after it has been on for less than 1 ms.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:53:16 -07:00
Alan Stern d58b4bcc6d USB: EHCI: introduce high-res timer
This patch (as1572) begins the conversion of ehci-hcd over to using
high-resolution timers rather than old-fashioned low-resolution kernel
timers.  This reduces overhead caused by timer roundoff on systems
where HZ is smaller than 1000.  Also, the new timer framework
introduced here is much more logical and easily extended than the
ad-hoc approach ehci-hcd currently uses for timers.

An hrtimer structure is added to ehci_hcd, along with a bitflag array
and an array of ktime_t values, to keep track of which timing events
are pending and what their expiration times are.

Only the infrastructure for the timing operations is added in this
patch.  Later patches will add routines for handling each of the
various timing events the driver needs.  In some cases the new hrtimer
handlers will replace the existing handlers for ehci-hcd's kernel
timers; as this happens the old timers will be removed.  In other
cases the new timing events will replace busy-wait loops.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:53:16 -07:00
Alan Stern c0c53dbc32 USB: EHCI: add new root-hub state: STOPPING
This patch (as1571) adds a new state for ehci-hcd's root hubs:
EHCI_RH_STOPPING.  This value is used at times when the root hub is
being stopped and we don't know whether or not the hardware has
finished all its DMA yet.

Although the purpose may not be apparent, this distinction will come
in useful later on.  Future patches will avoid actions that depend on
the root hub being operational (like turning on the async or periodic
schedules) when they see the state is EHCI_RH_STOPPING.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:50:14 -07:00
Alan Stern 2f5bb665ba USB: EHCI: add pointer to end of async-unlink list
This patch (as1570) adds a pointer for the end of ehci-hcd's
async-unlink list.  The list (which is actually a queue) is singly
linked, so having a pointer to its end makes adding new entries easier
-- there's no longer any need to scan through the whole list.

In principle it could be changed to a standard doubly-linked list.  It
turns out that doing so actually makes the code less clear, so I'm
leaving it as is.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:50:13 -07:00
Alan Stern 99ac5b1e95 USB: EHCI: rename "reclaim"
This patch (as1569) renames the ehci->reclaim list in ehci-hcd.  The
word "reclaim" is used in the EHCI specification to mean something
quite different, and "unlink_next" is more descriptive of the list's
purpose anyway.

Similarly, the "reclaim" field in the ehci_stats structure is renamed
"iaa", which is more meaningful (to experts, anyway) and is a better
match for the "lost_iaa" field.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:50:13 -07:00
Alan Stern 4c53de7210 USB: EHCI: add symbolic constants for QHs
This patch (as1568) introduces symbolic constants for some of the
less-frequently used bitfields in the QH structure.  This makes the
code a little easier to read and understand.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:50:13 -07:00
Alan Stern c83e1a9ff6 USB: EHCI: don't refcount QHs
This patch (as1567) removes ehci-hcd's reference counting of QH
structures.  It's not necessary to refcount these things because they
always get deallocated at exactly one spot in ehci_endpoint_disable()
(except for two special QHs, ehci->async and ehci->dummy) and are
never used again.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:50:13 -07:00
Alan Stern 15be105b4a USB: EHCI: remove unneeded suspend/resume code
This patch (as1566) removes the code in ehci-hcd's resume routines
which tries to restart or cancel any transfers left active while the
root hub or controller was asleep.  This code isn't necessary, because
all URBs are terminated before the root hub is suspended.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:50:13 -07:00
Alan Stern 631fe9d9d2 USB: EHCI: initialize data before resetting hardware
Currently, EHCI initialization turns off the controller (in case it
was left running by the firmware) before setting up the ehci_hcd data
structure.  This patch (as1565) reverses that order.

Although it doesn't matter now, it will matter later on when future
additions to ehci_halt() will want to acquire a spinlock that gets
initialized by ehci_init().

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:50:12 -07:00
Namjae Jeon 1f9be64a6d usb: storage: update usb devices for write cache quirk in quirk list.
Update information of Seagate Portable HDD and WD My Passport HDD in
quirk list.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Pankaj Kumar <pankaj.km@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:46:22 -07:00
Namjae Jeon e1bc9e5075 usb: storage: add support for write cache quirk
Add support for write cache quirk on usb hdd. scsi driver will be set to wce
by detecting write cache quirk in quirk list when plugging usb hdd.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Pankaj Kumar <pankaj.km@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 16:46:22 -07:00
Greg Kroah-Hartman b903bd69e3 Merge 3.5-rc7 into usb-next
This resolves the merge issue with the drivers/usb/host/ehci-omap.c
file.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 13:16:09 -07:00
Theodore Ts'o b04b3156a2 usb: feed USB device information to the /dev/random driver
Send the USB device's serial, product, and manufacturer strings to the
/dev/random driver to help seed its pools.

Cc: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Greg KH <greg@kroah.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@vger.kernel.org
2012-07-14 20:17:45 -04:00
Linus Torvalds 7801dc33be MFD Fixes for 3.5
- 3 Palmas fixes, 1 of them being a build error fix.
 - 2 mc13xx fixes. 1 for fixing an SPI regmap configuration and another one for
   working around an i.Mx hardware bug.
 - 1 omap-usb regression fix.
 - 1 twl6040 build breakage fix.
 - 1 file deletion (ab5500-core.h) that was overlooked during the last merge
   window.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJP/vIeAAoJEIqAPN1PVmxKTlMP/RFiIP9Exyy0gqGCMJpYpOfH
 m1NX0LMZ9ktv61M0bgx1AZewNCLG0O6vNf1zW6S4aaczx/D5o1uqWTrra7WqIHTj
 LG2dTpm1dYo2FHNkaGSwpDCGJI2H1K9l4HBcevJcNeVsE3OSZIfQXOFAdXuxJjf3
 RUBZ/dzRAi0/KnZySu+1z3ua3Fbican5CwcljsMEp3K5ajr/d7zFCYDz3Osk+g3k
 kvncHZtfeQNhXgfHMm+8nWRnHvpGWutUXtAIL5yzSQgeEtKANe7D2KsxK73t68iV
 BkelhzqXk9o711nluA0hF4gvS20/cS675QNbQ6XLUK2N7wsCORqMSTNXxnvJze2E
 1hH599dLqPMkq3P5TRCTaQLx8p/QK8Vnrgvsy5pOkSZnqiNU/Owtik0NA4Gz3WrG
 f6WMRHNb+wwLdvhkqHUuMjt2OzmIUiuikKu6kt2pyJ3tXj0tPisC0UieF+6fRHG+
 yxwrXqKtv/aj+gbp+X476fMWt2LR4Duihq1QkW2tE9rtkVlUMTIJgCj6T1mdC6T5
 g1ELR3mi+AXCyOp5d6jpmJmKTnHjQfCPouNgalfFonJlp7Fngih0SzUpwV/XYyP7
 CUy490mcRUZUhSmTH4UQV9CfxhQA8gKNbN9Oak499N6UNWSDyoiH/bh+h/BQuAli
 Gn6cYgk5IKYjiO020ilG
 =dlI4
 -----END PGP SIGNATURE-----

Merge tag 'mfd-for-linus-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6

Pull MFD Fixes from Samuel Ortiz:
 - Three Palmas fixes, One of them being a build error fix.
 - Two mc13xx fixes.  One for fixing an SPI regmap configuration and
   another one for working around an i.Mx hardware bug.
 - One omap-usb regression fix.
 - One twl6040 build breakage fix.
 - One file deletion (ab5500-core.h) that was overlooked during the last
   merge window.

* tag 'mfd-for-linus-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6:
  mfd: Add missing hunk to change palmas irq to clear on read
  mfd: Fix palmas regulator pdata missing
  mfd: USB: Fix the omap-usb EHCI ULPI PHY reset fix issues.
  mfd: Update twl6040 Kconfig to avoid build breakage
  mfd: Delete ab5500-core.h
  mfd: mc13xxx workaround SPI hardware bug on i.Mx
  mfd: Fix mc13xxx SPI regmap
  mfd: Add terminating entry for i2c_device_id palmas table
2012-07-13 09:54:26 -07:00
Guennadi Liakhovetski f19b7e0db7 usb: renesas_usbhs: prepare for conversion to the shdma base library
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-07-13 09:13:08 +05:30
Sarah Sharp 024f117c2f USB: Add a sysfs file to show LTM capabilities.
USB 3.0 devices can optionally support Latency Tolerance Messaging
(LTM).  Add a new sysfs file in the device directory to show whether a
device is LTM capable.  This file will be present for both USB 2.0 and
USB 3.0 devices.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2012-07-11 07:06:48 -04:00
Sarah Sharp f74631e342 USB: Enable Latency Tolerance Messaging (LTM).
USB 3.0 devices may optionally support a new feature called Latency
Tolerance Messaging.  If both the xHCI host controller and the device
support LTM, it should be turned on in order to give the system hardware
a better clue about the latency tolerance values of its PCI devices.

Once a Set Feature request to enable LTM is received, the USB 3.0 device
will begin to send LTM updates as its buffers fill or empty, and it can
tolerate more or less latency.

The USB 3.0 spec, section C.4.2 says that LTM should be disabled just
before the device is placed into suspend.  Then the device will send an
updated LTM notification, so that the system doesn't think it should
remain in an active state in order to satisfy the latency requirements
of the suspended device.

The Set and Clear Feature LTM enable command can only be sent to a
configured device.  The device will respond with an error if that
command is sent while it is in the Default or Addressed state.  Make
sure to check udev->actconfig in usb_enable_ltm() and usb_disable_ltm(),
and don't send those commands when the device is unconfigured.

LTM should be enabled once a new configuration is installed in
usb_set_configuration().  If we end up sending duplicate Set Feature LTM
Enable commands on a switch from one installed configuration to another
configuration, that should be harmless.

Make sure that LTM is disabled before the device is unconfigured in
usb_disable_device().  If no drivers are bound to the device, it doesn't
make sense to allow the device to control the latency tolerance of the
xHCI host controller.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2012-07-11 07:06:48 -04:00
Sarah Sharp af3a23ef4e xhci: Export Latency Tolerance Messaging capabilities.
Some xHCI host controllers may have optional support for Latency
Tolerance Messaging (LTM).  This allows USB 3.0 devices that support LTM
to pass information about how much latency they can tolerate to the xHC.
A PCI xHCI host will use this information to update the PCI Latency
Tolerance Request (LTR) info.  The goal of this is to gather latency
information for the system, to enable hardware-driven C states, and the
shutting down of PLLs.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2012-07-11 07:06:48 -04:00
Sarah Sharp 249719121b USB: Fix LPM disable count mismatch on driver unbind.
When a user runs `echo 0 > bConfigurationValue` for a USB 3.0 device,
usb_disable_device() is called.  This function disables all drivers,
deallocates interfaces, and sets the device configuration value to 0
(unconfigured).

With the new scheme to ensure that unconfigured devices have LPM
disabled, usb_disable_device() must call usb_unlocked_disable_lpm() once
it unconfigures the device.

This commit should be backported to kernels as old as 3.5, that contain
the commit 8306095fd2 "USB: Disable USB
3.0 LPM in critical sections."

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2012-07-11 07:06:47 -04:00
Sarah Sharp 9cf65991dd USB: Disable LPM while the device is unconfigured.
The USB 3.0 Set/Clear Feature U1/U2 Enable cannot be sent to a device in
the Default or Addressed state.  It can only be sent to a configured
device.  Change the USB core to initialize the LPM disable count to 1
(disabled), which reflects this limitation.

Change usb_set_configuration() to ensure that if the device is
unconfigured on entry, usb_lpm_disable() is not called.  This avoids
sending the Clear Feature U1/U2 when the device is in the Addressed
state.  When usb_set_configuration() exits with a successfully installed
configuration, usb_lpm_enable() will be called.

Once the new configuration is installed, make sure
usb_set_configuration() only calls usb_enable_lpm() if the device moved
to the Configured state.  If we have unconfigured the device by sending
it a Set Configuration for config 0, don't enable LPM.

This commit should be backported to kernels as old as 3.5, that contain
the commit 8306095fd2 "USB: Disable USB
3.0 LPM in critical sections."

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2012-07-11 07:06:46 -04:00
Sarah Sharp 6d1d051330 USB: Fix LPM disable/enable during device reset.
The USB 3.0 specification says that sending a Set Feature or Clear
Feature for U1/U2 Enable is not a valid request when the device is in
the Default or Addressed state.  It is only valid when the device is in
the Configured state.

The original LPM patch attempted to disable LPM after the device had
been reset by hub_port_init(), before it had the configuration
reinstalled.  The TI hub I tested with did not fail the Clear Feature
U1/U2 Enable request that khubd sent while it was in the addressed
state, which is why I didn't catch it.

Move the LPM disable before the device reset, so that we can send the
Clear Feature U1/U2 Enable successfully, and balance the LPM disable
count.

Also delete any calls to usb_enable_lpm() on error paths that lead to
re-enumeration.  The calls will fail because the device isn't
configured, and it's not useful to balance the LPM disable count because
the usb_device is about to be destroyed before re-enumeration.

Fix the early exit path ("done" label) to call usb_enable_lpm() to
balance the LPM disable count.

Note that calling usb_reset_and_verify_device() with an unconfigured
device may fail on the first call to usb_disable_lpm().  That's because
the LPM disable count is initialized to 0 (LPM enabled), and
usb_disable_lpm() will attempt to send a Clear Feature U1/U2 request to
a device in the Addressed state.  The next patch will fix that.

This commit should be backported to kernels as old as 3.5, that contain
the commit 8306095fd2 "USB: Disable USB
3.0 LPM in critical sections."

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2012-07-11 07:06:46 -04:00
Arnd Bergmann 99ac7b577f Merge branch 'omap/cleanup2' into next/clk
Dependency for omap/am33xx-clk branch
2012-07-10 17:40:43 +02:00
Alan Stern 1a49e2ac96 EHCI: centralize controller initialization
This patch (as1564c) converts the EHCI platform drivers to use the
central ehci_setup() routine for generic controller initialization
rather than each having its own idiosyncratic approach.

The major point of difficulty lies in ehci-pci's many vendor- and
device-specific workarounds.  Some of them have to be applied before
calling ehci_setup() and some after, which necessitates a fair amount
of code motion.  The other platform drivers require much smaller
changes.

One point not addressed by the patch is whether ports should be
powered on or off following initialization.  The different drivers
appear to handle this pretty much at random.  In fact it shouldn't
matter, because the hub driver turns on power to all ports when it
binds to the root hub.  Straightening that out will be left for
another day.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09 13:35:05 -07:00
Richard Zhao 1530280084 usb: chipidea: add imx platform driver
This patch supports only the host-mode functionality so far.

Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Peter Chen <peter.chen@freescale.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Felipe Balbi <balbi@ti.com>
Tested-by: Subodh Nijsure <snijsure@grid-net.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09 10:01:09 -07:00
Richard Zhao b3d9968122 usb: otg: add basic mxs phy driver support
mxs phy is used in Freescale i.MX SoCs, for example
imx23, imx28, imx6Q. This patch adds the basic host
support.

Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Peter Chen <peter.chen@freescale.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Tested-by: Subodh Nijsure <snijsure@grid-net.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09 09:59:23 -07:00
Richard Zhao a2c3d6902f usb: chipidea: permit driver bindings pass phy pointer
Sometimes, the driver bindings may know what phy they use.
For example, when using device tree, the usb controller may have a
phandler pointing to usb phy.

Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Felipe Balbi <balbi@ti.com>
Tested-by: Subodh Nijsure <snijsure@grid-net.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09 09:59:23 -07:00
Richard Zhao ca72ae9bf6 usb: chipidea: select USB_EHCI_ROOT_HUB_TT in USB_CHIPIDEA_HOST of Kconfig
ci13xxx host needs Root Hub Transaction Translators.

Reported-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09 09:55:09 -07:00
Richard Zhao fe6e125e30 USB: Chipidea: add ci13xxx device id management
We use ida_simple_get and ida_simple_remove to manage the ids.

Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09 09:53:44 -07:00
Richard Zhao cbc6dc2af3 USB: Chipidea: add unified ci13xxx_{add,remove}_device for platform drivers
Platform drivers do the similar things to add/remove ci13xxx device, so
create a unified one.

Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09 09:53:44 -07:00
Richard Zhao 26c696c678 USB: Chipidea: rename struct ci13xxx variables from udc to ci
struct ci13xxx represent the controller, which may be device or host,
so name its variables as ci.

Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09 09:52:15 -07:00
Kuninori Morimoto 2f0de9d844 usb: renesas_usbhs: use dmaengine helper functions
This patch used dmaengine helper functions instead of using hand setting.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09 09:48:26 -07:00
Kishon Vijay Abraham I 277bd8746b drivers: usb: otg: fix build break in twl6030-usb.c
Fixed a mistake in the merge conflict resoultion commit(ff9cce) in file
twl6030-usb.c

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09 09:46:51 -07:00
Hans de Goede fe2072cc17 usb/hcd: Ensure scatter-gather is not used for isoc transfers
We don't support sg for isoc transfers, enforce this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09 09:46:50 -07:00
Alan Stern c5cf9212a3 EHCI: centralize controller suspend/resume
This patch (as1563) removes a lot of duplicated code by moving the
EHCI controller suspend/resume routines into the core driver, where
the various platform drivers can invoke them as needed.

Not only does this simplify these platform drivers, this also makes it
easier for other platform drivers to add suspend/resume support in the
future.

Note: The patch does not touch the ehci-fsl.c file, because its
approach to suspend and resume is so different from all the others.
It will have to be handled specially by its maintainer.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09 08:54:18 -07:00
Russ Dill c05995c3d7 mfd: USB: Fix the omap-usb EHCI ULPI PHY reset fix issues.
'ARM: OMAP3: USB: Fix the EHCI ULPI PHY reset issue' (1fcb57d0) fixes
an issue where the ULPI PHYs were not held in reset while initializing
the EHCI controller. However, it also changes behavior in
omap-usb-host.c omap_usbhs_init by releasing reset while the
configuration in that function was done.

This change caused a regression on BB-xM where USB would not function
if 'usb start' had been run from u-boot before booting. A change was
made to release reset a little bit earlier which fixed the issue on
BB-xM and did not cause any regressions on 3430 sdp, the board for
which the fix was originally made.

This new fix, 'USB: EHCI: OMAP: Finish ehci omap phy reset cycle
before adding hcd.', (3aa2ae74) caused a regression on OMAP5.

The original fix to hold the EHCI controller in reset during
initialization was correct, however it appears that changing
omap_usbhs_init to not hold the PHYs in reset during it's
configuration was incorrect. This patch first reverts both fixes, and
then changes ehci_hcd_omap_probe in ehci-omap.c to hold the PHYs in
reset as the original patch had done. It also is sure to incorporate
the _cansleep change that has been made in the meantime.

I've tested this on Beagleboard xM, I'd really like to get an ack from
the 3430 sdp and OMAP5 guys before getting this merged.

v3 - Brown paper bag its too early in the morning actually run
     git commit amend fix
v2 - Put cansleep gpiolib call outside of spinlock

Acked-by: Mantesh Sarashetti <mantesh@ti.com>
Tested-by: Mantesh Sarashetti <mantesh@ti.com>
Acked-by: Keshava Munegowda <keshava_mgowda@ti.com>
Tested-by: Keshava Munegowda <keshava_mgowda@ti.com>
Signed-off-by: Russ Dill <Russ.Dill@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 00:16:25 +02:00
Russ Dill 2761a63945 mfd: USB: Fix the omap-usb EHCI ULPI PHY reset fix issues.
'ARM: OMAP3: USB: Fix the EHCI ULPI PHY reset issue' (1fcb57d0) fixes
an issue where the ULPI PHYs were not held in reset while initializing
the EHCI controller. However, it also changes behavior in
omap-usb-host.c omap_usbhs_init by releasing reset while the
configuration in that function was done.

This change caused a regression on BB-xM where USB would not function
if 'usb start' had been run from u-boot before booting. A change was
made to release reset a little bit earlier which fixed the issue on
BB-xM and did not cause any regressions on 3430 sdp, the board for
which the fix was originally made.

This new fix, 'USB: EHCI: OMAP: Finish ehci omap phy reset cycle
before adding hcd.', (3aa2ae74) caused a regression on OMAP5.

The original fix to hold the EHCI controller in reset during
initialization was correct, however it appears that changing
omap_usbhs_init to not hold the PHYs in reset during it's
configuration was incorrect. This patch first reverts both fixes, and
then changes ehci_hcd_omap_probe in ehci-omap.c to hold the PHYs in
reset as the original patch had done. It also is sure to incorporate
the _cansleep change that has been made in the meantime.

I've tested this on Beagleboard xM, I'd really like to get an ack from
the 3430 sdp and OMAP5 guys before getting this merged.

v3 - Brown paper bag its too early in the morning actually run
     git commit amend fix
v2 - Put cansleep gpiolib call outside of spinlock

Acked-by: Mantesh Sarashetti <mantesh@ti.com>
Tested-by: Mantesh Sarashetti <mantesh@ti.com>
Acked-by: Keshava Munegowda <keshava_mgowda@ti.com>
Tested-by: Keshava Munegowda <keshava_mgowda@ti.com>
Signed-off-by: Russ Dill <Russ.Dill@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 00:16:12 +02:00
Arnd Bergmann 524cd267e5 Merge branch 'for-3.6/common-clk' of git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-tegra into next/clk
From Stephen Warren <swarren@wwwdotorg.org>:

This branch contains numerous changes required as a baseline in order to
convert Tegra to the common clock framework. The intention was to also
include patches to actually convert Tegra to the common clock framework.
However, those patches appeared late in the kernel cycle and currently
cause regressions on some boards, so were dropped for now.

* 'for-3.6/common-clk' of git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-tegra:
  ARM: tegra: Provide clock for only one PWM controller
  ARM: tegra: Fix PWM clock programming
  ARM: tegra: dma: rename driver name for clock to "tegra-apbdma"
  ARM: tegra: Remove second instance of uart clk
  crypto: add clk_prepare/clk_unprepare
  ASoC: tegra: add clk_prepare/clk_unprepare
  staging: nvec: add clk_prepare/clk_unprepare
  spi/tegra: add clk_prepare/clk_unprepare
  Input: tegra-kbc - add clk_prepare/clk_unprepare
  USB: ehci-tegra: add clk_prepare/clk_unprepare
  mmc: tegra: add clk_prepare/clk_unprepare
  i2c: tegra: Add clk_prepare/clk_unprepare
  ARM: tegra: add clk_prepare/clk_unprepare

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2012-07-06 22:21:23 +02:00
Lan Tianyu 336c5c310e usb: convert port_owners type from void * to struct dev_state *
This patch is to convert port_owners type from void * to struct dev_state *
in order to make code more readable.

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>
2012-07-06 11:09:28 -07:00
Richard Zhao 77c4400f2f USB: Chipidea: rename struct ci13xxx_udc_driver to struct ci13xxx_platform_data
This patch rename struct ci13xxx_udc_driver and var with the type.

ci13xxx_platform_data reflect it's passed from platfrom driver.

Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 11:03:32 -07:00
Felipe Balbi 6bf83594e3 usb: chipidea: msm: add remove method
allow this driver to be removed too.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 10:58:39 -07:00
Felipe Balbi 17d2fcc393 usb: chipidea: msm: add missing section annotation
No functional changes, it will just free up some
code if we don't have hotplug.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 10:58:39 -07:00
Felipe Balbi b2006d91d8 usb: chipidea: drop useless arch-check
msm glue layer compiles on all arches just
fine. Let's drop the unnecessary ARCH check
so we have easier compile tests.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 10:58:38 -07:00
Alexander Shishkin b7283d5a04 usb: chipidea: remove unneeded NULL check
As reported by Dan Carpenter, there is a NULL check in udc_start() that
follows a dereference of the pointer that's being checked. However, at
that point udc pointer shouldn't ever be NULL and if it is, the dereference
should cause an oops.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 10:58:38 -07:00
Hans de Goede 3d97ff63f8 usbdevfs: Use scatter-gather lists for large bulk transfers
When using urb->transfer_buffer we need to allocate physical contiguous buffers
for the entire transfer, which is pretty much guaranteed to fail with large
transfers.

Currently userspace works around this by breaking large transfers into multiple
urbs. For large bulk transfers this leads to all kind of complications.

This patch makes it possible for userspace to reliable submit large bulk
transfers to scatter-gather capable host controllers in one go, by using a
scatterlist to break the transfer up in managable chunks.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 10:53:20 -07:00
Hans de Goede 19181bc50e usbdevfs: Add a USBDEVFS_GET_CAPABILITIES ioctl
There are a few (new) usbdevfs capabilities which an application cannot
discover in any other way then checking the kernel version. There are 3
problems with this:
1) It is just not very pretty.
2) Given the tendency of enterprise distros to backport stuff it is not
reliable.
3) As discussed in length on the mailinglist, USBDEVFS_URB_BULK_CONTINUATION
does not work as it should when combined with USBDEVFS_URB_SHORT_NOT_OK
(which is its intended use) on devices attached to an XHCI controller.
So the availability of these features can be host controller dependent,
making depending on them based on the kernel version not a good idea.

This patch besides adding the new ioctl also adds flags for the following
existing capabilities:

USBDEVFS_CAP_ZERO_PACKET,        available since 2.6.31
USBDEVFS_CAP_BULK_CONTINUATION,  available since 2.6.32, except for XHCI
USBDEVFS_CAP_NO_PACKET_SIZE_LIM, available since 3.3

Note that this patch only does not advertise the USBDEVFS_URB_BULK_CONTINUATION
cap for XHCI controllers, bulk transfers with this flag set will still be
accepted when submitted to XHCI controllers.

Returning -EINVAL for them would break existing apps, and in most cases the
troublesome scenario wrt USBDEVFS_URB_SHORT_NOT_OK urbs on XHCI controllers
will never get hit, so this would break working use cases.

The disadvantage of not returning -EINVAL is that cases were it is causing
real trouble may go undetected / the cause of the trouble may be unclear,
but this is the best we can do.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 10:53:19 -07:00
Hans de Goede 2102e06a5f usbdevfs: Correct amount of data copied to user in processcompl_compat
iso data buffers may have holes in them if some packets were short, so for
iso urbs we should always copy the entire buffer, just like the regular
processcompl does.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
CC: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 10:53:19 -07:00
Jeffrin Jose 02f824ac75 USB: class: cdc-acm: Fixed coding style issue.
Fixed coding style issue related to
prohibited space in drivers/usb/class/cdc-acm.c

Signed-off-by: Jeffrin Jose <ahiliation@yahoo.co.in>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 10:42:21 -07:00
Jingoo Han 9cb0756372 USB: ehci-s5p: 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 10:42:21 -07:00
Jingoo Han 390a0a7806 USB: ohci-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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 10:42:21 -07:00
Jingoo Han e864abed54 USB: ohci-exynos: add clock gating to suspend/resume
This patch adds clock gating to suspend and resume functions.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 10:42:21 -07:00
Bjørn Mork b086b6b10d USB: cdc-wdm: fix lockup on error in wdm_read
Clear the WDM_READ flag on empty reads to avoid running
forever in an infinite tight loop, causing lockups:

Jul  1 21:58:11 nemi kernel: [ 3658.898647] qmi_wwan 2-1:1.2: Unexpected error -71
Jul  1 21:58:36 nemi kernel: [ 3684.072021] BUG: soft lockup - CPU#0 stuck for 23s! [qmi.pl:12235]
Jul  1 21:58:36 nemi kernel: [ 3684.072212] CPU 0
Jul  1 21:58:36 nemi kernel: [ 3684.072355]
Jul  1 21:58:36 nemi kernel: [ 3684.072367] Pid: 12235, comm: qmi.pl Tainted: P           O 3.5.0-rc2+ #13 LENOVO 2776LEG/2776LEG
Jul  1 21:58:36 nemi kernel: [ 3684.072383] RIP: 0010:[<ffffffffa0635008>]  [<ffffffffa0635008>] spin_unlock_irq+0x8/0xc [cdc_wdm]
Jul  1 21:58:36 nemi kernel: [ 3684.072388] RSP: 0018:ffff88022dca1e70  EFLAGS: 00000282
Jul  1 21:58:36 nemi kernel: [ 3684.072393] RAX: ffff88022fc3f650 RBX: ffffffff811c56f7 RCX: 00000001000ce8c1
Jul  1 21:58:36 nemi kernel: [ 3684.072398] RDX: 0000000000000010 RSI: 000000000267d810 RDI: ffff88022fc3f650
Jul  1 21:58:36 nemi kernel: [ 3684.072403] RBP: ffff88022dca1eb0 R08: ffffffffa063578e R09: 0000000000000000
Jul  1 21:58:36 nemi kernel: [ 3684.072407] R10: 0000000000000008 R11: 0000000000000246 R12: 0000000000000002
Jul  1 21:58:36 nemi kernel: [ 3684.072412] R13: 0000000000000246 R14: ffffffff00000002 R15: ffff8802281d8c88
Jul  1 21:58:36 nemi kernel: [ 3684.072418] FS:  00007f666a260700(0000) GS:ffff88023bc00000(0000) knlGS:0000000000000000
Jul  1 21:58:36 nemi kernel: [ 3684.072423] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Jul  1 21:58:36 nemi kernel: [ 3684.072428] CR2: 000000000270d9d8 CR3: 000000022e865000 CR4: 00000000000007f0
Jul  1 21:58:36 nemi kernel: [ 3684.072433] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Jul  1 21:58:36 nemi kernel: [ 3684.072438] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Jul  1 21:58:36 nemi kernel: [ 3684.072444] Process qmi.pl (pid: 12235, threadinfo ffff88022dca0000, task ffff88022ff76380)
Jul  1 21:58:36 nemi kernel: [ 3684.072448] Stack:
Jul  1 21:58:36 nemi kernel: [ 3684.072458]  ffffffffa063592e 0000000100020000 ffff88022fc3f650 ffff88022fc3f6a8
Jul  1 21:58:36 nemi kernel: [ 3684.072466]  0000000000000200 0000000100000000 000000000267d810 0000000000000000
Jul  1 21:58:36 nemi kernel: [ 3684.072475]  0000000000000000 ffff880212cfb6d0 0000000000000200 ffff880212cfb6c0
Jul  1 21:58:36 nemi kernel: [ 3684.072479] Call Trace:
Jul  1 21:58:36 nemi kernel: [ 3684.072489]  [<ffffffffa063592e>] ? wdm_read+0x1a0/0x263 [cdc_wdm]
Jul  1 21:58:36 nemi kernel: [ 3684.072500]  [<ffffffff8110adb7>] ? vfs_read+0xa1/0xfb
Jul  1 21:58:36 nemi kernel: [ 3684.072509]  [<ffffffff81040589>] ? alarm_setitimer+0x35/0x64
Jul  1 21:58:36 nemi kernel: [ 3684.072517]  [<ffffffff8110aec7>] ? sys_read+0x45/0x6e
Jul  1 21:58:36 nemi kernel: [ 3684.072525]  [<ffffffff813725f9>] ? system_call_fastpath+0x16/0x1b
Jul  1 21:58:36 nemi kernel: [ 3684.072557] Code: <66> 66 90 c3 83 ff ed 89 f8 74 16 7f 06 83 ff a1 75 0a c3 83 ff f4

The WDM_READ flag is normally cleared by wdm_int_callback
before resubmitting the read urb, and set by wdm_in_callback
when this urb returns with data or an error.  But a crashing
device may cause both a read error and cancelling all urbs.
Make sure that the flag is cleared by wdm_read if the buffer
is empty.

We don't clear the flag on errors, as there may be pending
data in the buffer which should be processed.  The flag will
instead be cleared on the next wdm_read call.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Acked-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-05 16:04:58 -07:00
Johan Hovold b7d28e32c9 USB: metro-usb: fix tty_flip_buffer_push use
Do not set low_latency flag at open as tty_flip_buffer_push must not be
called in IRQ context with low_latency set.

Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-05 16:04:57 -07:00
Gaosen Zhang aacef9c561 USB: option: Add MEDIATEK product ids
Signed-off-by: Gaosen Zhang <gaosen.zhang@mediatek.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-05 16:00:22 -07:00
Bjørn Mork 8e16e33c16 USB: option: add ZTE MF60
Switches into a composite device by ejecting the initial
driver CD.  The four interfaces are: QCDM, AT, QMI/wwan
and mass storage.  Let this driver manage the two serial
interfaces:

T:  Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 28 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=19d2 ProdID=1402 Rev= 0.00
S:  Manufacturer=ZTE,Incorporated
S:  Product=ZTE WCDMA Technologies MSM
S:  SerialNumber=xxxxx
C:* #Ifs= 4 Cfg#= 1 Atr=c0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E:  Ad=83(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 3 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-05 15:57:18 -07:00
Greg Kroah-Hartman ff9cce8277 usb: phy: patches for v3.6 merge window
We are starting to support multiple USB phys as
 we should thanks for Kishon's work. DeviceTree support
 for USB PHYs won't come until discussion with DeviceTree
 maintainer is finished.
 
 Together with that series, we have one fix for twl4030
 which missed a IRQF_ONESHOT annotation when requesting
 a threaded IRQ without a top half handler, and removal
 of an unused variable compilation warning to isp1301_omap.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJP8VcOAAoJEIaOsuA1yqREeNYQAIxHOteF78nx5gMwB20agndf
 vYCOB3Jymc67vcLuEf60lqoVBuQ7bxGsJyx+HlNkKrVQQfF8enL9UBhUDwvmKytm
 Z1FBVmuA33PxS2aGSODkgafODO6wfnp5USzzYjEG+Hu6Q9Zt4rJ3NYakYFXdbrM3
 kT3uZ2uwuOd/B1Pzt8oiMSbiF16kLeX0a6m6C4KEFViX0uGHAe/KqN4b9eSbO41q
 16fvfthbAaqqSpEoMusI+kCFLku7ib3CXl5d4kgik7C7+wY08JTDWhWBMIl6wiFz
 LeDIXfoX0MgEcB3vDszGCf2pgtCNR8rfl/pzuLvr6F6p+Cj6CqtgsfV8HCe43Dzr
 RI7Fewl1xdz6MztKRBgr75RxqZ6VA91gLWT21nDI72DEBwyBJ1pk882CxkxSLK+b
 VNtI/La9JZkUqb0PXioD0a4JUVpzw5nLatpw1PXZoLUgSozVXmhDE6Wjhl/jvl4y
 ZVQVRQn2ZcyNzYY9bG2X08zyDRRvurXFfQ20CfAeBpgvvfccN9e5vGdWVbohwZro
 Vn1x+fSyb6KqVOeYlzpAKf+UGXE9UM53YKpjFnmrstqUjbL5ByW2pZn5fYgJP08v
 9im3SXwvs3Iz2mzwenRFUpI6PDuaTnIWgB7qquFDY1QwFyAKoPJuVN81/iPCisUM
 bIYQILhqgTNNjsnPmpCr
 =HwsA
 -----END PGP SIGNATURE-----

Merge tag 'xceiv-for-v3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

usb: phy: patches for v3.6 merge window

We are starting to support multiple USB phys as
we should thanks for Kishon's work. DeviceTree support
for USB PHYs won't come until discussion with DeviceTree
maintainer is finished.

Together with that series, we have one fix for twl4030
which missed a IRQF_ONESHOT annotation when requesting
a threaded IRQ without a top half handler, and removal
of an unused variable compilation warning to isp1301_omap.
2012-07-05 15:35:41 -07:00
Greg Kroah-Hartman 933141509c usb: dwc3: patches for v3.6 merge window
lots of changes for the dwc3 driver which will make
 the driver a lot more stable and some changes which
 are just cosmetic.
 
 The bulk of changes is related to mis-defined macros
 which were never used before, some fixes to error path
 which e.g. prevent the driver from initiating two
 transfer on ep0out in case of stall, some fixes to
 request dequeueing and the End Transfer Command.
 
 We have some changes to U1/U2 handling where we were
 enabling those transtions at the wrong spot (though
 we haven't seen a problem from that as of today).
 
 A few patches will make it easier to add support for
 newer releases of the core by adding definitions for
 new registers and changing the code to act accordingly
 when certain revisions are detected.
 
 There's also the usual comestic changes to make the
 driver easier to maintain and make it easier for new-
 comers to understand the driver. Also one patch fixing
 a double inclusion of a header.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJP8VNzAAoJEIaOsuA1yqREqpYP/Rq8Uy4p1TougBR64CZBmDIk
 g6kmr3PDPR1euI4rCXRRAQ+gHVo7sY4Ishf7FIj38Aq4J6muQ5bBHX43zqobtFor
 V7GB+rKGwlI14zYoH9tZo0NtiD3QjfmI/uiN7o4PpnHZCOUPR3c6xqvOUvNU7vee
 RKfnoWQbOBE7tQfHXQdulVdcbyddWJPQ/1CGOB44WcIqfGT8ZsMWQc+i4QScCA9E
 8lGKbXq10dw3E8PyxqtejcSa+nO8B7D3TwlLH1JNZD8nNKsOdhxZO3Xkm0OZoOVA
 5puQfIRJFRnIN1FyqFTfv+yD0O1bzuxz/Qrd0Tkv0HAfc/NMQntpLIe4mYFiJYyq
 H6xOcr87X3TXx7oz2JxIjo3Y5ylwgW2dYfTvPF6u4N0D6hkflx3ebko/mklOkYP2
 6TH8H1zd1x2wUkgPaCeLXiMVEyWvIh8MGZ2o9KMb73gPRuMQHVVkQFPe/BfY0l7a
 c6486uyR9h8BCSAuivbIKPD8ca+dU8bLYl9svrlGIKmJcj7KZmJ8sVT2zfY0+A+k
 0P2Yj3SUMP0DCuvMylf18+5npEn60mt2OFbU95RYakXvwCOerGxWfWr0HbqWfUgC
 dtxrghS4urZn8mmL/lTvnsR68ypFKaKIgfypuf/NQECMdANB07UQnpl4AYiAbUlK
 4OleN7N2/Kny2FE/EvVu
 =s04u
 -----END PGP SIGNATURE-----

Merge tag 'dwc3-for-v3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

usb: dwc3: patches for v3.6 merge window

lots of changes for the dwc3 driver which will make
the driver a lot more stable and some changes which
are just cosmetic.

The bulk of changes is related to mis-defined macros
which were never used before, some fixes to error path
which e.g. prevent the driver from initiating two
transfer on ep0out in case of stall, some fixes to
request dequeueing and the End Transfer Command.

We have some changes to U1/U2 handling where we were
enabling those transtions at the wrong spot (though
we haven't seen a problem from that as of today).

A few patches will make it easier to add support for
newer releases of the core by adding definitions for
new registers and changing the code to act accordingly
when certain revisions are detected.

There's also the usual comestic changes to make the
driver easier to maintain and make it easier for new-
comers to understand the driver. Also one patch fixing
a double inclusion of a header.
2012-07-05 15:15:38 -07:00
Greg Kroah-Hartman 94ff447cf2 usb: gadget: patches for v3.6 merge window
This is quite a big pull request and contains patches
 all over the place.
 
 omap_udc is now a bit cleaner after removing omap2 support,
 fixing some checkpatch.pl warnings and errors, switching over
 to generic map/unmap routines and preventing a NULL pointer
 de-reference.
 
 s3c-hsotg has been switched over to devm_* API, got some
 locking fixes and improvements and it also got an implementation
 for the pullup() method.
 
 the mass storage gadgets changed default value of the removable
 parameter, dropped some unused options and made "file" and "ro"
 module_parameters read-only in some cases.
 
 ffs function got support for HID descriptor.
 
 Some UDCs have been converted to clk_prepare_enable() and
 clk_disable_unprepare().
 
 Marvell now got support for its USB3 controller in mainline
 after introducing its mv_u3d_core.c driver.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJP8VZeAAoJEIaOsuA1yqREu0YP/jSrITte+Za8HMfvV1/eVNtz
 eVd+dhx82WnfPUmDHPsC+1IzCFlOIufFsqK/lWaNxVkUaL154lL85TPbxVPggNXA
 zvEldifaDahDax2B5MRP8hQKpp8rNrik/ePSPv1Lts5HsfPT2aUOYIcNAPlqdaPs
 4x4VejujirUGIgo1swocDOHu2nB9PTqnhtLUgLGaZcAMQtT5z/ao5NGeSugbc7sS
 jvci0WKWzjxxPT77ZrcyaOrCmzTCR4yK0DZGFNsyVmY9ATTwSr/By0AgQdm36t6f
 xdqjGib+Y2C+6xW35suLo1N+3qErClNuvJtvXlQ5VUpa70dsZTFu8KiCv+td7KA1
 9mNeovoAiuWKSgDevqJ8g4mND/LFcrGLyKR2dkyA2NNVANgJpPY3y3sjSXV8USt5
 pLGolz3XFQsUejIvrmcsHKIXNrCgJChQeaBvM13dmwhw2SWPcW0OSQnw+kPOQm8W
 ByqmwSPIYxGKyd0UIcbqjlV5OXI1FcWIDSlTXbQZBId7YfVYqIuMizVvbZ8yE1pG
 RTSuyo/khG4OwVKIQoxYboNYBE2MM32L8G6Hh2ataiw1M0rjIvCh6180xENKQ2I1
 iK54ViWctzNx7OC5JozUS+9i5KafRPdbxNHMUPGQQXpcCtb6Q4fmeGTyFYuIfTFK
 hRzP4o0SpAu7V+CoZ1Zz
 =hbE6
 -----END PGP SIGNATURE-----

Merge tag 'gadget-for-v3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

usb: gadget: patches for v3.6 merge window

This is quite a big pull request and contains patches
all over the place.

omap_udc is now a bit cleaner after removing omap2 support,
fixing some checkpatch.pl warnings and errors, switching over
to generic map/unmap routines and preventing a NULL pointer
de-reference.

s3c-hsotg has been switched over to devm_* API, got some
locking fixes and improvements and it also got an implementation
for the pullup() method.

the mass storage gadgets changed default value of the removable
parameter, dropped some unused options and made "file" and "ro"
module_parameters read-only in some cases.

ffs function got support for HID descriptor.

Some UDCs have been converted to clk_prepare_enable() and
clk_disable_unprepare().

Marvell now got support for its USB3 controller in mainline
after introducing its mv_u3d_core.c driver.
2012-07-05 15:10:09 -07:00
Greg Kroah-Hartman 979eef3326 usb: musb: patches for v3.6 merge window
Just two patches here:
 
 First we have a fix to disable DMA in case DMA channel
 request fails.
 
 Second, there's a fix for situations where the user
 kills musb (by rmmod or any other means) while a
 transfer is on the fly. In such cases, we could be
 led into a NULL pointer dereference due to endpoint
 being disabled and endpoint descriptor being NULL.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJP8VRPAAoJEIaOsuA1yqRE4NkP/jVDJ3akrDHtwjh9Ke8xJNNx
 VrfNyx2QU3cYZ2XnUVdvqzcOeUErZpiE/RPtgDAvccSQl5oOuBL8Zlikcj+JfjHM
 8Xt6TSd/coIyPYqq6HB1k/mG/dwwWmMf7U0Be+CFEwHsWhPPp80RnYXuGFx6XjZU
 wg0mV6iYP1AvGBIN+P5NKwN8HAozz+bxvXDbWyBZUCZL+ws5JTVM53fHy92hFSWs
 1N3c3fQizQZP3gmpzuJGV4CUigYWtAcyi1cjGjeIlXroioZK8N55chum+HmrJSiZ
 kviZ2K0m0Lh3uNiyH7P2g/7skGbTeCURXxUudnlzdIJKVQdrSni5WXBD9Ydzt1sG
 fv3+NDifMTPOoctJJs6y4QVDSOJBdOkHSpA7RWg2HbzD2EPODtKNn8Z+t3Sx7gaG
 zL78COmTuhpQOAp0qBcQLuL3dZ2Dq4aDlL9NO2+8vlmrYPilFW0jh/DlUKzryGoA
 5a3MA8cBrLG9gwpqlRzyanHjZOU5ejkQaFLQc9wiEzn9fZNh6c/rxk3AedGOzykq
 Rw8p90jLy2MuSUKgOPihjZbUzRlW71d2Tt8W4lHnzgA24kj/STS8Y+bhlNLfJFHr
 iRYDdFzJHByyt7/cyUGS9lPCAFfw7hjyflvsRuOkGxLuKRKTQk4F/PWWYN6LmNjt
 7+z/2VrbxxzPCbRsxay4
 =4uPD
 -----END PGP SIGNATURE-----

Merge tag 'musb-for-v3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

usb: musb: patches for v3.6 merge window

Just two patches here:

First we have a fix to disable DMA in case DMA channel
request fails.

Second, there's a fix for situations where the user
kills musb (by rmmod or any other means) while a
transfer is on the fly. In such cases, we could be
led into a NULL pointer dereference due to endpoint
being disabled and endpoint descriptor being NULL.
2012-07-05 15:09:27 -07:00
Greg Kroah-Hartman e765bf84d5 Merge 3.5-rc5 into usb-next
This resolves a merge issue with the option.c USB serial driver.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-05 08:58:03 -07:00
Tony Lindgren 3f96a2d90e Here is some more omap clean-up. The biggest changes are
hwmod, clock, and System Control Module cleanup, and the removal
 of the last instance of omap_read/write usage for omap2+ with
 the removal of unused USB OHCI Full Speed driver support. The
 removed OHCI is only currently used for omap1 as the actively
 used omap2+ boards have either MUSB or another instance of
 OHCI+EHCI that's more usable.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJP8AYmAAoJEBvUPslcq6VzH2sP/0QlWA9Xl31AnGUgKJ3p5W3A
 mjtLf9jHicOisSfYiEnuePHKwLnw7HZniI0xNcHXnFpRcDsxK8q2bmuFVpmqpIBv
 OaCTfnOY+hpZR0/sLRQrKRZF13zYiro40StrhgxrSUV6cGwky+fJx/63J3j16NeV
 TJkX4FjJXdAiGi/E7v+5XmQn3rpfcjntaDZgGSravVv1U1kYMMfN/2lHAvrALS+w
 c8xqommerOnSp0IfjAtPeLnDdgdDXDxSq7MRGyDbNmxffjDR/leTC7j1xl0j0S+O
 PSSvUa8aypeBWo9ckH77sXgiaAaMxVLu/X4ksPDijDdBkHsuQSffuj4swJP9B3d5
 4d0ryvBqJhfvvgnL6a3emYhiZXgdbYbnerA+smm1Hf5VhGt5BWvZkJgS2RBUWLdW
 j4OsaSI+vGhsYFjINNZ6QY3S1OeolGb8qBjNVHN0XsUg/tQPQZCMIjm2Zl+OM7Ex
 60mtVoNysA0VKl/bzQ9jH6BwAYkcKli8bHDrvHm5a73DunVrCOG7TmKM4g108kvo
 ccVCcEb3XEuqOfi+Nk6MSUQcHc1TkeDeAA9OtoFSi5hYwEh19w7UotRpsAVw2/Qe
 D+Rrm4QvfUrDYKRfbj6LRaNRxkgvVnqJ5mC1SyiIbuLLjkZPJDomMATOZ66dYNUi
 /tUf+6znwg+Iki+8rlhx
 =A9qD
 -----END PGP SIGNATURE-----
mergetag object c59b537d87
 type commit
 tag omap-devel-dmtimer-for-v3.6
 tagger Tony Lindgren <tony@atomide.com> 1341130362 -0700
 
 Here are some omap dmtimer changes to make it easier to add
 device tree support for dmtimer by simplifying the platform
 data structure used by dmtimr.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJP8AbkAAoJEBvUPslcq6Vz46YQAJZ7dWwSKHSQjuIx2j9iloi6
 zIgvX8secC8yrli88I27fcAB7qGI9fulebEGQXCu7s3OzHI3/FO1KTAMdW31y4it
 6WUkdWkSHfFtFiOcRjR9QTEuQ58Fii550iVcn8qezDizYfnd6ThwPHhhZek39oJC
 qSzb2jqvvHgVuMPqpXkCDmQnH3JoEqGZ2Qg+JlyuW9mMmq3ipK7BTY9vLIcCPvdu
 ET0rBvSmTr7s/XBMtDLseCHD3XsgnQ8dY0i7j3BWtCSkNjz2DFhj4zXL3/3f+ff6
 KCIrkY5CK1R4x4vithXyLpqgniwj66eOOHdnL78iV4Am7jQrbIyvC9k5LeQE28XD
 QgB718tO8UVRfAKmA9/zAwLJUN4lg8OUw2PrCBPxy4GXxY0Wu670gD+AqtSEwqV8
 8ifOEltLO/46jb/zdBFvNJ+69C0XZdSN48SpdZbGzVVaNMxWprSGxF3hdf8EnbjF
 /0F0A8dCtgMcIDgr+hUkSSM+AVVzlxr9imvATsAFTLlgq3G8LQ4bGSh/ywuNN5jn
 Ql5ZkuxBVIWwWcd68vCKQVH/X/mPj6jtmz1qRZZTOCbV7oM8/YVQP37tkn6jk+xl
 2ZCUrggvUcDYxVx0N1Eb4Yixje4BsrMPFn0zVjKSTzVMpYobxqVuNYPFfZ7ROJnf
 caxP57fcIOC3pYp4VYtq
 =L0+0
 -----END PGP SIGNATURE-----
mergetag object 6fd8246b1c
 type commit
 tag omap-devel-am33xx-for-v3.6
 tagger Tony Lindgren <tony@atomide.com> 1341131157 -0700
 
 Here are changes to add support for am33xx processors for the
 clock, power, and voltagedomains.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJP8Am6AAoJEBvUPslcq6VzhVsP/31PxWaX0JboIbAP0VlmJ+GK
 J9gIxs2ohx3fDcx4D3da7rLlDue4E0oKmftbj0G4Iom22si2HrtmCnkq41anOkDA
 UA9hW8kYfQJr90BzHYuIvOncpb6w6mzjJu7QDSO3j2l1FssoG+rOcDrW0EUSdzhF
 1pIaGairntUAsI/EE3Ja6r0reRgacV4CmWksatp3mzxpbyA2+m2zJj8IovY1ghPZ
 jq3zcLm4LCxDyiCDYcz6Jrt9fH9OA2cEQ/q0gHKspHvr2lsRu7gzN5gvi+700oML
 vIT42/rC6tppf72113arZ+vKluJfa9LhgD0G7JcDqCyRxmwe0w3cKZKWrVklolsZ
 sHATYxliWk4gB+pipw8W/hEHKGKPgPEPEAd60RN3g3/SDBo/fcQKvsF5/sZldC70
 ngagTSseCKGUOQxWJ1+eRqG+I5WIzgorunNIbN/N9dGyxQ3C+zDAgDbdar24sWFn
 1bA1wH7iwEYaqGOCEKfwodl+tSGAeuVXm4e2fR81sHRYY6eIFCKCdExZ/DPJrFTt
 FnbV2OgKKz9xYcw6MNmfVEk3TkMSNwFO+g+EtzM1km5oW6PIxkGoiDydxHGvN3fq
 gWfv7Y7AJCnbiqKBSahE1WkVADXYTlXk1ySzjHluPXJmqh/iUYDmpKKMYEFQYgyg
 ekpI3teAadGhu5ZIrqG5
 =bc0b
 -----END PGP SIGNATURE-----

Merge tags 'omap-cleanup-for-v3.6', 'omap-devel-dmtimer-for-v3.6' and 'omap-devel-am33xx-for-v3.6' into devel-am33xx-part2
2012-07-04 00:29:31 -07:00
Arnd Bergmann 1fe4061864 Here is some more omap clean-up. The biggest changes are
hwmod, clock, and System Control Module cleanup, and the removal
 of the last instance of omap_read/write usage for omap2+ with
 the removal of unused USB OHCI Full Speed driver support. The
 removed OHCI is only currently used for omap1 as the actively
 used omap2+ boards have either MUSB or another instance of
 OHCI+EHCI that's more usable.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJP8AYmAAoJEBvUPslcq6VzH2sP/0QlWA9Xl31AnGUgKJ3p5W3A
 mjtLf9jHicOisSfYiEnuePHKwLnw7HZniI0xNcHXnFpRcDsxK8q2bmuFVpmqpIBv
 OaCTfnOY+hpZR0/sLRQrKRZF13zYiro40StrhgxrSUV6cGwky+fJx/63J3j16NeV
 TJkX4FjJXdAiGi/E7v+5XmQn3rpfcjntaDZgGSravVv1U1kYMMfN/2lHAvrALS+w
 c8xqommerOnSp0IfjAtPeLnDdgdDXDxSq7MRGyDbNmxffjDR/leTC7j1xl0j0S+O
 PSSvUa8aypeBWo9ckH77sXgiaAaMxVLu/X4ksPDijDdBkHsuQSffuj4swJP9B3d5
 4d0ryvBqJhfvvgnL6a3emYhiZXgdbYbnerA+smm1Hf5VhGt5BWvZkJgS2RBUWLdW
 j4OsaSI+vGhsYFjINNZ6QY3S1OeolGb8qBjNVHN0XsUg/tQPQZCMIjm2Zl+OM7Ex
 60mtVoNysA0VKl/bzQ9jH6BwAYkcKli8bHDrvHm5a73DunVrCOG7TmKM4g108kvo
 ccVCcEb3XEuqOfi+Nk6MSUQcHc1TkeDeAA9OtoFSi5hYwEh19w7UotRpsAVw2/Qe
 D+Rrm4QvfUrDYKRfbj6LRaNRxkgvVnqJ5mC1SyiIbuLLjkZPJDomMATOZ66dYNUi
 /tUf+6znwg+Iki+8rlhx
 =A9qD
 -----END PGP SIGNATURE-----

Merge tag 'omap-cleanup-for-v3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/cleanup

From Tony Lindgren <tony@atomide.com>

Here is some more omap clean-up. The biggest changes are
hwmod, clock, and System Control Module cleanup, and the removal
of the last instance of omap_read/write usage for omap2+ with
the removal of unused USB OHCI Full Speed driver support. The
removed OHCI is only currently used for omap1 as the actively
used omap2+ boards have either MUSB or another instance of
OHCI+EHCI that's more usable.

* tag 'omap-cleanup-for-v3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  ARM: OMAP2+: hwmod: remove prm_clkdm, cm_clkdm; allow hwmods to have no clockdomain
  ARM: OMAP3: Move McBSP fck clock alias to hwmod data
  ARM: OMAP2: Move McBSP fck clock alias to hwmod data for OMAP2430
  ARM: OMAP2: Move McBSP fck clock alias to hwmod data for OMAP2420
  ARM: OMAP: dsp: interface to control module functions
  ARM: OMAP2+: control: new APIs to configure boot address and mode
  ARM: OMAP2+: CLEANUP: Remove ARCH_OMAPx ifdef from struct dpll_data
  ARM: OMAP2+: hwmod: use init-time function pointer for _init_clkdm
  ARM: OMAP2+: hwmod: use init-time function pointer for hardreset
  ARM: OMAP2+: hwmod: use init-time function pointer for wait_target_ready
  ARM: OMAP4: hwmod: drop extra cpu_is check from _wait_target_disable()
  ARM: OMAP2+: hwmod: use init-time function ptrs for enable/disable module
  ARM: OMAP4: hwmod: rename _enable_module to _omap4_enable_module()
  ARM: OMAP: Make FS USB omap1 only
  ARM: OMAP2: Remove legacy USB FS support
  ARM: OMAP3: There is no FS USB controller on omap3
  ARM: OMAP: dma: Clear status registers on enable/disable irq

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2012-07-03 21:54:55 +02:00
Sarah Sharp 0d9f78a92e xhci: Fix hang on back-to-back Set TR Deq Ptr commands.
The Microsoft LifeChat 3000 USB headset was causing a very reproducible
hang whenever it was plugged in.  At first, I thought the host
controller was producing bad transfer events, because the log was filled
with errors like:

xhci_hcd 0000:00:14.0: ERROR Transfer event TRB DMA ptr not part of current TD

However, it turned out to be an xHCI driver bug in the ring expansion
patches.  The bug is triggered When there are two ring segments, and a
TD that ends just before a link TRB, like so:

 ______________                     _____________
|              |              ---> | setup TRB B |
 ______________               |     _____________
|              |              |    |  data TRB B |
 ______________               |     _____________
| setup TRB A  | <-- deq      |    |  data TRB B |
 ______________               |     _____________
| data TRB A   |              |    |             | <-- enq, deq''
 ______________               |     _____________
| status TRB A |              |    |             |
 ______________               |     _____________
|  link TRB    |---------------    |  link TRB   |
 _____________  <--- deq'           _____________

TD A (the first control transfer) stalls on the data phase.  That halts
the ring.  The xHCI driver moves the hardware dequeue pointer to the
first TRB after the stalled transfer, which happens to be the link TRB.

Once the Set TR dequeue pointer command completes, the function
update_ring_for_set_deq_completion runs.  That function is supposed to
update the xHCI driver's dequeue pointer to match the internal hardware
dequeue pointer.  On the first call this would work fine, and the
software dequeue pointer would move to deq'.

However, if the transfer immediately after that stalled (TD B in this
case), another Set TR Dequeue command would be issued.  That would move
the hardware dequeue pointer to deq''.  Once that command completed,
update_ring_for_set_deq_completion would run again.

The original code would unconditionally increment the software dequeue
pointer, which moved the pointer off the ring segment into la-la-land.
The while loop would happy increment the dequeue pointer (possibly
wrapping it) until it matched the hardware pointer value.

The while loop would also access all the memory in between the first
ring segment and the second ring segment to determine if it was a link
TRB.  This could cause general protection faults, although it was
unlikely because the ring segments came from a DMA pool, and would often
have consecutive memory addresses.

If nothing in that space looked like a link TRB, the deq_seg pointer for
the ring would remain on the first segment.  Thus, the deq_seg and the
software dequeue pointer would get out of sync.

When the next transfer event came in after the stalled transfer, the
xHCI driver code would attempt to convert the software dequeue pointer
into a DMA address in order to compare the DMA address for the completed
transfer.  Since the deq_seg and the dequeue pointer were out of sync,
xhci_trb_virt_to_dma would return NULL.

The transfer event would get ignored, the transfer would eventually
timeout, and we would mistakenly convert the finished transfer to no-op
TRBs.  Some kernel driver (maybe xHCI?) would then get stuck in an
infinite loop in interrupt context, and the whole machine would hang.

This patch should be backported to kernels as old as 3.4, that contain
the commit b008df60c6 "xHCI: count free
TRBs on transfer ring"

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Andiry Xu <andiry.xu@amd.com>
Cc: stable@vger.kernel.org
2012-07-02 12:51:25 -07:00
Stanislaw Ledwon 8bea2bd37d usb: Add support for root hub port status CAS
The host controller port status register supports CAS (Cold Attach
Status) bit. This bit could be set when USB3.0 device is connected
when system is in Sx state. When the system wakes to S0 this port
status with CAS bit is reported and this port can't be used by any
device.

When CAS bit is set the port should be reset by warm reset. This
was not supported by xhci driver.

The issue was found when pendrive was connected to suspended
platform. The link state of "Compliance Mode" was reported together
with CAS bit. This link state was also not supported by xhci and
core/hub.c.

The CAS bit is defined only for xhci root hub port and it is
not supported on regular hubs. The link status is used to force
warm reset on port. Make the USB core issue a warm reset when port
is in ether the 'inactive' or 'compliance mode'. Change the xHCI driver
to report 'compliance mode' when the CAS is set. This force warm reset
on the root hub port.

This patch should be backported to stable kernels as old as 3.2, that
contain the commit 10d674a82e "USB: When
hot reset for USB3 fails, try warm reset."

Signed-off-by: Stanislaw Ledwon <staszek.ledwon@linux.intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: Andiry Xu <andiry.xu@amd.com>
Cc: stable@vger.kernel.org
2012-07-02 12:51:24 -07:00
Kishon Vijay Abraham I f8ecf82948 usb: phy: fix error handling in usb_get_phy
spin_unlock_irqrestore() was not being called in the error path of
usb_get_phy. It's fixed here.

Reported-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-07-02 10:41:00 +03:00
Kishon Vijay Abraham I ded017ee6c usb: phy: fix return value check of usb_get_phy
usb_get_phy will return -ENODEV if it's not able to find the phy. Hence
fixed all the callers of usb_get_phy to check for this error condition
instead of relying on a non-zero value as success condition.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-07-02 10:40:49 +03:00
Alexandre Pereira da Silva 65c84ea18b usb: gadget: at91_udc: Propagate devicetree to gadget drivers
Fill dev.of_node of gadget drivers, so they can use devicetree

Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-07-02 10:38:07 +03:00
Alexandre Pereira da Silva cb4baf104b usb: gadget: fsl_udc: Propagate devicetree to gadget drivers
Fill dev.of_node of gadget drivers, so they can use devicetree

Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-07-02 10:38:04 +03:00
Alexandre Pereira da Silva 7d7b22928b usb: gadget: s3c-hsotg: Propagate devicetree to gadget drivers
Fill dev.of_node of gadget drivers, so they can use devicetree

Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-07-02 10:38:01 +03:00
Alexandre Pereira da Silva eebc0d368f usb: gadget: lpc32xx_udc: Propagate devicetree to gadget drivers
Fill dev.of_node of gadget drivers, so they can use devicetree

Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-07-02 10:37:57 +03:00
Michal Nazarewicz 48a31af744 usb: gadget: mass_storage: make "file" and "ro" read only in some cases
The “file” sysfs entry for LUNs was writable even for non-removable
LUNs and the fsg_store_file() function did not check whether LUN is
removable or not.  This made it possible to change or even close
LUN's backing file.

The same is true for “ro” sysfs entry and LUNs simulating CD-ROM.
For those LUNs, the file should not be writable.

This commit introduces two new device_attribute structures for those
two special cases so that the file/ro sysfs entries are made
non-writable when not desired.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-07-02 10:36:55 +03:00
Pratyush Anand 6f17f74b3d usb: dwc3: return error in case of run/stop timeout
Although timeout has never been experienced, still to make it
meaningful, its better to return error if it ever occurs.

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-07-02 10:04:02 +03:00
Pratyush Anand e274a31e29 usb: dwc3: enable ACCEPT{U1,U2}ENA when SetConfiguration received
As per databook, ACCEPT{U1,U2}ENA bits should be set after receiving
SetConfiguration Command.

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-07-02 10:03:55 +03:00
Pratyush Anand dd864f20b3 usb: dwc3: no need to clear INIT{U1,U2}ENA bits
as per databook, these bits are cleared by hardware on each USB reset,
so no need to clear it explicitly by software in reset ISR.

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-07-02 10:03:15 +03:00
Pratyush Anand cbc725b371 usb: dwc3: keep default hird threshold value as 4b1100
as per data book any HIRD threshold value greater than 4b1100 is
invalid. So set the maximum valid value as default values.

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-07-02 10:02:34 +03:00
Pratyush Anand 08f0d96670 usb: dwc3: correct set_halt implementation for ep0
set_halt for ep0 is called to stall a deferred control responses by the
gadget.  We already have a function to stall default control endpoint.
This patch points set_halt for ep0 to the already available function.

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Michel Sanches <michel.sanches@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-07-02 10:02:07 +03:00