2012-08-22 04:05:55

by Doug Anderson

[permalink] [raw]
Subject: [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards

On some systems we need a way to disable MMC card support in a MMC/SD
card slot. Add support in the core SD/MMC code to support this.

Signed-off-by: Doug Anderson <[email protected]>
Signed-off-by: Alim Akhtar <[email protected]>
---
drivers/mmc/core/core.c | 2 +-
include/linux/mmc/host.h | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 8ac5246..3214972 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1981,7 +1981,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 f578a71..f36370e 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -257,6 +257,7 @@ struct mmc_host {
#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */
#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
+#define MMC_CAP2_NO_MMC (1 << 12) /* Only SD supported, not MMC */

mmc_pm_flag_t pm_caps; /* supported pm features */
unsigned int power_notify_type;
--
1.7.7.3


2012-08-22 04:06:04

by Doug Anderson

[permalink] [raw]
Subject: [PATCH 2/2] mmc: dw_mmc: Add a DISABLE_MMC quirk that sets the core mmc cap

On some systems we need a way to disable MMC card support in a MMC/SD
card slot. Add support in the dw_mmc to support this.

Signed-off-by: Doug Anderson <[email protected]>
---
drivers/mmc/host/dw_mmc.c | 3 +++
include/linux/mmc/dw_mmc.h | 2 ++
2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index af40d22..09111bf 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1810,6 +1810,9 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id)
if (host->pdata->quirks & DW_MCI_QUIRK_HIGHSPEED)
mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;

+ if (host->pdata->quirks & DW_MCI_QUIRK_DISABLE_MMC)
+ mmc->caps2 |= MMC_CAP2_NO_MMC;
+
if (mmc->caps2 & MMC_CAP2_POWEROFF_NOTIFY)
mmc->power_notify_type = MMC_HOST_PW_NOTIFY_SHORT;
else
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 7a7ebd3..5eaa9b9 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -201,6 +201,8 @@ struct dw_mci_dma_ops {
#define DW_MCI_QUIRK_HIGHSPEED BIT(2)
/* Unreliable card detection */
#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3)
+/* Only support SD cards, not MMC */
+#define DW_MCI_QUIRK_DISABLE_MMC BIT(4)


struct dma_pdata;
--
1.7.7.3

2012-08-22 04:36:17

by Jaehoon Chung

[permalink] [raw]
Subject: Re: [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards

Hi Doug,

I didn't know what purpose is.
Why need to add the MMC_CAP2_NO_MMC?
If card is SD or SDIO, mmc_attach_mmc(host) should not be entered.
Could you explain to me in more detail?

Best Regards,
Jaehoon Chung

On 08/22/2012 01:05 PM, Doug Anderson wrote:
> On some systems we need a way to disable MMC card support in a MMC/SD
> card slot. Add support in the core SD/MMC code to support this.
>
> Signed-off-by: Doug Anderson <[email protected]>
> Signed-off-by: Alim Akhtar <[email protected]>
> ---
> drivers/mmc/core/core.c | 2 +-
> include/linux/mmc/host.h | 1 +
> 2 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 8ac5246..3214972 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -1981,7 +1981,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 f578a71..f36370e 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -257,6 +257,7 @@ struct mmc_host {
> #define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */
> #define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
> #define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
> +#define MMC_CAP2_NO_MMC (1 << 12) /* Only SD supported, not MMC */
>
> mmc_pm_flag_t pm_caps; /* supported pm features */
> unsigned int power_notify_type;
>

2012-08-22 15:44:08

by Doug Anderson

[permalink] [raw]
Subject: Re: [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards

Jaehoon,

On Tue, Aug 21, 2012 at 9:35 PM, Jaehoon Chung <[email protected]> wrote:
>
> Hi Doug,
>
> I didn't know what purpose is.
> Why need to add the MMC_CAP2_NO_MMC?
> If card is SD or SDIO, mmc_attach_mmc(host) should not be entered.
> Could you explain to me in more detail?

Thanks for your feedback. In this case I have a card that is an MMC
card so mmc_attach_sdio() and mmc_attach_sd() will fail. If I let
mmc_attach_mmc() run it will actually find the MMC card. However, on
this platform it is not valid to recognize MMC cards.

-Doug

2012-08-22 16:01:06

by Philip Rakity

[permalink] [raw]
Subject: Re: [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards


On Aug 22, 2012, at 8:44 AM, Doug Anderson <[email protected]> wrote:

> Jaehoon,
>
> On Tue, Aug 21, 2012 at 9:35 PM, Jaehoon Chung <[email protected]> wrote:
>>
>> Hi Doug,
>>
>> I didn't know what purpose is.
>> Why need to add the MMC_CAP2_NO_MMC?
>> If card is SD or SDIO, mmc_attach_mmc(host) should not be entered.
>> Could you explain to me in more detail?
>
> Thanks for your feedback. In this case I have a card that is an MMC
> card so mmc_attach_sdio() and mmc_attach_sd() will fail. If I let
> mmc_attach_mmc() run it will actually find the MMC card. However, on
> this platform it is not valid to recognize MMC cards.
>


Understand.

Can you explain why the change is needed. Is it for technical
reasons that MMC is not allowed -- if so then I do not understand how SD can work
and MMC cannot.

If it is for marketing reasons -- then --- oh well .....


Could you add some additional comments to the commit message.
I think it makes sense to handle all 3 cases
a) SDIO not allowed
b) SD not allowed
c) MMC not allowed

> -Doug
> --
> 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

2012-08-22 16:50:42

by Olof Johansson

[permalink] [raw]
Subject: Re: [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards

Hi,

On Wed, Aug 22, 2012 at 9:00 AM, Philip Rakity <[email protected]> wrote:
>
> On Aug 22, 2012, at 8:44 AM, Doug Anderson <[email protected]> wrote:
>
>> Jaehoon,
>>
>> On Tue, Aug 21, 2012 at 9:35 PM, Jaehoon Chung <[email protected]> wrote:
>>>
>>> Hi Doug,
>>>
>>> I didn't know what purpose is.
>>> Why need to add the MMC_CAP2_NO_MMC?
>>> If card is SD or SDIO, mmc_attach_mmc(host) should not be entered.
>>> Could you explain to me in more detail?
>>
>> Thanks for your feedback. In this case I have a card that is an MMC
>> card so mmc_attach_sdio() and mmc_attach_sd() will fail. If I let
>> mmc_attach_mmc() run it will actually find the MMC card. However, on
>> this platform it is not valid to recognize MMC cards.
>>
>
>
> Understand.
>
> Can you explain why the change is needed. Is it for technical
> reasons that MMC is not allowed -- if so then I do not understand how SD can work
> and MMC cannot.
>
> If it is for marketing reasons -- then --- oh well .....
>
>
> Could you add some additional comments to the commit message.
> I think it makes sense to handle all 3 cases
> a) SDIO not allowed
> b) SD not allowed
> c) MMC not allowed

We are working with a system manufacturer who wishes to only support
SD cards in their product, and need to accommodate that. It made sense
for us to contribute this work upstream since others might want to do
the same in the future for some reason.

Adding all three cases makes sense if others foresee a use case for it.


-Olof

2012-08-22 18:25:50

by Nicolas Pitre

[permalink] [raw]
Subject: Re: [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards

On Wed, 22 Aug 2012, Olof Johansson wrote:

> On Wed, Aug 22, 2012 at 9:00 AM, Philip Rakity <[email protected]> wrote:
> >
> > On Aug 22, 2012, at 8:44 AM, Doug Anderson <[email protected]> wrote:
> >
> >> Thanks for your feedback. In this case I have a card that is an MMC
> >> card so mmc_attach_sdio() and mmc_attach_sd() will fail. If I let
> >> mmc_attach_mmc() run it will actually find the MMC card. However, on
> >> this platform it is not valid to recognize MMC cards.
> >>
> >
> >
> > Understand.
> >
> > Can you explain why the change is needed. Is it for technical
> > reasons that MMC is not allowed -- if so then I do not understand how SD can work
> > and MMC cannot.
> >
> > If it is for marketing reasons -- then --- oh well .....
> >
> >
> > Could you add some additional comments to the commit message.
> > I think it makes sense to handle all 3 cases
> > a) SDIO not allowed
> > b) SD not allowed
> > c) MMC not allowed
>
> We are working with a system manufacturer who wishes to only support
> SD cards in their product, and need to accommodate that. It made sense
> for us to contribute this work upstream since others might want to do
> the same in the future for some reason.
>
> Adding all three cases makes sense if others foresee a use case for it.

Isn't this rather revolting?

Personally I find such "feature" totally ridiculous. If said
manufacturer doesn't want to support MMC cards, they just have to not
advertise it, period. Or if they really mean it, then they only have to
state it explicitly in their user manual, and repeat it if ever problems
are reported.

Dumbing down kernel functionality to serve marketing purpose or
technology lock-ins is utterly stupid. Purposely restricting
interoperability might even be ruled illegal in some jurisdictions.

I therefore insist on providing a vehement NAK on such patches.


Nicolas

2012-08-22 18:28:05

by Olof Johansson

[permalink] [raw]
Subject: Re: [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards

On Wed, Aug 22, 2012 at 11:25 AM, Nicolas Pitre <[email protected]> wrote:
> On Wed, 22 Aug 2012, Olof Johansson wrote:
>
>> On Wed, Aug 22, 2012 at 9:00 AM, Philip Rakity <[email protected]> wrote:
>> >
>> > On Aug 22, 2012, at 8:44 AM, Doug Anderson <[email protected]> wrote:
>> >
>> >> Thanks for your feedback. In this case I have a card that is an MMC
>> >> card so mmc_attach_sdio() and mmc_attach_sd() will fail. If I let
>> >> mmc_attach_mmc() run it will actually find the MMC card. However, on
>> >> this platform it is not valid to recognize MMC cards.
>> >>
>> >
>> >
>> > Understand.
>> >
>> > Can you explain why the change is needed. Is it for technical
>> > reasons that MMC is not allowed -- if so then I do not understand how SD can work
>> > and MMC cannot.
>> >
>> > If it is for marketing reasons -- then --- oh well .....
>> >
>> >
>> > Could you add some additional comments to the commit message.
>> > I think it makes sense to handle all 3 cases
>> > a) SDIO not allowed
>> > b) SD not allowed
>> > c) MMC not allowed
>>
>> We are working with a system manufacturer who wishes to only support
>> SD cards in their product, and need to accommodate that. It made sense
>> for us to contribute this work upstream since others might want to do
>> the same in the future for some reason.
>>
>> Adding all three cases makes sense if others foresee a use case for it.
>
> Isn't this rather revolting?
>
> Personally I find such "feature" totally ridiculous. If said
> manufacturer doesn't want to support MMC cards, they just have to not
> advertise it, period. Or if they really mean it, then they only have to
> state it explicitly in their user manual, and repeat it if ever problems
> are reported.
>
> Dumbing down kernel functionality to serve marketing purpose or
> technology lock-ins is utterly stupid. Purposely restricting
> interoperability might even be ruled illegal in some jurisdictions.
>
> I therefore insist on providing a vehement NAK on such patches.

Ok, thanks. We'll keep carrying it locally instead then.


-Olof