Waiting while MMC busy

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

 



Hi

At present, the omap_hsmmc driver completes a write request while
the card is still busy.  The mmc_block driver caters for this by
waiting while the card is busy, but it does so by repeated requesting
the card status until the state is not "programming" and the
READ_FOR_DATA bit is set. e.g. the code from the block driver
driver/mmc/card/block.c:

static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
{
...
		if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) {
			do {
				int err;

				cmd.opcode = MMC_SEND_STATUS;
				cmd.arg = card->rca << 16;
				cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
				err = mmc_wait_for_cmd(card->host, &cmd, 5);
				if (err) {
					printk(KERN_ERR "%s: error %d requesting status\n",
					       req->rq_disk->disk_name, err);
					goto cmd_err;
				}
				/*
				 * Some cards mishandle the status bits,
				 * so make sure to check both the busy
				 * indication and the card state.
				 */
			} while (!(cmd.resp[0] & R1_READY_FOR_DATA) ||
				(R1_CURRENT_STATE(cmd.resp[0]) == 7));

We would much prefer to use an interrupt but we cannot see any suitable
interrupt bit in the OMAP HSMMC.  When we look at MMCHS_PSTATE we see
that DLA, DATI and CMDI are zero even while dat0 is low (as seen from
DLEV bit 20).

We are considering using pad configuration to switch dat0 to gpio while
waiting because dat0 is held low when the card is busy and returns high
when it is ready.  Then we can use a gpio interrupt.

Does anyone have any other ideas?

Regards
Adrian Hunter
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux