mmc: core: remove the polling for BKOPS completion

The original intention of polling for BKOPS completion was to give
the card enough time to perform the BKOPS before it is runtime suspended.
But as the BKOPS completion polling was happening in a different
context, it may race with card runtime/platform suspend which is quite
difficult to fix. So instead of BKOPS polling, let the runtime suspend
get deferred if the BKOPS is running on the card. Also if BKOPS is running
when platform suspend is triggered, stop the BKOPS before suspending the
card.

CRs-Fixed: 489523

Change-Id: Ib95c45ba2556b30d706f8d393f6f21fcc20e23f3
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
mmc: core: expose HPI capability to SWITCH commands

Some of the time consuming operations such as BKOPS, SANITIZE, CACHE
flush/off use the SWITCH command (CMD6) but as these operations don't
have card specification defined timeout for completion, we may see
timeout errors if card doesn't complete the operation within the SW
defined timeout. If SW defined timeout is hit, above operations are
considered to be failed and no real recovery mechanism is implemented
after timeout.

Most of the above operations (BKOPS/SANITIZE/CACHE flush/off) can be
interrupted by sending the HPI (High Priority Interrupt) command to card
if they taking longer than expected. This change adds the base support
which will these operations to be HPIed after timeout.

Change-Id: I67e889e94df1aa4f06a7e4030c97d543dfff7307
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
mmc: msm_sdcc: change the bkops_busy flag check to ignore_timeout

MMC core layer have made the "bkops_busy" flag in the mmc_command
structure absolute, use "ignore_timeout" instead.

Change-Id: I340aeb3193b43aa32034a3583e15be8261207525
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
mmc: core: remove bkops_busy flag from the mmc_command structure

As "bkops_busy" flag is no longer used, remove it from the mmc_command
structure.

Change-Id: I739030e90d37ce40a484a072e604a0e398b2872e
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
mmc: core: handle flush requests timeout

According to the eMMC 4.5 spec "Flushing a large amount of cached data may
take very unpredictably long time". Therefore the timeout for FLUSH should
be increased to prevent timeouts.

In case the timeout occurs HPI issued.

CRs-Fixed: 500874

Change-Id: I7a9195056481e6a8756c2c804ee20739bd461734
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
msm: kgsl: Verify the user doesn't accidentally submit a zero length IB

Indirect buffers to be executed will not be (and cannot be) zero length.
Check and reject.

Change-Id: Ic0dedbadea429c4f7bd386c5e64603b51ea8af61
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: scm: Add scm_call_noalloc and helper macros

Currently, scm_call internally calls kmalloc() to allocate a command
buffer structure. This prevents scm_call from working before kmalloc
structures are initialized or during atomic contexts. Allow clients
to pass in a pre-allocated buffer for scm_call to be used for internal
structures.

Change-Id: Id09500c8c696298228aefdcc2a61953e654677c9
CRs-Fixed: 498392
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
arm: Add ARCH_RANDOM Kconfig

Some boards may support architecture generated random numbers. Add
the appropriate Kconfig.

Change-Id: I0077a982c9bb6d3a35435cc27fe40b7e0596ca84
CRs-Fixed: 498392
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: implement ARCH_RANDOM

Currently, the software random number generator is not intialized
until relatively late in the boot process. Software that relies on
random numbers early will not be reliable. Entropy sources are
available early but not early enough for some use cases which means
that moving the software random number generation earlier is not an
option. As an alternate solution, implement the functions associated
with CONFIG_ARCH_RANDOM. These functions currently make a call into
trustzone to get reliable random numbers. The functions are disabled
once the regular random number generator is sufficiently reliable.

Change-Id: If40cfcb96b091fa26a28047c10a902287b26f6c1
CRs-Fixed: 498392
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
init: Move stack canary initialization after setup_arch

Stack canary intialization involves getting a random number.
Getting this random number may involve accessing caches or other
architectural specific features which are not available until
after the architecture is setup. Move the stack canary initialization
later to accomodate this.

Change-Id: I00b564a2c3172229a44339c061fa380c17fe7d8e
CRs-Fixed: 498392
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
ASoC: wcd9304: Fix dce and sta wait time

Apply correct dce and sta wait time based on calculation
rather than using default values.

CRs-Fixed: 521904
Change-Id: I15578c8ca5ba606af3d7ded85014c178ffc1effe
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
msm: board-8930-gpiomux: Change gpio config mode

Modify functional mode of suspended GPIO configuration
of GSBI9 to GPIO mode instead of FUNC2 mode. Observed
current leakage issue during bootup when the functional
mode of the GPIO is FUNC2. Hence, it is changed to
GPIO mode in this patch.

Change-Id: I35341c0530b571db955ec9b8c63ffd060f0ffd02
CRs-Fixed: 534685
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Revert "ASoC: wcd9310: Fix DMIC current leakage after disable"

0.3 mA higher sleep current .This happens due to manually
forcing digital mic clock pin to GPIO mode from functional
mode through the TLMM mux.

CRs-Fixed: 529174

This reverts commit 061a10151c1420459f57a8676749216a40c4c8be.

Change-Id: Ic94c8b867d445b2e341751f4e04982dd6bbefda6
Signed-off-by: johny <mjshai@codeaurora.org>
Revert "ASoC: wcd9310: Fix DMIC current leakage after disable"

0.3 mA higher sleep current .This happens due to manually
forcing digital mic clock pin to GPIO mode from functional
mode through the TLMM mux.

CRs-Fixed: 529174

This reverts commit 474bb04e27aa93c9dcdad780fe63100013c9d4eb.

Change-Id: I0b81bdc157115a4c6791f556f56f092607c5f597
Signed-off-by: johny <mjshai@codeaurora.org>
Merge "msm: kgsl: Verify the user doesn't accidentally submit a zero length IB"
Merge "ASoC: wcd9304: Fix dce and sta wait time"
Merge "Revert "ASoC: wcd9310: Fix DMIC current leakage after disable""
Merge "Revert "ASoC: wcd9310: Fix DMIC current leakage after disable""
Merge "msm: scm: Add scm_call_noalloc and helper macros"
Merge "arm: Add ARCH_RANDOM Kconfig"