All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dt: Document: Add optional dw_mmc pm bindings
@ 2012-11-07 11:07 ` Abhilash Kesavan
  0 siblings, 0 replies; 6+ messages in thread
From: Abhilash Kesavan @ 2012-11-07 11:07 UTC (permalink / raw)
  To: linux-arm-kernel, kgene.kim, cjb, linux-mmc, will.newton

Add documentation for pm capabilties such as MMC_PM_KEEP_POWER
and MMC_PM_WAKE_SDIO_IRQ.

Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
---
 .../devicetree/bindings/mmc/synposis-dw-mshc.txt   |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
index 06cd32d..fa6806d 100644
--- a/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
+++ b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
@@ -47,6 +47,11 @@ Optional properties:
 
 * broken-cd: as documented in mmc core bindings.
 
+* keep-power-in-suspend: Preserves card power during a suspend/resume cycle.
+
+* enable-sdio-wakeup: Enables wake up of host system on SDIO IRQ assertion.
+
+ Samsung Exynos5250 specific properties:
 Aliases:
 
 - All the MSHC controller nodes should be represented in the aliases node using
@@ -69,6 +74,8 @@ board specific portions as listed below.
 		num-slots = <1>;
 		supports-highspeed;
 		broken-cd;
+		keep-power-in-suspend;
+		enable-sdio-wakeup;
 		fifo-depth = <0x80>;
 		card-detect-delay = <200>;
 
-- 
1.6.6.1


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

* [PATCH] dt: Document: Add optional dw_mmc pm bindings
@ 2012-11-07 11:07 ` Abhilash Kesavan
  0 siblings, 0 replies; 6+ messages in thread
From: Abhilash Kesavan @ 2012-11-07 11:07 UTC (permalink / raw)
  To: linux-arm-kernel

Add documentation for pm capabilties such as MMC_PM_KEEP_POWER
and MMC_PM_WAKE_SDIO_IRQ.

Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
---
 .../devicetree/bindings/mmc/synposis-dw-mshc.txt   |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
index 06cd32d..fa6806d 100644
--- a/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
+++ b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
@@ -47,6 +47,11 @@ Optional properties:
 
 * broken-cd: as documented in mmc core bindings.
 
+* keep-power-in-suspend: Preserves card power during a suspend/resume cycle.
+
+* enable-sdio-wakeup: Enables wake up of host system on SDIO IRQ assertion.
+
+ Samsung Exynos5250 specific properties:
 Aliases:
 
 - All the MSHC controller nodes should be represented in the aliases node using
@@ -69,6 +74,8 @@ board specific portions as listed below.
 		num-slots = <1>;
 		supports-highspeed;
 		broken-cd;
+		keep-power-in-suspend;
+		enable-sdio-wakeup;
 		fifo-depth = <0x80>;
 		card-detect-delay = <200>;
 
-- 
1.6.6.1

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

* [PATCH] mmc: dw_mmc: Add sdio power bindings
  2012-11-07 11:07 ` Abhilash Kesavan
@ 2012-11-07 11:07   ` Abhilash Kesavan
  -1 siblings, 0 replies; 6+ messages in thread
From: Abhilash Kesavan @ 2012-11-07 11:07 UTC (permalink / raw)
  To: linux-arm-kernel, kgene.kim, cjb, linux-mmc, will.newton

Add dt-based retrieval of host sdio pm capabilities. Based on
the dt based discovery do a bus init in the resume function.

Signed-off-by: Olof Johansson <olofj@chromium.org>
Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
---
 drivers/mmc/host/dw_mmc.c  |   20 +++++++++++++++++---
 include/linux/mmc/dw_mmc.h |    1 +
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index c0667c8..5979203 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -617,13 +617,13 @@ static void mci_send_cmd(struct dw_mci_slot *slot, u32 cmd, u32 arg)
 		cmd, arg, cmd_status);
 }
 
