Commit graph

959 commits

Author SHA1 Message Date
Tony Lindgren 754fe4a92c 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>
2015-05-07 13:36:07 -05:00
Tony Lindgren fb91cddc54 usb: musb: Remove DMA ifdef for musb_gadget.c short_packet
Let's get rid of the horrible ifdef in middle of the expression.
We can do it by adding a variable for short_packet and testing
it separately for DMA related code.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-07 13:36:02 -05:00
Tony Lindgren 729697a13d usb: musb: Get rid of the DMA ifdefs for musb_core.c
For musb_core.c we can now just drop the DMA related
ifdef and use the already existing runtime test for
!is_cppi_enabled(musb) instead.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-07 13:35:57 -05:00
Tony Lindgren 7f6283ed6f usb: musb: Set up function pointers for DMA
Set up function pointers for DMA so get closer to
being able to build in all the DMA engines.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-07 13:35:51 -05:00
Tony Lindgren f8e9f34f80 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>
2015-05-07 13:35:46 -05:00
Bin Liu 205845ef70 usb: musb: only set test mode once
The MUSB test mode register can only be set once, otherwise the result
is undefined.

This prevents the debugfs testmode entry to set the register more than
once which causes test failure.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-04-27 15:51:45 -05:00
Johan Hovold d72348fb5c 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>
2015-04-27 15:48:39 -05:00
Greg Kroah-Hartman c8d1bc12c7 usb: generic resume timeout for v4.1
This part 2 pull request contains only the patches
 which make sure everybody on linux uses the same
 resume timeout value.
 
 Signed-off-by: Felipe Balbi <balbi@ti.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVJEivAAoJEIaOsuA1yqREV6QP/1oJVdBxzOeQVXyGZsZT4k0E
 T8SKmTIJmaCdSjgazSXAhqF7IR992sTM7urHZ2hww3tftODNVHvfFkgDlSguHwkr
 GV95YpNv99ash7spjod3xVOt8lDvrt6FHs7Foj4b0yQZ1yXUZsOH4j8G4gMYOgTd
 bq1mO2/NaaM7xiddzPMCGpSkL6NcsWrurJ8JiOlBXaUIkSR+Cwe9+8vzEDrxfSM+
 6yBTLQCdvR0ammqV0YMNsF9dGLO8yiDotC6b104i3yCqpAZnyj0RJQ3riH7ESxsG
 eSKkCXXGY0OWDGDcnWTskYEHJ7iDfg5MrlzBJyneMjauGKNeIoJRRYWP/f6NSV9m
 GHxRV1ITKC61Dtt3w+Oy2a16UpAbq7/w1q/SkQl4YtJ8l0P1PUb+TfOZpTOsCLLF
 cLXUKJufGWhuGbo+e2m6GizNCsDi5LlfdZcjIjVKRXpyiZI0peqyGj16mTm70UUY
 /A9nsLtE7c6bqHMTcFQFRx4d2iHmkilyzQqOvx4ulo1rovNMafgmZJF7Kq0LY7ZO
 Uj4s2rEAjqbELbOiEIf8HzGP+J/QuECG4SHyPEQsiG0drYyoCOqGR1S3kV7aJgFz
 krl4zTvXR8EOk2IpPa8PDzmMr7YCYzlXOxzmSoJiZhqqpLH7cHYkDiRTmyxn+eB3
 lEjEzBA8J9CG4iRIFjk3
 =RqsO
 -----END PGP SIGNATURE-----

Merge tag 'usb-for-v4.1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-testing

Felipe writes:

usb: generic resume timeout for v4.1

This part 2 pull request contains only the patches
which make sure everybody on linux uses the same
resume timeout value.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-04-10 13:45:27 +02:00
Felipe Balbi 309be23936 usb: musb: use new USB_RESUME_TIMEOUT
Make sure we're using the new macro, so our
resume signaling will always pass certification.

Based on original work by Bin Liu <Bin Liu <b-liu@ti.com>>

