Age | Commit message (Collapse) | Author | Files | Lines |
|
The unbind() method is optional is usb_composite_driver.
In this particular driver the method does nothing so it can be removed.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Function-specific setup requests should be handled in such a way, that
apart from filling in the data buffer, the requests are also actually
enqueued: if function-specific setup is called from composte_setup(),
the "usb_ep_queue()" block of code in composite_setup() is skipped.
The printer function lacks this part and it results in e.g. get device id
requests failing: the host expects some response, the device prepares it
but does not equeue it for sending to the host, so the host finally asserts
timeout.
This patch adds enqueueing the prepared responses.
Cc: <[email protected]> # v3.4+
Fixes: 2e87edf49227: "usb: gadget: make g_printer use composite"
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
If a non-standard request is processed and its parameters just happen
to match those of some standard request, the logic of composite_setup()
can be fooled, so don't even try any switch cases, just go to the
proper place where unknown requests are handled.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
This patch removes "Enable USB3 LPM Capability" option from Kconfig
and adds snps,usb3_lpm_capable devicetree property instead of it.
USB3 LPM (Link Power Management) capability is hardware property, and
it's platform dependent, so if our hardware supports this feature, we
want rather to configure it in devicetree than having it as Kconfig option.
Signed-off-by: Robert Baldyga <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
there's no need to fake an IRQ, just check
if VBUS is valid already.
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
|
|
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 <[email protected]>
|
|
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 <[email protected]>
|
|
no functional changes, clean up only.
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Silence the following warning:
drivers/usb/gadget/udc/net2280.c:3176:33: warning: context imbalance in
'handle_stat1_irqs' - unexpected unlock
Signed-off-by: Felipe Balbi <[email protected]>
|
|
net2280_start can be called with pullup disabled. Don't set
softconnect flag in it. Let net2280_pullup handle the connection part.
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Hopefully, these prints will help localize the problems faster.
[ [email protected]: removed 2 unnecessary OOM error messages ]
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Remove fiforegs from struct net2280 and net2280_ep as it is unused.
By the way, ep->fiforegs = &dev->fiforegs[i] assignment is incorrect.
It should be ep->fiforegs = &dev->fiforegs[ne[i]], but it doesn't
matter now.
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Each struct usb_ep added for net2280 can be used in either direction.
Whereas, each struct usb_ep for usb3380 has fixed direction. Use
ep_autoconf compatible names so that endpoint with correct direction
can be selected.
Name sequence is due to the logic in usb_reinit_338x() in ne[] and
ep_reg_addr[].
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
There's no point is splitting those anymore.
We're now also able to drop another forward
declaration.
Tested-by: Bin Liu <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
no functional changes, cleanup only.
Tested-by: Bin Liu <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
All we have to do is, really, drop session bit
and let the session restart.
Big thanks goes to Bin Liu <[email protected]> for
inspiring this work.
Tested-by: Bin Liu <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
this makes it easier to filter function traces.
No functional changes.
Tested-by: Bin Liu <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
MUSB does not generate a connect IRQ when working
in peripheral mode.
Tested-by: Bin Liu <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
no functional changes, clean up only.
Tested-by: Bin Liu <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
There was already a proper place where we were
checking for babble interrupts, move babble
recovery there.
Tested-by: Bin Liu <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
if reset fails, we should return a *negative*
error code, not a positive value.
Tested-by: Bin Liu <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
no functional changes, clean up only.
Tested-by: Bin Liu <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
As per the SAF1761 data sheet[0], the DcChipID register represents
the hardware version number (0001h) and the chip ID (1582h) for the
Peripheral Controller.
However as per the ISP1761 data sheet[1], the DcChipID register
represents the hardware version number (0015h) and the chip ID (8210h)
for the Peripheral Controller.
This patch adds support for both the chip ID values.
[0] http://www.nxp.com/documents/data_sheet/SAF1761.pdf
[1] http://pdf.datasheetcatalog.com/datasheets2/74/742102_1.pdf
Cc: Felipe Balbi <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Signed-off-by: Sudeep Holla <[email protected]>
Acked-by: Laurent Pinchart <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Removed FIXME from usb/dwc3/dwc3-pci.c by moving definition of
PCI_VENDOR_ID_SYNOPSYS shared with usb/dwc2 to linux/pci_ids.h.
Signed-off-by: Joseph Kogut <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
The seq_printf return value, because it's frequently misused,
will eventually be converted to void.
See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")
While there, simplify the error handler logic by returning
immediately and remove the unnecessary labels.
Tested-by: Robert Jarzmik <[email protected]>
Signed-off-by: Joe Perches <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
The function regulator_set_optimum_mode() is changing name to
regulator_set_load(), so update the code accordingly.
Signed-off-by: Bjorn Andersson <[email protected]>
Acked-by: Felipe Balbi <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
|
|
The function regulator_set_optimum_mode() is changing name to
regulator_set_load(), so update the code accordingly.
Signed-off-by: Bjorn Andersson <[email protected]>
Acked-by: Felipe Balbi <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
|
|
As per the SAF1761 data sheet[0], the DcChipID register represents
the hardware version number (0001h) and the chip ID (1582h) for the
Peripheral Controller.
However as per the ISP1761 data sheet[1], the DcChipID register
represents the hardware version number (0015h) and the chip ID (8210h)
for the Peripheral Controller.
This patch adds support for both the chip ID values.
[0] http://www.nxp.com/documents/data_sheet/SAF1761.pdf
[1] http://pdf.datasheetcatalog.com/datasheets2/74/742102_1.pdf
Acked-by: Laurent Pinchart <[email protected]>
Signed-off-by: Sudeep Holla <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
The IRQF_DISABLED is a NOOP and scheduled to be removed. According to
commit e58aa3d2d0cc ("genirq: Run irq handlers with interrupts
disabled") running IRQ handlers with interrupts enabled can cause stack
overflows when the interrupt line of the issuing device is still active.
This patch removes using this deprecated flag and additionally removes
redundantly setting IRQF_SHARED for isp1760_udc_register().
Signed-off-by: Valentin Rothberg <[email protected]>
Acked-by: Laurent Pinchart <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
Fixes: ca784be36cc725 ("usb: start using the control module driver")
Cc: <[email protected]> # v3.9+
Acked-by: Acked-by: Pavel Machek <[email protected]>
Tested-by: Aaro Koskinen <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Use spin_{un,}lock_irq{save,restore} in isp1760_udc_{start,stop} to
prevent following potentially deadlock scenario between
isp1760_udc_{start,stop} and isp1760_udc_irq :
=================================
[ INFO: inconsistent lock state ]
4.0.0-rc2-00004-gf7bb2ef60173 #51 Not tainted
---------------------------------
inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
in:imklog/2118 [HC1[1]:SC0[0]:HE0:SE1] takes:
(&(&udc->lock)->rlock){?.+...}, at: [<c0397a93>] isp1760_udc_irq+0x367/0x9dc
{HARDIRQ-ON-W} state was registered at:
[<c05135b3>] _raw_spin_lock+0x23/0x30
[<c0396b87>] isp1760_udc_start+0x23/0xf8
[<c039dc21>] udc_bind_to_driver+0x71/0xb0
[<c039de4f>] usb_gadget_probe_driver+0x53/0x9c
[<bf80d0df>] usb_composite_probe+0x8a/0xa4 [libcomposite]
[<bf8311a7>] 0xbf8311a7
[<c00088c5>] do_one_initcall+0x8d/0x17c
[<c050b92d>] do_init_module+0x49/0x148
[<c0087323>] load_module+0xb7f/0xbc4
[<c0087471>] SyS_finit_module+0x51/0x74
[<c000d8c1>] ret_fast_syscall+0x1/0x68
irq event stamp: 4966
hardirqs last enabled at (4965): [<c05137df>] _raw_spin_unlock_irq+0x1f/0x24
hardirqs last disabled at (4966): [<c00110b3>] __irq_svc+0x33/0x64
softirqs last enabled at (4458): [<c0023475>] __do_softirq+0x23d/0x2d0
softirqs last disabled at (4389): [<c002380b>] irq_exit+0xef/0x15c
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&(&udc->lock)->rlock);
<Interrupt>
lock(&(&udc->lock)->rlock);
*** DEADLOCK ***
1 lock held by in:imklog/2118:
#0: (&f->f_pos_lock){+.+.+.}, at: [<c010a101>] __fdget_pos+0x31/0x34
Signed-off-by: Sudeep Holla <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Acked-by: Laurent Pinchart <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Now that we're using XFERINPROGRESS for all endpoint
types (except Control), we will *always* be completing
one TRB at a time, so it's safe to remove the loop
from dwc3_cleanup_done_reqs.
Signed-off-by: Felipe Balbi <[email protected]>
|
|
This patch fixes a bug where removing dwc3-omap.ko
would not trigger removal of dwc3.ko.
of_platform_depopulate() already bakes an easy to
use API for removing all our children which were
populated during probe(); Let's use that one instead
of cooking our own solution.
Note that this is kind of a revert of commit c5a1fbc
(usb: dwc3: dwc3-omap: Fix the crash on module removal)
although we can't simply revert that because a direct
call to platform_device_unregister would also be flakey.
Signed-off-by: Felipe Balbi <[email protected]>
|
|
That trick is only needed if we end up with an error, so
there's no point in messing that outside of an error path.
In fact doing so causes problems when removing dwc3.ko,
problems which commit c5a1fbc (usb: dwc3: dwc3-omap: Fix
the crash on module removal) mistakenly tried to fix.
Signed-off-by: Felipe Balbi <[email protected]>
|
|
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 <[email protected]>
|
|
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: <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|