From: Ritesh Harjani <riteshh@codeaurora.org>
To: Shawn Lin <shawn.lin@rock-chips.com>,
ulf.hansson@linaro.org, linux-mmc@vger.kernel.org
Cc: adrian.hunter@intel.com, alex.lemberg@sandisk.com,
mateusz.nowak@intel.com, Yuliy.Izrailov@sandisk.com,
jh80.chung@samsung.com, dongas86@gmail.com,
asutoshd@codeaurora.org, zhangfei.gao@gmail.com,
sthumma@codeaurora.org, kdorfman@codeaurora.org,
david.griego@linaro.org, stummala@codeaurora.org,
venkatg@codeaurora.org
Subject: Re: [PATCH RFC 09/10] mmc: cmdq-host: add halt support to command queue host
Date: Mon, 27 Jun 2016 12:18:18 +0530 [thread overview]
Message-ID: <ec0915fb-e40f-724d-4eaf-7d70f187c9b7@codeaurora.org> (raw)
In-Reply-To: <1321eec0-fbd1-1e05-4842-ff80b00a95d6@rock-chips.com>
Hi,
On 6/17/2016 2:21 PM, Shawn Lin wrote:
> 在 2016/6/15 21:01, Ritesh Harjani 写道:
>> From: Asutosh Das <asutoshd@codeaurora.org>
>>
>> Halt can be used in error cases to get control of the
>> bus. This is used to remove a task from device queue
>> and/or other recovery mechanisms.
>
> where to ues it? cmdq_irq or sdhci_irq?
Below cmdq_halt will be used by higher
layers to get legacy bus control to send legacy commands.
Like during clock-scaling, we may need to send tuning commands
for which we may wait for the device queue to be empty and then halt
the controller to send legacy tuning commands.
>
>>
>> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
>> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
>> [riteshh@codeaurora.org: fixed merge conflicts]
>> Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
>> ---
>> drivers/mmc/host/cmdq_hci.c | 35 +++++++++++++++++++++++++++++++++++
>> 1 file changed, 35 insertions(+)
>>
>> diff --git a/drivers/mmc/host/cmdq_hci.c b/drivers/mmc/host/cmdq_hci.c
>> index 68c8e03..64be0ce 100644
>> --- a/drivers/mmc/host/cmdq_hci.c
>> +++ b/drivers/mmc/host/cmdq_hci.c
>> @@ -29,6 +29,9 @@
>> #define DCMD_SLOT 31
>> #define NUM_SLOTS 32
>>
>> +/* 1 sec */
>> +#define HALT_TIMEOUT_MS 1000
>> +
>> static inline u8 *get_desc(struct cmdq_host *cq_host, u8 tag)
>> {
>> return cq_host->desc_base + (tag * cq_host->slot_sz);
>> @@ -570,11 +573,42 @@ irqreturn_t cmdq_irq(struct mmc_host *mmc, u32
>> intmask)
>> cmdq_dumpregs(cq_host);
>> }
>>
>> + if (status & CQIS_HAC) {
>> + /* halt is completed, wakeup waiting thread */
>> + complete(&cq_host->halt_comp);
>> + }
>> +
>> out:
>> return IRQ_HANDLED;
>> }
>> EXPORT_SYMBOL(cmdq_irq);
>>
>> +/* May sleep */
>> +static int cmdq_halt(struct mmc_host *mmc, bool halt)
>> +{
>> + struct cmdq_host *cq_host = (struct cmdq_host
>> *)mmc_cmdq_private(mmc);
>> + u32 val;
>> +
>> + if (halt) {
>> + cmdq_writel(cq_host, cmdq_readl(cq_host, CQCTL) | HALT,
>> + CQCTL);
>> + val = wait_for_completion_timeout(&cq_host->halt_comp,
>> + msecs_to_jiffies(HALT_TIMEOUT_MS));
>> + /* halt done: re-enable legacy interrupts */
>> + if (cq_host->ops->clear_set_irqs)
>> + cq_host->ops->clear_set_irqs(mmc, false);
>> +
>> + return val ? 0 : -ETIMEDOUT;
>> + } else {
>> + if (cq_host->ops->clear_set_irqs)
>> + cq_host->ops->clear_set_irqs(mmc, true);
>> + cmdq_writel(cq_host, cmdq_readl(cq_host, CQCTL) & ~HALT,
>> + CQCTL);
>> + }
>> +
>> + return 0;
>> +}
>> +
>> static void cmdq_post_req(struct mmc_host *host, struct mmc_request
>> *mrq,
>> int err)
>> {
>> @@ -597,6 +631,7 @@ static const struct mmc_cmdq_host_ops
>> cmdq_host_ops = {
>> .disable = cmdq_disable,
>> .request = cmdq_request,
>> .post_req = cmdq_post_req,
>> + .halt = cmdq_halt,
>> };
>>
>> struct cmdq_host *cmdq_pltfm_init(struct platform_device *pdev)
>>
>
>
--
BR
Ritesh
next prev parent reply other threads:[~2016-06-27 6:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-15 13:01 [PATCH RFC 00/10] mmc: Add HW Command Queuing Support Ritesh Harjani
2016-06-15 13:01 ` [PATCH RFC 01/10] mmc: core: Add support to read command queue parameters Ritesh Harjani
2016-06-16 8:12 ` Shawn Lin
2016-06-27 7:59 ` Ritesh Harjani
2016-06-15 13:01 ` [PATCH RFC 02/10] mmc: queue: initialization of command queue Ritesh Harjani
2016-06-16 8:55 ` Shawn Lin
2016-06-27 6:12 ` Ritesh Harjani
2016-06-15 13:01 ` [PATCH RFC 03/10] mmc: core: Add command queue initialzation support Ritesh Harjani
2016-06-16 9:01 ` Shawn Lin
2016-06-27 6:18 ` Ritesh Harjani
2016-06-15 13:01 ` [PATCH RFC 04/10] mmc: card: add read/write support in command queue mode Ritesh Harjani
2016-06-15 13:01 ` [PATCH RFC 05/10] mmc: core: add flush request support to command queue Ritesh Harjani
2016-06-15 13:01 ` [PATCH RFC 06/10] mmc: host: sdhci: don't set SDMA buffer boundary in ADMA mode Ritesh Harjani
2016-06-15 13:01 ` [PATCH RFC 07/10] mmc: cmdq: support for command queue enabled host Ritesh Harjani
2016-06-17 8:45 ` Shawn Lin
2016-06-27 6:43 ` Ritesh Harjani
2016-06-15 13:01 ` [PATCH RFC 08/10] mmc: core: Add halt support Ritesh Harjani
2016-06-15 13:01 ` [PATCH RFC 09/10] mmc: cmdq-host: add halt support to command queue host Ritesh Harjani
2016-06-17 8:51 ` Shawn Lin
2016-06-27 6:48 ` Ritesh Harjani [this message]
2016-06-15 13:01 ` [PATCH RFC 10/10] mmc: sdhci: add command queue support to sdhci Ritesh Harjani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ec0915fb-e40f-724d-4eaf-7d70f187c9b7@codeaurora.org \
--to=riteshh@codeaurora.org \
--cc=Yuliy.Izrailov@sandisk.com \
--cc=adrian.hunter@intel.com \
--cc=alex.lemberg@sandisk.com \
--cc=asutoshd@codeaurora.org \
--cc=david.griego@linaro.org \
--cc=dongas86@gmail.com \
--cc=jh80.chung@samsung.com \
--cc=kdorfman@codeaurora.org \
--cc=linux-mmc@vger.kernel.org \
--cc=mateusz.nowak@intel.com \
--cc=shawn.lin@rock-chips.com \
--cc=sthumma@codeaurora.org \
--cc=stummala@codeaurora.org \
--cc=ulf.hansson@linaro.org \
--cc=venkatg@codeaurora.org \
--cc=zhangfei.gao@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox