All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage
@ 2010-11-02  0:05 Alberto Panizzo
  2010-11-02  7:39 ` Sascha Hauer
  2010-11-08 22:12 ` [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage Linus Walleij
  0 siblings, 2 replies; 14+ messages in thread
From: Alberto Panizzo @ 2010-11-02  0:05 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Daniel Mack, Andrew Morton, Uwe Kleine-König,
	Eric Bénard, Fabio Estevam, linux-kernel, linux-mmc

This implementation is based on the pxamci.c driver and it will
be used to support the mx31_3ds machine.

Signed-off-by: Alberto Panizzo <maramaopercheseimorto@gmail.com>
---

This patch is based on the pengutronix for-rmk branch and apply to the
linus tre, version:2.6.37-rc1

..cc the lists, sorry for the double mail.

 drivers/mmc/host/mxcmmc.c |   48 +++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index 350f78e..e4637fc 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -31,6 +31,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/regulator/consumer.h>
 
 #include <asm/dma.h>
 #include <asm/irq.h>
@@ -141,10 +142,45 @@ struct mxcmci_host {
 
 	struct work_struct	datawork;
 	spinlock_t		lock;
+
+	struct regulator	*vcc;
 };
 
 static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios);
 
+static inline void mxcmci_init_ocr(struct mxcmci_host *host)
+{
+#ifdef CONFIG_REGULATOR
+	host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
+
+	if (IS_ERR(host->vcc)) {
+		host->vcc = NULL;
+	} else {
+		host->mmc->ocr_avail = mmc_regulator_get_ocrmask(host->vcc);
+		if (host->pdata && host->pdata->ocr_avail)
+			dev_warn(mmc_dev(host->mmc),
+				"pdata->ocr_avail will not be used\n");
+	}
+#endif
+	if (host->vcc == NULL) {
+		/* fall-back to platform data */
+		if (host->pdata && host->pdata->ocr_avail)
+			host->mmc->ocr_avail = host->pdata->ocr_avail;
+		else
+			host->mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
+	}
+}
+
+static inline void mxcmci_set_power(struct mxcmci_host *host, unsigned int vdd)
+{
+#ifdef CONFIG_REGULATOR
+	if (host->vcc)
+		mmc_regulator_set_ocr(host->vcc, vdd);
+#endif
+	if (host->pdata && host->pdata->setpower)
+		host->pdata->setpower(mmc_dev(host->mmc), vdd);
+}
+
 static inline int mxcmci_use_dma(struct mxcmci_host *host)
 {
 	return host->do_dma;
@@ -680,9 +716,9 @@ static void mxcmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 		host->cmdat &= ~CMD_DAT_CONT_BUS_WIDTH_4;
 
 	if (host->power_mode != ios->power_mode) {
-		if (host->pdata && host->pdata->setpower)
-			host->pdata->setpower(mmc_dev(mmc), ios->vdd);
+		mxcmci_set_power(host, ios->vdd);
 		host->power_mode = ios->power_mode;
+
 		if (ios->power_mode == MMC_POWER_ON)
 			host->cmdat |= CMD_DAT_CONT_INIT;
 	}
@@ -808,10 +844,7 @@ static int mxcmci_probe(struct platform_device *pdev)
 	host->pdata = pdev->dev.platform_data;
 	spin_lock_init(&host->lock);
 
-	if (host->pdata && host->pdata->ocr_avail)
-		mmc->ocr_avail = host->pdata->ocr_avail;
-	else
-		mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
+	mxcmci_init_ocr(host);
 
 	if (host->pdata && host->pdata->dat3_card_detect)
 		host->default_irq_mask =
@@ -916,6 +949,9 @@ static int mxcmci_remove(struct platform_device *pdev)
 
 	mmc_remove_host(mmc);
 
+	if (host->vcc)
+		regulator_put(host->vcc);
+
 	if (host->pdata && host->pdata->exit)
 		host->pdata->exit(&pdev->dev, mmc);
 
-- 
1.6.3.3





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

* Re: [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage
  2010-11-02  0:05 [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage Alberto Panizzo
@ 2010-11-02  7:39 ` Sascha Hauer
  2010-11-02 10:33   ` Alberto Panizzo
  2010-11-05  9:27   ` Alberto Panizzo
  2010-11-08 22:12 ` [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage Linus Walleij
  1 sibling, 2 replies; 14+ messages in thread
From: Sascha Hauer @ 2010-11-02  7:39 UTC (permalink / raw)
  To: Alberto Panizzo
  Cc: Daniel Mack, Andrew Morton, Uwe Kleine-König,
	Eric Bénard, Fabio Estevam, linux-kernel, linux-mmc

On Tue, Nov 02, 2010 at 01:05:37AM +0100, Alberto Panizzo wrote:
> This implementation is based on the pxamci.c driver and it will
> be used to support the mx31_3ds machine.
> 
> Signed-off-by: Alberto Panizzo <maramaopercheseimorto@gmail.com>

Looks good to me

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

> ---
> 
> This patch is based on the pengutronix for-rmk branch and apply to the
> linus tre, version:2.6.37-rc1
> 
> ..cc the lists, sorry for the double mail.
> 
>  drivers/mmc/host/mxcmmc.c |   48 +++++++++++++++++++++++++++++++++++++++-----
>  1 files changed, 42 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
> index 350f78e..e4637fc 100644
> --- a/drivers/mmc/host/mxcmmc.c
> +++ b/drivers/mmc/host/mxcmmc.c
> @@ -31,6 +31,7 @@
>  #include <linux/clk.h>
>  #include <linux/io.h>
>  #include <linux/gpio.h>
> +#include <linux/regulator/consumer.h>
>  
>  #include <asm/dma.h>
>  #include <asm/irq.h>
> @@ -141,10 +142,45 @@ struct mxcmci_host {
>  
>  	struct work_struct	datawork;
>  	spinlock_t		lock;
> +
> +	struct regulator	*vcc;
>  };
>  
>  static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios);
>  
> +static inline void mxcmci_init_ocr(struct mxcmci_host *host)
> +{
> +#ifdef CONFIG_REGULATOR
> +	host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
> +
> +	if (IS_ERR(host->vcc)) {
> +		host->vcc = NULL;
> +	} else {
> +		host->mmc->ocr_avail = mmc_regulator_get_ocrmask(host->vcc);
> +		if (host->pdata && host->pdata->ocr_avail)
> +			dev_warn(mmc_dev(host->mmc),
> +				"pdata->ocr_avail will not be used\n");
> +	}
> +#endif
> +	if (host->vcc == NULL) {
> +		/* fall-back to platform data */
> +		if (host->pdata && host->pdata->ocr_avail)
> +			host->mmc->ocr_avail = host->pdata->ocr_avail;
> +		else
> +			host->mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
> +	}
> +}
> +
> +static inline void mxcmci_set_power(struct mxcmci_host *host, unsigned int vdd)
> +{
> +#ifdef CONFIG_REGULATOR
> +	if (host->vcc)
> +		mmc_regulator_set_ocr(host->vcc, vdd);
> +#endif
> +	if (host->pdata && host->pdata->setpower)
> +		host->pdata->setpower(mmc_dev(host->mmc), vdd);
> +}
> +
>  static inline int mxcmci_use_dma(struct mxcmci_host *host)
>  {
>  	return host->do_dma;
> @@ -680,9 +716,9 @@ static void mxcmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>  		host->cmdat &= ~CMD_DAT_CONT_BUS_WIDTH_4;
>  
>  	if (host->power_mode != ios->power_mode) {
> -		if (host->pdata && host->pdata->setpower)
> -			host->pdata->setpower(mmc_dev(mmc), ios->vdd);
> +		mxcmci_set_power(host, ios->vdd);
>  		host->power_mode = ios->power_mode;
> +
>  		if (ios->power_mode == MMC_POWER_ON)
>  			host->cmdat |= CMD_DAT_CONT_INIT;
>  	}
> @@ -808,10 +844,7 @@ static int mxcmci_probe(struct platform_device *pdev)
>  	host->pdata = pdev->dev.platform_data;
>  	spin_lock_init(&host->lock);
>  
> -	if (host->pdata && host->pdata->ocr_avail)
> -		mmc->ocr_avail = host->pdata->ocr_avail;
> -	else
> -		mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
> +	mxcmci_init_ocr(host);
>  
>  	if (host->pdata && host->pdata->dat3_card_detect)
>  		host->default_irq_mask =
> @@ -916,6 +949,9 @@ static int mxcmci_remove(struct platform_device *pdev)
>  
>  	mmc_remove_host(mmc);
>  
> +	if (host->vcc)
> +		regulator_put(host->vcc);
> +
>  	if (host->pdata && host->pdata->exit)
>  		host->pdata->exit(&pdev->dev, mmc);
>  
> -- 
> 1.6.3.3
> 
> 
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage
  2010-11-02  7:39 ` Sascha Hauer
@ 2010-11-02 10:33   ` Alberto Panizzo
  2010-11-05  9:27   ` Alberto Panizzo
  1 sibling, 0 replies; 14+ messages in thread
From: Alberto Panizzo @ 2010-11-02 10:33 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Daniel Mack, Andrew Morton, Uwe Kleine-König,
	Eric Bénard, Fabio Estevam, linux-kernel, linux-mmc

On mar, 2010-11-02 at 08:39 +0100, Sascha Hauer wrote:
> On Tue, Nov 02, 2010 at 01:05:37AM +0100, Alberto Panizzo wrote:
> > This implementation is based on the pxamci.c driver and it will
> > be used to support the mx31_3ds machine.
> > 
> > Signed-off-by: Alberto Panizzo <maramaopercheseimorto@gmail.com>
> 
> Looks good to me
> 
> Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

Tks Sascha, the only difference between the pxa implementations is in 
this part:

> > +static inline void mxcmci_set_power(struct mxcmci_host *host, unsigned int vdd)
> > +{
> > +#ifdef CONFIG_REGULATOR
> > +	if (host->vcc)
> > +		mmc_regulator_set_ocr(host->vcc, vdd);
> > +#endif
> > +	if (host->pdata && host->pdata->setpower)
> > +		host->pdata->setpower(mmc_dev(host->mmc), vdd);
> > +}
> > +

The original one have this test:
	if (!host->vcc && host->pdata && host->pdata->setpower)
		host->pdata->setpower(mmc_dev(host->mmc), vdd);

But removing it, we are able to add further action than only powering
with the right voltage the mmc card.
In the case of the mx31_3ds we are able to enable the external hardware 
buffer only when it is really needed.

-- 
Alberto!

        Be Persistent!
                - Greg Kroah-Hartman (FOSDEM 2010)


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

* Re: [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage
  2010-11-02  7:39 ` Sascha Hauer
  2010-11-02 10:33   ` Alberto Panizzo
@ 2010-11-05  9:27   ` Alberto Panizzo
  2010-11-05 13:12     ` Sascha Hauer
  2010-11-08 10:53     ` Alberto Panizzo
  1 sibling, 2 replies; 14+ messages in thread
From: Alberto Panizzo @ 2010-11-05  9:27 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Daniel Mack, Andrew Morton, Uwe Kleine-König,
	Eric Bénard, Fabio Estevam, linux-kernel, linux-mmc,
	Chris Ball

On mar, 2010-11-02 at 08:39 +0100, Sascha Hauer wrote:
> On Tue, Nov 02, 2010 at 01:05:37AM +0100, Alberto Panizzo wrote:
> > This implementation is based on the pxamci.c driver and it will
> > be used to support the mx31_3ds machine.
> > 
> > Signed-off-by: Alberto Panizzo <maramaopercheseimorto@gmail.com>
> 
> Looks good to me
> 
> Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> 

Sascha, must this one go to the Chris Ball mmc tree? or can you pick it
up directly?
Is there any chance to have it on one of .37-rcN?

(Adding Chris to cc.)

Thanks,
Alberto!

> > ---
> > 
> > This patch is based on the pengutronix for-rmk branch and apply to the
> > linus tre, version:2.6.37-rc1
> > 
> > ..cc the lists, sorry for the double mail.
> > 
> >  drivers/mmc/host/mxcmmc.c |   48 +++++++++++++++++++++++++++++++++++++++-----
> >  1 files changed, 42 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
> > index 350f78e..e4637fc 100644
> > --- a/drivers/mmc/host/mxcmmc.c
> > +++ b/drivers/mmc/host/mxcmmc.c
> > @@ -31,6 +31,7 @@
> >  #include <linux/clk.h>
> >  #include <linux/io.h>
> >  #include <linux/gpio.h>
> > +#include <linux/regulator/consumer.h>
> >  
> >  #include <asm/dma.h>
> >  #include <asm/irq.h>
> > @@ -141,10 +142,45 @@ struct mxcmci_host {
> >  
> >  	struct work_struct	datawork;
> >  	spinlock_t		lock;
> > +
> > +	struct regulator	*vcc;
> >  };
> >  
> >  static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios);
> >  
> > +static inline void mxcmci_init_ocr(struct mxcmci_host *host)
> > +{
> > +#ifdef CONFIG_REGULATOR
> > +	host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
> > +
> > +	if (IS_ERR(host->vcc)) {
> > +		host->vcc = NULL;
> > +	} else {
> > +		host->mmc->ocr_avail = mmc_regulator_get_ocrmask(host->vcc);
> > +		if (host->pdata && host->pdata->ocr_avail)
> > +			dev_warn(mmc_dev(host->mmc),
> > +				"pdata->ocr_avail will not be used\n");
> > +	}
> > +#endif
> > +	if (host->vcc == NULL) {
> > +		/* fall-back to platform data */
> > +		if (host->pdata && host->pdata->ocr_avail)
> > +			host->mmc->ocr_avail = host->pdata->ocr_avail;
> > +		else
> > +			host->mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
> > +	}
> > +}
> > +
> > +static inline void mxcmci_set_power(struct mxcmci_host *host, unsigned int vdd)
> > +{
> > +#ifdef CONFIG_REGULATOR
> > +	if (host->vcc)
> > +		mmc_regulator_set_ocr(host->vcc, vdd);
> > +#endif
> > +	if (host->pdata && host->pdata->setpower)
> > +		host->pdata->setpower(mmc_dev(host->mmc), vdd);
> > +}
> > +
> >  static inline int mxcmci_use_dma(struct mxcmci_host *host)
> >  {
> >  	return host->do_dma;
> > @@ -680,9 +716,9 @@ static void mxcmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> >  		host->cmdat &= ~CMD_DAT_CONT_BUS_WIDTH_4;
> >  
> >  	if (host->power_mode != ios->power_mode) {
> > -		if (host->pdata && host->pdata->setpower)
> > -			host->pdata->setpower(mmc_dev(mmc), ios->vdd);
> > +		mxcmci_set_power(host, ios->vdd);
> >  		host->power_mode = ios->power_mode;
> > +
> >  		if (ios->power_mode == MMC_POWER_ON)
> >  			host->cmdat |= CMD_DAT_CONT_INIT;
> >  	}
> > @@ -808,10 +844,7 @@ static int mxcmci_probe(struct platform_device *pdev)
> >  	host->pdata = pdev->dev.platform_data;
> >  	spin_lock_init(&host->lock);
> >  
> > -	if (host->pdata && host->pdata->ocr_avail)
> > -		mmc->ocr_avail = host->pdata->ocr_avail;
> > -	else
> > -		mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
> > +	mxcmci_init_ocr(host);
> >  
> >  	if (host->pdata && host->pdata->dat3_card_detect)
> >  		host->default_irq_mask =
> > @@ -916,6 +949,9 @@ static int mxcmci_remove(struct platform_device *pdev)
> >  
> >  	mmc_remove_host(mmc);
> >  
> > +	if (host->vcc)
> > +		regulator_put(host->vcc);
> > +
> >  	if (host->pdata && host->pdata->exit)
> >  		host->pdata->exit(&pdev->dev, mmc);
> >  
> > -- 
> > 1.6.3.3
> > 
> > 
> > 
> > 
> > 
> 



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

* Re: [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage
  2010-11-05  9:27   ` Alberto Panizzo
@ 2010-11-05 13:12     ` Sascha Hauer
  2010-11-08 10:53     ` Alberto Panizzo
  1 sibling, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2010-11-05 13:12 UTC (permalink / raw)
  To: Alberto Panizzo
  Cc: Daniel Mack, Andrew Morton, Uwe Kleine-König,
	Eric Bénard, Fabio Estevam, linux-kernel, linux-mmc,
	Chris Ball

On Fri, Nov 05, 2010 at 10:27:55AM +0100, Alberto Panizzo wrote:
> On mar, 2010-11-02 at 08:39 +0100, Sascha Hauer wrote:
> > On Tue, Nov 02, 2010 at 01:05:37AM +0100, Alberto Panizzo wrote:
> > > This implementation is based on the pxamci.c driver and it will
> > > be used to support the mx31_3ds machine.
> > > 
> > > Signed-off-by: Alberto Panizzo <maramaopercheseimorto@gmail.com>
> > 
> > Looks good to me
> > 
> > Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> > 
> 
> Sascha, must this one go to the Chris Ball mmc tree? or can you pick it
> up directly?

Better to pass this via the mmc tree.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage
  2010-11-05  9:27   ` Alberto Panizzo
  2010-11-05 13:12     ` Sascha Hauer
@ 2010-11-08 10:53     ` Alberto Panizzo
  2010-11-08 14:37       ` Chris Ball
  1 sibling, 1 reply; 14+ messages in thread
From: Alberto Panizzo @ 2010-11-08 10:53 UTC (permalink / raw)
  To: Chris Ball
  Cc: Daniel Mack, Andrew Morton, Uwe Kleine-König,
	Eric Bénard, Fabio Estevam, linux-kernel, linux-mmc,
	Sascha Hauer

On ven, 2010-11-05 at 10:28 +0100, Alberto Panizzo wrote:
> On mar, 2010-11-02 at 08:39 +0100, Sascha Hauer wrote:
> > On Tue, Nov 02, 2010 at 01:05:37AM +0100, Alberto Panizzo wrote:
> > > This implementation is based on the pxamci.c driver and it will
> > > be used to support the mx31_3ds machine.
> > > 
> > > Signed-off-by: Alberto Panizzo <maramaopercheseimorto@gmail.com>
> > 
> > Looks good to me
> > 
> > Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> > 

Chris,
Please, any comment on this one?

Thanks,
Alberto!

> 
> > > ---
> > > 
> > > This patch is based on the pengutronix for-rmk branch and apply to the
> > > linus tre, version:2.6.37-rc1
> > > 
> > > ..cc the lists, sorry for the double mail.
> > > 
> > >  drivers/mmc/host/mxcmmc.c |   48 +++++++++++++++++++++++++++++++++++++++-----
> > >  1 files changed, 42 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
> > > index 350f78e..e4637fc 100644
> > > --- a/drivers/mmc/host/mxcmmc.c
> > > +++ b/drivers/mmc/host/mxcmmc.c
> > > @@ -31,6 +31,7 @@
> > >  #include <linux/clk.h>
> > >  #include <linux/io.h>
> > >  #include <linux/gpio.h>
> > > +#include <linux/regulator/consumer.h>
> > >  
> > >  #include <asm/dma.h>
> > >  #include <asm/irq.h>
> > > @@ -141,10 +142,45 @@ struct mxcmci_host {
> > >  
> > >  	struct work_struct	datawork;
> > >  	spinlock_t		lock;
> > > +
> > > +	struct regulator	*vcc;
> > >  };
> > >  
> > >  static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios);
> > >  
> > > +static inline void mxcmci_init_ocr(struct mxcmci_host *host)
> > > +{
> > > +#ifdef CONFIG_REGULATOR
> > > +	host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
> > > +
> > > +	if (IS_ERR(host->vcc)) {
> > > +		host->vcc = NULL;
> > > +	} else {
> > > +		host->mmc->ocr_avail = mmc_regulator_get_ocrmask(host->vcc);
> > > +		if (host->pdata && host->pdata->ocr_avail)
> > > +			dev_warn(mmc_dev(host->mmc),
> > > +				"pdata->ocr_avail will not be used\n");
> > > +	}
> > > +#endif
> > > +	if (host->vcc == NULL) {
> > > +		/* fall-back to platform data */
> > > +		if (host->pdata && host->pdata->ocr_avail)
> > > +			host->mmc->ocr_avail = host->pdata->ocr_avail;
> > > +		else
> > > +			host->mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
> > > +	}
> > > +}
> > > +
> > > +static inline void mxcmci_set_power(struct mxcmci_host *host, unsigned int vdd)
> > > +{
> > > +#ifdef CONFIG_REGULATOR
> > > +	if (host->vcc)
> > > +		mmc_regulator_set_ocr(host->vcc, vdd);
> > > +#endif
> > > +	if (host->pdata && host->pdata->setpower)
> > > +		host->pdata->setpower(mmc_dev(host->mmc), vdd);
> > > +}
> > > +
> > >  static inline int mxcmci_use_dma(struct mxcmci_host *host)
> > >  {
> > >  	return host->do_dma;
> > > @@ -680,9 +716,9 @@ static void mxcmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> > >  		host->cmdat &= ~CMD_DAT_CONT_BUS_WIDTH_4;
> > >  
> > >  	if (host->power_mode != ios->power_mode) {
> > > -		if (host->pdata && host->pdata->setpower)
> > > -			host->pdata->setpower(mmc_dev(mmc), ios->vdd);
> > > +		mxcmci_set_power(host, ios->vdd);
> > >  		host->power_mode = ios->power_mode;
> > > +
> > >  		if (ios->power_mode == MMC_POWER_ON)
> > >  			host->cmdat |= CMD_DAT_CONT_INIT;
> > >  	}
> > > @@ -808,10 +844,7 @@ static int mxcmci_probe(struct platform_device *pdev)
> > >  	host->pdata = pdev->dev.platform_data;
> > >  	spin_lock_init(&host->lock);
> > >  
> > > -	if (host->pdata && host->pdata->ocr_avail)
> > > -		mmc->ocr_avail = host->pdata->ocr_avail;
> > > -	else
> > > -		mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
> > > +	mxcmci_init_ocr(host);
> > >  
> > >  	if (host->pdata && host->pdata->dat3_card_detect)
> > >  		host->default_irq_mask =
> > > @@ -916,6 +949,9 @@ static int mxcmci_remove(struct platform_device *pdev)
> > >  
> > >  	mmc_remove_host(mmc);
> > >  
> > > +	if (host->vcc)
> > > +		regulator_put(host->vcc);
> > > +
> > >  	if (host->pdata && host->pdata->exit)
> > >  		host->pdata->exit(&pdev->dev, mmc);
> > >  
> > > -- 
> > > 1.6.3.3
> > > 
> > > 
> > > 
> > > 
> > > 
> > 



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

* Re: [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage
  2010-11-08 10:53     ` Alberto Panizzo
@ 2010-11-08 14:37       ` Chris Ball
  2010-11-08 15:25         ` Alberto Panizzo
                           ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Chris Ball @ 2010-11-08 14:37 UTC (permalink / raw)
  To: Alberto Panizzo
  Cc: Daniel Mack, Andrew Morton, Uwe Kleine-König,
	Eric Bénard, Fabio Estevam, linux-kernel, linux-mmc,
	Sascha Hauer

Hi Alberto,

On Mon, Nov 08, 2010 at 11:53:15AM +0100, Alberto Panizzo wrote:
> > > Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> 
> Chris,
> Please, any comment on this one?

This is pushed to mmc-next and queued for 2.6.38 now.  Thanks!

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

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

* Re: [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage
  2010-11-08 14:37       ` Chris Ball
@ 2010-11-08 15:25         ` Alberto Panizzo
  2010-11-09 10:09         ` [PATCH] mxcmmc: update the regulator support code to the latest API Alberto Panizzo
  2010-11-09 10:35         ` [PATCH v2] " Alberto Panizzo
  2 siblings, 0 replies; 14+ messages in thread
From: Alberto Panizzo @ 2010-11-08 15:25 UTC (permalink / raw)
  To: Chris Ball
  Cc: Daniel Mack, Andrew Morton, Uwe Kleine-König,
	Eric Bénard, Fabio Estevam, linux-kernel, linux-mmc,
	Sascha Hauer

On lun, 2010-11-08 at 14:37 +0000, Chris Ball wrote:
> Hi Alberto,
> 
> On Mon, Nov 08, 2010 at 11:53:15AM +0100, Alberto Panizzo wrote:
> > > > Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> > 
> > Chris,
> > Please, any comment on this one?
> 
> This is pushed to mmc-next and queued for 2.6.38 now.  Thanks!
> 

Ok,
Thank you!

-- 
Alberto!

        Be Persistent!
                - Greg Kroah-Hartman (FOSDEM 2010)


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

* Re: [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage
  2010-11-02  0:05 [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage Alberto Panizzo
  2010-11-02  7:39 ` Sascha Hauer
@ 2010-11-08 22:12 ` Linus Walleij
  2010-11-09 10:03   ` Alberto Panizzo
  1 sibling, 1 reply; 14+ messages in thread
From: Linus Walleij @ 2010-11-08 22:12 UTC (permalink / raw)
  To: Alberto Panizzo
  Cc: Sascha Hauer, Daniel Mack, Andrew Morton, Uwe Kleine-König,
	Eric Bénard, Fabio Estevam, linux-kernel, linux-mmc

2010/11/2 Alberto Panizzo <maramaopercheseimorto@gmail.com>:

> +static inline void mxcmci_init_ocr(struct mxcmci_host *host)
> +{
> +#ifdef CONFIG_REGULATOR
> +       host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
> +
> +       if (IS_ERR(host->vcc)) {
> +               host->vcc = NULL;
> +       } else {
> +               host->mmc->ocr_avail = mmc_regulator_get_ocrmask(host->vcc);
> +               if (host->pdata && host->pdata->ocr_avail)
> +                       dev_warn(mmc_dev(host->mmc),
> +                               "pdata->ocr_avail will not be used\n");
> +       }
> +#endif

You don't need these #ifdef CONFIG_REGULATOR guardposts
anymore. I implemented stub functions for the ocrmask functions
for 2.6.37.

> +static inline void mxcmci_set_power(struct mxcmci_host *host, unsigned int vdd)
> +{
> +#ifdef CONFIG_REGULATOR
> +       if (host->vcc)
> +               mmc_regulator_set_ocr(host->vcc, vdd);
> +#endif

Neither here.

But for both cases: no big deal. Take it the day it disturbs you :-)

Yours,
Linus Walleij

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

* Re: [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage
  2010-11-08 22:12 ` [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage Linus Walleij
@ 2010-11-09 10:03   ` Alberto Panizzo
  0 siblings, 0 replies; 14+ messages in thread
From: Alberto Panizzo @ 2010-11-09 10:03 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Sascha Hauer, Daniel Mack, Andrew Morton, Uwe Kleine-König,
	Eric Bénard, Fabio Estevam, linux-kernel, linux-mmc

On lun, 2010-11-08 at 23:12 +0100, Linus Walleij wrote:
> 2010/11/2 Alberto Panizzo <maramaopercheseimorto@gmail.com>:
> 
> > +static inline void mxcmci_init_ocr(struct mxcmci_host *host)
> > +{
> > +#ifdef CONFIG_REGULATOR
> > +       host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
> > +
> > +       if (IS_ERR(host->vcc)) {
> > +               host->vcc = NULL;
> > +       } else {
> > +               host->mmc->ocr_avail = mmc_regulator_get_ocrmask(host->vcc);
> > +               if (host->pdata && host->pdata->ocr_avail)
> > +                       dev_warn(mmc_dev(host->mmc),
> > +                               "pdata->ocr_avail will not be used\n");
> > +       }
> > +#endif
> 
> You don't need these #ifdef CONFIG_REGULATOR guardposts
> anymore. I implemented stub functions for the ocrmask functions
> for 2.6.37.

Ehm.. thank you really for pointing me this, because I've also used the
old API breaking the build in the -next branch..

A Fix will be posted as soon as possible!

Thanks Linus!
Best regards,

-- 
Alberto!

        Be Persistent!
                - Greg Kroah-Hartman (FOSDEM 2010)


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

* [PATCH] mxcmmc: update the regulator support code to the latest API
  2010-11-08 14:37       ` Chris Ball
  2010-11-08 15:25         ` Alberto Panizzo
@ 2010-11-09 10:09         ` Alberto Panizzo
  2010-11-09 10:14           ` Uwe Kleine-König
  2010-11-09 10:35         ` [PATCH v2] " Alberto Panizzo
  2 siblings, 1 reply; 14+ messages in thread
From: Alberto Panizzo @ 2010-11-09 10:09 UTC (permalink / raw)
  To: Chris Ball
  Cc: Daniel Mack, Andrew Morton, Uwe Kleine-König,
	Eric Bénard, Fabio Estevam, linux-kernel, linux-mmc,
	Sascha Hauer, Linus Walleij


This fix also the build problem introduced by my previous patch
due to unhanded API changes introduced by
commit:99fc5131018cbdc3cf42ce09fb394a4e8b053c74

Signed-off-by: Alberto Panizzo <maramaopercheseimorto@gmail.com>
---

This patch apply to the current mmc-next branch

 drivers/mmc/host/mxcmmc.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index 1a7f48c..2b9f7c8 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -150,7 +150,6 @@ static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios);
 
 static inline void mxcmci_init_ocr(struct mxcmci_host *host)
 {
-#ifdef CONFIG_REGULATOR
 	host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
 
 	if (IS_ERR(host->vcc)) {
@@ -161,7 +160,7 @@ static inline void mxcmci_init_ocr(struct mxcmci_host *host)
 			dev_warn(mmc_dev(host->mmc),
 				"pdata->ocr_avail will not be used\n");
 	}
-#endif
+
 	if (host->vcc == NULL) {
 		/* fall-back to platform data */
 		if (host->pdata && host->pdata->ocr_avail)
@@ -171,12 +170,17 @@ static inline void mxcmci_init_ocr(struct mxcmci_host *host)
 	}
 }
 
-static inline void mxcmci_set_power(struct mxcmci_host *host, unsigned int vdd)
+static inline void mxcmci_set_power(struct mxcmci_host *host,
+				    unsigned char power_mode,
+				    unsigned int vdd)
 {
-#ifdef CONFIG_REGULATOR
-	if (host->vcc)
-		mmc_regulator_set_ocr(host->vcc, vdd);
-#endif
+	if (host->vcc) {
+		if (power_mode == MMC_POWER_UP)
+			mmc_regulator_set_ocr(host->mmc, host->vcc, vdd);
+		else if (power_mode == MMC_POWER_OFF)
+			mmc_regulator_set_ocr(host->mmc, host->vcc, 0);
+	}
+
 	if (host->pdata && host->pdata->setpower)
 		host->pdata->setpower(mmc_dev(host->mmc), vdd);
 }
@@ -716,7 +720,7 @@ static void mxcmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 		host->cmdat &= ~CMD_DAT_CONT_BUS_WIDTH_4;
 
 	if (host->power_mode != ios->power_mode) {
-		mxcmci_set_power(host, ios->vdd);
+		mxcmci_set_power(host, ios->power_mode, ios->vdd);
 		host->power_mode = ios->power_mode;
 
 		if (ios->power_mode == MMC_POWER_ON)
-- 
1.6.3.3




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

* Re: [PATCH] mxcmmc: update the regulator support code to the latest API
  2010-11-09 10:09         ` [PATCH] mxcmmc: update the regulator support code to the latest API Alberto Panizzo
@ 2010-11-09 10:14           ` Uwe Kleine-König
  2010-11-09 10:30             ` Alberto Panizzo
  0 siblings, 1 reply; 14+ messages in thread
From: Uwe Kleine-König @ 2010-11-09 10:14 UTC (permalink / raw)
  To: Alberto Panizzo
  Cc: Chris Ball, Daniel Mack, Andrew Morton, Eric Bénard,
	Fabio Estevam, linux-kernel, linux-mmc, Sascha Hauer,
	Linus Walleij

On Tue, Nov 09, 2010 at 11:09:50AM +0100, Alberto Panizzo wrote:
> 
> This fix also the build problem introduced by my previous patch
> due to unhanded API changes introduced by
s/handed/handled/ ?

> commit:99fc5131018cbdc3cf42ce09fb394a4e8b053c74
Linus wants to have the commit shortlog for references to other commits.
After doing:

	git config --global alias.one "show -s --pretty='format:%h (%s)'"

once you can simply use the output of

	git one 99fc5131018cbdc3cf42ce09fb394a4e8b053c74

for that.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* Re: [PATCH] mxcmmc: update the regulator support code to the latest API
  2010-11-09 10:14           ` Uwe Kleine-König
@ 2010-11-09 10:30             ` Alberto Panizzo
  0 siblings, 0 replies; 14+ messages in thread
From: Alberto Panizzo @ 2010-11-09 10:30 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Chris Ball, Daniel Mack, Andrew Morton, Eric Bénard,
	Fabio Estevam, linux-kernel, linux-mmc, Sascha Hauer,
	Linus Walleij

On mar, 2010-11-09 at 11:14 +0100, Uwe Kleine-König wrote:
> On Tue, Nov 09, 2010 at 11:09:50AM +0100, Alberto Panizzo wrote:
> > 
> > This fix also the build problem introduced by my previous patch
> > due to unhanded API changes introduced by
> s/handed/handled/ ?
> 
> > commit:99fc5131018cbdc3cf42ce09fb394a4e8b053c74
> Linus wants to have the commit shortlog for references to other commits.
> After doing:
> 
> 	git config --global alias.one "show -s --pretty='format:%h (%s)'"
> 
> once you can simply use the output of
> 
> 	git one 99fc5131018cbdc3cf42ce09fb394a4e8b053c74
> 
> for that.

Ok Uwe,
I will update my patch pushing rules on this.
A cleaner patch will be sent soon.

Best Regards,

-- 
Alberto!

        Be Persistent!
                - Greg Kroah-Hartman (FOSDEM 2010)


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

* [PATCH v2] mxcmmc: update the regulator support code to the latest API
  2010-11-08 14:37       ` Chris Ball
  2010-11-08 15:25         ` Alberto Panizzo
  2010-11-09 10:09         ` [PATCH] mxcmmc: update the regulator support code to the latest API Alberto Panizzo
@ 2010-11-09 10:35         ` Alberto Panizzo
  2 siblings, 0 replies; 14+ messages in thread
From: Alberto Panizzo @ 2010-11-09 10:35 UTC (permalink / raw)
  To: Chris Ball
  Cc: Daniel Mack, Andrew Morton, Uwe Kleine-König,
	Eric Bénard, Fabio Estevam, linux-kernel, linux-mmc,
	Sascha Hauer, Linus Walleij

This fix also the build problem introduced by my previous patch
due to not handled API changes introduced by commit:
 99fc513 (mmc: Move regulator handling closer to core)

Signed-off-by: Alberto Panizzo <maramaopercheseimorto@gmail.com>
---

This patch apply to the current mmc-next branch

 drivers/mmc/host/mxcmmc.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index 1a7f48c..2b9f7c8 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -150,7 +150,6 @@ static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios);
 
 static inline void mxcmci_init_ocr(struct mxcmci_host *host)
 {
-#ifdef CONFIG_REGULATOR
 	host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
 
 	if (IS_ERR(host->vcc)) {
@@ -161,7 +160,7 @@ static inline void mxcmci_init_ocr(struct mxcmci_host *host)
 			dev_warn(mmc_dev(host->mmc),
 				"pdata->ocr_avail will not be used\n");
 	}
-#endif
+
 	if (host->vcc == NULL) {
 		/* fall-back to platform data */
 		if (host->pdata && host->pdata->ocr_avail)
@@ -171,12 +170,17 @@ static inline void mxcmci_init_ocr(struct mxcmci_host *host)
 	}
 }
 
-static inline void mxcmci_set_power(struct mxcmci_host *host, unsigned int vdd)
+static inline void mxcmci_set_power(struct mxcmci_host *host,
+				    unsigned char power_mode,
+				    unsigned int vdd)
 {
-#ifdef CONFIG_REGULATOR
-	if (host->vcc)
-		mmc_regulator_set_ocr(host->vcc, vdd);
-#endif
+	if (host->vcc) {
+		if (power_mode == MMC_POWER_UP)
+			mmc_regulator_set_ocr(host->mmc, host->vcc, vdd);
+		else if (power_mode == MMC_POWER_OFF)
+			mmc_regulator_set_ocr(host->mmc, host->vcc, 0);
+	}
+
 	if (host->pdata && host->pdata->setpower)
 		host->pdata->setpower(mmc_dev(host->mmc), vdd);
 }
@@ -716,7 +720,7 @@ static void mxcmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 		host->cmdat &= ~CMD_DAT_CONT_BUS_WIDTH_4;
 
 	if (host->power_mode != ios->power_mode) {
-		mxcmci_set_power(host, ios->vdd);
+		mxcmci_set_power(host, ios->power_mode, ios->vdd);
 		host->power_mode = ios->power_mode;
 
 		if (ios->power_mode == MMC_POWER_ON)
-- 
1.6.3.3





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

end of thread, other threads:[~2010-11-09 10:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-02  0:05 [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage Alberto Panizzo
2010-11-02  7:39 ` Sascha Hauer
2010-11-02 10:33   ` Alberto Panizzo
2010-11-05  9:27   ` Alberto Panizzo
2010-11-05 13:12     ` Sascha Hauer
2010-11-08 10:53     ` Alberto Panizzo
2010-11-08 14:37       ` Chris Ball
2010-11-08 15:25         ` Alberto Panizzo
2010-11-09 10:09         ` [PATCH] mxcmmc: update the regulator support code to the latest API Alberto Panizzo
2010-11-09 10:14           ` Uwe Kleine-König
2010-11-09 10:30             ` Alberto Panizzo
2010-11-09 10:35         ` [PATCH v2] " Alberto Panizzo
2010-11-08 22:12 ` [PATCH] mxcmmc: Add the ability to bind a regulator to manage the MMC card voltage Linus Walleij
2010-11-09 10:03   ` Alberto Panizzo

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.