mmc: dw_mmc: Cleanup the DTO timer like the CTO one
authorDouglas Anderson <dianders@chromium.org>
Thu, 12 Oct 2017 20:11:18 +0000 (13:11 -0700)
committerUlf Hansson <ulf.hansson@linaro.org>
Thu, 2 Nov 2017 14:20:41 +0000 (15:20 +0100)
commit93c23ae385299f889606b42507b12b40e50d6088
treeab9222986faed046208bb655bcabd8abd1a1f54d
parenteaaffcefaa8015aaf496590707ddfa70905e0001
mmc: dw_mmc: Cleanup the DTO timer like the CTO one

The recent CTO timer introduced in commit 03de19212ea3 ("mmc: dw_mmc:
introduce timer for broken command transfer over scheme") was causing
observable problems due to race conditions.  Previous patches have
fixed those race conditions.

It can be observed that these same race conditions ought to be
theoretically possible with the DTO timer too though they are
massively less likely to happen because the data timeout is always set
to 0xffffff right now.  That means even at a 200 MHz card clock we
were arming the DTO timer for 94 ms:
  >>> (0xffffff * 1000. / 200000000) + 10
  93.886075

We always also were setting the DTO timer _after_ starting the
transfer, unlike how the old code was seting the CTO timer.

In any case, even though the DTO timer is much less likely to have
races, it still makes sense to add code to handle it _just in case_.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/dw_mmc.c