[RFC] sdhci: SDHCI_QUIRK_BROKEN_CARD_DETECTION

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

 



The quirk SDHCI_QUIRK_BROKEN_CARD_DETECTION is not quite what may needed for embedded systems.

Sometimes the card is hard wired onto the board and is always present -- usually the signal into the controller
is not used by the board designed -- saves a pin

Sometimes the card is plugged into a slot and Card Detect REALLY is broken.  In this case we need to poll by 
setting MMC_CAP_NEEDS_POLL so mmc_detect_change() will find the card.

	if (host->caps & MMC_CAP_NEEDS_POLL)
		mmc_schedule_delayed_work(&host->detect, HZ);


Since the behavior is a board issue I think it makes more sense to define a new 
struct sdhci_ops {
}

that gets called and the adaption layer can decide to set or not set MMC_CAP_NEEDS_POLL.  if this is okay will
generate the patch.

Sample code snippets below

struct sdhci_ops {
	......
	void	(*card_detect)(struct sdhci_host *host);
}

====
replace 

	if (caps & SDHCI_CAN_DO_HISPD)
		mmc->caps |= MMC_CAP_SD_HIGHSPEED;

	if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
		mmc->caps |= MMC_CAP_NEEDS_POLL;


with

	if (caps & SDHCI_CAN_DO_HISPD)
		mmc->caps |= MMC_CAP_SD_HIGHSPEED;

	if (host->ops->card_detect)
		host->ops->card_detect(host)
====

platform code 
void card_detect (struct sdhci_host *host)
{
	if (card_hard_wired || sd_slot_has_no_card_detect_signal) {
		host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
		if (sd_slot_has_no_card_detect_signal)
			host->mmc->caps |= MMC_CAP_NEEDS_POLL
	}
}--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux