diff mbox

[1/2] mmc: core: Add a capability for disabling mmc cards

Message ID 1345608318-15347-1-git-send-email-dianders@chromium.org (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Doug Anderson Aug. 22, 2012, 4:05 a.m. UTC
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 <dianders@chromium.org>
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
---
 drivers/mmc/core/core.c  |    2 +-
 include/linux/mmc/host.h |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

Comments

Jaehoon Chung Aug. 22, 2012, 4:35 a.m. UTC | #1
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 <dianders@chromium.org>
> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
> ---
>  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;
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Doug Anderson Aug. 22, 2012, 3:44 p.m. UTC | #2
Jaehoon,

On Tue, Aug 21, 2012 at 9:35 PM, Jaehoon Chung <jh80.chung@samsung.com> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Philip Rakity Aug. 22, 2012, 4 p.m. UTC | #3
On Aug 22, 2012, at 8:44 AM, Doug Anderson <dianders@chromium.org> wrote:

> Jaehoon,
> 
> On Tue, Aug 21, 2012 at 9:35 PM, Jaehoon Chung <jh80.chung@samsung.com> 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Olof Johansson Aug. 22, 2012, 4:50 p.m. UTC | #4
Hi,

On Wed, Aug 22, 2012 at 9:00 AM, Philip Rakity <prakity@marvell.com> wrote:
>
> On Aug 22, 2012, at 8:44 AM, Doug Anderson <dianders@chromium.org> wrote:
>
>> Jaehoon,
>>
>> On Tue, Aug 21, 2012 at 9:35 PM, Jaehoon Chung <jh80.chung@samsung.com> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nicolas Pitre Aug. 22, 2012, 6:25 p.m. UTC | #5
On Wed, 22 Aug 2012, Olof Johansson wrote:

> On Wed, Aug 22, 2012 at 9:00 AM, Philip Rakity <prakity@marvell.com> wrote:
> >
> > On Aug 22, 2012, at 8:44 AM, Doug Anderson <dianders@chromium.org> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Olof Johansson Aug. 22, 2012, 6:27 p.m. UTC | #6
On Wed, Aug 22, 2012 at 11:25 AM, Nicolas Pitre <nico@fluxnic.net> wrote:
> On Wed, 22 Aug 2012, Olof Johansson wrote:
>
>> On Wed, Aug 22, 2012 at 9:00 AM, Philip Rakity <prakity@marvell.com> wrote:
>> >
>> > On Aug 22, 2012, at 8:44 AM, Doug Anderson <dianders@chromium.org> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;