Cc: Bin Liu <b-liu@ti.com>
Cc: <stable@vger.kernel.org> # v3.10+
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-04-07 12:58:35 -05:00
Tony Lindgren d30323f810 usb: musb: dsps: fix build on i386 when COMPILE_TEST is set
Commit 3e457371f4 ("usb: musb: Fix fifo reads for dm816x with musb_dsps")
fixed a USB error on dm816x, but introduced a new build error on i386
when COMPILE_TEST is set:

drivers/usb/musb/musb_dsps.c: In function ‘dsps_read_fifo32’:
drivers/usb/musb/musb_dsps.c:624:3: error: implicit declaration of function
‘readsl’ [-Werror=implicit-function-declaration]
readsl(fifo, dst, len >> 2);

Let's fix this by using ioread32_rep() instead of readsl() as that's
more portable.

Fixes: 3e457371f4 ("usb: musb: Fix fifo reads for dm816x with musb_dsps")
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Cc: Bin Liu <binmlist@gmail.com>
Cc: Brian Hutchinson <b.hutchman@gmail.com>
Cc: George Cherian <george.cherian@ti.com>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-03 19:09:53 +02:00
Sergei Shtylyov e95af3aa1d musb_virthub: use USB_DT_HUB
Fix  using the  bare number to set the 'bDescriptorType' field of the Hub
Descriptor while the value  is #define'd in <linux/usb/ch11.h>.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-03 19:03:16 +02:00
Greg Kroah-Hartman 1c41a9570a usb: patches for v4.1 merge window
As usual, a big pile of commits. This time a total
 of 111 non-merge commits.
 
 Other than the usual set of cleanups and non-critical
 fixes, we have some interesting work for AM335x's MUSB
 babble recovery. Now that takes a lot less time and we
 don't have to Reset MUSB all the time.
 
 The printer gadget has been converted to configfs interface
 and the atmel udc has learned suspend/resume with wakeup.
 
 Signed-off-by: Felipe Balbi <balbi@ti.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVEZlvAAoJEIaOsuA1yqREvPMP/1dxQ6ufjkfmBmeZWiDWmwQs
 uoLskjNqVlnmcjWdasEwUSKMJMYfxNAmabYCx7ZWdmcDi0FNvmrjSfXqmM5uG5bF
 UKgP/7KbiK9WSRAcAuFEqYCMcAoH2CcLhlZ7BF7Peo+WxeQrh0A4ZPxh4VVJI2D4
 47/bpXFqPydVZyZurpfB0QA1r5jjsG+tJdP/LJKv6/g38XSBs4cgFUzzBWDN8212
 YVKlCiRWRwnCOrYFP1pf/gR4SM8UF4Vd+lDZ28JnwcxCmTKKMhAAoHjgckV6UctW
 Ur+hshsuvPwFWm9Rqp77TnO37LranaFUR2W2cBUGiPSZaUeXsdOhORpT+S64nuZi
 ZEw4qp9QlRwH8wCBT0m/Uozv+CZ7VP41hjYdFpcUevd/XLPQjx1ddn032jGYsrtC
 o+drLGtuULimusf/14zs1X4ejLdeYy6f0hLzqyDS8zTHAjToAmrM3Uw9nQWxWauB
 rHdTYMrgMGoolnIFVSLgR6xbGMu9wCYexylKFwVWEV6xrj4ZgpoVitUGg5DphCQy
 FdEepkeWgAUTcYC3wcIUHHC9wVS3YgPWRmyKjnh65kIFDGjPjHMK1eW06RGuhld/
 A92UJNIga34RtUXSUrcuwRBtWY+pDE/6XxppqzxTKAMjT9HV8JNPZGHu+2nKP0kp
 qu9PqszUGOyCuTG9+A+E
 =U+M2
 -----END PGP SIGNATURE-----

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

Felipe writes:

usb: patches for v4.1 merge window

As usual, a big pile of commits. This time a total
of 111 non-merge commits.

Other than the usual set of cleanups and non-critical
fixes, we have some interesting work for AM335x's MUSB
babble recovery. Now that takes a lot less time and we
don't have to Reset MUSB all the time.

The printer gadget has been converted to configfs interface
and the atmel udc has learned suspend/resume with wakeup.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-24 22:57:49 +01:00
Tony Lindgren 3e457371f4 usb: musb: Fix fifo reads for dm816x with musb_dsps
Looks like dm81xx can only do 32-bit fifo reads like am35x. Let's set
up musb-dsps with a custom read_fifo function based on the compatible
flag.

Otherwise we can get the following errors when starting dhclient on a
asix USB Ethernet adapter:

asix 2-1:1.0 eth2: asix_rx_fixup() Bad Header Length 0xffff003c, offset 4

While at it, let's also remove pointless cast of the driver data.

Cc: Bin Liu <binmlist@gmail.com>
Cc: Brian Hutchinson <b.hutchman@gmail.com>
Cc: George Cherian <george.cherian@ti.com>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-24 11:36:38 -05:00
Takeyoshi Kikuchi 72a472d2f9 usb: musb: cppi41: fix condition to call cppi41_trans_done().
connect AR9271(USB wifi) to AM335x, and send a flood ping from Mac OSX,
AR9271 is stopped.

on USB bus, the following occurs.

 - OUT transaction is ACKed (NYET).
 - IN transaction is ACKed (512bytes).
 - PING-NAK transaction is continued for about 2 seconds (AR9271 timeout?).

In current imprementation, IN-transaction is not completed because it
checks the empty of TX-FIFO in cppi41_dma_callback().
As a result, communication to AR9271 stops.

This patch modified to check the empty of TX-FIFO only when OUT-transaction.

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-11 11:34:37 -05:00
Felipe Balbi 33c300cb90 usb: musb: dsps: don't fake of_node to musb core
If we pass our own of_node to musb_core, at least
pinctrl settings will be duplicated, meaning that
pinctrl framework will try to select default pin
state for musb_core when they were already requested
by musb-dsps.

A Warning will be printed however things will still
work.

Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-11 10:19:35 -05:00
Felipe Balbi 983f3cabf6 usb: musb: dsps: request phy using our device pointer
musb shouldn't have of_node and phy phandle is passed
to dsps device, not musb's.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-11 10:19:34 -05:00
Felipe Balbi ad78c91860 usb: musb: dsps: just start polling already
there's no need to fake an IRQ, just check
if VBUS is valid already.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:33 -05:00
Felipe Balbi 9e204d885a usb: musb: dsps: use msecs_to_jiffies instead
when polling, we were using n * HZ (where n is
an integer in seconds), however HZ isn't always
correct if we're using cpufreq. A better way
is to use msecs_to_jiffies(n) (where n is now
an integer in miliseconds).

while at that, also rename poll_seconds to poll_timeout
and  change its type to unsigned int.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:32 -05:00
Felipe Balbi 043f5b75dd usb: musb: cppi41: do not call udelay()
according to comment in code, HS completion
will happen pretty fast, instead of using
udelay(), let's just busy loop and drop a
cpu_relax() where udelay() was.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:32 -05:00
Felipe Balbi af63429cf0 usb: musb: cppi41: exit early when tx fifo is empty
as soon as we find out tx fifo is empty, there's
no need to break out of the loop just to have another
branch to complete the transfer. We can just complete
transfer and exit early.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:32 -05:00
Felipe Balbi 1b61625f8b usb: musb: cppi41: decrease indentation level
no functional changes, clean up only.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:32 -05:00
Felipe Balbi 34754dec8a usb: musb: core: always try to recover from babble
we can also have babble conditions with LS/FS
and we also want to recover in that case.

Because of that we will drop the check of HSMODE
and always try to run babble recovery.

Suggested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:30 -05:00
Felipe Balbi 0244336f81 usb: musb: core: disable irqs inside babble recovery
There's no point is splitting those anymore.

We're now also able to drop another forward
declaration.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:30 -05:00
Felipe Balbi 06753fe115 usb: musb: core: remove unnecessary forward declaration
no functional changes, cleanup only.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:29 -05:00
Felipe Balbi 83b8f5b8c0 usb: musb: core: drop recover_work
that's not needed anymore. Everything that we
call is irq-safe, so we might as well not
have a delayed work for babble recovery.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:29 -05:00
Felipe Balbi b28a643240 usb: musb: rename ->reset() to ->recover()
recover is a much better name than reset, considering
we don't really reset the IP, just run platform-specific
babble recovery algorithm.

