linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Expose new mmc caps to DT
@ 2016-07-01  7:45 Shawn Lin
  2016-07-01  7:45 ` [PATCH 1/3] mmc: core: Allow hosts to specify non-support for MMC commands Shawn Lin
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Shawn Lin @ 2016-07-01  7:45 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Adrian Hunter, Jaehoon Chung, Rob Herring, linux-mmc,
	linux-kernel, Doug Anderson, devicetree, Shawn Lin


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

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

* [PATCH 1/3] mmc: core: Allow hosts to specify non-support for MMC commands
  2016-07-01  7:45 [PATCH 0/3] Expose new mmc caps to DT Shawn Lin
@ 2016-07-01  7:45 ` Shawn Lin
  2016-07-06 16:21   ` Ulf Hansson
  2016-07-01  7:45 ` [PATCH 2/3] mmc: core: expose MMC_CAP2_NO_* to dt Shawn Lin
  2016-07-01  7:45 ` [PATCH 3/3] Documentation: mmc: add description for new no-sd* and no-mmc Shawn Lin
  2 siblings, 1 reply; 7+ messages in thread
From: Shawn Lin @ 2016-07-01  7:45 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Adrian Hunter, Jaehoon Chung, Rob Herring, linux-mmc,
	linux-kernel, Doug Anderson, devicetree, Shawn Lin

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

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

* [PATCH 2/3] mmc: core: expose MMC_CAP2_NO_* to dt
  2016-07-01  7:45 [PATCH 0/3] Expose new mmc caps to DT Shawn Lin
  2016-07-01  7:45 ` [PATCH 1/3] mmc: core: Allow hosts to specify non-support for MMC commands Shawn Lin
@ 2016-07-01  7:45 ` Shawn Lin
  2016-07-01  7:45 ` [PATCH 3/3] Documentation: mmc: add description for new no-sd* and no-mmc Shawn Lin
  2 siblings, 0 replies; 7+ messages in thread
From: Shawn Lin @ 2016-07-01  7:45 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Adrian Hunter, Jaehoon Chung, Rob Herring, linux-mmc,
	linux-kernel, Doug Anderson, devicetree, Shawn Lin

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

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

* [PATCH 3/3] Documentation: mmc: add description for new no-sd* and no-mmc
  2016-07-01  7:45 [PATCH 0/3] Expose new mmc caps to DT Shawn Lin
  2016-07-01  7:45 ` [PATCH 1/3] mmc: core: Allow hosts to specify non-support for MMC commands Shawn Lin
  2016-07-01  7:45 ` [PATCH 2/3] mmc: core: expose MMC_CAP2_NO_* to dt Shawn Lin
@ 2016-07-01  7:45 ` Shawn Lin
  2016-07-11 13:57   ` Rob Herring
  2 siblings, 1 reply; 7+ messages in thread
From: Shawn Lin @ 2016-07-01  7:45 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Adrian Hunter, Jaehoon Chung, Rob Herring, linux-mmc,
	linux-kernel, Doug Anderson, devicetree, Shawn Lin

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

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

* Re: [PATCH 1/3] mmc: core: Allow hosts to specify non-support for MMC commands
  2016-07-01  7:45 ` [PATCH 1/3] mmc: core: Allow hosts to specify non-support for MMC commands Shawn Lin
@ 2016-07-06 16:21   ` Ulf Hansson
  0 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2016-07-06 16:21 UTC (permalink / raw)
  To: Shawn Lin
  Cc: Adrian Hunter, Jaehoon Chung, Rob Herring, linux-mmc,
	linux-kernel, Doug Anderson, devicetree

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

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

* Re: [PATCH 3/3] Documentation: mmc: add description for new no-sd* and no-mmc
  2016-07-01  7:45 ` [PATCH 3/3] Documentation: mmc: add description for new no-sd* and no-mmc Shawn Lin
@ 2016-07-11 13:57   ` Rob Herring
  2016-07-12  1:51     ` Shawn Lin
  0 siblings, 1 reply; 7+ messages in thread
From: Rob Herring @ 2016-07-11 13:57 UTC (permalink / raw)
  To: Shawn Lin
  Cc: Ulf Hansson, Adrian Hunter, Jaehoon Chung, linux-mmc,
	linux-kernel, Doug Anderson, devicetree

On Fri, Jul 01, 2016 at 03:45:30PM +0800, Shawn Lin wrote:
> 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

I still have issue with the description for these properties and the 
commit msg. They are fine if described as controller limitations as Ulf 
described. If folks want to (ab)use the properties for just skipping 
init, then that's their problem.

Rob

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

* Re: [PATCH 3/3] Documentation: mmc: add description for new no-sd* and no-mmc
  2016-07-11 13:57   ` Rob Herring
@ 2016-07-12  1:51     ` Shawn Lin
  0 siblings, 0 replies; 7+ messages in thread
From: Shawn Lin @ 2016-07-12  1:51 UTC (permalink / raw)
  To: Rob Herring
  Cc: shawn.lin, Ulf Hansson, Adrian Hunter, Jaehoon Chung, linux-mmc,
	linux-kernel, Doug Anderson, devicetree

Hi Rob,

On 2016/7/11 21:57, Rob Herring WROTE:
> On Fri, Jul 01, 2016 at 03:45:30PM +0800, Shawn Lin wrote:
>> 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
>
> I still have issue with the description for these properties and the
> commit msg. They are fine if described as controller limitations as Ulf
> described. If folks want to (ab)use the properties for just skipping
> init, then that's their problem.

Sounds like it's okay for you if I amend the commit msg and drscription
to emphasize that these properties are intent to describe the
limitations of controllers rather than to skip init.

I will fix them.

Thanks.

>
> Rob
>
>
>


-- 
Best Regards
Shawn Lin

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

end of thread, other threads:[~2016-07-12  1:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-01  7:45 [PATCH 0/3] Expose new mmc caps to DT Shawn Lin
2016-07-01  7:45 ` [PATCH 1/3] mmc: core: Allow hosts to specify non-support for MMC commands Shawn Lin
2016-07-06 16:21   ` Ulf Hansson
2016-07-01  7:45 ` [PATCH 2/3] mmc: core: expose MMC_CAP2_NO_* to dt Shawn Lin
2016-07-01  7:45 ` [PATCH 3/3] Documentation: mmc: add description for new no-sd* and no-mmc Shawn Lin
2016-07-11 13:57   ` Rob Herring
2016-07-12  1:51     ` Shawn Lin

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).