History log of /linux-master/drivers/usb/musb/musb_host.c
Revision Date Author Comments
# 33d7e372 18-Sep-2023 Xingxing Luo <xingxing.luo@unisoc.com>

usb: musb: Get the musb_qh poniter after musb_giveback

When multiple threads are performing USB transmission, musb->lock will be
unlocked when musb_giveback is executed. At this time, qh may be released
in the dequeue process in other threads, resulting in a wild pointer, so
it needs to be here get qh again, and judge whether qh is NULL, and when
dequeue, you need to set qh to NULL.

Fixes: dbac5d07d13e ("usb: musb: host: don't start next rx urb if current one failed")
Cc: stable@vger.kernel.org
Signed-off-by: Xingxing Luo <xingxing.luo@unisoc.com>
Link: https://lore.kernel.org/r/20230919033055.14085-1-xingxing.luo@unisoc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0afddf1e 26-Oct-2022 Paul Cercueil <paul@crapouillou.net>

usb: musb: Support setting OTG mode using generic PHY

When musb->xceiv is not provided but musb->phy is, support setting the
OTG mode (host, peripheral) using the generic PHY framework.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20221026182657.146630-5-paul@crapouillou.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a6d45ea0 26-Oct-2022 Paul Cercueil <paul@crapouillou.net>

usb: musb: Allow running without CONFIG_USB_PHY

Modify the core so that musb->xceiv is never deferenced without being
checked first.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20221026182657.146630-4-paul@crapouillou.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 285f28bf 26-Oct-2022 Paul Cercueil <paul@crapouillou.net>

usb: musb: Add and use inline function musb_otg_state_string

The musb_otg_state_string() simply calls usb_otg_state_string().
This will make it easier to get rid of the musb->xceiv dependency later.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20221026182657.146630-3-paul@crapouillou.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 21acc656 26-Oct-2022 Paul Cercueil <paul@crapouillou.net>

usb: musb: Add and use inline functions musb_{get,set}_state

Instead of manipulating musb->xceiv->otg->state directly, use the newly
introduced musb_get_state() and musb_set_state() inline functions.

Later, these inline functions will be modified to get rid of the
musb->xceiv dependency, which prevents the musb code from using the
generic PHY subsystem.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20221026182657.146630-2-paul@crapouillou.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3c5e0d0e 08-May-2021 Saurav Girepunje <saurav.girepunje@gmail.com>

usb: musb: Remove unused function argument dma, qh, offset, length

Remove unused function argument dma, qh, offset, length from
musb_tx_dma_set_mode_cppi_tusb() in musb_host.c

Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
Link: https://lore.kernel.org/r/20210508170317.24403-3-saurav.girepunje@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6cfe9036 08-May-2021 Saurav Girepunje <saurav.girepunje@gmail.com>

usb: musb: Remove unused local variable dma, urb, offset

Remove unused function argument struct dma_controller *dma,
struct urb *urb and u32 offset from musb_tx_dma_set_mode_mentor.

Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
Link: https://lore.kernel.org/r/20210508170317.24403-2-saurav.girepunje@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# df561f66 23-Aug-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

treewide: Use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>


# 1b967691 24-May-2020 Bin Liu <b-liu@ti.com>

usb: musb: return -ESHUTDOWN in urb when three-strikes error happened

When a USB device attached to a hub got disconnected, MUSB controller
generates RXCSR_RX_ERROR interrupt for the 3-strikes-out error.

Currently the MUSB host driver returns -EPROTO in current URB, then the
USB device driver could immediately resubmit the URB which causes MUSB
generate RXCSR_RX_ERROR interrupt again. This circle causes interrupt
storm then the hub never got a chance to report the USB device detach.

To fix the interrupt storm, change the URB return code to -ESHUTDOWN for
MUSB_RXCSR_H_ERROR interrupt, so that the USB device driver will not
immediately resubmit the URB.

Signed-off-by: Bin Liu <b-liu@ti.com>
Link: https://lore.kernel.org/r/20200525025049.3400-2-b-liu@ti.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 52974d94 16-Mar-2020 Mans Rullgard <mans@mansr.com>

usb: musb: fix crash with highmen PIO and usbmon

When handling a PIO bulk transfer with highmem buffer, a temporary
mapping is assigned to urb->transfer_buffer. After the transfer is
complete, an invalid address is left behind in this pointer. This is
not ordinarily a problem since nothing touches that buffer before the
urb is released. However, when usbmon is active, usbmon_urb_complete()
calls (indirectly) mon_bin_get_data() which does access the transfer
buffer if it is set. To prevent an invalid memory access here, reset
urb->transfer_buffer to NULL when finished (musb_host_rx()), or do not
set it at all (musb_host_tx()).

Fixes: 8e8a55165469 ("usb: musb: host: Handle highmem in PIO mode")
Signed-off-by: Mans Rullgard <mans@mansr.com>
Cc: stable@vger.kernel.org
Signed-off-by: Bin Liu <b-liu@ti.com>
Link: https://lore.kernel.org/r/20200316211136.2274-8-b-liu@ti.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 21a37aed 11-Feb-2020 Gustavo A. R. Silva <gustavo@embeddedor.com>

USB: musb: Replace zero-length array with flexible-array member

The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
int stuff;
struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertenly introduced[3] to the codebase from now on.

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Link: https://lore.kernel.org/r/20200211232519.GA23263@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# fe3bbd6b 15-Jan-2020 Min Guo <min.guo@mediatek.com>

usb: musb: Add get/set toggle hooks

Add get/set toggle hooks in struct musb_io and struct musb_platform_ops
for special platform; remove function musb_save_toggle, use the set/get
callback to handle toggle.

Signed-off-by: Min Guo <min.guo@mediatek.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Link: https://lore.kernel.org/r/20200115132547.364-21-b-liu@ti.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7b81cb6b 16-Aug-2019 Christoph Hellwig <hch@lst.de>

usb: add a HCD_DMA flag instead of guestimating DMA capabilities

The usb core is the only major place in the kernel that checks for
a non-NULL device dma_mask to see if a device is DMA capable. This
is generally a bad idea, as all major busses always set up a DMA mask,
even if the device is not DMA capable - in fact bus layers like PCI
can't even know if a device is DMA capable at enumeration time. This
leads to lots of workaround in HCD drivers, and also prevented us from
setting up a DMA mask for platform devices by default last time we
tried.

Replace this guess with an explicit HCD_DMA that is set by drivers that
appear to have DMA support.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20190816062435.881-4-hch@lst.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d2fce701 12-Feb-2019 Gustavo A. R. Silva <gustavo@embeddedor.com>

USB: musb: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.

This patch fixes the following warning:

