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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux