Patchwork [Saucy] UBUNTU: SAUCE: mmc: core: Add a capability for disabling mmc cards

login
register
mail settings
Submitter Adam Lee
Date May 14, 2013, 8:09 a.m.
Message ID <1368518971-1330-3-git-send-email-adam.lee@canonical.com>
Download mbox | patch
Permalink /patch/243623/
State New
Headers show

Comments

Adam Lee - May 14, 2013, 8:09 a.m.
On some systems we need a way to disable MMC card support in a MMC/SD
card slot due to the legal concern.

Add support in the core SD/MMC code to support this.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Adam Lee <adam.lee@canonical.com>
---
 drivers/mmc/core/core.c  |    2 +-
 include/linux/mmc/host.h |    1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
Adam Lee - May 14, 2013, 8:18 a.m.
On Tue, May 14, 2013 at 04:09:31PM +0800, Adam Lee wrote:
> On some systems we need a way to disable MMC card support in a MMC/SD
> card slot due to the legal concern.
> 
> Add support in the core SD/MMC code to support this.

Hi, kernel team

Due to the pressure of time, I submit this to upstream and our list at
the same time. We need this to avoid legal problems.

Please review, thanks.

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 08a3cf2..3541142 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2271,7 +2271,7 @@  static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
 		return 0;
 	if (!mmc_attach_sd(host))
 		return 0;
-	if (!mmc_attach_mmc(host))
+	if (!(host->caps2 & MMC_CAP2_NO_MMC) && !mmc_attach_mmc(host))
 		return 0;
 
 	mmc_power_off(host);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index d6f20cc..38f5616 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -280,6 +280,7 @@  struct mmc_host {
 #define MMC_CAP2_PACKED_WR	(1 << 13)	/* Allow packed write */
 #define MMC_CAP2_PACKED_CMD	(MMC_CAP2_PACKED_RD | \
 				 MMC_CAP2_PACKED_WR)
+#define MMC_CAP2_NO_MMC		(1 << 15)	/* Only SD supported, not MMC */
 
 	mmc_pm_flag_t		pm_caps;	/* supported pm features */