1
0
Fork 0
Commit Graph

74 Commits (51ef74f6400c731827454d010b35b122103fe9f9)

Author SHA1 Message Date
Greg Kroah-Hartman 976f8bef9c usb: patches for v3.11 merge window
All function drivers are now converted to our new configfs-based
 binding. Eventually this will help us getting rid of in-kernel
 gadget drivers and only keep function drivers in the kernel.
 
 MUSB was taught that it needs to be built for host-only and
 device-only modes too. We had this support long ago but it
 involved a ridiculous amount of ifdefs. Now we have a much
 cleaner approach.
 
 Samsung Exynos4 platform now implements HSIC support.
 
 We're introducing support for AB8540 and AB9540 PHYs.
 
 MUSB module reinsertion now works as expected, before we were
 getting -EBUSY being returned by the resource checks done on
 driver core.
 
 DWC3 now has minimum support for TI's AM437x series of SoCs.
 
 OMAP5 USB3 PHY learned one extra DPLL configuration values because
 that PHY is reused in TI's DRA7xx devices.
 
 We're introducing support for Faraday fotg210 UDCs.
 
 Last, but not least, the usual set of non-critical fixes and cleanups
 ranging from usage of platform_{get,set}_drvdata to lock improvements.
 
 Signed-of-by: Felipe Balbi <balbi@ti.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRuODuAAoJEIaOsuA1yqREEYMP/212PIcMM/niwl2T97l+Ispc
 EVe8ebg69/t+LjEHmipyw00HvBuGv+6ccJbuU+NBSSi229iIkxXlE+Q7MoywHOZg
 eSozqiIXIotkNTPg4vT6YfWspyNaoiDrl9TK3KMP9SyctlgxqMdcfke5dqpGpdUP
 xqYhWCAbZ6uvu6Lq6r3NwX1pMKhXxbnTDCY77YOCb/H8UPlSHSW4nwjAKYvsEWwD
 RLXn0UKDZF4FRm296ftIHDD8rDazCaQPkkglQejFrqheNpbR7SUkC672veca7xF5
 2iaWS62p7SWDHsfzyLpeJwoglHcxRa3E8ZqdT9ALvrimMTm0jVM0pzDSCF2xBpFq
 UP78YX2S94o/YC8NXfp6GMf5CFSlLDxQ7oahcUpUBVtx5l2v8bfyb2/KOrB6kHBS
 v8RJqFbcYXHHygaYS0oXGqKg2ScwYeVIenlrk8ByPrfkJqS3v7CKLB0wNrV5ZWyC
 nnfyMF+bW+M00nb9jKjS+Utni8looKpWdKcmAdP/zPVKDZE5zh5WL2q/zWepWdgP
 8nIslvivXmAkNs8wN5ji/E/w9qqkXiYCVkSQXfXPgBLWesaQqBR2geRWduSetKSm
 AHINjU4+wXkRR0V1HyKzn+b1v5yZ5ksV7n5SXltyXKNeO0IeBDHNBHRVPFqHdgau
 u2prz3aPvqEFENqgr7z5
 =O9AH
 -----END PGP SIGNATURE-----

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

Felipe writes:

usb: patches for v3.11 merge window

All function drivers are now converted to our new configfs-based
binding. Eventually this will help us getting rid of in-kernel
gadget drivers and only keep function drivers in the kernel.

MUSB was taught that it needs to be built for host-only and
device-only modes too. We had this support long ago but it
involved a ridiculous amount of ifdefs. Now we have a much
cleaner approach.

Samsung Exynos4 platform now implements HSIC support.

We're introducing support for AB8540 and AB9540 PHYs.

MUSB module reinsertion now works as expected, before we were
getting -EBUSY being returned by the resource checks done on
driver core.

DWC3 now has minimum support for TI's AM437x series of SoCs.

OMAP5 USB3 PHY learned one extra DPLL configuration values because
that PHY is reused in TI's DRA7xx devices.

We're introducing support for Faraday fotg210 UDCs.

Last, but not least, the usual set of non-critical fixes and cleanups
ranging from usage of platform_{get,set}_drvdata to lock improvements.

