Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1435088 > unrolled thread

[PATCH 0/3] Expose new mmc caps to DT

Started byShawn Lin <shawn.lin@rock-chips.com>
First post2016-07-01 09:50 +0200
Last post2016-07-06 18:30 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] Expose new mmc caps to DT Shawn Lin <shawn.lin@rock-chips.com> - 2016-07-01 09:50 +0200
    [PATCH 3/3] Documentation: mmc: add description for new no-sd* and no-mmc Shawn Lin <shawn.lin@rock-chips.com> - 2016-07-01 09:50 +0200
    [PATCH 2/3] mmc: core: expose MMC_CAP2_NO_* to dt Shawn Lin <shawn.lin@rock-chips.com> - 2016-07-01 09:50 +0200
    [PATCH 1/3] mmc: core: Allow hosts to specify non-support for MMC commands Shawn Lin <shawn.lin@rock-chips.com> - 2016-07-01 09:50 +0200
      Re: [PATCH 1/3] mmc: core: Allow hosts to specify non-support for MMC commands Ulf Hansson <ulf.hansson@linaro.org> - 2016-07-06 18:30 +0200

#1435088 — [PATCH 0/3] Expose new mmc caps to DT

FromShawn Lin <shawn.lin@rock-chips.com>
Date2016-07-01 09:50 +0200
Subject[PATCH 0/3] Expose new mmc caps to DT
Message-ID<rQ1n3-3Pu-7@gated-at.bofh.it>
I sent a RFC patchset[0] to invent new caps for improving the initialization
of mmc core. And Ulf merged MMC_CAP2_NO_SD and improved it for the latest
patchset of sh_mmcif[1].

So we could continue to add MMC_CAP2_NO_MMC for a sd or a sdio slot not to
send MMC command during initialization if failing to probe the device.
Also I'm exposing these new caps to DT for the specific board to improve
the initialization.

From the test, we can save nearly 2ms for attaching emmc against the
original 8ms. And we gain more than 30us improvement for sd card for
each insert.

[0]: http://thread.gmane.org/gmane.linux.kernel.mmc/37933
[1]: https://patchwork.kernel.org/patch/9190529/



Shawn Lin (3):
  mmc: core: Allow hosts to specify non-support for MMC commands
  mmc: core: expose MMC_CAP2_NO_* to dt
  Documentation: mmc: add description for new no-sd* and no-mmc

 Documentation/devicetree/bindings/mmc/mmc.txt | 3 +++
 drivers/mmc/core/core.c                       | 5 +++--
 drivers/mmc/core/host.c                       | 6 ++++++
 include/linux/mmc/host.h                      | 1 +
 4 files changed, 13 insertions(+), 2 deletions(-)

-- 
2.3.7

[toc] | [next] | [standalone]


#1435089 — [PATCH 3/3] Documentation: mmc: add description for new no-sd* and no-mmc

FromShawn Lin <shawn.lin@rock-chips.com>
Date2016-07-01 09:50 +0200
Subject[PATCH 3/3] Documentation: mmc: add description for new no-sd* and no-mmc
Message-ID<rQ1n4-3Pu-19@gated-at.bofh.it>
In reply to#1435088
This patch adds description for no-sd, no-sdio, no-mmc. We
expect the specific boards adds these in DT to improve
the initialization. For instance, for a soldered eMMC slot,
we could skip sending SDIO and SD commands to probe its card
types as it's always should be the type fo MMC card.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 Documentation/devicetree/bindings/mmc/mmc.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/mmc/mmc.txt b/Documentation/devicetree/bindings/mmc/mmc.txt
index ecc007a..b2046c6 100644
--- a/Documentation/devicetree/bindings/mmc/mmc.txt
+++ b/Documentation/devicetree/bindings/mmc/mmc.txt
@@ -49,6 +49,9 @@ Optional properties:
 - mmc-hs400-enhanced-strobe: eMMC HS400 enhanced strobe mode is supported
 - dsr: Value the card's (optional) Driver Stage Register (DSR) should be
   programmed with. Valid range: [0 .. 0xffff].
+- no-sdio: skip sending sdio cmd during initialization
+- no-sd: skip sending sd cmd during initialization
+- no-mmc: skip sending mmc cmd during initialization
 
 *NOTE* on CD and WP polarity. To use common for all SD/MMC host controllers line
 polarity properties, we have to fix the meaning of the "normal" and "inverted"
-- 
2.3.7

[toc] | [prev] | [next] | [standalone]


#1435091 — [PATCH 2/3] mmc: core: expose MMC_CAP2_NO_* to dt