-static void dw_mci_setup_bus(struct dw_mci_slot *slot)
+static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
 {
 	struct dw_mci *host = slot->host;
 	u32 div;
 	u32 clk_en_a;
 
-	if (slot->clock != host->current_speed) {
+	if (slot->clock != host->current_speed || force_clkinit) {
 		div = host->bus_hz / slot->clock;
 		if (host->bus_hz % slot->clock && host->bus_hz > slot->clock)
 			/*
@@ -684,7 +684,7 @@ static void __dw_mci_start_request(struct dw_mci *host,
 		host->pdata->select_slot(slot->id);
 
 	/* Slot specific timing and width adjustment */
-	dw_mci_setup_bus(slot);
+	dw_mci_setup_bus(slot, false);
 
 	host->cur_slot = slot;
 	host->mrq = mrq;
@@ -1850,6 +1850,9 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
 	if (host->pdata->caps)
 		mmc->caps = host->pdata->caps;
 
+	if (host->pdata->pm_caps)
+		mmc->pm_caps = host->pdata->pm_caps;
+
 	if (host->dev->of_node) {
 		ctrl_id = of_alias_get_id(host->dev->of_node, "mshc");
 		if (ctrl_id < 0)
@@ -2072,6 +2075,12 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
 			return ERR_PTR(ret);
 	}
 
+	if (of_find_property(np, "keep-power-in-suspend", NULL))
+		pdata->pm_caps |= MMC_PM_KEEP_POWER;
+
+	if (of_find_property(np, "enable-sdio-wakeup", NULL))
+		pdata->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
+
 	return pdata;
 }
 
@@ -2411,6 +2420,11 @@ int dw_mci_resume(struct dw_mci *host)
 		struct dw_mci_slot *slot = host->slot[i];
 		if (!slot)
 			continue;
+		if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER) {
+			dw_mci_set_ios(slot->mmc, &slot->mmc->ios);
+			dw_mci_setup_bus(slot, true);
+		}
+
 		ret = mmc_resume_host(host->slot[i]->mmc);
 		if (ret < 0)
 			return ret;
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 9653166..b27471d 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -231,6 +231,7 @@ struct dw_mci_board {
 
 	unsigned int caps;	/* Capabilities */
 	unsigned int caps2;	/* More capabilities */
+	unsigned int pm_caps;	/* PM capabilities */
 	/*
 	 * Override fifo depth. If 0, autodetect it from the FIFOTH register,
 	 * but note that this may not be reliable after a bootloader has used
-- 
1.6.6.1


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

* [PATCH] mmc: dw_mmc: Add sdio power bindings
@ 2012-11-07 11:07   ` Abhilash Kesavan
  0 siblings, 0 replies; 6+ messages in thread
From: Abhilash Kesavan @ 2012-11-07 11:07 UTC (permalink / raw)
  To: linux-arm-kernel

Add dt-based retrieval of host sdio pm capabilities. Based on
the dt based discovery do a bus init in the resume function.

Signed-off-by: Olof Johansson <olofj@chromium.org>
Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
---
 drivers/mmc/host/dw_mmc.c  |   20 +++++++++++++++++---
 include/linux/mmc/dw_mmc.h |    1 +
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index c0667c8..5979203 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -617,13 +617,13 @@ static void mci_send_cmd(struct dw_mci_slot *slot, u32 cmd, u32 arg)
 		cmd, arg, cmd_status);
 }
 
-static void dw_mci_setup_bus(struct dw_mci_slot *slot)
+static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
 {
 	struct dw_mci *host = slot->host;
 	u32 div;
 	u32 clk_en_a;
 
-	if (slot->clock != host->current_speed) {
+	if (slot->clock != host->current_speed || force_clkinit) {
 		div = host->bus_hz / slot->clock;
 		if (host->bus_hz % slot->clock && host->bus_hz > slot->clock)
 			/*
@@ -684,7 +684,7 @@ static void __dw_mci_start_request(struct dw_mci *host,
 		host->pdata->select_slot(slot->id);
 
 	/* Slot specific timing and width adjustment */
-	dw_mci_setup_bus(slot);
+	dw_mci_setup_bus(slot, false);
 
 	host->cur_slot = slot;
 	host->mrq = mrq;
@@ -1850,6 +1850,9 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
 	if (host->pdata->caps)
 		mmc->caps = host->pdata->caps;
 
+	if (host->pdata->pm_caps)
+		mmc->pm_caps = host->pdata->pm_caps;
+
 	if (host->dev->of_node) {
 		ctrl_id = of_alias_get_id(host->dev->of_node, "mshc");
 		if (ctrl_id < 0)
@@ -2072,6 +2075,12 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
 			return ERR_PTR(ret);
 	}
 
+	if (of_find_property(np, "keep-power-in-suspend", NULL))
+		pdata->pm_caps |= MMC_PM_KEEP_POWER;
+
+	if (of_find_property(np, "enable-sdio-wakeup", NULL))
+		pdata->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
+
 	return pdata;
 }
 
@@ -2411,6 +2420,11 @@ int dw_mci_resume(struct dw_mci *host)
 		struct dw_mci_slot *slot = host->slot[i];
 		if (!slot)
 			continue;
+		if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER) {
+			dw_mci_set_ios(slot->mmc, &slot->mmc->ios);
+			dw_mci_setup_bus(slot, true);
+		}
+
 		ret = mmc_resume_host(host->slot[i]->mmc);
 		if (ret < 0)
 			return ret;
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 9653166..b27471d 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -231,6 +231,7 @@ struct dw_mci_board {
 
 	unsigned int caps;	/* Capabilities */
 	unsigned int caps2;	/* More capabilities */
+	unsigned int pm_caps;	/* PM capabilities */
 	/*
 	 * Override fifo depth. If 0, autodetect it from the FIFOTH register,
 	 * but note that this may not be reliable after a bootloader has used
-- 
1.6.6.1

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

* Re: [PATCH] dt: Document: Add optional dw_mmc pm bindings
  2012-11-07 11:07 ` Abhilash Kesavan
@ 2012-11-17 21:05   ` Chris Ball
  -1 siblings, 0 replies; 6+ messages in thread
From: Chris Ball @ 2012-11-17 21:05 UTC (permalink / raw)
  To: Abhilash Kesavan; +Cc: linux-arm-kernel, kgene.kim, linux-mmc, will.newton

Hi Abhilash,

On Wed, Nov 07 2012, Abhilash Kesavan wrote:
> Add documentation for pm capabilties such as MMC_PM_KEEP_POWER
> and MMC_PM_WAKE_SDIO_IRQ.
>
> Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
> ---
>  .../devicetree/bindings/mmc/synposis-dw-mshc.txt   |    7 +++++++

(Ugh, I just noticed the typo in that filename.  We should fix that.)

>  1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
> index 06cd32d..fa6806d 100644
> --- a/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
> +++ b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
> @@ -47,6 +47,11 @@ Optional properties:
>  
>  * broken-cd: as documented in mmc core bindings.
>  
> +* keep-power-in-suspend: Preserves card power during a suspend/resume cycle.
> +
> +* enable-sdio-wakeup: Enables wake up of host system on SDIO IRQ assertion.
> +
> + Samsung Exynos5250 specific properties:
>  Aliases:
>  
>  - All the MSHC controller nodes should be represented in the aliases node using
> @@ -69,6 +74,8 @@ board specific portions as listed below.
>  		num-slots = <1>;
>  		supports-highspeed;
>  		broken-cd;
> +		keep-power-in-suspend;
> +		enable-sdio-wakeup;
>  		fifo-depth = <0x80>;
>  		card-detect-delay = <200>;

Let's make these core optional properties, documented in
Documentation/devicetree/bindings/mmc/mmc.txt instead of in
synposis-dw-mshc.txt, and also add support for them in sdhci_pltfm.c
by adding your "host->pm_caps |= .." lines to sdhci_get_of_property().

Please could you do that and resend?  The dw_mmc patch looks fine.

Thanks,

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

* [PATCH] dt: Document: Add optional dw_mmc pm bindings
@ 2012-11-17 21:05   ` Chris Ball
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Ball @ 2012-11-17 21:05 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Abhilash,

On Wed, Nov 07 2012, Abhilash Kesavan wrote:
> Add documentation for pm capabilties such as MMC_PM_KEEP_POWER
> and MMC_PM_WAKE_SDIO_IRQ.
>
> Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
> ---
>  .../devicetree/bindings/mmc/synposis-dw-mshc.txt   |    7 +++++++

(Ugh, I just noticed the typo in that filename.  We should fix that.)

>  1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
> index 06cd32d..fa6806d 100644
> --- a/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
> +++ b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
> @@ -47,6 +47,11 @@ Optional properties:
>  
>  * broken-cd: as documented in mmc core bindings.
>  
> +* keep-power-in-suspend: Preserves card power during a suspend/resume cycle.
> +
> +* enable-sdio-wakeup: Enables wake up of host system on SDIO IRQ assertion.
> +
> + Samsung Exynos5250 specific properties:
>  Aliases:
>  
>  - All the MSHC controller nodes should be represented in the aliases node using
> @@ -69,6 +74,8 @@ board specific portions as listed below.
>  		num-slots = <1>;
>  		supports-highspeed;
>  		broken-cd;
> +		keep-power-in-suspend;
> +		enable-sdio-wakeup;
>  		fifo-depth = <0x80>;
>  		card-detect-delay = <200>;

Let's make these core optional properties, documented in
Documentation/devicetree/bindings/mmc/mmc.txt instead of in
synposis-dw-mshc.txt, and also add support for them in sdhci_pltfm.c
by adding your "host->pm_caps |= .." lines to sdhci_get_of_property().

Please could you do that and resend?  The dw_mmc patch looks fine.

Thanks,

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

end of thread, other threads:[~2012-11-17 21:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-07 11:07 [PATCH] dt: Document: Add optional dw_mmc pm bindings Abhilash Kesavan
2012-11-07 11:07 ` Abhilash Kesavan
2012-11-07 11:07 ` [PATCH] mmc: dw_mmc: Add sdio power bindings Abhilash Kesavan
2012-11-07 11:07   ` Abhilash Kesavan
2012-11-17 21:05 ` [PATCH] dt: Document: Add optional dw_mmc pm bindings Chris Ball
2012-11-17 21:05   ` Chris Ball

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.