devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jyan Chou [周芷安]" <jyanchou@realtek.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
	"ulf.hansson@linaro.org" <ulf.hansson@linaro.org>,
	"jh80.chung@samsung.com" <jh80.chung@samsung.com>,
	"riteshh@codeaurora.org" <riteshh@codeaurora.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"krzysztof.kozlowski+dt@linaro.org"
	<krzysztof.kozlowski+dt@linaro.org>
Cc: "conor+dt@kernel.org" <conor+dt@kernel.org>,
	"asutoshd@codeaurora.org" <asutoshd@codeaurora.org>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"briannorris@chromium.org" <briannorris@chromium.org>,
	"doug@schmorgal.com" <doug@schmorgal.com>,
	"tonyhuang.sunplus@gmail.com" <tonyhuang.sunplus@gmail.com>,
	"abel.vesa@linaro.org" <abel.vesa@linaro.org>,
	"william.qiu@starfivetech.com" <william.qiu@starfivetech.com>
Subject: RE: [PATCH v7][2/4] mmc: Add Synopsys DesignWare mmc cmdq host driver
Date: Mon, 11 Dec 2023 10:37:49 +0000	[thread overview]
Message-ID: <49d0b19c5ec741638e41ee6f970d057b@realtek.com> (raw)
In-Reply-To: <8e7b6ac2-9d92-4f37-97c4-ae295f7cdbd4@intel.com>

Hi Adrian,

>>>> +
>>>> +static irqreturn_t dw_mci_cqe_interrupt(int irq, void *dev_id) {
>>>> +     struct dw_mci *host = dev_id;
>>>> +     struct mmc_host *mmc = host->slot->mmc;
>>>> +     struct cqhci_host *cq_host = NULL;
>>>> +     int cmd_error = 0, data_error = 0;
>>>> +
>>>> +     if (host->pdata && (host->pdata->caps2 & MMC_CAP2_CQE))
>>>> +             cq_host = mmc->cqe_private;
>>>> +
>>>> +     dw_mci_get_int(host);
>>>> +
>>>> +     if (host->pdata && (host->pdata->caps2 & MMC_CAP2_CQE)) {
>>>> +             if (!mmc->cqe_on && !cq_host->activated)
>>>
>>> Shouldn't really look at internals like mmc->cqe_on or cq_host->activated.
>>> There are the cqhci_host_ops ->enable() and ->disable() callbacks to
>>> keep track of whether cqhci is expecting interrupts.
>>
>> Does this means we need to use cqhci_host_ops ->enable() and
>> ->disable() callbacks instead of mmc->cqe_on && !cq_host->activated?
>Thanks.
>
>Yes.  ->enable() is always called before cqhci operation and ->disable() before
>non-cqhci operation, so they can be used to determine if an interrupt is for
>cqhci.

Thanks for your advice, and I got your point for calling cqhci_host_ops ->enable()

and ->disable() callbacks, but the reason we used " if (!mmc->cqe_on && !cq_host->activated) "

is that when sending command like cmd0, 1, 7, 8... in mmc_init_card before mmc_cmdq_enable,

we need to use interrupt in legacy mode, it is much better to write in this way?

+	events = mci_readw(host, NORMAL_INT_STAT_R);
- 	if (host->pdata && (host->pdata->caps2 & MMC_CAP2_CQE)) {
- 		if (!mmc->cqe_on && !cq_host->activated)
+	if (mmc->caps2 & MMC_CAP2_CQE) {
+		if (!(events & CQE_EVENT))
			dw_mci_clr_signal_int(host);

Using CQE_EVENT to determine whether Command Queue enable or not.

Many thanks.

Best Regards,
Jyan

  reply	other threads:[~2023-12-11 10:39 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21  9:10 [PATCH V7][0/4] Add DesignWare Mobile mmc driver Jyan Chou
2023-11-21  9:10 ` [PATCH v7][1/4] mmc: solve DMA boundary limitation of CQHCI driver Jyan Chou
2023-11-21  9:10 ` [PATCH v7][2/4] mmc: Add Synopsys DesignWare mmc cmdq host driver Jyan Chou
2023-11-22  0:20   ` kernel test robot
2023-11-22 14:48   ` kernel test robot
2023-11-27 12:51   ` Philipp Zabel
2023-11-28  7:05     ` Jyan Chou [周芷安]
2023-11-28 10:53     ` Arnd Bergmann
2023-11-27 13:02   ` Christian Loehle
2023-11-28  6:58     ` Jyan Chou [周芷安]
2023-11-28 18:05   ` Adrian Hunter
2023-12-05  9:19     ` Jyan Chou [周芷安]
2023-12-05 11:26       ` Adrian Hunter
2023-12-11 10:37         ` Jyan Chou [周芷安] [this message]
2023-12-11 10:45           ` Adrian Hunter
2023-11-21  9:11 ` [PATCH v7][3/4] mmc: Add dw mobile mmc cmdq rtk driver Jyan Chou
2023-11-21  9:11 ` [PATCH v7][4/4] dt-bindings: mmc: Add dt-bindings for realtek mmc driver Jyan Chou
2023-11-21  9:35   ` Krzysztof Kozlowski
2023-11-22  2:54     ` Jyan Chou [周芷安]
2023-11-22  7:36       ` Krzysztof Kozlowski
2023-11-22  8:33         ` Jyan Chou [周芷安]
2023-11-22  8:45           ` Krzysztof Kozlowski

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=49d0b19c5ec741638e41ee6f970d057b@realtek.com \
    --to=jyanchou@realtek.com \
    --cc=abel.vesa@linaro.org \
    --cc=adrian.hunter@intel.com \
    --cc=arnd@arndb.de \
    --cc=asutoshd@codeaurora.org \
    --cc=briannorris@chromium.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=doug@schmorgal.com \
    --cc=jh80.chung@samsung.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=riteshh@codeaurora.org \
    --cc=robh+dt@kernel.org \
    --cc=tonyhuang.sunplus@gmail.com \
    --cc=ulf.hansson@linaro.org \
    --cc=william.qiu@starfivetech.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;
as well as URLs for NNTP newsgroup(s).