All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mmc: core: Introduce MMC_CAP2_NO_SDIO cap
@ 2015-11-25 14:39 Carlo Caione
  2015-11-25 16:34 ` Ulf Hansson
  0 siblings, 1 reply; 4+ messages in thread
From: Carlo Caione @ 2015-11-25 14:39 UTC (permalink / raw)
  To: ulf.hansson, linux-mmc, drake; +Cc: Carlo Caione

From: Carlo Caione <carlo@endlessm.com>

This patch introduce a new MMC_CAP2_NO_SDIO cap used to tell the mmc
core to not send SDIO specific commands.

Signed-off-by: Carlo Caione <carlo@endlessm.com>
---

Drivers fix will follow.

Changelog:

* v2:
   - moved check from __mmc_start_request to mmc_rescan_try_freq

---
 drivers/mmc/core/core.c  | 11 ++++++++---
 include/linux/mmc/host.h |  1 +
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 5ae89e4..8a4e0d2 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2476,15 +2476,20 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
 	 * sdio_reset sends CMD52 to reset card.  Since we do not know
 	 * if the card is being re-initialized, just send it.  CMD52
 	 * should be ignored by SD/eMMC cards.
+	 * Skip it if we already know that we do not support SDIO commands
 	 */
-	sdio_reset(host);
+	if (!(host->caps2 & MMC_CAP2_NO_SDIO))
+		sdio_reset(host);
+
 	mmc_go_idle(host);
 
 	mmc_send_if_cond(host, host->ocr_avail);
 
 	/* Order's important: probe SDIO, then SD, then MMC */
-	if (!mmc_attach_sdio(host))
-		return 0;
+	if (!(host->caps2 & MMC_CAP2_NO_SDIO))
+		if (!mmc_attach_sdio(host))
+			return 0;
+
 	if (!mmc_attach_sd(host))
 		return 0;
 	if (!mmc_attach_mmc(host))
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 8673ffe..cf6d0bb 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -289,6 +289,7 @@ struct mmc_host {
 #define MMC_CAP2_HSX00_1_2V	(MMC_CAP2_HS200_1_2V_SDR | MMC_CAP2_HS400_1_2V)
 #define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17)
 #define MMC_CAP2_NO_WRITE_PROTECT (1 << 18)	/* No physical write protect pin, assume that card is always read-write */
+#define MMC_CAP2_NO_SDIO	(1 << 19)	/* Do not send SDIO commands during initialization */
 
 	mmc_pm_flag_t		pm_caps;	/* supported pm features */
 
-- 
2.5.0


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

* Re: [PATCH v2] mmc: core: Introduce MMC_CAP2_NO_SDIO cap
  2015-11-25 14:39 [PATCH v2] mmc: core: Introduce MMC_CAP2_NO_SDIO cap Carlo Caione
@ 2015-11-25 16:34 ` Ulf Hansson
  2015-11-25 17:16   ` Carlo Caione
  0 siblings, 1 reply; 4+ messages in thread
From: Ulf Hansson @ 2015-11-25 16:34 UTC (permalink / raw)
  To: Carlo Caione; +Cc: linux-mmc, Daniel Drake, Carlo Caione

On 25 November 2015 at 15:39, Carlo Caione <carlo@caione.org> wrote:
> From: Carlo Caione <carlo@endlessm.com>
>
> This patch introduce a new MMC_CAP2_NO_SDIO cap used to tell the mmc
> core to not send SDIO specific commands.

I guess there are two reasons to why such capability is useful.
1) The host controller/driver doesn't support SDIO.
2) There is an embedded/non-removable eMMC/SD card.

Within that context, we might also want to add MMC_CAP2_NO_MMC|SD, or
what do you think?

Because of 2), we might also want to add a new mmc DT binding or
perhaps try interpret a combination of them to enable
MMC_CAP2_NO_SDIO!?

>
> Signed-off-by: Carlo Caione <carlo@endlessm.com>

Thanks, applied for next!

Kind regards
Uffe

> ---
>
> Drivers fix will follow.
>
> Changelog:
>
> * v2:
>    - moved check from __mmc_start_request to mmc_rescan_try_freq
>
> ---
>  drivers/mmc/core/core.c  | 11 ++++++++---
>  include/linux/mmc/host.h |  1 +
>  2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 5ae89e4..8a4e0d2 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2476,15 +2476,20 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
>          * sdio_reset sends CMD52 to reset card.  Since we do not know
>          * if the card is being re-initialized, just send it.  CMD52
>          * should be ignored by SD/eMMC cards.
> +        * Skip it if we already know that we do not support SDIO commands
>          */
> -       sdio_reset(host);
> +       if (!(host->caps2 & MMC_CAP2_NO_SDIO))
> +               sdio_reset(host);
> +
>         mmc_go_idle(host);
>
>         mmc_send_if_cond(host, host->ocr_avail);
>
>         /* Order's important: probe SDIO, then SD, then MMC */
> -       if (!mmc_attach_sdio(host))
> -               return 0;
> +       if (!(host->caps2 & MMC_CAP2_NO_SDIO))
> +               if (!mmc_attach_sdio(host))
> +                       return 0;
> +
>         if (!mmc_attach_sd(host))
>                 return 0;
>         if (!mmc_attach_mmc(host))
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index 8673ffe..cf6d0bb 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -289,6 +289,7 @@ struct mmc_host {
>  #define MMC_CAP2_HSX00_1_2V    (MMC_CAP2_HS200_1_2V_SDR | MMC_CAP2_HS400_1_2V)
>  #define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17)
>  #define MMC_CAP2_NO_WRITE_PROTECT (1 << 18)    /* No physical write protect pin, assume that card is always read-write */
> +#define MMC_CAP2_NO_SDIO       (1 << 19)       /* Do not send SDIO commands during initialization */
>
>         mmc_pm_flag_t           pm_caps;        /* supported pm features */
>
> --
> 2.5.0
>

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

* Re: [PATCH v2] mmc: core: Introduce MMC_CAP2_NO_SDIO cap
  2015-11-25 16:34 ` Ulf Hansson
@ 2015-11-25 17:16   ` Carlo Caione
  2015-11-26 11:04     ` Ulf Hansson
  0 siblings, 1 reply; 4+ messages in thread
From: Carlo Caione @ 2015-11-25 17:16 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Carlo Caione, linux-mmc, Daniel Drake

On Wed, Nov 25, 2015 at 5:34 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 25 November 2015 at 15:39, Carlo Caione <carlo@caione.org> wrote:
>> From: Carlo Caione <carlo@endlessm.com>
>>
>> This patch introduce a new MMC_CAP2_NO_SDIO cap used to tell the mmc
>> core to not send SDIO specific commands.
>
> I guess there are two reasons to why such capability is useful.
> 1) The host controller/driver doesn't support SDIO.
> 2) There is an embedded/non-removable eMMC/SD card.
>
> Within that context, we might also want to add MMC_CAP2_NO_MMC|SD, or
> what do you think?

Is there really any driver / controller not supporting MMC|SD commands?

> Because of 2), we might also want to add a new mmc DT binding or
> perhaps try interpret a combination of them to enable
> MMC_CAP2_NO_SDIO!?

Probably I'm missing something but what would be the difference with
the 'non-removable' parameter we already have?

>>
>> Signed-off-by: Carlo Caione <carlo@endlessm.com>
>
> Thanks, applied for next!

Thanks,

-- 
Carlo Caione  |  +39.340.80.30.096  |  Endless

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

* Re: [PATCH v2] mmc: core: Introduce MMC_CAP2_NO_SDIO cap
  2015-11-25 17:16   ` Carlo Caione
@ 2015-11-26 11:04     ` Ulf Hansson
  0 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2015-11-26 11:04 UTC (permalink / raw)
  To: Carlo Caione; +Cc: Carlo Caione, linux-mmc, Daniel Drake

On 25 November 2015 at 18:16, Carlo Caione <carlo@endlessm.com> wrote:
> On Wed, Nov 25, 2015 at 5:34 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>> On 25 November 2015 at 15:39, Carlo Caione <carlo@caione.org> wrote:
>>> From: Carlo Caione <carlo@endlessm.com>
>>>
>>> This patch introduce a new MMC_CAP2_NO_SDIO cap used to tell the mmc
>>> core to not send SDIO specific commands.
>>
>> I guess there are two reasons to why such capability is useful.
>> 1) The host controller/driver doesn't support SDIO.
>> 2) There is an embedded/non-removable eMMC/SD card.
>>
>> Within that context, we might also want to add MMC_CAP2_NO_MMC|SD, or
>> what do you think?
>
> Is there really any driver / controller not supporting MMC|SD commands?

Probably not.

I was thinking of optimizing the time it takes to detect a card. For
example, if we know it's a non-removable eMMC, we can skip the SDIO
and SD part in the initialization sequence. Whether that's really
worth to optimize I don't know without measuring the times.

[...]

Kind regards
Uffe

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

end of thread, other threads:[~2015-11-26 11:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-25 14:39 [PATCH v2] mmc: core: Introduce MMC_CAP2_NO_SDIO cap Carlo Caione
2015-11-25 16:34 ` Ulf Hansson
2015-11-25 17:16   ` Carlo Caione
2015-11-26 11:04     ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.