From a9c940c044ad74de4d0fe3fdb41432703e61e23a Mon Sep 17 00:00:00 2001 From: Talel Shenhar Date: Mon, 29 Jun 2015 10:50:19 +0300 Subject: mmc: cmdq: add clock scaling for CMDQ mode This change adds clock scaling ability to command-queueing mode, it does so by adding next logic: * Statistics collection for CMDQ data path * Empty the queue and Halt it before frequency change * Scale from data path in case host claiming is not possible Change-Id: I53a323b55df4d7c27e3ee3426ee4e856e533522c Signed-off-by: Talel Shenhar --- include/linux/mmc/core.h | 6 ++++++ include/linux/mmc/host.h | 5 +++++ 2 files changed, 11 insertions(+) (limited to 'include/linux') diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 9a3e44f993c2..014eb7e272c6 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -210,6 +210,12 @@ extern int mmc_detect_card_removed(struct mmc_host *host); extern void mmc_blk_init_bkops_statistics(struct mmc_card *card); +extern void mmc_deferred_scaling(struct mmc_host *host); +extern void mmc_cmdq_clk_scaling_start_busy(struct mmc_host *host, + bool lock_needed); +extern void mmc_cmdq_clk_scaling_stop_busy(struct mmc_host *host, + bool lock_needed, bool is_cmdq_dcmd); + /** * mmc_claim_host - exclusively claim a host * @host: mmc host to claim diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index cb46cdf8dcf3..a0b472ba414a 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -237,19 +237,24 @@ struct mmc_slot { /** * mmc_cmdq_context_info - describes the contexts of cmdq * @active_reqs requests being processed + * @data_active_reqs data requests being processed * @curr_state state of cmdq engine * @req_starved completion should invoke the request_fn since * no tags were available * @cmdq_ctx_lock acquire this before accessing this structure + * @queue_empty_wq workqueue for waiting for all + * the outstanding requests to be completed */ struct mmc_cmdq_context_info { unsigned long active_reqs; /* in-flight requests */ + unsigned long data_active_reqs; /* in-flight data requests */ unsigned long curr_state; #define CMDQ_STATE_ERR 0 #define CMDQ_STATE_DCMD_ACTIVE 1 #define CMDQ_STATE_HALT 2 /* no free tag available */ unsigned long req_starved; + wait_queue_head_t queue_empty_wq; }; /** -- cgit v1.2.3