linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards
@ 2012-08-22  4:05 Doug Anderson
  2012-08-22  4:05 ` [PATCH 2/2] mmc: dw_mmc: Add a DISABLE_MMC quirk that sets the core mmc cap Doug Anderson
  2012-08-22  4:35 ` [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards Jaehoon Chung
  0 siblings, 2 replies; 8+ messages in thread
From: Doug Anderson @ 2012-08-22  4:05 UTC (permalink / raw)
  To: linux-mmc
  Cc: Olof Johansson, Alim Akhtar, Thomas P Abraham, Chris Ball,
	Will Newton, Seungwon Jeon, Jaehoon Chung, James Hogan,
	linux-kernel, Linus Walleij, Ulf Hansson, Adrian Hunter,
	Doug Anderson

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;
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] mmc: dw_mmc: Add a DISABLE_MMC quirk that sets the core mmc cap
  2012-08-22  4:05 [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards Doug Anderson
@ 2012-08-22  4:05 ` Doug Anderson
  2012-08-22  4:35 ` [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards Jaehoon Chung
  1 sibling, 0 replies; 8+ messages in thread
From: Doug Anderson @ 2012-08-22  4:05 UTC (permalink / raw)
  To: linux-mmc
  Cc: Olof Johansson, Alim Akhtar, Thomas P Abraham, Chris Ball,
	Will Newton, Seungwon Jeon, Jaehoon Chung, James Hogan,
	linux-kernel, Linus Walleij, Ulf Hansson, Adrian Hunter,
	Doug Anderson

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 <dianders@chromium.org>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards
  2012-08-22  4:05 [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards Doug Anderson
  2012-08-22  4:05 ` [PATCH 2/2] mmc: dw_mmc: Add a DISABLE_MMC quirk that sets the core mmc cap Doug Anderson
@ 2012-08-22  4:35 ` Jaehoon Chung
  2012-08-22 15:44   ` Doug Anderson
  1 sibling, 1 reply; 8+ messages in thread
From: Jaehoon Chung @ 2012-08-22  4:35 UTC (permalink / raw)
  To: Doug Anderson
  Cc: linux-mmc, Olof Johansson, Alim Akhtar, Thomas P Abraham,
	Chris Ball, Will Newton, Seungwon Jeon, Jaehoon Chung,
	James Hogan, linux-kernel, Linus Walleij, Ulf Hansson,
	Adrian Hunter

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards
  2012-08-22  4:35 ` [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards Jaehoon Chung
@ 2012-08-22 15:44   ` Doug Anderson
  2012-08-22 16:00     ` Philip Rakity
  0 siblings, 1 reply; 8+ messages in thread
From: Doug Anderson @ 2012-08-22 15:44 UTC (permalink / raw)
  To: Jaehoon Chung
  Cc: linux-mmc, Olof Johansson, Alim Akhtar, Thomas P Abraham,
	Chris Ball, Will Newton, Seungwon Jeon, James Hogan,
	linux-kernel, Linus Walleij, Ulf Hansson, Adrian Hunter

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards
  2012-08-22 15:44   ` Doug Anderson
@ 2012-08-22 16:00     ` Philip Rakity
  2012-08-22 16:50       ` Olof Johansson
  0 siblings, 1 reply; 8+ messages in thread
From: Philip Rakity @ 2012-08-22 16:00 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Jaehoon Chung, linux-mmc, Olof Johansson, Alim Akhtar,
	Thomas P Abraham, Chris Ball, Will Newton, Seungwon Jeon,
	James Hogan, linux-kernel, Linus Walleij, Ulf Hansson,
	Adrian Hunter


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards
  2012-08-22 16:00     ` Philip Rakity
@ 2012-08-22 16:50       ` Olof Johansson
  2012-08-22 18:25         ` Nicolas Pitre
  0 siblings, 1 reply; 8+ messages in thread
From: Olof Johansson @ 2012-08-22 16:50 UTC (permalink / raw)
  To: Philip Rakity
  Cc: Doug Anderson, Jaehoon Chung, linux-mmc, Alim Akhtar,
	Thomas P Abraham, Chris Ball, Will Newton, Seungwon Jeon,
	James Hogan, linux-kernel, Linus Walleij, Ulf Hansson,
	Adrian Hunter

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards
  2012-08-22 16:50       ` Olof Johansson
@ 2012-08-22 18:25         ` Nicolas Pitre
  2012-08-22 18:27           ` Olof Johansson
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Pitre @ 2012-08-22 18:25 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Philip Rakity, Doug Anderson, Jaehoon Chung, linux-mmc,
	Alim Akhtar, Thomas P Abraham, Chris Ball, Will Newton,
	Seungwon Jeon, James Hogan, linux-kernel, Linus Walleij,
	Ulf Hansson, Adrian Hunter

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards
  2012-08-22 18:25         ` Nicolas Pitre
@ 2012-08-22 18:27           ` Olof Johansson
  0 siblings, 0 replies; 8+ messages in thread
From: Olof Johansson @ 2012-08-22 18:27 UTC (permalink / raw)
  To: Nicolas Pitre
  Cc: Philip Rakity, Doug Anderson, Jaehoon Chung, linux-mmc,
	Alim Akhtar, Thomas P Abraham, Chris Ball, Will Newton,
	Seungwon Jeon, James Hogan, linux-kernel, Linus Walleij,
	Ulf Hansson, Adrian Hunter

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-08-22 18:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-22  4:05 [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards Doug Anderson
2012-08-22  4:05 ` [PATCH 2/2] mmc: dw_mmc: Add a DISABLE_MMC quirk that sets the core mmc cap Doug Anderson
2012-08-22  4:35 ` [PATCH 1/2] mmc: core: Add a capability for disabling mmc cards Jaehoon Chung
2012-08-22 15:44   ` Doug Anderson
2012-08-22 16:00     ` Philip Rakity
2012-08-22 16:50       ` Olof Johansson
2012-08-22 18:25         ` Nicolas Pitre
2012-08-22 18:27           ` Olof Johansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).