drivers/usb/musb/musb_host.c: In function ‘musb_advance_schedule’:
drivers/usb/musb/musb_host.c:374:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (qh->mux == 1) {
^
drivers/usb/musb/musb_host.c:383:3: note: here
case USB_ENDPOINT_XFER_ISOC:
^~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

Notice that, in this particular case, the code comment is modified
in accordance with what GCC is expecting to find.

This patch is part of the ongoing efforts to enable
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# fce11867 11-Feb-2019 Colin Ian King <colin.king@canonical.com>

USB: musb: fix indentation issue on a return statement

A return statement is indented one level too far, fix this by removing
a tab.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 169d3606 28-Jun-2018 Gustavo A. R. Silva <gustavo@embeddedor.com>

USB: musb: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0a9134bd 21-May-2018 Bin Liu <b-liu@ti.com>

usb: musb: disable otg protocol support

As decided in the discussion [1] we are deleting the otg protocol
support from the musb drivers.

First this patch disables the flags for enabling the otg protocols. We
will later gradually delete the otg protocol code from the musb drivers.

[1] https://www.spinics.net/lists/linux-usb/msg167003.html

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d2852f2d 21-May-2018 Bin Liu <b-liu@ti.com>

usb: musb: remove references to default_a of struct usb_otg

musb drivers do not use the otg fsm framework, so referencing to
otg->default_a doesn't have any effect, so remove the references.

But tusb6010 glue driver uses it locally to control the vbus power, so
keep the references in tusb6010 only.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7ad76955 21-May-2018 Bin Liu <b-liu@ti.com>

usb: musb: remove duplicated port mode enum

include/linux/usb/musb.h already defines enum for musb port mode, so
remove the duplicate in musb_core.h and use the definition in musb.h.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ebc3dd68 14-May-2018 Daniel Glöckner <dg@emlix.com>

usb: musb: fix remote wakeup racing with suspend

It has been observed that writing 0xF2 to the power register while it
reads as 0xF4 results in the register having the value 0xF0, i.e. clearing
RESUME and setting SUSPENDM in one go does not work. It might also violate
the USB spec to transition directly from resume to suspend, especially
when not taking T_DRSMDN into account. But this is what happens when a
remote wakeup occurs between SetPortFeature USB_PORT_FEAT_SUSPEND on the
root hub and musb_bus_suspend being called.

This commit returns -EBUSY when musb_bus_suspend is called while remote
wakeup is signalled and thus avoids to reset the RESUME bit. Ignoring
this error when musb_port_suspend is called from musb_hub_control is ok.

Signed-off-by: Daniel Glöckner <dg@emlix.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2b63f132 30-Apr-2018 Bin Liu <b-liu@ti.com>

usb: musb: host: fix potential NULL pointer dereference

musb_start_urb() doesn't check the pass-in parameter if it is NULL. But
in musb_bulk_nak_timeout() the parameter passed to musb_start_urb() is
returned from first_qh(), which could be NULL.

So wrap the musb_start_urb() call here with a if condition check to
avoid the potential NULL pointer dereference.

Fixes: f283862f3b5c ("usb: musb: NAK timeout scheme on bulk TX endpoint")
Cc: stable@vger.kernel.org # v3.7+
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1f81f118 23-Apr-2018 Johan Hovold <johan@kernel.org>

USB: musb: host: prevent core phy initialisation

Set the new HCD flag which prevents USB core from trying to manage our
phys.

This is needed to be able to associate the controller platform device
with the glue device device-tree node on the BBB which uses legacy USB
phys. Otherwise, the generic phy lookup in usb_phy_roothub_init() and
thus HCD registration fails repeatedly with -EPROBE_DEFER (see commit
178a0bce05cb ("usb: core: hcd: integrate the PHY wrapper into the HCD
core")).

Note that a related phy-lookup issue was recently worked around in the
phy core by commit b7563e2796f8 ("phy: work around 'phys' references to
usb-nop-xceiv devices"). Something similar may now be needed for other
USB phys, and in particular if we eventually want to let USB core manage
musb generic phys.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a9762b70 09-Mar-2018 Arnd Bergmann <arnd@arndb.de>

usb: musb: remove blackfin port

The blackfin architecture is getting removed, so we can clean up
all the special cases in the musb driver.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Aaron Wu <aaron.wu@analog.com>
Acked-by: Bin Liu <b-liu@ti.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
[arnd: adding in fixups from Aaron and Stephen]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>


# 44eb5e12 20-Feb-2018 Bin Liu <b-liu@ti.com>

Revert "usb: musb: host: don't start next rx urb if current one failed"

This reverts commit dbac5d07d13e330e6706813c9fde477140fb5d80.

commit dbac5d07d13e ("usb: musb: host: don't start next rx urb if current one failed")
along with commit b5801212229f ("usb: musb: host: clear rxcsr error bit if set")
try to solve the issue described in [1], but the latter alone is
sufficient, and the former causes the issue as in [2], so now revert it.

[1] https://marc.info/?l=linux-usb&m=146173995117456&w=2
[2] https://marc.info/?l=linux-usb&m=151689238420622&w=2

Cc: stable@vger.kernel.org # v4.7+
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3f514f97 26-Dec-2017 Corentin Labbe <clabbe@baylibre.com>

usb: musb: remove unused pipe variable

This patch fix the following build warning:
drivers/usb/musb/musb_host.c:1809:8: warning: variable 'pipe' set but not used [-Wunused-but-set-variable]
by removing the pipe variable in musb_host_rx()

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 576ec7fd 26-Dec-2017 Corentin Labbe <clabbe@baylibre.com>

usb: musb: remove unused frame variable

This patch fix the following warning
drivers/usb/musb/musb_host.c:223:8: warning: variable 'frame' set but not used [-Wunused-but-set-variable]
by remove the frame variable in musb_start_urb().

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 21b650c2 06-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: musb: Remove redundant license text

Now that the SPDX tag is in all USB files, that identifies the license
in a specific and legally-defined manner. So the extra GPL text wording
can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text. And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

No copyright headers or other non-license-description text was removed.

Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Acked-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5fd54ace 03-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: add SPDX identifiers to all remaining files in drivers/usb/

It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Update the drivers/usb/ and include/linux/usb* files with the correct
SPDX license identifier based on the license text in the file itself.
The SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.

This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1bff25ea 24-Aug-2017 Bin Liu <b-liu@ti.com>

usb: musb: print an error message when high bandwidth is unsupported

There are multiple places in usb core or controller driver which returns
-EMSGSIZE when a class driver queueing urb failed, so the "Message too
long" log doesn't help much for understanding the error.

Let the musb driver to specifically print a error message when
musb_urb_enqueue() returns -EMSGSIZE.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a2f65606 24-Aug-2017 Bin Liu <b-liu@ti.com>

usb: musb: print an error message when hwep alloc failed

Print an error message with qh maxpacket size and hb_mult when hwep
allocation failed, so we have a better idea why it is failed.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 45d73860 25-Jul-2017 Bin Liu <b-liu@ti.com>

usb: musb: fix tx fifo flush handling again

commit 68fe05e2a451 ("usb: musb: fix tx fifo flush handling") drops the
1ms delay trying to solve the long disconnect time issue when
application queued many tx urbs. However, the 1ms delay is needed for
some use cases, for example, without the delay, reconnecting AR9271 WIFI
dongle no longer works if the connection is dropped from the AP.

So let's add back the 1ms delay in musb_h_tx_flush_fifo(), and solve the
long disconnect time problem with a separate patch for
usb_hcd_flush_endpoint().

Cc: stable@vger.kernel.org # v4.4+
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c68bb0ef 21-Jun-2017 Gustavo A. R. Silva <garsilva@embeddedor.com>

usb: musb: compress return logic into one line

Simplify return logic to avoid unnecessary variable assignment.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Acked-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3c50ffef 17-May-2017 Tony Lindgren <tony@atomide.com>

usb: musb: Fix trying to suspend while active for OTG configurations

Commit d8e5f0eca1e8 ("usb: musb: Fix hardirq-safe hardirq-unsafe
lock order error") caused a regression where musb keeps trying to
enable host mode with no cable connected. This seems to be caused
by the fact that now phy is enabled earlier, and we are wrongly
trying to force USB host mode on an OTG port. The errors we are
getting are "trying to suspend as a_idle while active".

For ports configured as OTG, we should not need to do anything
to try to force USB host mode on it's OTG port. Trying to force host
mode in this case just seems to completely confuse the musb state
machine.

Let's fix the issue by making musb_host_setup() attempt to force the
mode only if port_mode is configured for host mode.

Fixes: d8e5f0eca1e8 ("usb: musb: Fix hardirq-safe hardirq-unsafe lock order error")
Cc: Johan Hovold <johan@kernel.org>
Cc: stable <stable@vger.kernel.org>
Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reported-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6def85a3 03-Jan-2017 Bin Liu <b-liu@ti.com>

usb: musb: core: add clear_ep_rxintr() to musb_platform_ops

During dma teardown for dequque urb, if musb load is high, musb might
generate bogus rx ep interrupt even when the rx fifo is flushed. In such
case any of the follow log messages could happen.

musb_host_rx 1853: BOGUS RX2 ready, csr 0000, count 0

musb_host_rx 1936: RX3 dma busy, csr 2020

As mentioned in the current inline comment, clearing ep interrupt in the
teardown path avoids the bogus interrupt.

Clearing ep interrupt is platform dependent, so this patch adds a
platform callback to allow glue driver to clear the ep interrupt.

This bug seems to be existing since the initial driver for musb support,
but I only validated the fix back to v4.1, so only cc stable for v4.1+.

cc: stable@vger.kernel.org # 4.1+
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6ddcabc2 28-Sep-2016 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: musb: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Cc: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 19ca682e 29-Jun-2016 Bin Liu <b-liu@ti.com>

usb: musb: host: add urb tracepoints

Add urb tracepoints for host mode.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b99d3659 29-Jun-2016 Bin Liu <b-liu@ti.com>

usb: musb: switch dev_dbg to tracepoints

Switch dev_dbg() to tracepoint debug musb_dbg().

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7b2c17f8 31-May-2016 Andrew Goodbody <andrew.goodbody@cambrionix.com>

usb: musb: Stop bulk endpoint while queue is rotated

Ensure that the endpoint is stopped by clearing REQPKT before
clearing DATAERR_NAKTIMEOUT before rotating the queue on the
dedicated bulk endpoint.
This addresses an issue where a race could result in the endpoint
receiving data before it was reprogrammed resulting in a warning
about such data from musb_rx_reinit before it was thrown away.
The data thrown away was a valid packet that had been correctly
ACKed which meant the host and device got out of sync.

Signed-off-by: Andrew Goodbody <andrew.goodbody@cambrionix.com>
Cc: stable@vger.kernel.org
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f3eec0cf 31-May-2016 Andrew Goodbody <andrew.goodbody@cambrionix.com>

usb: musb: Ensure rx reinit occurs for shared_fifo endpoints

shared_fifo endpoints would only get a previous tx state cleared
out, the rx state was only cleared for non shared_fifo endpoints
Change this so that the rx state is cleared for all endpoints.
This addresses an issue that resulted in rx packets being dropped
silently.

Signed-off-by: Andrew Goodbody <andrew.goodbody@cambrionix.com>
Cc: stable@vger.kernel.org
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 04471eb8 31-May-2016 Bin Liu <b-liu@ti.com>

usb: musb: host: correct cppi dma channel for isoch transfer

Incorrect cppi dma channel is referenced in musb_rx_dma_iso_cppi41(),
which causes kernel NULL pointer reference oops later when calling
cppi41_dma_channel_program().

Fixes: 069a3fd (usb: musb: Remove ifdefs for musb_host_rx in musb_host.c
part1)

Cc: <stable@vger.kernel.org> # v4.2+
Reported-by: Matwey V. Kornilov <matwey@sai.msu.ru>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b6a6631d 31-May-2016 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

usb: musb: host: make musb_tx_dma_set_mode_*() *void*

Now that the DMA engine check was moved to musb_tx_dma_porgram(), both
musb_tx_dma_set_mode_cppi_tusb() and musb_tx_dma_set_mode_mentor() always
return 0, so we can make both these functions *void*.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
[b-liu@ti.com: revise subject prefix]
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 858b9be7 31-May-2016 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

usb: musb: host: move DMA engine check from musb_tx_dma_set_mode_cppi_tusb() to its caller

Commit 754fe4a92c07 ("usb: musb: Remove ifdefs for TX DMA for musb_host.c")
looks incomplete: the DMA engine checks are done outside the Mentor/UX500
handler but inside the CPPI/TUSB handler. Move the checks out of the CPPI/
TUSB handler into its caller, musb_tx_dma_program().

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
[b-liu@ti.com: revise subject prefix]
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# dbac5d07 31-May-2016 Bin Liu <b-liu@ti.com>

usb: musb: host: don't start next rx urb if current one failed

urb->status is set when endpoint csr RXSTALL, H_ERROR, DATAERROR or
INCOMPRX bit is set. Those bits mean a broken pipe, so don't start next
urb when any of these bits is set by checking urb->status.

To minimize the risk of regression, only do so for RX, until we have a
test case to understand the behavior of TX.

The patch fixes system freeze issue caused by repeatedly invoking RX ISR
while removing a usb uart device connected to a hub, in which case the
hub has no chance to report the disconnect event due to the kernel is
busy in processing the RX interrupt flooding.

Fix checkpatch complaint (qh != NULL) as while.

Reported-by: Max Uvarov <muvarov@gmail.com>
Tested-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b5801212 31-May-2016 Bin Liu <b-liu@ti.com>

usb: musb: host: clear rxcsr error bit if set

The MUSB Programming Guide states that the driver should clear RXCSR
bit2 when the controller sets the bit.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f551e135 25-Apr-2016 Bin Liu <b-liu@ti.com>

Revert "usb: musb: musb_host: Enable HCD_BH flag to handle urb return in bottom half"

This reverts commit 2035772010db634ec8566b658fb1cd87ec47ac77.

Commit 20357720 claims throughput improvement for MSC/UVC, but I
don't see much improvement. Following are the MSC measurement using
dd on AM335x GP EVM.

with BCD_BH: read: 14.9MB/s, write: 20.9MB/s
without BCD_BH: read: 15.2MB/s, write: 21.2MB/s

However with this commit the following regressions have been observed.

1. ASIX usb-ethernet dongle is completely broken on UDP RX.

2. Unpluging a 3G modem, which uses option driver, behind a hub causes
console log flooding with the following message.

option_instat_callback: error -71

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4c2ba0c6 19-Feb-2016 Cristian Birsan <cristian.birsan@microchip.com>

usb: musb: fix DMA for host mode

Commit ac33cdb16681 ("usb: musb: Remove ifdefs for musb_host_rx in
musb_host.c part5") introduces a problem setting DMA host mode.

The musb_advance_schedule() is called immediately after receiving an
endpoint RX interrupt without waiting for the DMA transfer to complete.

As a consequence when the dma complete interrupt arrives the in_qh
member of hw_ep is already null an the musb_host_rx() exits on !urb
error case. Fix the done condition that advances the musb schedule.

Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
Signed-off-by: Joshua Henderson <joshua.henderson@microchip.com>
Tested-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# bba40e69 11-Feb-2016 Cristian Birsan <cristian.birsan@microchip.com>

usb: musb: Fix DMA desired mode for Mentor DMA engine

Commit 754fe4a92c07 ("usb: musb: Remove ifdefs for TX DMA for musb_host.c")
introduces a problem setting the desired channel mode for the Mentor DMA
engine.

There is a case where an address is incorrectly assigned to the DMA
channel desired mode when it should instead be assigned the actual mode
value. This results in the value of channel->desired_mode not being
correct.

Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
Signed-off-by: Joshua Henderson <joshua.henderson@microchip.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# 68fe05e2 05-Nov-2015 Bin Liu <b-liu@ti.com>

usb: musb: fix tx fifo flush handling

Here are a few changes in musb_h_tx_flush_fifo().

- It has been observed that sometimes (if not always) musb is unable
to flush tx fifo during urb dequeue when disconnect a device. But
it seems to be harmless, since the tx fifo flush is done again in
musb_ep_program() when re-use the hw_ep.

But the WARN() floods the console in the case when multiple tx urbs
are queued, so change it to dev_WARN_ONCE().

- applications could queue up many tx urbs, then the 1ms delay could
causes minutes of delay in device disconnect. So remove it to get
better user experience. The 1ms delay does not help the flushing
anyway.

- cleanup the debug code - related to lastcsr.

----
Note: The tx fifo flush issue has been observed during device disconnect
on AM335x.

To reproduce the issue, ensure tx urb(s) are queued when unplug the usb
device which is connected to AM335x usb host port.

I found using a usb-ethernet device and running iperf (client on AM335x)
has very high chance to trigger the problem.

Better to turn on dev_dbg() in musb_cleanup_urb() with CPPI enabled to
see the issue when aborting the tx channel.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 6cc2af6d 20-Mar-2015 Hans de Goede <hdegoede@redhat.com>

usb: musb: Make busctl_offset an io-op rather then a define

The Allwinner (sunxi) implementation of the musb has its busctl registers
indexed by the MUSB_INDEX register rather then in a flat address space.

This commit turns MUSB_BUSCTL_OFFSET from a macro into an io-op which can
be overridden from the platform ops.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 0cb74b3d 20-Mar-2015 Hans de Goede <hdegoede@redhat.com>

usb: musb: Make musb_write_rxfun* and musb_write_rxhub* work like their tx versions

For some reason the musb_write_rxfun* and musb_write_rxhub* functions had
a different function prototype and some extra magic needed on the caller side
compared to their tx counterparts, this commit makes them work the same as
their tx counterparts.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 8ca9a321 23-Apr-2015 Johan Hovold <johan@kernel.org>

USB: musb: fix inefficient copy of unaligned buffers

Make sure only to copy any actual data rather than the whole buffer,
when releasing the temporary buffer used for unaligned non-isochronous
transfers.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ac33cdb1 01-May-2015 Tony Lindgren <tony@atomide.com>

usb: musb: Remove ifdefs for musb_host_rx in musb_host.c part5

Remove ifdefs for musb_host_rx to get closer to building in
all the DMA drivers.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# e530bb8f 01-May-2015 Tony Lindgren <tony@atomide.com>

usb: musb: Remove ifdefs for musb_host_rx in musb_host.c part4

Remove ifdefs for musb_host_rx to get closer to building in
all the DMA drivers.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# cff84bdb 01-May-2015 Tony Lindgren <tony@atomide.com>

usb: musb: Remove ifdefs for musb_host_rx in musb_host.c part3

Remove ifdefs for musb_host_rx to get closer to building in
all the DMA drivers.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 557d543e 01-May-2015 Tony Lindgren <tony@atomide.com>

usb: musb: Remove ifdefs for musb_host_rx in musb_host.c part2

Remove ifdefs for musb_host_rx to get closer to building in
all the DMA drivers.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 069a3fd1 01-May-2015 Tony Lindgren <tony@atomide.com>

usb: musb: Remove ifdefs for musb_host_rx in musb_host.c part1

Remove ifdefs for musb_host_rx to get closer to building in
all the DMA drivers.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 754fe4a9 01-May-2015 Tony Lindgren <tony@atomide.com>

usb: musb: Remove ifdefs for TX DMA for musb_host.c

We can remove the ifdefs by setting up helper functions for
mentor DMA and cppi/tusb DMA.

Note that I've kept the existing formatting as otherwise this
patch becomes pretty much unreadable.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# f8e9f34f 01-May-2015 Tony Lindgren <tony@atomide.com>

usb: musb: Fix up DMA related macros

Pass struct musb to tusb_dma_omap() and is_cppi_enabled(),
and add macros for the other DMA controllers. Populate the
platform specific quirks with the DMA type and use it during
runtime.

Note that platform glue layers with no custom DMA code are
tagged with MUSB_DMA_INVENTRA which may have a chance of
working. Looks like the defconfigs for these use PIO_ONLY,
so this should not break existing configs.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# d72348fb 23-Apr-2015 Johan Hovold <johan@kernel.org>

usb: musb: fix inefficient copy of unaligned buffers

Make sure only to copy any actual data rather than the whole buffer,
when releasing the temporary buffer used for unaligned non-isochronous
transfers.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 20357720 05-Mar-2014 George Cherian <george.cherian@ti.com>

usb: musb: musb_host: Enable HCD_BH flag to handle urb return in bottom half

Enable HCD_BH flag for musb host controller driver.
This improves the MSC/UVC through put. With this enabled
even 640x480@30fps webcam streaming is also supported.

Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 68693b8e 11-Dec-2014 Sebastian Andrzej Siewior <bigeasy@linutronix.de>

usb: musb: stuff leak of struct usb_hcd

since the split of host+gadget mode in commit 74c2e9360058 ("usb: musb:
factor out hcd initalization") we leak the usb_hcd struct. We call now
musb_host_cleanup() which does basically usb_remove_hcd() and also sets
the hcd variable to NULL. Doing so makes the finall call to
musb_host_free() basically a nop and the usb_hcd remains around for ever
without anowner.
This patch drops that NULL assignment for that reason.

Fixes: 74c2e9360058 ("usb: musb: factor out hcd initalization")
Cc: <stable@vger.kernel.org> # v3.11+
Cc: Daniel Mack <zonque@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# e47d9254 30-Oct-2014 Antoine Tenart <atenart@kernel.org>

usb: move the OTG state from the USB PHY to the OTG structure

Before using the PHY framework instead of the USB PHY one, we need to
move the OTG state into another place, since it won't be available when
USB PHY isn't used. This patch moves the OTG state into the OTG
structure, and makes all the needed modifications in the drivers
using the OTG state.

[ balbi@ti.com : fix build regressions with phy-tahvo.c, musb_dsps.c,
phy-isp1301-omap, and chipidea's debug.c ]

Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 49a9e885 26-May-2014 Daniel Mack <zonque@gmail.com>

usb: musb: fix wrong indentation in musb_host.c

Just a cosmetic cleanup with no functional change.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# ff3fcac9 26-May-2014 Daniel Mack <zonque@gmail.com>

usb: musb: introduce dma_channel.rx_packet_done

The musb/cppi41 glue layer is capable of handling transactions that span
over more than one USB packet by reloading the DMA descriptors
partially. An urb is considered completed when either its transfer
buffer has been filled entirely (actual_length ==
transfer_buffer_length) or if a packet in the stream has less bytes than
the endpoint's wMaxPacketSize.

Once one of the above conditions is met, musb_dma_completion() is called
from cppi41_trans_done(). However, the final decision whether or not to
return the urb to its owner is made by the core and its determination of
the variable 'done' in musb_host_rx(). This code has currently no way of
knowing what the size of the last packet was, and whether or not to
give back the urb due to a short read.

Fix this by introducing a new boolean flag in 'struct dma_channel', and
set it from musb_cppi41.c. If set, it will make the core do what the
DMA layer decided and complete the urb.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Acked-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 2ccc6d30 26-May-2014 Daniel Mack <zonque@gmail.com>

usb: musb: fix bit mask for CSR in musb_h_tx_flush_fifo()

The datasheet says that MUSB_TXCSR_FLUSHFIFO is only valid when
MUSB_TXCSR_TXPKTRDY is set as well.

With this patch applied, the warning in this function does no longer
kick in when an USB soundcard is unplugged while the stream is active.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 9c547699 26-May-2014 Daniel Mack <zonque@gmail.com>

usb: musb: remove unnecessary (void) prefix at function calls

Just a little cleanup that removes unnecessary casts.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Acked-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# eac44dc4 01-Jun-2014 Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>

usb: musb: musb_host.c: Cleaning up uninitialized variables

There is a risk that the variable will be used without being initialized.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 3c4653c1 04-Feb-2014 Ajay Kumar Gupta <ajay.gupta@ti.com>

usb: musb: host: Fix SuperSpeed hub enumeration

Disables PING on status phase of control transfer.
PING token is not mandatory in status phase of control transfer
and so some high speed USB devices don't support it. If such devices
are connected to MUSB then they would not respond to PING token
causing delayed or failed enumeration.

[Roger Q] Fixes enumeration issues with some Super-Speed USB hubs
e.g. Dlink DUB-1340

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# c57c41d2 27-Jan-2014 George Cherian <george.cherian@ti.com>

usb: musb: musb_host: Enable ISOCH IN handling for AM335x host

Enable the isochrounous IN handling for AM335x HOST.
Reprogram CPPI to receive consecutive ISOCH frames in the same URB.

Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 803a5362 08-Jan-2014 Paul Gortmaker <paul.gortmaker@windriver.com>

usb: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>. Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5ae477b0 02-Jan-2014 Rahul Bedarkar <rahulbedarkar89@gmail.com>

USB: musb: correct spelling mistakes in comment and error string

Signed-off-by: Rahul Bedarkar <rahulbedarkar89@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3c9740a1 04-Nov-2013 Peter Chen <peter.chen@freescale.com>

usb: hcd: move controller wakeup setting initialization to individual driver

Individual controller driver has different requirement for wakeup
setting, so move it from core to itself. In order to align with
current etting the default wakeup setting is enabled (except for
chipidea host).

Pass compile test with below commands:
make O=outout/all allmodconfig
make -j$CPU_NUM O=outout/all drivers/usb

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 869c5978 26-Nov-2013 Daniel Mack <zonque@gmail.com>

usb: musb: dsps: add support for suspend and resume

The dsps platform needs to save save some registers at suspend time and
restore them after resume. This patch adds a struct for these registers,
and also lets the musb core know that the core registers need to be
saved as well.

We also have to explicitly de-assert the port reset upon resume on this
platform, but musb_port_reset() should not be called from glue layers.

Hence, introduce a flag in struct musb_hdrc_config for this.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 94f72136 25-Nov-2013 Daniel Mack <zonque@gmail.com>

usb: musb: call musb_port_suspend from musb_bus_suspend

Make musb_port_suspend() externally available, and call it when to host
goes into suspend. This allows the core to go into suspend while a
device is connected.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 2b84f92b 08-Oct-2013 Joe Perches <joe@perches.com>

usb: Remove unnecessary semicolons

These aren't necessary after switch and if blocks.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 90474288 20-Aug-2013 Sebastian Andrzej Siewior <bigeasy@linutronix.de>

usb: musb: only remove host/udc if it has been added

musb_shutdown() removes always USB host and device.
musb_init_controller() adds host and device depending on port_mode. If
port mode is set to HOST then the removal of UDC leads only to:
|(NULL device *): gadget not registered.
and nothing else happens. If port mode is set to DEVICE and we remove
the host then we oops in usb_remove_hcd().
This patch ensures that we only remove host in OTG/host mode and device
only in OTG/device mode to avoid any trouble.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 8a1ea51f 29-May-2013 Alan Stern <stern@rowland.harvard.edu>

USB: MUSB: upgrade the isochronous API

This patch attempts to fix the isochonour API in the musb host
driver. In particular, the urb->start_frame field should always be
set by the driver; it isn't an input parameter.

The simplest way to accomplish this is to treat all URBs as though the
URB_ISO_ASAP flag was set. This won't give the right behavior when an
underrun occurs, but I don't know enough about the musb driver to
handle that case.

Unfortunately, I have no way to test this change.

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


# 91e3af64 29-May-2013 Felipe Balbi <balbi@ti.com>

usb: musb: host: fix build warning

very minor patch fixing the following build warning on
a debug message:

drivers/usb/musb/musb_host.c: In function ‘musb_host_rx’:
drivers/usb/musb/musb_host.c:1763:4: warning: format ‘%x’ \
expects argument of type ‘unsigned int’, but argument \
6 has type ‘dma_addr_t’ [-Wformat]

Signed-off-by: Felipe Balbi <balbi@ti.com>


# ed74df12 24-Apr-2013 Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>

usb: musb: make use_sg flag URB specific

Since highmem PIO URB handling was introduced in:

8e8a551 usb: musb: host: Handle highmem in PIO mode

when a URB is being handled it may happen that the static use_sg flag
was set by a previous URB with buffer in highmem. This leads to error
in handling the present URB.

Fix this by making the use_sg flag URB specific.

Cc: stable <stable@vger.kernel.org> # 3.7+
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# aee5500f 15-May-2013 Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>

usb: musb: enable ux500 host side dma support

Host side dma support for ux500 is enabled by piggybacking on Inventra
dma support.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 8b125df5 10-Apr-2013 Daniel Mack <zonque@gmail.com>

usb: musb: eliminate musb_to_hcd

With the hcd is now a direct member of struct musb, we can now simply
eliminate the musb_to_hcd() macro. There aren't that many users left
anyway, as some where already fixed up when parts were factored out to
musb_host.c

Signed-off-by: Daniel Mack <zonque@gmail.com>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 2cc65fea 10-Apr-2013 Daniel Mack <zonque@gmail.com>

usb: musb: add musb_host_setup() and musb_host_cleanup()

This patch re-introduces the bits that are necessary to use the musb
controller in host mode.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 74c2e936 10-Apr-2013 Daniel Mack <zonque@gmail.com>

usb: musb: factor out hcd initalization

The musb struct is currently allocated along with the hcd, which makes
it difficult to build a driver that only acts as gadget device.

Fix this by allocating musb directly, and keep the hcd around as
a pointer in the musb struct.

struct hc_driver musb_hc_driver can now also be static to musb_host.c,
and the macro musb_to_hcd() is just a pointer dereferencer for now, and
will be eliminated later.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 0b3eba44 10-Apr-2013 Daniel Mack <zonque@gmail.com>

usb: musb: factor some host-specific functions

In particular, this introduces musb_host_resume_root_hub()and
musb_host_poke_root_hub() which will be stubbed out later.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 8408fd1d 29-Mar-2013 Ruslan Bilovol <ruslan.bilovol@ti.com>

usb: musb: implement (un)map_urb_for_dma hooks

MUSB controller cannot work in DMA mode with misaligned buffers,
switching in PIO mode.

HCD core has hooks that allow to override the default DMA
mapping and unmapping routines for host controllers that have
special DMA requirements, such as alignment constraints.

It is observed that work in PIO mode is slow and it's better
to align buffers properly before passing them to MUSB

This increased throughput 80->120 MBits/s over musb@omap4 with
USB Gigabit Ethernet adapter attached.

Some ideas are taken from ehci-tegra.c

Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 42c0bf1c 07-Mar-2013 Felipe Balbi <balbi@ti.com>

usb: otg: prefix otg_state_string with usb_

all other functions under drivers/usb/ start
with usb_, let's do the same thing.

This patch is in preparation for moving otg_state_string
to usb-common.c and deleting otg.c completely.

Signed-off-by: Felipe Balbi <balbi@ti.com>


# a70b8442 04-Jan-2013 supriya karanth <supriya.karanth@stericsson.com>

usb: musb: Double buffering issues in host mode TX

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

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

Signed-off-by: supriya karanth <supriya.karanth@stericsson.com>
Signed-off-by: Praveena NADAHALLY <praveen.nadahally@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# f2786281 05-Dec-2012 supriya karanth <supriya.karanth@stericsson.com>

usb: musb: set AUTOSET for full speed bulk DMA transfer in host mode

The "mult" factor is not updated properly for the can_bulk_split()
case.

The AUTOSET bit in the TXCSR is not being set if the "mult"
factor is greater than 1 for the High Bandwidth ISO case.
But the "mult" factor is also greater than 1 in case of Full speed
bulk transfers with the packet splitting in TXMAXP register
enabled with can_bulk_split().

Without the AUTOSET the DMA transfers will not progress in mode1

[ balbi@ti.com : fix braces placement ]

Signed-off-by: supriya karanth <supriya.karanth@stericsson.com>
Signed-off-by: Praveena NADAHALLY <praveen.nadahally@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# b18d26f6 30-Oct-2012 Sebastian Andrzej Siewior <bigeasy@linutronix.de>

usb: musb: Perform only write access on MUSB_INTRTXE

This is part of the workaround for AM35x advisory Advisory 1.1.20.
The advisory says that the IPSS bridge can't handle 8 & 16 bit read
access. An 16bit read access to MUSB_INTRTXE results in an 32bit read
access which also reads INTRRX and therefore may lose interrupts.
This patch uses a shadow register of MUSB_INTRTXE so we only perform
write access to it.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 3067779b 15-Aug-2012 yuzheng ma <myz147@gmail.com>

usb: musb: host: fix for musb_start_urb Oops

when using musb_urb_enqueue to submit three urbs to the same endpoint, when
hep->hcpriv is NULL, qh will be allocated when the first urb is completed.

When the IRQ completes the next two urbs, qh->hep->hcpriv will be set to NULL.
Now the second urb get musb->lock and executes musb_schedule(), but
next_urb(qh) is NULL, so musb_start_urb will Oops.

[ balbi@ti.com : practically rewrote commit log so it makes sense ]

Signed-off-by: mayuzheng <myz147@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 8e8a5516 07-Aug-2012 Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>

usb: musb: host: Handle highmem in PIO mode

In case of USB bulk transfer, when himem page
is received, the usb_sg_init function sets the
urb transfer buffer to NULL. When such URB
transfer is handled, kernel crashes in PIO mode.
Handle this by mapping the highmem buffer in PIO mode.

Signed-off-by: Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>
Signed-off-by: Praveena NADAHALLY <praveen.nadahally@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# f283862f 19-Jul-2012 Ajay Kumar Gupta <ajay.gupta@ti.com>

usb: musb: NAK timeout scheme on bulk TX endpoint

Fixes endpoint starvation issue when more than one bulk QH is
multiplexed on the reserved bulk TX endpoint.

This patch sets the NAK timeout interval for such QHs, and when
a timeout triggers the next QH will be scheduled.

This scheme doesn't work for devices which are connected to a
high to full speed tree (transaction translator) as there is
no NAK timeout interrupt from the musb controller from such
devices.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 3132122c 19-Jul-2012 Ajay Kumar Gupta <ajay.gupta@ti.com>

usb: musb: host: don't program dma for zero byte tx

This is to reduce the overhead of dma programming for zero byte
transmit as same can be done using pio mode.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 8c778db9 21-Jun-2012 Ajay Kumar Gupta <ajay.gupta@ti.com>

usb: musb: host: release dma channels if no active io

Currently DMA channels are allocated and they remain allocated
even if there is no active data transfer. Added channel_release()
whenever there is no pending request.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 2ed9127c 01-Jun-2012 Mantesh Sarasetti <mantesh@ti.com>

usb: musb: host: Disable MUSB DMA mode incase of DMA channel request failure

Currently in case of MUSB DMA channel request failure we are not
clearing MUSB_RXCSR_DMAENAB, MUSB_RXCSR_H_AUTOREQ and
MUSB_RXCSR_AUTOCLEAR bits of MUSB RXCSR of MUSB DMA. Which is
causing failure in receipt of data packets in next transfer.

Fix is to disable the MUSB DMA mode and related bits incase of
DMA channel request fails

Signed-off-by: Mantesh Sarashetti <mantesh@ti.com>
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 692933b2 14-Mar-2012 Ajay Kumar Gupta <ajay.gupta@ti.com>

usb: musb: fix bug in musb_cleanup_urb

Control transfers with data expected from device to host will use usb_rcvctrlpipe()
for urb->pipe so for such urbs 'is_in' will be set causing control urb to fall
into the first "if" condition in musb_cleanup_urb().

Fixed by adding logic to check for non control endpoints.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# ccc080c7 12-Dec-2011 Ajay Kumar Gupta <ajay.gupta@ti.com>

usb: musb: fix reset issue with full speed device

TXMAXP register is not getting programmed correctly for a full speed device
as can_bulk_split() have been removed by
"0662481: usb: musb: disable double buffering when it's broken" patch.

Adding back the case for can_bulk_split() to fix the reset message seen with
a full speed stick.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 29cc8897 23-Aug-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

USB: use usb_endpoint_maxp() instead of le16_to_cpu()

Now ${LINUX}/drivers/usb/* can use usb_endpoint_maxp(desc) to get maximum packet size
instead of le16_to_cpu(desc->wMaxPacketSize).
This patch fix it up

Cc: Armin Fuerst <fuerst@in.tum.de>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Johannes Erdfelt <johannes@erdfelt.com>
Cc: Vojtech Pavlik <vojtech@suse.cz>
Cc: Oliver Neukum <oliver@neukum.name>
Cc: David Kubicek <dave@awk.cz>
Cc: Johan Hovold <jhovold@gmail.com>
Cc: Brad Hards <bhards@bigpond.net.au>
Acked-by: Felipe Balbi <balbi@ti.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Thomas Dahlmann <dahlmann.thomas@arcor.de>
Cc: David Brownell <david-b@pacbell.net>
Cc: David Lopo <dlopo@chipidea.mips.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Michal Nazarewicz <m.nazarewicz@samsung.com>
Cc: Xie Xiaobo <X.Xie@freescale.com>
Cc: Li Yang <leoli@freescale.com>
Cc: Jiang Bo <tanya.jiang@freescale.com>
Cc: Yuan-hsin Chen <yhchen@faraday-tech.com>
Cc: Darius Augulis <augulis.darius@gmail.com>
Cc: Xiaochen Shen <xiaochen.shen@intel.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: OKI SEMICONDUCTOR, <toshiharu-linux@dsn.okisemi.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Ben Dooks <ben@simtec.co.uk>
Cc: Thomas Abraham <thomas.ab@samsung.com>
Cc: Herbert Pötzl <herbert@13thfloor.at>
Cc: Arnaud Patard <arnaud.patard@rtp-net.org>
Cc: Roman Weissgaerber <weissg@vienna.at>
Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Tony Olech <tony.olech@elandigitalsystems.com>
Cc: Florian Floe Echtler <echtler@fs.tum.de>
Cc: Christian Lucht <lucht@codemercs.com>
Cc: Juergen Stuber <starblue@sourceforge.net>
Cc: Georges Toth <g.toth@e-biz.lu>
Cc: Bill Ryder <bryder@sgi.com>
Cc: Kuba Ober <kuba@mareimbrium.org>
Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 72887c86 30-May-2011 Márton Németh <nm127@freemail.hu>

usb: musb: host: compare status for negative error values

Variable d is a struct usb_iso_packet_descriptor. The status filed is usually
negative when an error happens.

Signed-off-by: Márton Németh <nm127@freemail.hu>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# c51e36dc 07-May-2011 Sergei Shtylyov <sshtylyov@ru.mvista.com>

usb: musb: host: remove duplicate check in musb_ep_program()

musb_ep_program() contains obviously duplicate check for 'dma_channel' in its
IN/receive path -- removing it allows to save one level of indentation. While
at it, improve the comment style...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 5c8a86e1 10-May-2011 Felipe Balbi <balbi@ti.com>

usb: musb: drop unneeded musb_debug trickery

We have a generic way of enabling/disabling
different debug messages on a driver called
DYNAMIC_PRINTK. Anyone interested in enabling
just part of the debug messages, please read
the documentation under:

Documentation/dynamic-debug-howto.txt

for information on how to use that great
infrastructure.

Signed-off-by: Felipe Balbi <balbi@ti.com>


# 3df00453 04-May-2011 Anatolij Gustschin <agust@denx.de>

usb: fix building musb drivers

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

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

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# c8cf203a 26-Jan-2011 Robert Morell <rmorell@nvidia.com>

USB: HCD: Add usb_hcd prefix to exported functions

The convention is to prefix symbols exported from the USB HCD core with
"usb_hcd". This change makes unmap_urb_setup_for_dma() and
unmap_urb_for_dma() consistent with that.

Signed-off-by: Robert Morell <rmorell@nvidia.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 06624818 20-Jan-2011 Felipe Balbi <balbi@ti.com>

usb: musb: disable double buffering when it's broken

We know that blackfin doesn't support double
buffering feature as of today. So we add a
flag set by musb_platform_init() to forcefully
disable that feature.

Such flag is created and marked as deprecated
to force us to find a solution for the missing
double buffering support on blackfin.

Signed-off-by: Felipe Balbi <balbi@ti.com>


# f8afbf7f 24-Sep-2010 T. S., Anil Kumar <anil@ti.com>

usb: musb: host: support DMA transfers greater than max channel length

Add support for MUSB Host DMA transfers greater than max
channel length, so that such transfers won't be truncated.

Signed-off-by: Anil Shetty <anil@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 496dda70 24-Sep-2010 Maulik Mankad <x0082077@ti.com>

usb: musb: host: unmap the buffer for PIO data transfers

The USB stack maps the buffer for DMA if the controller supports DMA.
MUSB controller can perform DMA as well as PIO transfers.
The buffer needs to be unmapped before CPU can perform
PIO data transfers.

Export unmap_urb_for_dma() so that drivers can perform
the DMA unmapping in a sane way.

Signed-off-by: Maulik Mankad <x0082077@ti.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 4c647338 20-Sep-2010 Santosh Shilimkar <santosh.shilimkar@ti.com>

usb: musb: host: Issue a memory barrier before starting DMA

This patch fixes the issue which was observed while transfering
a large file ( > 20MB) over USB (OMAP MUSB controller acts as USB host)
to an attached USB thumb drive.

It was found that CDB field of CBW packet was set to 0x0. This was
due to missing a barrier before DMA engine starts transfer.
This buffer is allocated using dma_alloc_coherent which gives
non-cacheble but bufferable memory and hence needed a write
memory barrier to flush the write buffer.

More info on this thread is here:
http://www.spinics.net/lists/linux-omap/msg33987.html

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Maulik Mankad <x0082077@ti.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 714bc5ef 25-Mar-2010 Dan Carpenter <error27@gmail.com>

musb: potential use after free

We assign "urb->hcpriv = qh;" a few lines down. I'm pretty sure we
want it "urb->hcpriv" to be NULL not a freed value.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# ae926976 08-Mar-2010 Sonic Zhang <sonic.zhang@analog.com>

USB: musb: fix build error introduced by isoc change

The recent commit "usb: musb: Fix for isochronous IN transfer" (f82a689fa)
seems to have been against an older kernel version. It uses the old style
naming of variables. Unfortunately, this breaks building for most MUSB
users out there since "bDesiredMode" has been renamed to "desired_mode".

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Felipe Balbi <felipe.balbi@nokia.com>
Acked-by: Anand Gadiyar <gadiyar@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 9f445cb2 28-Jan-2010 Cliff Cai <cliff.cai@analog.com>

USB: musb: disable double buffering for older RTL versions

Trying to use double buffer modes in RTL versions <2.0 may result in
infinite hangs or data corruption. So avoid them with older versions.

Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 5274dab6 28-Dec-2009 Swaminathan S <swami.iyer@ti.com>

usb: musb: workaround toggle bug when doing bulk transfer after isoc

This patch implements the work around for a Mentor controller related
bug where it's observed a BULK Tx toggle error on the bus when a
BULK IO gets scheduled on an endpoint that was earlier used for
handling ISOC transaction and needed to start on 1 toggle. When such
a situation arises even if the TXCSR toggle bits are programmed
correctly by the musb driver the data gets transmitted with 0 toggle
which leads to toggle error on the bus and the BULK transaction fails.
In case of MSC write, the device gets reset by the Host.

This Mentor bug is observed on almost all Mentor versions (1.3, 1.5,
1.8). Confirmed on DM644x, DM355, DM365, OMAPL13x platforms.

Signed-off-by: Swaminathan S <swami.iyer@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 8b4959d6 04-Dec-2009 Felipe Balbi <felipe.balbi@nokia.com>

USB: musb: musb_host: fix sparse warning

Fix the following sparse warning:

drivers/usb/musb/musb_host.c:1642:9: warning: symbol 'status' shadows an earlier one

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# dfeffa53 17-Nov-2009 Ajay Kumar Gupta <ajay.gupta@ti.com>

USB: musb: fix ISOC Tx programming for CPPI DMAs

Isochronous Tx DMA is getting programmed but never getting started
for CPPI and TUSB DMAs and thus Isochronous Tx doesn't work.

Fixing it by starting DMAs using musb_h_tx_dma_start().

Signed-off-by: Swaminathan S <swami.iyer@ti.com>
Signed-off-by: Babu Ravi <ravibabu@ti.com>
Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 1fe975f9 10-Jul-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com>

USB: musb_host: undo incorrect change in musb_advance_schedule()

Commit c9cd06b3d6ea825c62e277def929cc4315802b48 (musb_host: refactor
URB giveback) included due to my overlook the change incorrect in the
context of the current kernel -- undo it.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 89368d3d 01-Jul-2009 David Brownell <dbrownell@users.sourceforge.net>

USB: musb: silence "suspend as a_wait_vrise is_active" msgs

Get rid of some obnoxious and inappropriate messaging, mostly on
DaVinci, when usbcore tries to autosuspend a root hub if just a
mini/micro-A connector is connected. Symptom: endless stream of
messages reading like:

musb_bus_suspend 2221: trying to suspend as a_wait_vrise is_active=1

Improve that musb bus suspend primitive a bit. Take advantage of
this call to update the OTG state machine if appropriate, moving
the device out of the A_WAIT_VRISE state. There's basically no
timer for that state transition just now, except with tusb6010;
that can make trouble.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# a483d706 03-Apr-2009 Ajay Kumar Gupta <ajay.gupta@ti.com>

musb: add high bandwidth ISO support

Tested on OMAP3 host side with Creative (Live! Cam Optia) USB camera
which uses high bandwidth isochronous IN endpoints. FIFO mode 4 is
updated to provide the needed 4K endpoint buffer without breaking
the g_nokia composite gadget configuration. (This is the only
gadget driver known to use enough endpoints to notice the change.)

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>


# 84e250ff 31-Mar-2009 David Brownell <dbrownell@users.sourceforge.net>

musb: proper hookup to transceiver drivers

Let the otg_transceiver in MUSB be managed by an external driver;
don't assume it's integrated. OMAP3 chips need it to be external,
and there may be ways to interact with the transceiver which add
functionality to the system.

Platform init code is responsible for setting up the transeciver,
probably using the NOP transceiver for integrated transceivers.
External ones will use whatever the board init code provided,
such as twl4030 or something more hands-off.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# c9cd06b3 27-Mar-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com>

musb_host: refactor URB giveback

As musb_advance_schedule() is now the only remaning
caller of musb_giveback() (and the only valid context
of such call), just fold the latter into the former
and then rename __musb_giveback() into musb_giveback().

This is a net minor shrink.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 81ec4e4a 27-Mar-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com>

musb_host: streamline musb_cleanup_urb() calls

The argument for the 'is_in' parameter of musb_cleanup_urb()
is always extracted from an URB that's passed to the function.
So that parameter is superfluous; remove it.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 22a0d6f1 27-Mar-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com>

musb_host: simplify check for active URB

The existance of the scheduling list shouldn't matter in
determining whether there's currectly an URB executing on a
hardware endpoint. What should actually matter is the 'in_qh'
or 'out_qh' fields of the 'struct musb_hw_ep' -- those are
set in musb_start_urb() and cleared in musb_giveback() when
the endpoint's URB list drains. Hence we should be able to
replace the big *switch* statements in musb_urb_dequeue()
and musb_h_disable() with mere musb_ep_get_qh() calls...

While at it, do some more changes:

- add 'is_in' variable to musb_urb_dequeue();

- remove the unnecessary 'epnum' variable from musb_h_disable();

- fix the comment style in the vicinity.

This is a minor shrink of source and object code.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 3e5c6dc7 27-Mar-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com>

musb_host: factor out musb_ep_{get|set}_qh()

Factor out the often used code to get/set the active 'qh'
pointer for the hardware endpoint. Change the way the case
of a shared FIFO is handled by setting *both* 'in_qh' and
'out_qh' fields of 'struct musb_hw_ep'. That seems more
consistent and makes getting to the current 'qh' easy when
the code knows the direction beforehand.

While at it, turn some assignments into intializers and
fix declaration style in the vicinity.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 846099a6 27-Mar-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com>

musb_host: refactor musb_save_toggle() (take 2)

Refactor musb_save_toggle() as follows:

- replace 'struct musb_hw_ep *ep' parameter by 'struct
musb_qh *qh' to avoid re-calculating this value

- move usb_settogle() call out of the *if* operator.

This is a net minor shrink of source and object code.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 6b6e9710 26-Mar-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com>

USB: musb: fix isochronous TXDMA (take 2)

Multi-frame isochronous TX URBs transfers in DMA mode never
complete with CPPI DMA because musb_host_tx() doesn't restart
DMA on the second frame, only emitting a debug message.
With Inventra DMA they complete, but in PIO mode. To fix:

- Factor out programming of the DMA transfer from
musb_ep_program() into musb_tx_dma_program();

- Reorder the code at the end of musb_host_tx() to
facilitate the fallback to PIO iff DMA fails;

- Handle the buffer offset consistently for both
PIO and DMA modes;

- Add an argument to musb_ep_program() for the same
reason (it only worked correctly with non-zero
offset of the first frame in PIO mode);

- Set the completed isochronous frame descriptor's
'actual_length' and 'status' fields correctly in
DMA mode.

Also, since CPPI reportedly doesn't like sending isochronous
packets in the RNDIS mode, change the criterion for this
mode to be used only for multi-packet transfers. (There's
no need for that mode in the single-packet case anyway.)

[ dbrownell@users.sourceforge.net: split comment paragraph
into bullet list, shrink patch delta, style tweaks ]

Signed-off-by: Pavel Kiryukhin <pkiryukhin@ru.mvista.com>
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# b6e434a5 26-Mar-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com>

USB: musb: sanitize clearing TXCSR DMA bits (take 2)

The MUSB code clears TXCSR_DMAMODE incorrectly in several
places, either asserting that TXCSR_DMAENAB is clear (when
sometimes it isn't) or clearing both bits together. Recent
versions of the programmer's guide require DMAENAB to be
cleared first, although some older ones didn't.

Fix this and while at it:

- In musb_gadget::txstate(), stop clearing the AUTOSET
and DMAMODE bits for the CPPI case since they never
get set anyway (the former bit is reserved on DaVinci);
but do clear the DMAENAB bit on the DMA error path.

- In musb_host::musb_ep_program(), remove the duplicate
DMA controller specific code code clearing the TXCSR
previous state, add the code to clear TXCSR DMA bits
on the Inventra DMA error path, to replace such code
(executed late) on the PIO path.

- In musbhsdma::dma_channel_abort()/dma_controller_irq(),
add/use the 'offset' variable to avoid MUSB_EP_OFFSET()
invocations on every RXCSR/TXCSR access.

[dbrownell@users.sourceforge.net: don't introduce CamelCase,
shrink diff]

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# c7bbc056 26-Mar-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com>

USB: musb: bugfixes for multi-packet TXDMA support

We really want to use DMA mode 1 for all multi-packet transfers;
that's one IRQ on DMA completion, instead of one per packet.

There is an important issue with such transfers, especially on
the host side: when such transfers end with a full-size packet,
we must defer musb_dma_completion() calls until the FIFO empties.
Else we report URB completions too soon, and may clobber data in
the FIFO fifo when writing the next packet (losing data).

The Inventra DMA support uses DMA mode 1, but it ignores that
issue. The CPPI DMA support uses mode 0, but doesn't handle
its TXPKTRDY interrupts quite right either; it can get stale
"packet ready" interrupts, and report transfer completion too
early using slightly different code paths, also losing data.

So I'm solving it in a generic way -- by adding a sort of the
"interrupt filter" into musb_host_tx(), catching these cases
where a DMA completion IRQ doesn't suffice and removing some
needlessly controller-specific logic. When a TXDMA interrupt
happens and DMA request mode 1 is active, that filter resets
to mode 0 and defers URB completion processing until TXPKTRDY,
unless the FIFO is already empty. Related filtering logic in
Inventra and CPPI code gets removed.

Since it should be competely safe now to use the DMA request
mode 1 for host side transfers with the CPPI DMA controller,
set it in musb_h_tx_dma_start() ... now renamed (and shared).

[ dbrownell@users.sourceforge.net: don't introduce more
CamElCase; use more concise explanations ]

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 78322c1a 26-Mar-2009 David Brownell <dbrownell@users.sourceforge.net>

USB: musb_host, fix ep0 fifo flushing

The MUSB host side can't share generic TX FIFO flush logic
with EP0; the EP0 TX status register bits are different
from those for other entpoints.

Resolve this issue by providing a new EP0-specific routine
to flush and reset the FIFO, which pays careful attention to
restrictions listed in the latest programmer's guide. This
gets rid of an open issue whereby the usbtest control write
test (#14) failed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 74bb3508 26-Mar-2009 David Brownell <dbrownell@users.sourceforge.net>

USB: musb_host, minor enqueue locking fix (v2)

Someone noted that the enqueue path used an unlocked access
for usb_host_endpoint->hcpriv ... fix that, by being safe
and always accessing it under spinlock protection.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 1e0320f0 24-Feb-2009 Ajay Kumar Gupta <ajay.gupta@ti.com>

USB: musb: NAK timeout scheme on bulk RX endpoint

Fixes endpoint starvation issue when more than one bulk QH is
multiplexed on the reserved bulk RX endpoint, which is normal
for cases like serial and ethernet adapters.

This patch sets the NAK timeout interval for such QHs, and when
a timeout triggers the next QH will be scheduled. (This resembles
the bulk scheduling done in hardware by EHCI, OHCI, and UHCI.)

This scheme doesn't work for devices which are connected to a
high to full speed tree (transaction translator) as there is
no NAK timeout interrupt from the musb controller from such
devices.

Tested with PIO, Inventra DMA, CPPI DMA.

[ dbrownell@users.sourceforge.net: fold in start_urb() update;
clarify only for bulk RX; don't accidentally clear WZC bits ]

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Cc: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 5d67a851 24-Feb-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com>

USB: musb: rewrite host periodic endpoint allocation

The current MUSB host code doesn't make use of all the available
FIFOs in for periodic transfers since it wrongly assumes the RX
and TX sides of any given hw_ep always share one FIFO.

Change: use 'in_qh' and 'out_qh' fields of the 'struct musb_hw_ep'
to check the endpoint's business; get rid of the now-unused 'periodic'
array in the 'struct musb'. Also optimize a loop induction variable
in the endpoint lookup code.

(Based on a previous patch from Ajay Kumar Gupta <ajay.gupta@ti.com>)

[ dbrownell@users.sourceforge.net: clarify description and origin
of this fix; whitespace ]

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 136733d6 21-Feb-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com>

USB: musb: use right poll limit for low speed devices

Remove wrongly applied upper limit on the interrupt transfer
interval for low speed devices (not much of an error per se,
according to USB specs).

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 3ecdb9ac 21-Feb-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com>

USB: musb: be careful with 64K+ transfer lengths, host side

Feeding 32-bit length cast down to 'u16' to min() to calculate the FIFO
count in musb_host_tx() risks sending a short packet prematurely for
transfer sizes over 64 KB.

Similarly, although data transfer size shouldn't exceed 65535 bytes for
the control endpoint, making musb_h_ep0_continue() more robust WRT URBs
with possibly oversized buffer will not hurt either...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 51d9f3e1 21-Feb-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com>

USB: musb: fix data toggle saving with shared FIFO

For some strange reason the host side musb_giveback() decides
that it's always got an IN transfer when the hardware endpoint
is using a shared FIFO. This causes musb_save_toggle() to read
the toggle state from the RXCSR register instead of TXCSR, and
may also cause unneeded reloading of RX endpoint registers.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# dc61d238 21-Feb-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com>

USB: musb: host endpoint_disable() oops fixes

The musb_h_disable() routine can oops in some cases:

- It's not safe to read hep->hcpriv outside musb->lock,
since it gets changed on completion IRQ paths.

- The list iterators aren't safe to use in that way;
just remove the first element while !list_empty(),
so deletions on other code paths can't make trouble.

We need two "scrub the list" loops because only one branch
should touch hardware and advance the schedule.

[ dbrownell@users.sourceforge.net: massively simplify
patch description; add key points as code comments ]

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# a2fd814e 21-Feb-2009 Sergei Shtylyov <sshtylyov@ru.mvista.com>

USB: musb: fix urb_dequeue() method

The urb_dequeue() method forgets to unlink 'struct musb_qh' from the
control or bulk schedules when the URB being cancelled is the only
one queued to its endpoint. That will cause musb_advance_schedule()
to block once it reaches 'struct musb_qh' with now empty URB list, so
URBs queued for other endpoints after the one being dequeued will not
be served.

Fix by unlinking the QH from the list except when it's already being
handled (typically by musb_giveback). Since a QH with an empty URB
list is now supposed to be freed, do that. And remove a now-useless
check from musb_advance_schedule().

[ dbrownell@users.sourceforge.net: update patch description,
and fold in a dequeue() comment patch ]

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# b7bdcb79 21-Feb-2009 Dmitry Krivoschekov <dkrivoschekov@ru.mvista.com>

USB: musb: fix musb_host_tx() for shared endpoint FIFO

The input queue should be used for TX on endpoints which
share FIFO hardware. The host TX path wasn't doing that.

Shared FIFOs are most often configured for periodic endpoints,
which are mostly used for RX/IN transfers ... that's probably
how this bug managed to linger for a long time.

[ dbrownell@users.sourceforge.net: update patch description ]

Signed-off-by: Dmitry Krivoschekov <dkrivoschekov@ru.mvista.com>
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 96bcd090 24-Jan-2009 Julia Lawall <julia@diku.dk>

USB: musb uses endpoint functions

This set of patches introduces calls to the following set of functions:

usb_endpoint_dir_in(epd)
usb_endpoint_dir_out(epd)
usb_endpoint_is_bulk_in(epd)
usb_endpoint_is_bulk_out(epd)
usb_endpoint_is_int_in(epd)
usb_endpoint_is_int_out(epd)
usb_endpoint_num(epd)
usb_endpoint_type(epd)
usb_endpoint_xfer_bulk(epd)
usb_endpoint_xfer_control(epd)
usb_endpoint_xfer_int(epd)
usb_endpoint_xfer_isoc(epd)

In some cases, introducing one of these functions is not possible, and it
just replaces an explicit integer value by one of the following constants:

USB_ENDPOINT_XFER_BULK
USB_ENDPOINT_XFER_CONTROL
USB_ENDPOINT_XFER_INT
USB_ENDPOINT_XFER_ISOC

An extract of the semantic patch that makes these changes is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r1@ struct usb_endpoint_descriptor *epd; @@

- ((epd->bmAttributes & \(USB_ENDPOINT_XFERTYPE_MASK\|3\)) ==
- \(USB_ENDPOINT_XFER_CONTROL\|0\))
+ usb_endpoint_xfer_control(epd)

@r5@ struct usb_endpoint_descriptor *epd; @@

- ((epd->bEndpointAddress & \(USB_ENDPOINT_DIR_MASK\|0x80\)) ==
- \(USB_DIR_IN\|0x80\))
+ usb_endpoint_dir_in(epd)

@inc@
@@

#include <linux/usb.h>

@depends on !inc && (r1||r5)@
@@

+ #include <linux/usb.h>
#include <linux/usb/...>
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# c6cf8b00 02-Dec-2008 Bryan Wu <cooloney@kernel.org>

USB: musb: add Blackfin specific configuration to MUSB

Some config registers are not avaiable in Blackfin, we have to comment them out.

v1-v2:
- remove Blackfin specific header file
- add Blackfin register version to musb_regs.h header file

Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# bb1c9ef1 24-Nov-2008 David Brownell <dbrownell@users.sourceforge.net>

USB: musb: host side diagnostics tweaks

Random host-side MUSB updates, mostly relating to better diagnostics:

+ Improve diagnostics on host side:
- tx flush fifo:
* Avoid hundreds of duplicate TX FIFONOTEMPTY messages
* make "Can't flush TX fifo" a warning, and say which endpoint
- giveback:
* use correct status code
* show completion function name not just URB pointer
- Fix annoying "1 bytes" (should be "1 byte")

+ Be more consistent about failing init of unusable fifo_mode

It's not clear why that "can't flush TX fifo" message appears, though
it might relate to disconnection; I see it not infrequently

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# aa5cbbec 17-Nov-2008 Felipe Balbi <felipe.balbi@nokia.com>

usb: musb: fix bug in musb_schedule

This bug was introduced recently. Fix it before bigger
problems appear.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 23d15e07 29-Oct-2008 Ajay Kumar Gupta <ajay.gupta@ti.com>

usb: musb: fix BULK request on different available endpoints

Fixes co-working issue of usb serial device with usb/net devices while
oter endpoints are free and can be used.This patch implements the policy
that if endpoint resources are available then different BULK request goes
to different endpoint otherwise they are multiplexed to one reserved
endpoint as currently done.

Switch statement case is reordered in musb_giveback() to take care of
bulk request both in multiplex scenario and otherwise.

NAK limit scheme has to be added for multiplexed BULK request scenario
to avoid endpoint starvation due to usb/net devices.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# f82a689f 29-Oct-2008 Ajay Kumar Gupta <ajay.gupta@ti.com>

usb: musb: Fix for isochronous IN transfer

Fixes blurred capture images in dma mode. Isochronous error field in
urb and source data buffer pointer were not updated properly in dma
mode.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# c767c1c6 11-Sep-2008 David Brownell <dbrownell@users.sourceforge.net>

usb: musb_hdrc build fixes

Minor musb_hdrc updates:

- so it'll build on DaVinci, given relevant platform updates;
* remove support for an un-shipped OTG prototype
* rely on gpiolib framework conversion for the I2C GPIOs
* the <asm/arch/hdrc_cnf.h> mechanism has been removed

- catch comments up to the recent removal of the per-SOC header
with the silicon configuration data;

- and remove two inappropriate "inline" declarations which
just bloat host side code.

There are still some more <asm/arch/XYZ.h> ==> <mach/XYZ.h>
changes needed in this driver, catching up to the relocation
of most of the include/asm-arm/arch-* contents.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Cc: stable <stable@kernel.org> [2.6.27]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 2492e674 11-Sep-2008 Ajay Kumar Gupta <ajay.gupta@ti.com>

OMAP:MUSB: Corrects urb unlink function path

Fixes kernel panic while ISO IN transfer is aborted.Replaced
usb_hcd_unlink_urb_from_ep() from musb_giveback() to __musb_giveback()
to make sure urb is unlinked before giveback when __musb_giveback() is
called from musb_urb_dequeue().

Acquired musb->lock() before usb_hcd_unlink_urb_from_ep() within in
enqueue path.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# ae5ad296 11-Sep-2008 Ajay Kumar Gupta <ajay.gupta@ti.com>

OMAP:MUSB: Fixes the TT programming.

Fixes enumeration failures when a USB device attached to a LS hub is
connected to OMAP EVM via HS hub. This is fixed by correctly
programming hub address register in enqueue path.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 550a7375 23-Jul-2008 Felipe Balbi <felipe.balbi@nokia.com>

USB: Add MUSB and TUSB support

This patch adds support for MUSB and TUSB controllers
integrated into omap2430 and davinci. It also adds support
for external tusb6010 controller.

Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>