android_kernel_google_msm/drivers/firewire
Stefan Richter 51257521d2 firewire: ohci: fix JMicron JMB38x IT context discovery
commit 100ceb66d5c40cc0c7018e06a9474302470be73c upstream.

Reported by Clifford and Craig for JMicron OHCI-1394 + SDHCI combo
controllers:  Often or even most of the time, the controller is
initialized with the message "added OHCI v1.10 device as card 0, 4 IR +
0 IT contexts, quirks 0x10".  With 0 isochronous transmit DMA contexts
(IT contexts), applications like audio output are impossible.

However, OHCI-1394 demands that at least 4 IT contexts are implemented
by the link layer controller, and indeed JMicron JMB38x do implement
four of them.  Only their IsoXmitIntMask register is unreliable at early
access.

With my own JMB381 single function controller I found:
  - I can reproduce the problem with a lower probability than Craig's.
  - If I put a loop around the section which clears and reads
    IsoXmitIntMask, then either the first or the second attempt will
    return the correct initial mask of 0x0000000f.  I never encountered
    a case of needing more than a second attempt.
  - Consequently, if I put a dummy reg_read(...IsoXmitIntMaskSet)
    before the first write, the subsequent read will return the correct
    result.
  - If I merely ignore a wrong read result and force the known real
    result, later isochronous transmit DMA usage works just fine.

So let's just fix this chip bug up by the latter method.  Tested with
JMB381 on kernel 3.13 and 4.3.

Since OHCI-1394 generally requires 4 IT contexts at a minium, this
workaround is simply applied whenever the initial read of IsoXmitIntMask
returns 0, regardless whether it's a JMicron chip or not.  I never heard
of this issue together with any other chip though.

I am not 100% sure that this fix works on the OHCI-1394 part of JMB380
and JMB388 combo controllers exactly the same as on the JMB381 single-
function controller, but so far I haven't had a chance to let an owner
of a combo chip run a patched kernel.

Strangely enough, IsoRecvIntMask is always reported correctly, even
though it is probed right before IsoXmitIntMask.

Reported-by: Clifford Dunn
Reported-by: Craig Moore <craig.moore@qenos.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
[lizf: Backported to 3.4: use dev_notice() instead of ohci_notice()]
Signed-off-by: Zefan Li <lizefan@huawei.com>
2016-10-26 23:15:27 +08:00
..
Kconfig firewire: ohci: move runtime debug facility out of #ifdef 2012-03-10 17:41:19 +01:00
Makefile ieee1394: move init_ohci1394_dma to drivers/firewire/ 2010-10-11 14:48:03 +02:00
core-card.c firewire: allow explicit flushing of iso packet completions 2012-03-18 22:15:39 +01:00
core-cdev.c firewire: cdev: prevent kernel stack leaking into ioctl arguments 2015-02-02 17:05:24 +08:00
core-device.c firewire: don't use PREPARE_DELAYED_WORK 2014-03-23 21:37:06 -07:00
core-iso.c IEEE 1394 (FireWire) subsystem updates post v3.3: 2012-03-22 20:31:15 -07:00
core-topology.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
core-transaction.c firewire: core: convert AR-req handler lock from _irqsave to _bh 2012-02-22 22:36:01 +01:00
core.h firewire: allow explicit flushing of iso packet completions 2012-03-18 22:15:39 +01:00
init_ohci1394_dma.c ieee1394: move init_ohci1394_dma to drivers/firewire/ 2010-10-11 14:48:03 +02:00
net.c firewire: net: fix use after free 2014-03-23 21:37:06 -07:00
nosy-user.h firewire: nosy: endianess fixes and annotations 2010-07-27 11:04:11 +02:00
nosy.c firewire: nosy: Use the macro DMA_BIT_MASK(). 2012-02-22 22:36:01 +01:00
nosy.h firewire: nosy: misc cleanups 2010-07-27 11:04:10 +02:00
ohci.c firewire: ohci: fix JMicron JMB38x IT context discovery 2016-10-26 23:15:27 +08:00
ohci.h firewire: ohci: fix TI TSB82AA2 regression since 2.6.35 2010-10-17 14:09:12 +02:00
sbp2.c firewire: don't use PREPARE_DELAYED_WORK 2014-03-23 21:37:06 -07:00