while at that, also fix a typo in comment and add kdoc
for recover memeber of platform_ops.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:29 -05:00
Felipe Balbi b4dc38fd45 usb: musb: core: simplify musb_recover_work()
we're not resetting musb at all, just restarting
the session. This means we don't need to touch PHYs
or VBUS or anything like that. Just make sure session
bit is reenabled after MUSB dropped it.

while at that, make sure to tell usbcore that we're
dropping the session and, thus, disconnecting the
device.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:29 -05:00
Felipe Balbi 011d0dd540 usb: musb: dsps: do not reset musb on babble
All we have to do is, really, drop session bit
and let the session restart.

Big thanks goes to Bin Liu <b-liu@ti.com> for
inspiring this work.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:28 -05:00
Felipe Balbi d5fa3e9f73 usb: musb: core: decrease delayed_work time
When babble IRQ happens, we need to wait only
5.3us (320 cycles of 60MHz clock), we will give
it some slack and schedule our work a 10 usecs into
the future.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:28 -05:00
Felipe Balbi ba7ee8bb31 usb: musb: don't touch devctl from babble recovery
We do *not* want to touch devctl at all when
trying to recover from babble. All we want to
do is mask IRQs until we're done without our
babble recovery, at which point we will unmask
IRQs.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:28 -05:00
Felipe Balbi e1eb3eb8b0 usb: musb: core: refactor IRQ enable/disable to separate functions
sometimes we want to just mask/unmask interrupts
without touching devctl register. For those
cases, let's introduce musb_enable_interrupts and
musb_disable_interrupts()

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:27 -05:00
Felipe Balbi 3709ffca64 usb: musb: dsps: add dsps_ prefix to sw_babble_control
this makes it easier to filter function traces.
No functional changes.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:27 -05:00
Felipe Balbi a67cab72b8 usb: musb: core: controller drops session automatically
Whenever babble happens, MUSB controller will
drop session automatically.

The only case where it won't drop the session,
is when we're running on AM335x and SW_SESSION_CTRL
bit has been set. In that case, controller will
not touch session bit so SW has a chance to recover
from babble condition.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:27 -05:00
Felipe Balbi f860f0b1ea usb: musb: dsps: check for the single bit
We want to check if that particular bit is
set. It could very well be that bootloader
(or romcode) has fiddled with MUSB before
us which could leave other bits set in this
register.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:27 -05:00
Felipe Balbi 52b9e6eb07 usb: musb: dsps: remove babble check from dsps irq handler
musb->int_usb already contains the correct
information for musb-core to handle babble.

In fact, this very check was just causing a
nonsensical babble interrupt storm.

With this I can get test.sh to run and, even though
all tests fail with timeout, that's still better
than locking up the system due to IRQ storm.

Also, if I remove g_zero and load g_mass_storage,
then everything works fine again.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:26 -05:00
Felipe Balbi b2c7361bd0 usb: musb: core: there is no connect interrupt in peripheral mode
MUSB does not generate a connect IRQ when working
in peripheral mode.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:26 -05:00
Felipe Balbi 46571889ec usb: musb: core: remove unnecessary reg access from resume IRQ
when musb is operating as host and a remote wakeup
fires up, a resume interrupt will be raised. At that
point SUSPENDM bit is automatically cleared and
RESUME bit is automatically set.

