Patchwork [Quantal] 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-1-git-send-email-adam.lee@canonical.com>
Download mbox | patch
Permalink /patch/243622/
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(-)
Tim Gardner - May 14, 2013, 1:59 p.m.
I happen to agree with Nicolas Pitre:
https://patchwork.kernel.org/patch/1359121/

rtg
Adam Lee - May 14, 2013, 2:37 p.m.
On Tue, May 14, 2013 at 07:59:03AM -0600, Tim Gardner wrote:
> I happen to agree with Nicolas Pitre:
> https://patchwork.kernel.org/patch/1359121/

Hi, Tim

Actually I don't like it too. But some our projects need it. And this
patch just add a capability, but not cut off that kernel functionality.
Tim Gardner - May 14, 2013, 2:42 p.m.
On 05/14/2013 08:37 AM, Adam Lee wrote:
> On Tue, May 14, 2013 at 07:59:03AM -0600, Tim Gardner wrote:
>> I happen to agree with Nicolas Pitre:
>> https://patchwork.kernel.org/patch/1359121/
> 
> Hi, Tim
> 
> Actually I don't like it too. But some our projects need it. And this
> patch just add a capability, but not cut off that kernel functionality.
> 

I do not find your argument compelling. What legal issues exist ? I find
it hard to believe that disabling a capability of hardware that you own
has legal implications.

rtg

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 0b6141d..10a34ad 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1949,7 +1949,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 0707d22..89fbeb4 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -238,6 +238,7 @@  struct mmc_host {
 #define MMC_CAP2_BROKEN_VOLTAGE	(1 << 7)	/* Use the broken voltage */
 #define MMC_CAP2_DETECT_ON_ERR	(1 << 8)	/* On I/O err check card removal */
 #define MMC_CAP2_HC_ERASE_SZ	(1 << 9)	/* High-capacity erase size */
+#define MMC_CAP2_NO_MMC		(1 << 15)	/* Only SD supported, not MMC */
 
 	mmc_pm_flag_t		pm_caps;	/* supported pm features */
 	unsigned int        power_notify_type;