Hi Konstantin
On 11/22/2011 09:44 PM, Konstantin Dorfman wrote:
> Hello Jaehoon,
>
> ...
>> +/**
>> + * mmc_start_bkops - start BKOPS for supported cards
>> + * @card: MMC card to start BKOPS
>> + *
>> + * Start background operations whenever requested.
>> + * when the urgent BKOPS bit is set in a R1 command response
>> + * then background operations should be started immediately.
>> +*/
>> +void mmc_start_bkops(struct mmc_card *card)
>> +{
>> + int err;
>> + unsigned long flags;
>> +
>> + BUG_ON(!card);
>> + if ((!card->ext_csd.bkops_en) ||
>> + !(card->host->caps2 & MMC_CAP2_BKOPS))
>> + return;
>> +
>> + /*
>> + * If card is already doing bkops or need for
>> + * bkops flag is not set, then do nothing just
>> + * return
>> + */
>> + if (mmc_card_doing_bkops(card)
>> + || !mmc_card_need_bkops(card))
>> + return;
>> +
>> + mmc_claim_host(card->host);
>> + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>> + EXT_CSD_BKOPS_START, 1, 0);
>> + if (err) {
>> + pr_warning("error %d starting bkops\n", err);
>> + mmc_card_clr_need_bkops(card);
>> + goto out;
>> + }
>> + spin_lock_irqsave(&card->host->lock, flags);
>> + mmc_card_clr_need_bkops(card);
>> + mmc_card_set_doing_bkops(card);
> Sending CMD6 (by mmc_switch()) will start BKOPS on card,
> according to eMMC spec:
> -----
> 7.4.56 BKOPS_START [164]
> Writing any value to this field shall manually start background operations.
> Device shall stay busy till no more background operations are needed.
> -----
> Where/when mmc_card_clear_doing_bkops() should called? The only place I
> see this happens is
> in mmc_interrupt_bkops(). This means, that once BKOPS started, next
> read/write request
> will _always_(and not when card really busy) send HPI and only then will
> clear "doing" flag.
Right, that is called only in mmc_interrupt_bkops. I wonder how did you check
to finish the bkops without hpi command?
> May be it is possible to poll for ack from card about when BKOPS finished?
> Another possibility that
> mmc_switch() synchronous and after flow returns from it, we can clear
> "doing" flag immediately.
> Does it make sense?
i didn't know how poll for ack from card..did you know?
So i implemented that send the hpi command whatever status.
If let me know checking for ack from card, i will consider that.
Thanks
Best Regards,
Jaehoon Chung
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html