mmc: msm_sdcc: enable support to handle Urgent data transfer request

In order to decrease a latency of a prioritized requests (aka Urgent
request), we might want to stop the transmission of a running "low
priority" request in order to handle the Urgent request.

URGENT_REQUEST handling has following dependencies:
1. Host controller driver should support mmc_host op named "stop_request"
2. Block I/O scheduler should support re-insert API
3. eMMC card should support HPI (High Priority Interrupt) command
If any of the above dependencies are not met then urgent request mechanism
will not become operational.

Change-Id: I976af4fa794fb0fac701fe12f249c36d78080c6e
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
mmc: core: Fix broken clock gating with commit 9b0f5ecb

With commit 9b0f5ecb "mmc: Add support to handle Urgent
data transfer request" runtime MMC clock gating is broken.
The implementation in the commit introduces a new stop
transmission sequence due to which the underlying host
drivers may not always call mmc_request_done(). The clock
gating reference count must be updated in such cases failing
which the clocks are never turned off even when MMC is idle
for long time.

Change-Id: Idb8ea495290f34edf0f311728d4d5ef8b2dc2d1f
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
mmc: core: Fix updating clock scaling statistics

Due to stop transmission mechanism to handle high priority requests,
the update of clock scaling statistics is broken as the stop command
will re-enter host through mmc_start_request() and modifies ->start.busy
timestamp. If statistics are updated after sending stop command then
the duration of the interrupted command will be left unaccounted.

CRs-Fixed: 473385
Change-Id: Id671388efbfdd16981a262c0b1e5b95d119f51ae
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
mmc: add dynamic trigger for packed control

In the current implementation packing is enabled according to a statically
defined trigger. This patch updates the packing control mechanism to use a
dynamically defined trigger.
The trigger's value is calculated by the relation
between the number of potential packed write requests and the mean
value of all previous potential values:
If the current potential is greater than the mean potential then
the heuristic is that the following workload will contain many write
requests, therefore we lower the packed trigger. In the opposite case
we want to increase the trigger in order to get less packing events.
In case we get an urgent request we 'punish' the packing control by
increasing the trigger.

Change-Id: I775e1582ad32a8f798e8b2bd2b3178aef357e747
Signed-off-by: Lee Susman <lsusman@codeaurora.org>