Signed-of-by: Felipe Balbi <balbi@ti.com>
2013-06-12 14:44:13 -07:00
Greg Kroah-Hartman 141dc40ee3 Merge 3.10-rc5 into usb-next
We need the changes in this branch.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-08 21:27:51 -07:00
Alan Stern 8a1ea51f87 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>
2013-05-30 21:34:29 +09:00
Felipe Balbi 91e3af64c7 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>
2013-05-30 03:07:09 +03:00
Virupax Sadashivpetimath ed74df12dc 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>
2013-05-28 22:17:21 +03:00
Mian Yousaf Kaukab aee5500f4f 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>
2013-05-28 19:58:57 +03:00
Daniel Mack 8b125df5b2 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>
2013-05-28 19:22:26 +03:00
Daniel Mack 2cc65feab2 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>
2013-05-28 19:22:24 +03:00
Daniel Mack 74c2e93600 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>
2013-05-28 19:22:23 +03:00
Daniel Mack 0b3eba442d 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>
2013-05-28 19:22:21 +03:00
Ruslan Bilovol 8408fd1d83 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>
2013-04-02 11:42:49 +03:00
Felipe Balbi 42c0bf1ce7 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>
2013-03-18 11:18:03 +02:00
supriya karanth a70b84421b 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>
2013-01-17 15:45:44 +02:00
supriya karanth f278628193 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>
2013-01-10 14:16:47 +02:00
Sebastian Andrzej Siewior b18d26f6ad 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>
2012-10-31 15:22:18 +02:00
Greg Kroah-Hartman 2bcb132c69 Merge 3.6-rc6 into usb-next
This resolves the merge problems with:
	drivers/usb/dwc3/gadget.c
	drivers/usb/musb/tusb6010.c
that had been seen in linux-next.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-16 20:42:46 -07:00
yuzheng ma 3067779b15 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>
2012-09-06 19:52:26 +03:00
Virupax Sadashivpetimath 8e8a551654 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>
2012-08-07 14:27:18 +03:00
Ajay Kumar Gupta f283862f3b 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>
2012-08-03 09:34:42 +03:00
Ajay Kumar Gupta 3132122c66 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>
2012-08-03 09:34:39 +03: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
Ajay Kumar Gupta 8c778db9f0 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>
2012-06-22 13:15:55 +03:00
Mantesh Sarasetti 2ed9127cff 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>
2012-06-04 18:37:18 +03:00
Ajay Kumar Gupta 692933b2cc 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>
2012-04-10 19:11:48 +03:00
Ajay Kumar Gupta ccc080c77c 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>
2011-12-14 09:32:51 +02:00
Kuninori Morimoto 29cc88979a 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>
2011-08-23 09:47:40 -07:00
Márton Németh 72887c8644 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>
2011-06-09 12:01:03 +03:00
Sergei Shtylyov c51e36dc11 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>
2011-05-13 14:34:07 +03:00
Felipe Balbi 5c8a86e10a 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>
2011-05-13 14:34:04 +03:00
Anatolij Gustschin 3df0045325 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>
2011-05-06 18:16:39 -07:00
Greg Kroah-Hartman 66b0835e2b Merge 2.6.38-rc5 into usb-next
This is needed to resolve some merge conflicts that were found
in the USB host controller patches, and reported by Stephen Rothwell.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-17 09:56:55 -08:00
Robert Morell c8cf203a1d 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>
2011-02-04 11:48:18 -08:00
Felipe Balbi 0662481855 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>
2011-02-01 10:41:30 +02:00
T. S., Anil Kumar f8afbf7f2b 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>
2010-10-22 10:21:54 -07:00
Maulik Mankad 496dda704b 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>
2010-10-22 10:21:53 -07:00
Santosh Shilimkar 4c64733826 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>
2010-09-24 11:05:01 -07:00
Dan Carpenter 714bc5ef3e 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>
2010-04-30 09:25:08 -07:00
Sonic Zhang ae926976ac 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>
2010-03-19 07:24:08 -07:00
Cliff Cai 9f445cb299 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>
2010-03-02 14:54:48 -08:00
Swaminathan S 5274dab6cb 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>
2010-03-02 14:53:45 -08:00
Felipe Balbi 8b4959d6a5 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>
2009-12-11 11:55:28 -08:00
Ajay Kumar Gupta dfeffa531c 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>
2009-11-30 16:43:16 -08:00
Sergei Shtylyov 1fe975f930 USB: musb_host: undo incorrect change in musb_advance_schedule()
Commit c9cd06b3d6 (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>
2009-07-12 15:16:40 -07:00
David Brownell 89368d3d11 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>
2009-07-12 15:16:37 -07:00
Ajay Kumar Gupta a483d7068f 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>
2009-06-15 21:44:41 -07:00
David Brownell 84e250ffa7 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>
2009-06-15 21:44:40 -07:00
Sergei Shtylyov c9cd06b3d6 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>
2009-06-15 21:44:40 -07:00
Sergei Shtylyov 81ec4e4a51 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>
2009-06-15 21:44:40 -07:00
Sergei Shtylyov 22a0d6f138 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>
2009-06-15 21:44:40 -07:00
Sergei Shtylyov 3e5c6dc711 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>
2009-06-15 21:44:40 -07:00