Remove those two from IRQ handler.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:26 -05:00
Felipe Balbi 0acff6b831 usb: musb: core: break long line
no functional changes, clean up only.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:25 -05:00
Felipe Balbi d0fc0a20b5 usb: musb: core: move babble recovery inside babble check
There was already a proper place where we were
checking for babble interrupts, move babble
recovery there.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:25 -05:00
Felipe Balbi d0cddae792 usb: musb: dsps: return error code if reset fails
if reset fails, we should return a *negative*
error code, not a positive value.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:25 -05:00
Felipe Balbi 28378d5ed5 usb: musb: core: fix highspeed check
FSDEV is set for both HIGH and FULL speeds,
the correct HIGHSPEED check is done through
power register's HSMODE bit.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:25 -05:00
Felipe Balbi d57a277119 usb: musb: core: add missing curly braces
no functional changes, clean up only.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:24 -05:00
Felipe Balbi 896f7ea37f usb: musb: core: remove unnecessary logical comparison
devctl & MUSB_DEVCTL_HM represents a single bit,
just check for the bit, there's really no need
to compare the result against 0.

Tested-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10 15:33:24 -05:00
Arnd Bergmann 1c390eb360 usb: musb: fix Kconfig regression
A recent bug fix I did that was marked for stable backports
introduced a slightly wrong dependency on CONFIG_OMAP_CONTROL_PHY.

I was missing the fact that the PHY driver already stubs out the
omap_control_usb_set_mode, and we only need to add a dependency
to prevent the musb-omap2430 driver from being built-in when
the phy driver is a loadable module, but we should not prevent it
from being built altogether when the phy driver is disabled.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: ca784be36c ("usb: start using the control module driver")
Cc: <stable@vger.kernel.org> # v3.9+
Acked-by: Acked-by: Pavel Machek <pavel@ucw.cz>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-09 10:44:35 -05:00
Felipe Balbi 31a0ede0de usb: musb: core: improve musb_interrupt() a bit
instead of using manually spelled out bit-shits
and iterate over each of the 16-bits (one for
each endpoint) on each direction, we can make use
of for_each_set_bit() which internally uses
find_first_bit().

This makes the code slightly more readable while
also making we only iterate over bits which are
actually set.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-09 10:38:49 -05:00
Felipe Balbi e3c93e1a3f usb: musb: core: fix TX/RX endpoint order
As per Mentor Graphics' documentation, we should
always handle TX endpoints before RX endpoints.

This patch fixes that error while also updating
some hard-to-read comments which were scattered
around musb_interrupt().

This patch should be backported as far back as
possible since this error has been in the driver
since it's conception.

Cc: <stable@vger.kernel.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-09 10:38:48 -05:00
Felipe Balbi d5638fcf15 usb: musb: gadget: get rid of stop_activity()
that function is pretty close to a no-op by now,
all we need is a call to musb_stop().

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-09 10:38:48 -05:00
Tony Lindgren bb90600d5c usb: musb: Fix getting a generic phy for musb_dsps
We still have a combination of legacy phys and generic phys in
use so we need to support both types of phy for musb_dsps.c.

Cc: Brian Hutchinson <b.hutchman@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-02-23 09:15:25 -06:00
Tony Lindgren 606bf4d5d6 usb: musb: Fix use for of_property_read_bool for disabled multipoint
The value for the multipoint dts property is ignored when parsing with
of_property_read_bool, so we currently have multipoint always set as 1
even if value 0 is specified in the dts file.

Let's fix this to read the value too instead of just the property like
the binding documentation says as otherwise MUSB will fail to work
on devices with Mentor configuration that does not support multipoint.

Cc: Brian Hutchinson <b.hutchman@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-02-23 09:14:30 -06:00
Felipe Balbi 3e43a07256 usb: musb: core: add pm_runtime_irq_safe()
We need a pm_runtime_get_sync() call from
within musb_gadget_pullup() to make sure
registers are accessible at that time.

The problem is that musb_gadget_pullup() is
called with IRQs disabled and, because of that,
we need to tell pm_runtime that this pm_runtime_get_sync()
is IRQ safe.

We can simply add pm_runtime_irq_safe(), however, because
we need to make our read/write accessor function pointers
have been initialized before trying to use them. This means
that all pm_runtime initialization for musb_core needs to
be moved down so that when we call pm_runtime_irq_safe(),
the pm_runtime_get_sync() that it calls on the parent, won't
cause a crash due to NULL musb_read/write accessors.

Reported-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-02-23 00:18:53 -06:00