FromShawn Lin <shawn.lin@rock-chips.com>
Date2016-07-01 09:50 +0200
Subject[PATCH 2/3] mmc: core: expose MMC_CAP2_NO_* to dt
Message-ID<rQ1n4-3Pu-25@gated-at.bofh.it>
In reply to#1435088
The reason for why we expose these to dt is that
most of the controllers could support all card typs including
sd, sdio and MMC card, but for the specific boards, (e)MMC or
sdio are non-removable devices, so it's impossible that these slot
will be used for other card types. Also for a certain SD slot, it
seems reasonable that we couldn't solder MMC devices or SDIO
devices. So let's expose these caps to dt for the specific boards
to imporve the behaviour of initialization.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/mmc/core/host.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index d7e86f9..98f25ff 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -315,6 +315,12 @@ int mmc_of_parse(struct mmc_host *host)
 		host->caps2 |= MMC_CAP2_HS400_1_2V | MMC_CAP2_HS200_1_2V_SDR;
 	if (of_property_read_bool(np, "mmc-hs400-enhanced-strobe"))
 		host->caps2 |= MMC_CAP2_HS400_ES;
+	if (of_property_read_bool(np, "no-sdio"))
+		host->caps2 |= MMC_CAP2_NO_SDIO;
+	if (of_property_read_bool(np, "no-sd"))
+		host->caps2 |= MMC_CAP2_NO_SD;
+	if (of_property_read_bool(np, "no-mmc"))
+		host->caps2 |= MMC_CAP2_NO_MMC;
 
 	host->dsr_req = !of_property_read_u32(np, "dsr", &host->dsr);
 	if (host->dsr_req && (host->dsr & ~0xffff)) {
-- 
2.3.7

[toc] | [prev] | [next] | [standalone]


#1435093 — [PATCH 1/3] mmc: core: Allow hosts to specify non-support for MMC commands

FromShawn Lin <shawn.lin@rock-chips.com>
Date2016-07-01 09:50 +0200
Subject[PATCH 1/3] mmc: core: Allow hosts to specify non-support for MMC commands
Message-ID<rQ1n4-3Pu-17@gated-at.bofh.it>
In reply to#1435088
Host drivers which needs to valdiate for non-supported MMC
commands and returnn error code for such requests.

To improve and simplify the behaviour, let's invent MMC_CAP2_NO_MMC
which these host drivers can set to tell the mmc core to skip sending MMC
commands during card initialization.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

---

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

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 4c823df..94cbf4e 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2510,8 +2510,9 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
 		if (!mmc_attach_sd(host))
 			return 0;
 
-	if (!mmc_attach_mmc(host))
-		return 0;
+	if (!(host->caps2 & MMC_CAP2_NO_MMC))
+		if (!mmc_attach_mmc(host))
+			return 0;
 
 	mmc_power_off(host);
 	return -EIO;
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index c22476d..aa4bfbf 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -310,6 +310,7 @@ struct mmc_host {
 #define MMC_CAP2_NO_SDIO	(1 << 19)	/* Do not send SDIO commands during initialization */
 #define MMC_CAP2_HS400_ES	(1 << 20)	/* Host supports enhanced strobe */
 #define MMC_CAP2_NO_SD		(1 << 21)	/* Do not send SD commands during initialization */
+#define MMC_CAP2_NO_MMC		(1 << 22)	/* Do not send (e)MMC commands during initialization */
 
 	mmc_pm_flag_t		pm_caps;	/* supported pm features */
 
-- 
2.3.7

[toc] | [prev] | [next] | [standalone]


#1437835 — Re: [PATCH 1/3] mmc: core: Allow hosts to specify non-support for MMC commands

FromUlf Hansson <ulf.hansson@linaro.org>
Date2016-07-06 18:30 +0200
SubjectRe: [PATCH 1/3] mmc: core: Allow hosts to specify non-support for MMC commands
Message-ID<rRXS2-32X-29@gated-at.bofh.it>
In reply to#1435093
On 1 July 2016 at 09:45, Shawn Lin <shawn.lin@rock-chips.com> wrote:
> Host drivers which needs to valdiate for non-supported MMC
> commands and returnn error code for such requests.
>
> To improve and simplify the behaviour, let's invent MMC_CAP2_NO_MMC
> which these host drivers can set to tell the mmc core to skip sending MMC
> commands during card initialization.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

Thanks, applied for next!

Delaying patch2 and patch3 until I received acks from DT maintainers.

Kind regards
Uffe

>
> ---
>
>  drivers/mmc/core/core.c  | 5 +++--
>  include/linux/mmc/host.h | 1 +
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 4c823df..94cbf4e 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2510,8 +2510,9 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
>                 if (!mmc_attach_sd(host))
>                         return 0;
>
> -       if (!mmc_attach_mmc(host))
> -               return 0;
> +       if (!(host->caps2 & MMC_CAP2_NO_MMC))
> +               if (!mmc_attach_mmc(host))
> +                       return 0;
>
>         mmc_power_off(host);
>         return -EIO;
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index c22476d..aa4bfbf 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -310,6 +310,7 @@ struct mmc_host {
>  #define MMC_CAP2_NO_SDIO       (1 << 19)       /* Do not send SDIO commands during initialization */
>  #define MMC_CAP2_HS400_ES      (1 << 20)       /* Host supports enhanced strobe */
>  #define MMC_CAP2_NO_SD         (1 << 21)       /* Do not send SD commands during initialization */
> +#define MMC_CAP2_NO_MMC                (1 << 22)       /* Do not send (e)MMC commands during initialization */
>
>         mmc_pm_flag_t           pm_caps;        /* supported pm features */
>
> --
> 2.3.7
>
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web