Re: [PATCH v7][2/4] mmc: Add Synopsys DesignWare mmc cmdq host driver

Adrian Hunter
2023-12-05T11:28:37Z

On 5/12/23 11:19, Jyan Chou [周芷安] wrote:
>>> +
>>> +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.