Re: [RFC/RFT 4/6] mmc: sdhci-msm: convert driver to use runtime PM apis

2015-04-23 Thread Rajendra Nayak

 Rajendra Nayak rna...@codeaurora.org writes:

 On 23 April 2015 at 10:45, Rajendra Nayak rna...@codeaurora.org
 wrote:
 With platform support now in place to manage clocks from within
 runtime
 PM
 callbacks, get rid of all clock handling from the driver and convert
 the
 driver to use runtime PM apis.

 Signed-off-by: Rajendra Nayak rna...@codeaurora.org
 Cc: linux-mmc@vger.kernel.org
 ---
  drivers/mmc/host/sdhci-msm.c | 46
 +++-
  1 file changed, 11 insertions(+), 35 deletions(-)

 diff --git a/drivers/mmc/host/sdhci-msm.c
 b/drivers/mmc/host/sdhci-msm.c
 index 4a09f76..3c62a77 100644
 --- a/drivers/mmc/host/sdhci-msm.c
 +++ b/drivers/mmc/host/sdhci-msm.c
 @@ -19,6 +19,7 @@
  #include linux/delay.h
  #include linux/mmc/mmc.h
  #include linux/slab.h
 +#include linux/pm_runtime.h

  #include sdhci-pltfm.h

 @@ -56,8 +57,6 @@
  struct sdhci_msm_host {
 struct platform_device *pdev;
 void __iomem *core_mem; /* MSM SDCC mapped address */
 -   struct clk *clk;/* main SD/MMC bus clock */
 -   struct clk *pclk;   /* SDHC peripheral bus clock */
 struct clk *bus_clk;/* SDHC bus voter clock */
 struct mmc_host *mmc;
 struct sdhci_pltfm_data sdhci_msm_pdata;
 @@ -469,29 +468,8 @@ static int sdhci_msm_probe(struct platform_device
 *pdev)
 goto pltfm_free;
 }

 -   /* Setup main peripheral bus clock */
 -   msm_host-pclk = devm_clk_get(pdev-dev, iface);
 -   if (IS_ERR(msm_host-pclk)) {
 -   ret = PTR_ERR(msm_host-pclk);
 -   dev_err(pdev-dev, Perpheral clk setup failed
 (%d)\n,
 ret);
 -   goto bus_clk_disable;
 -   }
 -
 -   ret = clk_prepare_enable(msm_host-pclk);
 -   if (ret)
 -   goto bus_clk_disable;
 -
 -   /* Setup SDC MMC clock */
 -   msm_host-clk = devm_clk_get(pdev-dev, core);
 -   if (IS_ERR(msm_host-clk)) {
 -   ret = PTR_ERR(msm_host-clk);
 -   dev_err(pdev-dev, SDC MMC clk setup failed (%d)\n,
 ret);
 -   goto pclk_disable;
 -   }
 -
 -   ret = clk_prepare_enable(msm_host-clk);
 -   if (ret)
 -   goto pclk_disable;
 +   pm_runtime_enable(pdev-dev);
 +   pm_runtime_get_sync(pdev-dev);

 core_memres = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 msm_host-core_mem = devm_ioremap_resource(pdev-dev,
 core_memres);
 @@ -499,7 +477,7 @@ static int sdhci_msm_probe(struct platform_device
 *pdev)
 if (IS_ERR(msm_host-core_mem)) {
 dev_err(pdev-dev, Failed to remap registers\n);
 ret = PTR_ERR(msm_host-core_mem);
 -   goto clk_disable;
 +   goto err;
 }

 /* Reset the core and Enable SDHC mode */
 @@ -511,7 +489,7 @@ static int sdhci_msm_probe(struct platform_device
 *pdev)
 if (readl(msm_host-core_mem + CORE_POWER)  CORE_SW_RST) {
 dev_err(pdev-dev, Stuck in reset\n);
 ret = -ETIMEDOUT;
 -   goto clk_disable;
 +   goto err;
 }

 /* Set HC_MODE_EN bit in HC_MODE register */
 @@ -545,15 +523,13 @@ static int sdhci_msm_probe(struct
 platform_device
 *pdev)

 ret = sdhci_add_host(host);
 if (ret)
 -   goto clk_disable;
 +   goto err;

 return 0;

 -clk_disable:
 -   clk_disable_unprepare(msm_host-clk);
 -pclk_disable:
 -   clk_disable_unprepare(msm_host-pclk);
 -bus_clk_disable:
 +err:
 +   pm_runtime_put_sync(pdev-dev);
 +   pm_runtime_disable(pdev-dev);
 if (!IS_ERR(msm_host-bus_clk))
 clk_disable_unprepare(msm_host-bus_clk);
  pltfm_free:
 @@ -571,8 +547,8 @@ static int sdhci_msm_remove(struct platform_device
 *pdev)

 sdhci_remove_host(host, dead);
 sdhci_pltfm_free(pdev);
 -   clk_disable_unprepare(msm_host-clk);
 -   clk_disable_unprepare(msm_host-pclk);
 +   pm_runtime_put_sync(pdev-dev);
 +   pm_runtime_disable(pdev-dev);
 if (!IS_ERR(msm_host-bus_clk))
 clk_disable_unprepare(msm_host-bus_clk);
 return 0;
[]..

 This all looks wrong. The driver will no longer work unless CONFIG_PM
 is
 set.

 Right, I seem to have completely ignored the !CONFIG_PM case.
 Will look at how to handle that.

 IMO, don't complicate the driver with that.  Just enable (or leave
 enabled) all the clocks in the clock driver in the !CONFIG_PM case.

so I just looked at what pm_clk_notify() does in !CONFIG_PM case and it
seems to do just that, leaves all the clocks enabled on
BUS_NOTIFY_BIND_DRIVER case and disables them for BUS_NOTIFY_UNBOUND_DRIVER
case. So looks like things are already in place to handle this :)

Ulf, does that address your concern or did I miss anything?

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

[RFC/RFT 4/6] mmc: sdhci-msm: convert driver to use runtime PM apis

2015-04-23 Thread Rajendra Nayak
With platform support now in place to manage clocks from within runtime PM
callbacks, get rid of all clock handling from the driver and convert the
driver to use runtime PM apis.

Signed-off-by: Rajendra Nayak rna...@codeaurora.org
Cc: linux-mmc@vger.kernel.org
---
 drivers/mmc/host/sdhci-msm.c | 46 +++-
 1 file changed, 11 insertions(+), 35 deletions(-)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 4a09f76..3c62a77 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -19,6 +19,7 @@
 #include linux/delay.h
 #include linux/mmc/mmc.h
 #include linux/slab.h
+#include linux/pm_runtime.h
 
 #include sdhci-pltfm.h
 
@@ -56,8 +57,6 @@
 struct sdhci_msm_host {
struct platform_device *pdev;
void __iomem *core_mem; /* MSM SDCC mapped address */
-   struct clk *clk;/* main SD/MMC bus clock */
-   struct clk *pclk;   /* SDHC peripheral bus clock */
struct clk *bus_clk;/* SDHC bus voter clock */
struct mmc_host *mmc;
struct sdhci_pltfm_data sdhci_msm_pdata;
@@ -469,29 +468,8 @@ static int sdhci_msm_probe(struct platform_device *pdev)
goto pltfm_free;
}
 
-   /* Setup main peripheral bus clock */
-   msm_host-pclk = devm_clk_get(pdev-dev, iface);
-   if (IS_ERR(msm_host-pclk)) {
-   ret = PTR_ERR(msm_host-pclk);
-   dev_err(pdev-dev, Perpheral clk setup failed (%d)\n, ret);
-   goto bus_clk_disable;
-   }
-
-   ret = clk_prepare_enable(msm_host-pclk);
-   if (ret)
-   goto bus_clk_disable;
-
-   /* Setup SDC MMC clock */
-   msm_host-clk = devm_clk_get(pdev-dev, core);
-   if (IS_ERR(msm_host-clk)) {
-   ret = PTR_ERR(msm_host-clk);
-   dev_err(pdev-dev, SDC MMC clk setup failed (%d)\n, ret);
-   goto pclk_disable;
-   }
-
-   ret = clk_prepare_enable(msm_host-clk);
-   if (ret)
-   goto pclk_disable;
+   pm_runtime_enable(pdev-dev);
+   pm_runtime_get_sync(pdev-dev);
 
core_memres = platform_get_resource(pdev, IORESOURCE_MEM, 1);
msm_host-core_mem = devm_ioremap_resource(pdev-dev, core_memres);
@@ -499,7 +477,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
if (IS_ERR(msm_host-core_mem)) {
dev_err(pdev-dev, Failed to remap registers\n);
ret = PTR_ERR(msm_host-core_mem);
-   goto clk_disable;
+   goto err;
}
 
/* Reset the core and Enable SDHC mode */
@@ -511,7 +489,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
if (readl(msm_host-core_mem + CORE_POWER)  CORE_SW_RST) {
dev_err(pdev-dev, Stuck in reset\n);
ret = -ETIMEDOUT;
-   goto clk_disable;
+   goto err;
}
 
/* Set HC_MODE_EN bit in HC_MODE register */
@@ -545,15 +523,13 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 
ret = sdhci_add_host(host);
if (ret)
-   goto clk_disable;
+   goto err;
 
return 0;
 
-clk_disable:
-   clk_disable_unprepare(msm_host-clk);
-pclk_disable:
-   clk_disable_unprepare(msm_host-pclk);
-bus_clk_disable:
+err:
+   pm_runtime_put_sync(pdev-dev);
+   pm_runtime_disable(pdev-dev);
if (!IS_ERR(msm_host-bus_clk))
clk_disable_unprepare(msm_host-bus_clk);
 pltfm_free:
@@ -571,8 +547,8 @@ static int sdhci_msm_remove(struct platform_device *pdev)
 
sdhci_remove_host(host, dead);
sdhci_pltfm_free(pdev);
-   clk_disable_unprepare(msm_host-clk);
-   clk_disable_unprepare(msm_host-pclk);
+   pm_runtime_put_sync(pdev-dev);
+   pm_runtime_disable(pdev-dev);
if (!IS_ERR(msm_host-bus_clk))
clk_disable_unprepare(msm_host-bus_clk);
return 0;
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC/RFT 4/6] mmc: sdhci-msm: convert driver to use runtime PM apis

2015-04-23 Thread Rajendra Nayak

 On 23 April 2015 at 10:45, Rajendra Nayak rna...@codeaurora.org wrote:
 With platform support now in place to manage clocks from within runtime
 PM
 callbacks, get rid of all clock handling from the driver and convert the
 driver to use runtime PM apis.

 Signed-off-by: Rajendra Nayak rna...@codeaurora.org
 Cc: linux-mmc@vger.kernel.org
 ---
  drivers/mmc/host/sdhci-msm.c | 46
 +++-
  1 file changed, 11 insertions(+), 35 deletions(-)

 diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
 index 4a09f76..3c62a77 100644
 --- a/drivers/mmc/host/sdhci-msm.c
 +++ b/drivers/mmc/host/sdhci-msm.c
 @@ -19,6 +19,7 @@
  #include linux/delay.h
  #include linux/mmc/mmc.h
  #include linux/slab.h
 +#include linux/pm_runtime.h

  #include sdhci-pltfm.h

 @@ -56,8 +57,6 @@
  struct sdhci_msm_host {
 struct platform_device *pdev;
 void __iomem *core_mem; /* MSM SDCC mapped address */
 -   struct clk *clk;/* main SD/MMC bus clock */
 -   struct clk *pclk;   /* SDHC peripheral bus clock */
 struct clk *bus_clk;/* SDHC bus voter clock */
 struct mmc_host *mmc;
 struct sdhci_pltfm_data sdhci_msm_pdata;
 @@ -469,29 +468,8 @@ static int sdhci_msm_probe(struct platform_device
 *pdev)
 goto pltfm_free;
 }

 -   /* Setup main peripheral bus clock */
 -   msm_host-pclk = devm_clk_get(pdev-dev, iface);
 -   if (IS_ERR(msm_host-pclk)) {
 -   ret = PTR_ERR(msm_host-pclk);
 -   dev_err(pdev-dev, Perpheral clk setup failed (%d)\n,
 ret);
 -   goto bus_clk_disable;
 -   }
 -
 -   ret = clk_prepare_enable(msm_host-pclk);
 -   if (ret)
 -   goto bus_clk_disable;
 -
 -   /* Setup SDC MMC clock */
 -   msm_host-clk = devm_clk_get(pdev-dev, core);
 -   if (IS_ERR(msm_host-clk)) {
 -   ret = PTR_ERR(msm_host-clk);
 -   dev_err(pdev-dev, SDC MMC clk setup failed (%d)\n,
 ret);
 -   goto pclk_disable;
 -   }
 -
 -   ret = clk_prepare_enable(msm_host-clk);
 -   if (ret)
 -   goto pclk_disable;
 +   pm_runtime_enable(pdev-dev);
 +   pm_runtime_get_sync(pdev-dev);

 core_memres = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 msm_host-core_mem = devm_ioremap_resource(pdev-dev,
 core_memres);
 @@ -499,7 +477,7 @@ static int sdhci_msm_probe(struct platform_device
 *pdev)
 if (IS_ERR(msm_host-core_mem)) {
 dev_err(pdev-dev, Failed to remap registers\n);
 ret = PTR_ERR(msm_host-core_mem);
 -   goto clk_disable;
 +   goto err;
 }

 /* Reset the core and Enable SDHC mode */
 @@ -511,7 +489,7 @@ static int sdhci_msm_probe(struct platform_device
 *pdev)
 if (readl(msm_host-core_mem + CORE_POWER)  CORE_SW_RST) {
 dev_err(pdev-dev, Stuck in reset\n);
 ret = -ETIMEDOUT;
 -   goto clk_disable;
 +   goto err;
 }

 /* Set HC_MODE_EN bit in HC_MODE register */
 @@ -545,15 +523,13 @@ static int sdhci_msm_probe(struct platform_device
 *pdev)

 ret = sdhci_add_host(host);
 if (ret)
 -   goto clk_disable;
 +   goto err;

 return 0;

 -clk_disable:
 -   clk_disable_unprepare(msm_host-clk);
 -pclk_disable:
 -   clk_disable_unprepare(msm_host-pclk);
 -bus_clk_disable:
 +err:
 +   pm_runtime_put_sync(pdev-dev);
 +   pm_runtime_disable(pdev-dev);
 if (!IS_ERR(msm_host-bus_clk))
 clk_disable_unprepare(msm_host-bus_clk);
  pltfm_free:
 @@ -571,8 +547,8 @@ static int sdhci_msm_remove(struct platform_device
 *pdev)

 sdhci_remove_host(host, dead);
 sdhci_pltfm_free(pdev);
 -   clk_disable_unprepare(msm_host-clk);
 -   clk_disable_unprepare(msm_host-pclk);
 +   pm_runtime_put_sync(pdev-dev);
 +   pm_runtime_disable(pdev-dev);
 if (!IS_ERR(msm_host-bus_clk))
 clk_disable_unprepare(msm_host-bus_clk);
 return 0;
 --
 QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
 member
 of Code Aurora Forum, hosted by The Linux Foundation

 --
 To unsubscribe from this list: send the line unsubscribe linux-pm in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

 This all looks wrong. The driver will no longer work unless CONFIG_PM is
 set.

Right, I seem to have completely ignored the !CONFIG_PM case.
Will look at how to handle that.


 Kind regards
 Uffe



-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC/RFT 4/6] mmc: sdhci-msm: convert driver to use runtime PM apis

2015-04-23 Thread Rajendra Nayak

 On 23 April 2015 at 10:45, Rajendra Nayak rna...@codeaurora.org wrote:
 With platform support now in place to manage clocks from within runtime
 PM
 callbacks, get rid of all clock handling from the driver and convert the
 driver to use runtime PM apis.

 Signed-off-by: Rajendra Nayak rna...@codeaurora.org
 Cc: linux-mmc@vger.kernel.org
 ---
  drivers/mmc/host/sdhci-msm.c | 46
 +++-
  1 file changed, 11 insertions(+), 35 deletions(-)

 diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
 index 4a09f76..3c62a77 100644
 --- a/drivers/mmc/host/sdhci-msm.c
 +++ b/drivers/mmc/host/sdhci-msm.c
 @@ -19,6 +19,7 @@
  #include linux/delay.h
  #include linux/mmc/mmc.h
  #include linux/slab.h
 +#include linux/pm_runtime.h

  #include sdhci-pltfm.h

 @@ -56,8 +57,6 @@
  struct sdhci_msm_host {
 struct platform_device *pdev;
 void __iomem *core_mem; /* MSM SDCC mapped address */
 -   struct clk *clk;/* main SD/MMC bus clock */
 -   struct clk *pclk;   /* SDHC peripheral bus clock */
 struct clk *bus_clk;/* SDHC bus voter clock */
 struct mmc_host *mmc;
 struct sdhci_pltfm_data sdhci_msm_pdata;
 @@ -469,29 +468,8 @@ static int sdhci_msm_probe(struct platform_device
 *pdev)
 goto pltfm_free;
 }

 -   /* Setup main peripheral bus clock */
 -   msm_host-pclk = devm_clk_get(pdev-dev, iface);
 -   if (IS_ERR(msm_host-pclk)) {
 -   ret = PTR_ERR(msm_host-pclk);
 -   dev_err(pdev-dev, Perpheral clk setup failed (%d)\n,
 ret);
 -   goto bus_clk_disable;
 -   }
 -
 -   ret = clk_prepare_enable(msm_host-pclk);
 -   if (ret)
 -   goto bus_clk_disable;
 -
 -   /* Setup SDC MMC clock */
 -   msm_host-clk = devm_clk_get(pdev-dev, core);
 -   if (IS_ERR(msm_host-clk)) {
 -   ret = PTR_ERR(msm_host-clk);
 -   dev_err(pdev-dev, SDC MMC clk setup failed (%d)\n,
 ret);
 -   goto pclk_disable;
 -   }
 -
 -   ret = clk_prepare_enable(msm_host-clk);
 -   if (ret)
 -   goto pclk_disable;
 +   pm_runtime_enable(pdev-dev);
 +   pm_runtime_get_sync(pdev-dev);

 core_memres = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 msm_host-core_mem = devm_ioremap_resource(pdev-dev,
 core_memres);
 @@ -499,7 +477,7 @@ static int sdhci_msm_probe(struct platform_device
 *pdev)
 if (IS_ERR(msm_host-core_mem)) {
 dev_err(pdev-dev, Failed to remap registers\n);
 ret = PTR_ERR(msm_host-core_mem);
 -   goto clk_disable;
 +   goto err;
 }

 /* Reset the core and Enable SDHC mode */
 @@ -511,7 +489,7 @@ static int sdhci_msm_probe(struct platform_device
 *pdev)
 if (readl(msm_host-core_mem + CORE_POWER)  CORE_SW_RST) {
 dev_err(pdev-dev, Stuck in reset\n);
 ret = -ETIMEDOUT;
 -   goto clk_disable;
 +   goto err;
 }

 /* Set HC_MODE_EN bit in HC_MODE register */
 @@ -545,15 +523,13 @@ static int sdhci_msm_probe(struct platform_device
 *pdev)

 ret = sdhci_add_host(host);
 if (ret)
 -   goto clk_disable;
 +   goto err;

 return 0;

 -clk_disable:
 -   clk_disable_unprepare(msm_host-clk);
 -pclk_disable:
 -   clk_disable_unprepare(msm_host-pclk);
 -bus_clk_disable:
 +err:
 +   pm_runtime_put_sync(pdev-dev);
 +   pm_runtime_disable(pdev-dev);
 if (!IS_ERR(msm_host-bus_clk))
 clk_disable_unprepare(msm_host-bus_clk);
  pltfm_free:
 @@ -571,8 +547,8 @@ static int sdhci_msm_remove(struct platform_device
 *pdev)

 sdhci_remove_host(host, dead);
 sdhci_pltfm_free(pdev);
 -   clk_disable_unprepare(msm_host-clk);
 -   clk_disable_unprepare(msm_host-pclk);
 +   pm_runtime_put_sync(pdev-dev);
 +   pm_runtime_disable(pdev-dev);
 if (!IS_ERR(msm_host-bus_clk))
 clk_disable_unprepare(msm_host-bus_clk);
 return 0;
 --
 QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
 member
 of Code Aurora Forum, hosted by The Linux Foundation

 --
 To unsubscribe from this list: send the line unsubscribe linux-pm in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

 This all looks wrong. The driver will no longer work unless CONFIG_PM is
 set.

Right, I seem to have completely ignored the !CONFIG_PM case.
Will look at how to handle that.


 Kind regards
 Uffe



-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] MMC/omap_hsmmc: handle failure of regulator_get better.

2012-07-30 Thread Rajendra Nayak

On Monday 30 July 2012 11:54 AM, NeilBrown wrote:

On Mon, 30 Jul 2012 10:50:36 +0530 Rajendra Nayakrna...@ti.com  wrote:


On Monday 30 July 2012 05:42 AM, NeilBrown wrote:


1/ if regulator_get fails, return an error.  This is important
 if it failed with EPROBE_DEFER, as the probe needs to be
 deferred.

2/ Don't set .set_power until the regulator has been found, or
 the deferred probe will not bother calling omap_hsmmc_reg_get().


I am not very sure, but aren't the data structures re-allocated on a
re-probe (after it was deferred) causing .set_power to be lost anyway?



Apparently not - as I needed to make that change before the re-probe would
work.

Looking at the code to remind myself:

#define mmc_slot(host)  (host-pdata-slots[host-slot_id])

so the slot is inside the platform data which is allocated in
omap_hsmmc_init_one, called from omap_hsmmc_init.
This is all prior to the probing of the device.

So no: once set_power is set, it stays set.


Thanks for the explanation, makes sense.

Acked-by: Rajendra Nayak rna...@ti.com

Btw, is the support for re-probe/deferred probe already merged
now? or are you testing this with some out of tree patches.



Thanks,
NeilBrown



Signed-off-by: NeilBrownne...@suse.de

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 389a3ee..f052c29 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -299,12 +299,12 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host 
*host)
struct regulator *reg;
int ocr_value = 0;

-   mmc_slot(host).set_power = omap_hsmmc_set_power;
-
reg = regulator_get(host-dev, vmmc);
if (IS_ERR(reg)) {
dev_dbg(host-dev, vmmc regulator missing\n);
+   return PTR_ERR(reg);
} else {
+   mmc_slot(host).set_power = omap_hsmmc_set_power;
host-vcc = reg;
ocr_value = mmc_regulator_get_ocrmask(reg);
if (!mmc_slot(host).ocr_mask) {




--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] MMC/omap_hsmmc: handle failure of regulator_get better.

2012-07-29 Thread Rajendra Nayak

On Monday 30 July 2012 05:42 AM, NeilBrown wrote:


1/ if regulator_get fails, return an error.  This is important
if it failed with EPROBE_DEFER, as the probe needs to be
deferred.

2/ Don't set .set_power until the regulator has been found, or
the deferred probe will not bother calling omap_hsmmc_reg_get().


I am not very sure, but aren't the data structures re-allocated on a
re-probe (after it was deferred) causing .set_power to be lost anyway?



Signed-off-by: NeilBrownne...@suse.de

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 389a3ee..f052c29 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -299,12 +299,12 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host 
*host)
struct regulator *reg;
int ocr_value = 0;

-   mmc_slot(host).set_power = omap_hsmmc_set_power;
-
reg = regulator_get(host-dev, vmmc);
if (IS_ERR(reg)) {
dev_dbg(host-dev, vmmc regulator missing\n);
+   return PTR_ERR(reg);
} else {
+   mmc_slot(host).set_power = omap_hsmmc_set_power;
host-vcc = reg;
ocr_value = mmc_regulator_get_ocrmask(reg);
if (!mmc_slot(host).ocr_mask) {


--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] mmc: omap: add clk_prepare and clk_unprepare

2012-06-27 Thread Rajendra Nayak
In preparation of OMAP moving to Common Clk Framework(CCF) add clk_prepare()
and clk_unprepare() for the hsmmc clocks.

Signed-off-by: Rajendra Nayak rna...@ti.com
Cc: Chris Ball c...@laptop.org
Cc: Balaji T K balaj...@ti.com
Cc: linux-mmc@vger.kernel.org
Cc: Paul Walmsley p...@pwsan.com
Cc: Mike Turquette mturque...@linaro.org
---
 drivers/mmc/host/omap_hsmmc.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9a7a60a..07f5945 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1097,7 +1097,7 @@ static int omap_hsmmc_switch_opcond(struct 
omap_hsmmc_host *host, int vdd)
/* Disable the clocks */
pm_runtime_put_sync(host-dev);
if (host-dbclk)
-   clk_disable(host-dbclk);
+   clk_disable_unprepare(host-dbclk);
 
/* Turn the power off */
ret = mmc_slot(host).set_power(host-dev, host-slot_id, 0, 0);
@@ -1108,7 +1108,7 @@ static int omap_hsmmc_switch_opcond(struct 
omap_hsmmc_host *host, int vdd)
   vdd);
pm_runtime_get_sync(host-dev);
if (host-dbclk)
-   clk_enable(host-dbclk);
+   clk_prepare_enable(host-dbclk);
 
if (ret != 0)
goto err;
@@ -1908,7 +1908,7 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
if (IS_ERR(host-dbclk)) {
dev_warn(mmc_dev(host-mmc), Failed to get debounce clk\n);
host-dbclk = NULL;
-   } else if (clk_enable(host-dbclk) != 0) {
+   } else if (clk_prepare_enable(host-dbclk) != 0) {
dev_warn(mmc_dev(host-mmc), Failed to enable debounce clk\n);
clk_put(host-dbclk);
host-dbclk = NULL;
@@ -2032,7 +2032,7 @@ err_irq:
pm_runtime_disable(host-dev);
clk_put(host-fclk);
if (host-dbclk) {
-   clk_disable(host-dbclk);
+   clk_disable_unprepare(host-dbclk);
clk_put(host-dbclk);
}
 err1:
@@ -2067,7 +2067,7 @@ static int __devexit omap_hsmmc_remove(struct 
platform_device *pdev)
pm_runtime_disable(host-dev);
clk_put(host-fclk);
if (host-dbclk) {
-   clk_disable(host-dbclk);
+   clk_disable_unprepare(host-dbclk);
clk_put(host-dbclk);
}
 
@@ -2125,7 +2125,7 @@ static int omap_hsmmc_suspend(struct device *dev)
}
 
if (host-dbclk)
-   clk_disable(host-dbclk);
+   clk_disable_unprepare(host-dbclk);
 err:
pm_runtime_put_sync(host-dev);
return ret;
@@ -2146,7 +2146,7 @@ static int omap_hsmmc_resume(struct device *dev)
pm_runtime_get_sync(host-dev);
 
if (host-dbclk)
-   clk_enable(host-dbclk);
+   clk_prepare_enable(host-dbclk);
 
if (!(host-mmc-pm_flags  MMC_PM_KEEP_POWER))
omap_hsmmc_conf_bus_power(host);
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/11] mmc: omap: add clk_prepare and clk_unprepare

2012-06-24 Thread Rajendra Nayak

On Saturday 23 June 2012 12:04 AM, Paul Walmsley wrote:

On Fri, 22 Jun 2012, S, Venkatraman wrote:


On Fri, Jun 22, 2012 at 7:18 PM, Rajendra Nayakrna...@ti.com  wrote:

In preparation of OMAP moving to Common Clk Framework(CCF) add clk_prepare()
and clk_unprepare() for the mmc and hsmmc clocks as part of the drivers
probe() and remove() routines.

Signed-off-by: Rajendra Nayakrna...@ti.com
Cc: Chris Ballc...@laptop.org
Cc: Balaji T Kbalaj...@ti.com
Cc:linux-mmc@vger.kernel.org


Rajendra,
   Can this be applied independently, or does this patch have a
dependency on other patches in the series ?


A better way to handle this one would be to convert the driver to runtime
PM.  That needs to be done anyway.


Well, mmc driver is already using runtime PM. But it still using clock
apis' to deal with some optional debounce clock needed only on 2430.




- Paul


--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/11] mmc: omap: add clk_prepare and clk_unprepare

2012-06-24 Thread Rajendra Nayak

On Friday 22 June 2012 11:53 PM, S, Venkatraman wrote:

On Fri, Jun 22, 2012 at 7:18 PM, Rajendra Nayakrna...@ti.com  wrote:

In preparation of OMAP moving to Common Clk Framework(CCF) add clk_prepare()
and clk_unprepare() for the mmc and hsmmc clocks as part of the drivers
probe() and remove() routines.

Signed-off-by: Rajendra Nayakrna...@ti.com
Cc: Chris Ballc...@laptop.org
Cc: Balaji T Kbalaj...@ti.com
Cc:linux-mmc@vger.kernel.org


Rajendra,
   Can this be applied independently, or does this patch have a
dependency on other patches in the series ?


Yes, this can be applied independently. There is no other
dependency.
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/11] mmc: omap: add clk_prepare and clk_unprepare

2012-06-22 Thread Rajendra Nayak
In preparation of OMAP moving to Common Clk Framework(CCF) add clk_prepare()
and clk_unprepare() for the mmc and hsmmc clocks as part of the drivers
probe() and remove() routines.

Signed-off-by: Rajendra Nayak rna...@ti.com
Cc: Chris Ball c...@laptop.org
Cc: Balaji T K balaj...@ti.com
Cc: linux-mmc@vger.kernel.org
---
 drivers/mmc/host/omap.c   |9 ++---
 drivers/mmc/host/omap_hsmmc.c |6 +++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 552196c..331fa89 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1466,13 +1466,14 @@ static int __devinit mmc_omap_probe(struct 
platform_device *pdev)
ret = PTR_ERR(host-iclk);
goto err_free_mmc_host;
}
-   clk_enable(host-iclk);
+   clk_prepare_enable(host-iclk);
 
host-fclk = clk_get(pdev-dev, fck);
if (IS_ERR(host-fclk)) {
ret = PTR_ERR(host-fclk);
goto err_free_iclk;
}
+   clk_prepare(host-fclk);
 
ret = request_irq(host-irq, mmc_omap_irq, 0, DRIVER_NAME, host);
if (ret)
@@ -1509,9 +1510,10 @@ err_plat_cleanup:
 err_free_irq:
free_irq(host-irq, host);
 err_free_fclk:
+   clk_unprepare(host-fclk);
clk_put(host-fclk);
 err_free_iclk:
-   clk_disable(host-iclk);
+   clk_disable_unprepare(host-iclk);
clk_put(host-iclk);
 err_free_mmc_host:
iounmap(host-virt_base);
@@ -1539,8 +1541,9 @@ static int __devexit mmc_omap_remove(struct 
platform_device *pdev)
 
mmc_omap_fclk_enable(host, 0);
free_irq(host-irq, host);
+   clk_unprepare(host-fclk);
clk_put(host-fclk);
-   clk_disable(host-iclk);
+   clk_disable_unprepare(host-iclk);
clk_put(host-iclk);
 
iounmap(host-virt_base);
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9a7a60a..154baa5 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1908,7 +1908,7 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
if (IS_ERR(host-dbclk)) {
dev_warn(mmc_dev(host-mmc), Failed to get debounce clk\n);
host-dbclk = NULL;
-   } else if (clk_enable(host-dbclk) != 0) {
+   } else if (clk_prepare_enable(host-dbclk) != 0) {
dev_warn(mmc_dev(host-mmc), Failed to enable debounce clk\n);
clk_put(host-dbclk);
host-dbclk = NULL;
@@ -2032,7 +2032,7 @@ err_irq:
pm_runtime_disable(host-dev);
clk_put(host-fclk);
if (host-dbclk) {
-   clk_disable(host-dbclk);
+   clk_disable_unprepare(host-dbclk);
clk_put(host-dbclk);
}
 err1:
@@ -2067,7 +2067,7 @@ static int __devexit omap_hsmmc_remove(struct 
platform_device *pdev)
pm_runtime_disable(host-dev);
clk_put(host-fclk);
if (host-dbclk) {
-   clk_disable(host-dbclk);
+   clk_disable_unprepare(host-dbclk);
clk_put(host-dbclk);
}
 
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/29] mmc: omap_hsmmc: use clk_prepare_enable and clk_disable_unprepare

2012-06-14 Thread Rajendra Nayak
As we move to Common clk framework use clk_prepare_enable()
instead of clk_enable() and similarly clk_disable_unprepare()
instead of clk_disable()

Signed-off-by: Rajendra Nayak rna...@ti.com
Cc: Chris Ball c...@laptop.org
Cc: Balaji T K balaj...@ti.com
Cc: linux-mmc@vger.kernel.org
---
 drivers/mmc/host/omap_hsmmc.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9a7a60a..07f5945 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1097,7 +1097,7 @@ static int omap_hsmmc_switch_opcond(struct 
omap_hsmmc_host *host, int vdd)
/* Disable the clocks */
pm_runtime_put_sync(host-dev);
if (host-dbclk)
-   clk_disable(host-dbclk);
+   clk_disable_unprepare(host-dbclk);
 
/* Turn the power off */
ret = mmc_slot(host).set_power(host-dev, host-slot_id, 0, 0);
@@ -1108,7 +1108,7 @@ static int omap_hsmmc_switch_opcond(struct 
omap_hsmmc_host *host, int vdd)
   vdd);
pm_runtime_get_sync(host-dev);
if (host-dbclk)
-   clk_enable(host-dbclk);
+   clk_prepare_enable(host-dbclk);
 
if (ret != 0)
goto err;
@@ -1908,7 +1908,7 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
if (IS_ERR(host-dbclk)) {
dev_warn(mmc_dev(host-mmc), Failed to get debounce clk\n);
host-dbclk = NULL;
-   } else if (clk_enable(host-dbclk) != 0) {
+   } else if (clk_prepare_enable(host-dbclk) != 0) {
dev_warn(mmc_dev(host-mmc), Failed to enable debounce clk\n);
clk_put(host-dbclk);
host-dbclk = NULL;
@@ -2032,7 +2032,7 @@ err_irq:
pm_runtime_disable(host-dev);
clk_put(host-fclk);
if (host-dbclk) {
-   clk_disable(host-dbclk);
+   clk_disable_unprepare(host-dbclk);
clk_put(host-dbclk);
}
 err1:
@@ -2067,7 +2067,7 @@ static int __devexit omap_hsmmc_remove(struct 
platform_device *pdev)
pm_runtime_disable(host-dev);
clk_put(host-fclk);
if (host-dbclk) {
-   clk_disable(host-dbclk);
+   clk_disable_unprepare(host-dbclk);
clk_put(host-dbclk);
}
 
@@ -2125,7 +2125,7 @@ static int omap_hsmmc_suspend(struct device *dev)
}
 
if (host-dbclk)
-   clk_disable(host-dbclk);
+   clk_disable_unprepare(host-dbclk);
 err:
pm_runtime_put_sync(host-dev);
return ret;
@@ -2146,7 +2146,7 @@ static int omap_hsmmc_resume(struct device *dev)
pm_runtime_get_sync(host-dev);
 
if (host-dbclk)
-   clk_enable(host-dbclk);
+   clk_prepare_enable(host-dbclk);
 
if (!(host-mmc-pm_flags  MMC_PM_KEEP_POWER))
omap_hsmmc_conf_bus_power(host);
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: omap_hsmmc: Fix check for mmc dt node

2012-04-17 Thread Rajendra Nayak

On Tuesday 17 April 2012 03:24 PM, Jassi Brar wrote:

Proper check should be if the hsmmc driver got its platform_data
via devicetree, and not if the devicetree is populated for the
platform.


This one is already fixed here..
http://www.spinics.net/lists/linux-omap/msg67879.html



Signed-off-by: Jassi Brarjaswinder.si...@linaro.org
---

The patch is more than a nit-pick because upstream doesn't yet have dt
nodes for mmc on OMAP while the driver wrongly assumes it does.
Which isn't a problem until you use some low-end sdhc card
(Transcend 8GB Class-4 in my experience) which fails to re-initialize,
OCR[30] set, if the first attempt fails due to delay at certain times
during the probe (for ex, simply enable CONFIG_REGULATOR_DUMMY).
Apparently such cards need proper 0v-1.8v power cycle to recover
(another Class-10 card does recover after ~10 attempts by the host).

While this simple patch gets us through the problem, it also tells
that adding mmc dt nodes without PBIAS setup callbacks in place
(without which we can't switch off the regulator or do 1.8v -  3.3v
switch) is probably not a safe option.

  drivers/mmc/host/omap_hsmmc.c |6 --
  1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index c628b95..b5ca4593 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -138,6 +138,7 @@ struct omap_hsmmc_next {

  struct omap_hsmmc_host {
struct  device  *dev;
+   struct  of_device_id*of_dev;
struct  mmc_host*mmc;
struct  mmc_request *mrq;
struct  mmc_command *cmd;
@@ -249,7 +250,7 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
 * the pbias cell programming support is still missing when
 * booting with Device tree
 */
-   if (of_have_populated_dt()  !vdd)
+   if (host-of_dev  !vdd)
return 0;

if (mmc_slot(host).before_set_reg)
@@ -1550,7 +1551,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
 * can't be allowed when booting with device
 * tree.
 */
-   (!of_have_populated_dt())) {
+   !host-of_dev) {
/*
 * The mmc_select_voltage fn of the core does
 * not seem to set the power_mode to
@@ -1837,6 +1838,7 @@ static int __devinit omap_hsmmc_probe(struct 
platform_device *pdev)
host= mmc_priv(mmc);
host-mmc= mmc;
host-pdata  = pdata;
+   host-of_dev = match;
host-dev=pdev-dev;
host-use_dma= 1;
host-dev-dma_mask =pdata-dma_mask;


--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mmc: omap_hsmmc: Get rid of of_have_populated_dt() usage

2012-04-11 Thread Rajendra Nayak
of_have_populated_dt() is not expected to be used in drivers but
instead only in early platform init code.
Drivers on the other hand should rely on dev-of_node or of_match_device().
Besides usage of of_have_populated_dt() also throws up build error as below
which was reported by Balaji TK, when omap_hsmmc is built as a module.

ERROR: allnodes [drivers/mmc/host/omap_hsmmc.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

So get rid of all of_have_populated_dt() usage in omap_hsmmc driver and
instead use dev-of_node to make the same dicisions as earlier.

Signed-off-by: Rajendra Nayak rna...@ti.com
Reported-by: Benoit Cousson b-cous...@ti.com
Cc: Balaji TK balaj...@ti.com
Cc: Rob Herring rob.herr...@calxeda.com
Cc: Sebastian Andrzej Siewior bige...@linutronix.de
---
 drivers/mmc/host/omap_hsmmc.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index ecc9521..4254b6f 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -252,7 +252,7 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
 * the pbias cell programming support is still missing when
 * booting with Device tree
 */
-   if (of_have_populated_dt()  !vdd)
+   if (dev-of_node  !vdd)
return 0;
 
if (mmc_slot(host).before_set_reg)
@@ -1564,7 +1564,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
 * can't be allowed when booting with device
 * tree.
 */
-   (!of_have_populated_dt())) {
+   !host-dev-of_node) {
/*
 * The mmc_select_voltage fn of the core does
 * not seem to set the power_mode to
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: omap_hsmmc: Get rid of of_have_populated_dt() usage

2012-04-11 Thread Rajendra Nayak

On Wednesday 11 April 2012 03:39 PM, Felipe Balbi wrote:

On Wed, Apr 11, 2012 at 03:33:13PM +0530, Rajendra Nayak wrote:

@@ -1564,7 +1564,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
 * can't be allowed when booting with device
 * tree.
 */
-   (!of_have_populated_dt())) {
+   !host-dev-of_node) {


won't compile


why? compiles fine for me.
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: omap_hsmmc: Get rid of of_have_populated_dt() usage

2012-04-11 Thread Rajendra Nayak

On Wednesday 11 April 2012 03:56 PM, Felipe Balbi wrote:

On Wed, Apr 11, 2012 at 03:54:28PM +0530, Rajendra Nayak wrote:

On Wednesday 11 April 2012 03:39 PM, Felipe Balbi wrote:

On Wed, Apr 11, 2012 at 03:33:13PM +0530, Rajendra Nayak wrote:

@@ -1564,7 +1564,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
 * can't be allowed when booting with device
 * tree.
 */
-   (!of_have_populated_dt())) {
+   !host-dev-of_node) {


won't compile


why? compiles fine for me.


aren't you missing the opening parenthesis ? Or is there a something not
shown in the context ?


Its the missing context thats confusing :-)

This is how the code looks in the file after the patch.

   if ((OMAP_HSMMC_READ(host-base, HCTL)  SDVSDET) 
(ios-vdd == DUAL_VOLT_OCR_BIT) 
/*
 * With pbias cell programming missing, this
 * can't be allowed when booting with device
 * tree.
 */
!host-dev-of_node) {



--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/4] omap hsmmc device tree support

2012-03-12 Thread Rajendra Nayak
The series adds device tree support for OMAP hsmmc
driver.

Changes in V2:
-1- Minor fixes based on comments from Grant.
-2- Added a seperate compatible for omap3.
-3- Added a new binding ti,needs-special-reset
to handle some mmc modules which need special
softreset sequence.
-4- Updated board dts files with status = disable;
for unused mmc modules.

Rob,
I retained your ack on patch 1 despite the additional
binding that I added to handle the special softreset
sequence. Let me know if you have any issues with it.

Chris.
Patch 1 and Patch 2 apply cleanly on mmc-next and can
be taken in from the mmc tree after relevent acks from
DT folks.
Patch 3 and Patch 4 which update dts files, I plan to
push via linux-omap/Tony's tree.

The series is tested on omap4sdp (both external and emmc),
omap4panda amd omap3beagle boards.

Things to do:
-1- Card detect isn't functional and needs twl4030 gpio
to be DT converted.
-2- pbias cell programming is missing and needs an OMAP
control module driver.

Rajendra Nayak (4):
  mmc: omap_hsmmc: Convert hsmmc driver to use device tree
  mmc: omap_hsmmc: Avoid a regulator voltage change with dt
  arm/dts: OMAP4: Add mmc controller nodes and board data
  arm/dts: OMAP3: Add mmc controller nodes and board data

 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |   33 +++
 arch/arm/boot/dts/omap3-beagle.dts |   14 +++
 arch/arm/boot/dts/omap3.dtsi   |   16 
 arch/arm/boot/dts/omap4-panda.dts  |   22 +
 arch/arm/boot/dts/omap4-sdp.dts|   24 ++
 arch/arm/boot/dts/omap4.dtsi   |   31 +++
 drivers/mmc/host/omap_hsmmc.c  |   88 +++-
 7 files changed, 227 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/4] arm/dts: OMAP4: Add mmc controller nodes and board data

2012-03-12 Thread Rajendra Nayak
Add omap mmc related device tree data for OMAP4.
Currenly limited to only omap4-panda and omap4-sdp
boards.

Signed-off-by: Rajendra Nayak rna...@ti.com
---
 arch/arm/boot/dts/omap4-panda.dts |   22 ++
 arch/arm/boot/dts/omap4-sdp.dts   |   24 
 arch/arm/boot/dts/omap4.dtsi  |   31 +++
 3 files changed, 77 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-panda.dts 
b/arch/arm/boot/dts/omap4-panda.dts
index 29646dc..ea6f5bb 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -52,3 +52,25 @@
 i2c4 {
clock-frequency = 40;
 };
+
+mmc1 {
+   vmmc-supply = vmmc;
+   ti,bus-width = 8;
+};
+
+mmc2 {
+   status = disable;
+};
+
+mmc3 {
+   status = disable;
+};
+
+mmc4 {
+   status = disable;
+};
+
+mmc5 {
+   ti,non-removable;
+   ti,bus-width = 4;
+};
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 01db8b7..852657a 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -70,3 +70,27 @@
reg = 0x1e;
};
 };
+
+mmc1 {
+   vmmc-supply = vmmc;
+   ti,bus-width = 8;
+};
+
+mmc2 {
+   vmmc-supply = vaux1;
+   ti,bus-width = 8;
+   ti,non-removable;
+};
+
+mmc3 {
+   status = disable;
+};
+
+mmc4 {
+   status = disable;
+};
+
+mmc5 {
+   ti,bus-width = 4;
+   ti,non-removable;
+};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 29f4589..9226543 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -155,5 +155,36 @@
#size-cells = 0;
ti,hwmods = i2c4;
};
+
+   mmc1: mmc@1 {
+   compatible = ti,omap4-hsmmc;
+   ti,hwmods = mmc1;
+   ti,dual-volt;
+   ti,needs-special-reset;
+   };
+
+   mmc2: mmc@2 {
+   compatible = ti,omap4-hsmmc;
+   ti,hwmods = mmc2;
+   ti,needs-special-reset;
+   };
+
+   mmc3: mmc@3 {
+   compatible = ti,omap4-hsmmc;
+   ti,hwmods = mmc3;
+   ti,needs-special-reset;
+   };
+
+   mmc4: mmc@4 {
+   compatible = ti,omap4-hsmmc;
+   ti,hwmods = mmc4;
+   ti,needs-special-reset;
+   };
+
+   mmc5: mmc@5 {
+   compatible = ti,omap4-hsmmc;
+   ti,hwmods = mmc5;
+   ti,needs-special-reset;
+   };
};
 };
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 4/4] arm/dts: OMAP3: Add mmc controller nodes and board data

2012-03-12 Thread Rajendra Nayak
Add omap mmc related device tree data for OMAP3.
Currenly limited to only omap3-beagle board.

Signed-off-by: Rajendra Nayak rna...@ti.com
---
 arch/arm/boot/dts/omap3-beagle.dts |   14 ++
 arch/arm/boot/dts/omap3.dtsi   |   16 
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap3-beagle.dts 
b/arch/arm/boot/dts/omap3-beagle.dts
index 714ba5d..5cf67d1 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -47,3 +47,17 @@
reg = 0x50;
};
 };
+
+mmc1 {
+   vmmc-supply = vmmc1;
+   vmmc_aux-supply = vsim;
+   ti,bus-width = 8;
+};
+
+mmc2 {
+   status = disable;
+};
+
+mmc3 {
+   status = disable;
+};
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index ca37ba5..3892e34 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -113,5 +113,21 @@
#size-cells = 0;
ti,hwmods = i2c3;
};
+
+   mmc1: mmc@1 {
+   compatible = ti,omap3-hsmmc;
+   ti,hwmods = mmc1;
+   ti,dual-volt;
+   };
+
+   mmc2: mmc@2 {
+   compatible = ti,omap3-hsmmc;
+   ti,hwmods = mmc2;
+   };
+
+   mmc3: mmc@3 {
+   compatible = ti,omap3-hsmmc;
+   ti,hwmods = mmc3;
+   };
};
 };
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/4] mmc: omap_hsmmc: Avoid a regulator voltage change with dt

2012-03-12 Thread Rajendra Nayak
When booting with Device tree, the omap_hsmmc driver does not
program the pbias cell (inside OMAP control module) during
a regulator voltage change.
In case of non-dt boot, this is handled using callbacks
from within platform_data and implemented in machine code.
To be able to do this with device tree, without invoking
any machine code, a OMAP control module driver is needed
which is yet missing.

The pbias cell is used to provide a 1.8v or 3.0v reference
to the mmc/sd/sdio1 interface supporting both 1.8v and 3.0v
voltages.

Until a OMAP control module driver is available to handle this,
when booting with a device tree blob, never change the regulator
voltage which might then require a pbias cell re-program.
There are 2 instances where in the mmc regulator voltage can be
changed.
-1- when the regulator is turned OFF.
-2- when attempting a switch to 1.8v from 3.0v for dual volt cards

This patch avoids a voltage change in both cases when booting from
device tree, and hence compromises on power savings.
Once the OMAP control module driver is available and hsmmc driver
is modified to then do pbias programming even when booting
with device tree, these limitaions can be removed to achieve better
power savings.

Signed-off-by: Rajendra Nayak rna...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   15 ++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 38ae8c0..f29e1a2 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -244,6 +244,13 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
 */
if (!host-vcc)
return 0;
+   /*
+* With DT, never turn OFF the regulator. This is because
+* the pbias cell programming support is still missing when
+* booting with Device tree
+*/
+   if (of_have_populated_dt()  !vdd)
+   return 0;
 
if (mmc_slot(host).before_set_reg)
mmc_slot(host).before_set_reg(dev, slot, power_on, vdd);
@@ -1516,7 +1523,13 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
 * of external transceiver; but they all handle 1.8V.
 */
if ((OMAP_HSMMC_READ(host-base, HCTL)  SDVSDET) 
-   (ios-vdd == DUAL_VOLT_OCR_BIT)) {
+   (ios-vdd == DUAL_VOLT_OCR_BIT) 
+   /*
+* With pbias cell programming missing, this
+* can't be allowed when booting with device
+* tree.
+*/
+   (!of_have_populated_dt())) {
/*
 * The mmc_select_voltage fn of the core does
 * not seem to set the power_mode to
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/4] mmc: omap_hsmmc: Convert hsmmc driver to use device tree

2012-03-09 Thread Rajendra Nayak

Hi Grant,

On Friday 09 March 2012 11:12 AM, Grant Likely wrote:

On Thu, 23 Feb 2012 17:31:27 +0530, Rajendra Nayakrna...@ti.com  wrote:

Define dt bindings for the ti-omap-hsmmc, and adapt
the driver to extract data (which was earlier passed as
platform_data) from device tree.

Signed-off-by: Rajendra Nayakrna...@ti.com
---
  .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |   31 +
  drivers/mmc/host/omap_hsmmc.c  |   68 
  2 files changed, 99 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt

diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
new file mode 100644
index 000..e4fa8f0
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -0,0 +1,31 @@
+* TI Highspeed MMC host controller for OMAP
+
+The Highspeed MMC Host Controller on TI OMAP family
+provides an interface for MMC, SD, and SDIO types of memory cards.
+
+Required properties:
+- compatible:
+ Should be ti,omap2-hsmmc, for OMAP2/3 controllers
+ Should be ti,omap4-hsmmc, for OMAP4 controllers
+- ti,hwmods: Must be mmcn, n is controller instance starting 1
+- reg : should contain hsmmc registers location and length
+
+Optional properties:
+ti,dual-volt: boolean, supports dual voltage cards
+supply-name-supply: phandle to the regulator device tree node
+supply-name examples are vmmc, vmmc_aux etc
+ti,bus-width: Number of data lines, default assumed is 1 if the property is 
missing.
+cd-gpios: GPIOs for card detection
+wp-gpios: GPIOs for write protection
+ti,non-removable: non-removable slot (like eMMC)


Binding looks okay.  A couple comments below...

[...]

+static const struct of_device_id omap_mmc_of_match[];


If you move the omap_mmc_of_match[] table up to here then there is no
need for the forward declaration.


+
  static int __init omap_hsmmc_probe(struct platform_device *pdev)
  {
struct omap_mmc_platform_data *pdata = pdev-dev.platform_data;
@@ -1725,6 +1768,14 @@ static int __init omap_hsmmc_probe(struct 
platform_device *pdev)
struct omap_hsmmc_host *host = NULL;
struct resource *res;
int ret, irq;
+   const struct of_device_id *match;
+
+   match = of_match_device(omap_mmc_of_match,pdev-dev);
+   if (match) {
+   pdata = of_get_hsmmc_pdata(pdev-dev);
+   if (match-data)
+   pdata-reg_offset = *(u16 *)match-data;


Blech on the ugly cast.  It is slightly safer to do thusly:

u16 *offsetp = match-data;
pdata-reg_offset = *offsetp


thanks for the review. I'll repost with these changes.

regards,
Rajendra




+   }

if (pdata == NULL) {
dev_err(pdev-dev, Platform Data is missing\n);
@@ -2120,12 +2171,29 @@ static struct dev_pm_ops omap_hsmmc_dev_pm_ops = {
.runtime_resume = omap_hsmmc_runtime_resume,
  };

+#if defined(CONFIG_OF)
+static u16 omap4_reg_offset = 0x100;
+
+static const struct of_device_id omap_mmc_of_match[] = {
+   {
+   .compatible = ti,omap2-hsmmc,
+   },
+   {
+   .compatible = ti,omap4-hsmmc,
+   .data =omap4_reg_offset,
+   },
+   {},
+}
+MODULE_DEVICE_TABLE(of, omap_mmc_of_match);
+#endif
+
  static struct platform_driver omap_hsmmc_driver = {
.remove = omap_hsmmc_remove,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
.pm =omap_hsmmc_dev_pm_ops,
+   .of_match_table = of_match_ptr(omap_mmc_of_match),
},
  };

--
1.7.1


___
linaro-dev mailing list
linaro-...@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev




--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/4] arm/dts: OMAP3: Add mmc controller nodes and board data

2012-03-09 Thread Rajendra Nayak

On Friday 09 March 2012 11:16 AM, Grant Likely wrote:

On Fri, 24 Feb 2012 10:49:00 -0800, Tony Lindgrent...@atomide.com  wrote:

* Rajendra Nayakrna...@ti.com  [120223 19:29]:

On Friday 24 February 2012 12:27 AM, Tony Lindgren wrote:

--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -113,5 +113,31 @@
#size-cells =0;
ti,hwmods = i2c3;
};
+
+   mmc1: mmc@1 {
+   compatible = ti,omap2-hsmmc;
+   ti,hwmods = mmc1;
+   ti,dual-volt;
+   };
+
+   mmc2: mmc@2 {
+   compatible = ti,omap2-hsmmc;
+   ti,hwmods = mmc2;
+   };
+
+   mmc3: mmc@3 {
+   compatible = ti,omap2-hsmmc;
+   ti,hwmods = mmc3;
+   };
+
+   mmc4: mmc@4 {
+   compatible = ti,omap2-hsmmc;
+   ti,hwmods = mmc4;
+   };
+
+   mmc5: mmc@5 {
+   compatible = ti,omap2-hsmmc;
+   ti,hwmods = mmc5;
+   };
};
  };


These all should all be ti,omap3-hsmmc I guess?


Well, I defined the binding such that both omap2 and omap3
can use the same compatible ti,omap2-hsmmc since there is
no difference in the way they are defined or handled. If thats
confusing, I can have separate compatibles.
Btw, I guess we do the same with a few other re-used IPs as well,
I just checked and mcpsi does the same.


Yeah let's use separate compatibles to avoid confusion.
For omap2 we also have the ti,omap2-mmc in addition to
ti,omap2-hsmmc..


Yes, absolutely use separate compatible values.  It is always important
to be specific as to the silicon implementing the IP.  The omap3 instance
can also carry the omap2 string in its compatible list:

compatible = ti,omap3-hsmmc, ti,omap2-hsmmc;


Sure, will repost with seperate compatible strings. Also missed adding
the 'status = disable;' for unused mmc blocks in the board .dts file
causing unused mmc modules to get probed too. Will fix that as well.

thanks,
Rajendra



g.


--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/4] arm/dts: OMAP3: Add mmc controller nodes and board data

2012-03-09 Thread Rajendra Nayak

Hi Paul,

On Friday 09 March 2012 12:21 PM, Paul Walmsley wrote:

On Thu, 8 Mar 2012, Grant Likely wrote:


Yes, absolutely use separate compatible values.  It is always important
to be specific as to the silicon implementing the IP.


In that case, it is probably best to use the full chip name in the
compatible string, e.g., omap2420 or omap2430 rather than just omap2.


Since omap2420 and omap2430 have different MMC controllers (and these
bindings only cover the hsmmc controller used in 2430 and beyond, I
haven't done the bindings for the legacy one yet), the idea was
to differentiate between omap2420 and omap2430 by using
compatible of ti,omap2-hsmmc for the High-Speed controller used in
OMAP2 (2430) and ti,omap2-mmc for the legacy one used in OMAP2 (2420).
Does that sound good to you?


Particularly in the case of OMAP3, which is a largely meaningless group
these days with AM33xx, OMAP34xx, OMAP36xx, and AM3517, many of which are
quite different from each other...


But these bindings are specific and limited to HSMMC module which is
not quite different in the different SoC variants. There is a single
driver to handle hsmmc module on all the SoCs which does not need to
differentiate which SoC it is on.

regards,
Rajendra




- Paul


--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/6] mmc: omap_hsmmc: Clean up use/abuse of pdev-id

2012-03-08 Thread Rajendra Nayak

Hi Chris,

On Wednesday 07 March 2012 08:29 PM, Chris Ball wrote:

Hi Rajendra,

On Wed, Mar 07 2012, Rajendra Nayak wrote:

Chris, Ping. I am basing my DT support patches on top of these cleanups.
Would be great if you can have a look and pull them in.


Chris, just realized the last two requests from me to get this merged
weren't addressed to you directly, but instead you were copied.
Resending with you in 'To', hope this lands in your inbox :)


Sorry for the delay, thanks for the ping; I've pushed these to mmc-next
for 3.4 now.


There's just one other cleanup patch here [1] to convert all pr_* prints
in the driver to dev_*. Would be great if you can pick that as well.

Thanks,
Rajendra

[1] http://marc.info/?l=linux-mmcm=132999677405098w=3



Thanks,

- Chris.


--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/6] mmc: omap_hsmmc: Clean up use/abuse of pdev-id

2012-03-07 Thread Rajendra Nayak

On Monday 05 March 2012 01:24 PM, Rajendra Nayak wrote:

On Friday 24 February 2012 03:40 PM, Rajendra Nayak wrote:

Chris,

On Thursday 23 February 2012 04:56 PM, Rajendra Nayak wrote:

Re-sending as these patches did not make it to the lists due to
issues with my 'git send-email'

This series mainly cleans up all instances of hardcoding's in
the driver based on pdev-id. This is cleanup leading to the
DT adaptation of omap_hsmmc driver.

v2 mainly has some minor changes to get rid of a debug print
which was still using host-id and getting rid of 'id' field
entirely from omap_hsmmc_host struct.

The series is tested on OMAP4SDP, OMAP4panda, OMAP3beagle and
OMAP2430SDP
boards.


This series is reviewed/tested and acked by Balaji and Venkat.
Care to pull this in for 3.4?

I have one other cleanup patch on top of this series to make all
remaining pr_* prints in the driver to dev_* [1].
It would be great if you could pick that up as well.

These patches are cleanups leading to the DT conversion of omap_hsmmc
driver.


Chris, Ping. I am basing my DT support patches on top of these cleanups.
Would be great if you can have a look and pull them in.


Chris, just realized the last two requests from me to get this merged
weren't addressed to you directly, but instead you were copied.
Resending with you in 'To', hope this lands in your inbox :)

regards,
Rajendra





regards,
Rajendra

[1] http://marc.info/?l=linux-mmcm=132999677405098w=3



regards,
Rajendra

Balaji T K (3):
mmc: omap_hsmmc: use platform_get_resource_byname for tx/rx DMA
channels
mmc: omap_hsmmc: remove unused .set_sleep function
mmc: omap_hsmmc: Use OMAP_HSMMC_SUPPORTS_DUAL_VOLT flag to remove
host-id based hardcoding

Rajendra Nayak (3):
mmc: omap_hsmmc: Get rid of omap_hsmmc_1_set_power function
mmc: omap_hsmmc: Get rid of omap_hsmmc_4_set_power function
mmc: omap_hsmmc: Don't expect MMC1 to always have vmmc supply

arch/arm/plat-omap/include/plat/mmc.h | 2 -
drivers/mmc/host/omap_hsmmc.c | 175 +++--
2 files changed, 16 insertions(+), 161 deletions(-)







--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/6] mmc: omap_hsmmc: Clean up use/abuse of pdev-id

2012-03-07 Thread Rajendra Nayak

On Wednesday 07 March 2012 08:29 PM, Chris Ball wrote:

Hi Rajendra,

On Wed, Mar 07 2012, Rajendra Nayak wrote:

Chris, Ping. I am basing my DT support patches on top of these cleanups.
Would be great if you can have a look and pull them in.


Chris, just realized the last two requests from me to get this merged
weren't addressed to you directly, but instead you were copied.
Resending with you in 'To', hope this lands in your inbox :)


Sorry for the delay, thanks for the ping; I've pushed these to mmc-next
for 3.4 now.


Great, thanks Chris.



Thanks,

- Chris.


--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/4] mmc: omap_hsmmc: Convert hsmmc driver to use device tree

2012-03-07 Thread Rajendra Nayak

Hi Rob/Grant,

On Thursday 23 February 2012 05:31 PM, Rajendra Nayak wrote:

Define dt bindings for the ti-omap-hsmmc, and adapt
the driver to extract data (which was earlier passed as
platform_data) from device tree.


Any comments on these bindings for omap hsmmc? All the dependent
patches/series on which this series was based have now made it to
the respective -next of Mark and Chris.

regards,
Rajendra



Signed-off-by: Rajendra Nayakrna...@ti.com
---
  .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |   31 +
  drivers/mmc/host/omap_hsmmc.c  |   68 
  2 files changed, 99 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt

diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
new file mode 100644
index 000..e4fa8f0
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -0,0 +1,31 @@
+* TI Highspeed MMC host controller for OMAP
+
+The Highspeed MMC Host Controller on TI OMAP family
+provides an interface for MMC, SD, and SDIO types of memory cards.
+
+Required properties:
+- compatible:
+ Should be ti,omap2-hsmmc, for OMAP2/3 controllers
+ Should be ti,omap4-hsmmc, for OMAP4 controllers
+- ti,hwmods: Must be mmcn, n is controller instance starting 1
+- reg : should contain hsmmc registers location and length
+
+Optional properties:
+ti,dual-volt: boolean, supports dual voltage cards
+supply-name-supply: phandle to the regulator device tree node
+supply-name examples are vmmc, vmmc_aux etc
+ti,bus-width: Number of data lines, default assumed is 1 if the property is 
missing.
+cd-gpios: GPIOs for card detection
+wp-gpios: GPIOs for write protection
+ti,non-removable: non-removable slot (like eMMC)
+
+Example:
+   mmc1: mmc@0x4809c000 {
+   compatible = ti,omap4-hsmmc;
+   reg =0x4809c000 0x400;
+   ti,hwmods = mmc1;
+   ti,dual-volt;
+   ti,bus-width =4;
+   vmmc-supply =vmmc; /* phandle to regulator node */
+   ti,non-removable;
+   };
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 35f6dc1..0c93d58 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -26,6 +26,9 @@
  #includelinux/platform_device.h
  #includelinux/timer.h
  #includelinux/clk.h
+#includelinux/of.h
+#includelinux/of_gpio.h
+#includelinux/of_device.h
  #includelinux/mmc/host.h
  #includelinux/mmc/core.h
  #includelinux/mmc/mmc.h
@@ -1718,6 +1721,46 @@ static void omap_hsmmc_debugfs(struct mmc_host *mmc)

  #endif

+#ifdef CONFIG_OF
+static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
+{
+   struct omap_mmc_platform_data *pdata;
+   struct device_node *np = dev-of_node;
+   u32 bus_width;
+
+   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata)
+   return NULL; /* out of memory */
+
+   if (of_find_property(np, ti,dual-volt, NULL))
+   pdata-controller_flags |= OMAP_HSMMC_SUPPORTS_DUAL_VOLT;
+
+   /* This driver only supports 1 slot */
+   pdata-nr_slots = 1;
+   pdata-slots[0].switch_pin = of_get_named_gpio(np, cd-gpios, 0);
+   pdata-slots[0].gpio_wp = of_get_named_gpio(np, wp-gpios, 0);
+
+   if (of_find_property(np, ti,non-removable, NULL)) {
+   pdata-slots[0].nonremovable = true;
+   pdata-slots[0].no_regulator_off_init = true;
+   }
+   of_property_read_u32(np, ti,bus-width,bus_width);
+   if (bus_width == 4)
+   pdata-slots[0].caps |= MMC_CAP_4_BIT_DATA;
+   else if (bus_width == 8)
+   pdata-slots[0].caps |= MMC_CAP_8_BIT_DATA;
+   return pdata;
+}
+#else
+static inline struct omap_mmc_platform_data
+   *of_get_hsmmc_pdata(struct device *dev)
+{
+   return NULL;
+}
+#endif
+
+static const struct of_device_id omap_mmc_of_match[];
+
  static int __init omap_hsmmc_probe(struct platform_device *pdev)
  {
struct omap_mmc_platform_data *pdata = pdev-dev.platform_data;
@@ -1725,6 +1768,14 @@ static int __init omap_hsmmc_probe(struct 
platform_device *pdev)
struct omap_hsmmc_host *host = NULL;
struct resource *res;
int ret, irq;
+   const struct of_device_id *match;
+
+   match = of_match_device(omap_mmc_of_match,pdev-dev);
+   if (match) {
+   pdata = of_get_hsmmc_pdata(pdev-dev);
+   if (match-data)
+   pdata-reg_offset = *(u16 *)match-data;
+   }

if (pdata == NULL) {
dev_err(pdev-dev, Platform Data is missing\n);
@@ -2120,12 +2171,29 @@ static struct dev_pm_ops omap_hsmmc_dev_pm_ops = {
.runtime_resume = omap_hsmmc_runtime_resume,
  };

+#if defined(CONFIG_OF)
+static u16 omap4_reg_offset = 0x100;
+
+static const struct of_device_id omap_mmc_of_match

Re: [PATCH 4/4] mmc: omap_hsmmc: Simplify init for twl6030 MMC card detect

2012-03-05 Thread Rajendra Nayak

On Friday 02 March 2012 10:52 PM, Tony Lindgren wrote:

BTW, with -rc5, looks like re-inserting omap_hsmmc on omap4 fails
to detect any cards, and then fails to unload. This works on omap3
just fine. Any ideas why that would be?


Yeah, looks like thats broken. I am not sure whats going wrong though.
I just enabled CONFIG_MMC_DEBUG and saw these logs below.

Venkat/Balaji, care to look at this one?

# insmod omap_hsmmc.ko
[   43.358398] omap_hsmmc omap_hsmmc.0: context was not lost
[   43.364105] omap_hsmmc omap_hsmmc.0: enabled
[   44.434661] mmc0: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0 
timing 0

[   44.442352] omap_hsmmc omap_hsmmc.0: Set clock to 0Hz
[   44.474365] omap_hsmmc omap_hsmmc.0: disabled
[   44.482208] omap_hsmmc omap_hsmmc.4: context was not lost
[   44.482208] omap_hsmmc omap_hsmmc.4: enabled
[   44.546600] omap_hsmmc omap_hsmmc.0: context was not lost
[   44.552276] omap_hsmmc omap_hsmmc.0: enabled
[   44.552276] mmc0: mmc_rescan_try_freq: trying to init card at 40 Hz
[   44.563720] mmc0: clock 0Hz busmode 2 powermode 1 cs 0 Vdd 18 width 0 
timing 0

[   44.572174] omap_hsmmc omap_hsmmc.0: Set clock to 0Hz
[   44.613800] mmc0: clock 40Hz busmode 2 powermode 2 cs 0 Vdd 18 
width 0 timing 0

[   44.621887] omap_hsmmc omap_hsmmc.0: Set clock to 40Hz
[   44.735290] mmc0: starting CMD52 arg 0c00 flags 0195
[   44.741271] omap_hsmmc omap_hsmmc.0: mmc0: CMD52, argument 0x0c00
[   45.560241] mmc1: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0 
timing 0

[   45.567871] omap_hsmmc omap_hsmmc.4: Set clock to 0Hz
[   45.591491] omap_hsmmc omap_hsmmc.4: disabled
#
#
# rmmod omap_hsmmc
[  607.302307] omap_hsmmc omap_hsmmc.4: context was not lost
[  607.308044] omap_hsmmc omap_hsmmc.4: enabled
[  607.312591] omap_hsmmc omap_hsmmc.4: disabled
[  607.317199] omap_hsmmc omap_hsmmc.4: context was not lost
[  607.322875] omap_hsmmc omap_hsmmc.4: enabled

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/6] mmc: omap_hsmmc: Clean up use/abuse of pdev-id

2012-03-04 Thread Rajendra Nayak

On Friday 24 February 2012 03:40 PM, Rajendra Nayak wrote:

Chris,

On Thursday 23 February 2012 04:56 PM, Rajendra Nayak wrote:

Re-sending as these patches did not make it to the lists due to
issues with my 'git send-email'

This series mainly cleans up all instances of hardcoding's in
the driver based on pdev-id. This is cleanup leading to the
DT adaptation of omap_hsmmc driver.

v2 mainly has some minor changes to get rid of a debug print
which was still using host-id and getting rid of 'id' field
entirely from omap_hsmmc_host struct.

The series is tested on OMAP4SDP, OMAP4panda, OMAP3beagle and OMAP2430SDP
boards.


This series is reviewed/tested and acked by Balaji and Venkat.
Care to pull this in for 3.4?

I have one other cleanup patch on top of this series to make all
remaining pr_* prints in the driver to dev_* [1].
It would be great if you could pick that up as well.

These patches are cleanups leading to the DT conversion of omap_hsmmc
driver.


Chris, Ping. I am basing my DT support patches on top of these cleanups.
Would be great if you can have a look and pull them in.



regards,
Rajendra

[1] http://marc.info/?l=linux-mmcm=132999677405098w=3



regards,
Rajendra

Balaji T K (3):
mmc: omap_hsmmc: use platform_get_resource_byname for tx/rx DMA
channels
mmc: omap_hsmmc: remove unused .set_sleep function
mmc: omap_hsmmc: Use OMAP_HSMMC_SUPPORTS_DUAL_VOLT flag to remove
host-id based hardcoding

Rajendra Nayak (3):
mmc: omap_hsmmc: Get rid of omap_hsmmc_1_set_power function
mmc: omap_hsmmc: Get rid of omap_hsmmc_4_set_power function
mmc: omap_hsmmc: Don't expect MMC1 to always have vmmc supply

arch/arm/plat-omap/include/plat/mmc.h | 2 -
drivers/mmc/host/omap_hsmmc.c | 175 +++--
2 files changed, 16 insertions(+), 161 deletions(-)





--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] mmc: omap_hsmmc: Use gpio_find_by_chip_name() for omap_hsmmc_gpio_init()

2012-03-01 Thread Rajendra Nayak

On Friday 02 March 2012 12:25 AM, Tony Lindgren wrote:

Use gpio_find_by_chip_name() to find the GPIO pins as they can
be dynamically allocated on various gpio_chips.

Note that we don't want to touch the platform data as it can
now specify the GPIO offset on a named gpio_chip.

This removes the need to use callbacks to set the GPIO pins
in platform data.


While one of the reasons for those callbacks was to set the GPIO
pins in platform data, I guess the other and more important one
was to make sure the init sequencing between twl4030-gpio and the
mmc device depending on it was done rightly. Doesn't this patch now
leave the sequencing to work by luck (in the absence of something
like deferred probe being in place) like is the case of twl6030 and
mmc init sequence on OMAP4 already?

regards,
Rajendra



Cc: Chris Ballc...@laptop.org
Cc: Grant Likelygrant.lik...@secretlab.ca
Cc: Rajendra Nayakrna...@ti.com
Signed-off-by: Tony Lindgrent...@atomide.com
---
  arch/arm/mach-omap2/hsmmc.c   |3 +
  arch/arm/mach-omap2/hsmmc.h   |5 ++
  arch/arm/plat-omap/include/plat/mmc.h |3 +
  drivers/gpio/gpio-twl4030.c   |2 +
  drivers/mmc/host/omap_hsmmc.c |  109 +
  5 files changed, 82 insertions(+), 40 deletions(-)

diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index a97876d..dda88f7 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -323,7 +323,10 @@ static int __init omap_hsmmc_pdata_init(struct 
omap2_hsmmc_info *c,

mmc-get_context_loss_count = hsmmc_get_context_loss;

+   mmc-slots[0].gpiochip_cd = c-gpiochip_cd;
mmc-slots[0].switch_pin = c-gpio_cd;
+
+   mmc-slots[0].gpiochip_wp = c-gpiochip_wp;
mmc-slots[0].gpio_wp = c-gpio_wp;

mmc-slots[0].remux = c-remux;
diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h
index 07831cc..ffbb78d 100644
--- a/arch/arm/mach-omap2/hsmmc.h
+++ b/arch/arm/mach-omap2/hsmmc.h
@@ -22,8 +22,13 @@ struct omap2_hsmmc_info {
boolno_off_init;/* no power off when not in MMC sleep state */
boolvcc_aux_disable_is_sleep; /* Regulator off remapped to sleep */
booldeferred;   /* mmc needs a deferred probe */
+
+   char*gpiochip_cd;   /* Optional gpiochip for gpio_cd */
int gpio_cd;/* or -EINVAL */
+
+   char*gpiochip_wp;   /* Optional gpiochip for gpio_wp */
int gpio_wp;/* or -EINVAL */
+
char*name;  /* or NULL for default */
struct platform_device *pdev;   /* mmc controller instance */
int ocr_mask;   /* temporary HACK */
diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index f75946c..cbfbdc3 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -130,7 +130,10 @@ struct omap_mmc_platform_data {
  #define HSMMC_HAS_UPDATED_RESET   (1  1)
unsigned features;

+   char *gpiochip_cd;  /* optional gpiochip for card 
detect */
int switch_pin; /* gpio (card detect) */
+
+   char *gpiochip_wp;  /* optional gpiochip for write 
protect */
int gpio_wp;/* gpio (write protect) */

int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index b8b4f22..d0f266c 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -391,6 +391,7 @@ static int __devinit gpio_twl4030_debounce(u32 debounce, u8 
mmc_cd)
  }

  static int gpio_twl4030_remove(struct platform_device *pdev);
+static struct platform_driver gpio_twl4030_driver;

  static int __devinit gpio_twl4030_probe(struct platform_device *pdev)
  {
@@ -430,6 +431,7 @@ no_irqs:
pdata-debounce, pdata-mmc_cd,
ret);

+   twl_gpiochip.label = gpio_twl4030_driver.driver.name;
twl_gpiochip.base = pdata-gpio_base;
twl_gpiochip.ngpio = TWL4030_GPIO_MAX;
twl_gpiochip.dev =pdev-dev;
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index fd0c661..1aa2420 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -176,6 +176,8 @@ struct omap_hsmmc_host {
int use_dma, dma_ch;
int dma_line_tx, dma_line_rx;
int slot_id;
+   int gpio_cd;
+   int gpio_wp;
int got_dbclk;
int response_busy;
int context_loss;
@@ -192,26 +194,29 @@ struct omap_hsmmc_host {

  static int omap_hsmmc_card_detect(struct device *dev, int slot)
  {
-   struct omap_mmc_platform_data *mmc = 

Re: [PATCH 3/4] mmc: omap_hsmmc: Use GPIO offset for external GPIO chips

2012-03-01 Thread Rajendra Nayak

On Friday 02 March 2012 12:25 AM, Tony Lindgren wrote:

We can now remove the setting of GPIO pins with callbacks
as the drivers can access a GPIO offset on a named gpio_chip
directly with gpio_find_by_chip_name().

Cc: Rajendra Nayakrna...@ti.com
Signed-off-by: Tony Lindgrent...@atomide.com
---
  arch/arm/mach-omap2/board-3430sdp.c  |   13 -
  arch/arm/mach-omap2/board-cm-t35.c   |8 ++--
  arch/arm/mach-omap2/board-devkit8000.c   |7 ++-
  arch/arm/mach-omap2/board-igep0020.c |8 ++--
  arch/arm/mach-omap2/board-omap3beagle.c  |9 +++--
  arch/arm/mach-omap2/board-omap3evm.c |8 ++--
  arch/arm/mach-omap2/board-omap3pandora.c |   13 -
  arch/arm/mach-omap2/board-omap3stalker.c |8 ++--
  arch/arm/mach-omap2/board-omap3touchbook.c   |7 ++-
  arch/arm/mach-omap2/board-zoom-peripherals.c |7 ++-
  10 files changed, 25 insertions(+), 63 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index da75f23..238b95a 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -231,14 +231,16 @@ static struct omap2_hsmmc_info mmc[] = {
 * so the SIM card isn't used; else 4 bits.
 */
.caps   = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
+   .gpiochip_cd= twl4030_gpio,
+   .gpio_cd= 0,/* mmc0_cd offset in twl4030 */
.gpio_wp= 4,
-   .deferred   = true,


Shouldn't this patch completely get rid of all the 'deferred'
infrastructure that was put in place, including the 
omap_hsmmc_late_init() function, since there is no need for it

anymore?


},

[..]


/*
 * Most GPIOs are for USB OTG.  Some are mostly sent to
 * the P2 connector; notably LEDA for the LCD backlight.
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c 
b/arch/arm/mach-omap2/board-omap3pandora.c
index ace466b..b387264 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -270,19 +270,19 @@ static struct omap2_hsmmc_info omap3pandora_mmc[] = {
{
.mmc= 1,
.caps   = MMC_CAP_4_BIT_DATA,
-   .gpio_cd= -EINVAL,
+   .gpiochip_cd= twl4030_gpio,
+   .gpio_cd= 0,/* mmc0_cd offset in twl4030 */
.gpio_wp= 126,
.ext_clock  = 0,
-   .deferred   = true,
},
{
.mmc= 2,
.caps   = MMC_CAP_4_BIT_DATA,
-   .gpio_cd= -EINVAL,
+   .gpiochip_cd= twl4030_gpio,
+   .gpio_cd= 0,/* mmc0_cd offset in twl4030 */


This one should be gpio_cd = 1,

regards,
Rajendra


.gpio_wp= 127,
.ext_clock  = 1,
.transceiver= true,
-   .deferred   = true,
},
{
.mmc= 3,
@@ -299,11 +299,6 @@ static int omap3pandora_twl_gpio_setup(struct device *dev,
  {
int ret, gpio_32khz;

-   /* gpio + {0,1} is mmc{0,1}_cd (input/IRQ) */
-   omap3pandora_mmc[0].gpio_cd = gpio + 0;
-   omap3pandora_mmc[1].gpio_cd = gpio + 1;
-   omap_hsmmc_late_init(omap3pandora_mmc);
-
/* gpio + 13 drives 32kHz buffer for wifi module */
gpio_32khz = gpio + 13;
ret = gpio_request_one(gpio_32khz, GPIOF_OUT_INIT_HIGH, wifi 32kHz);
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c 
b/arch/arm/mach-omap2/board-omap3stalker.c
index 6410043..6d0deb9 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -211,9 +211,9 @@ static struct omap2_hsmmc_info mmc[] = {
{
.mmc= 1,
.caps   = MMC_CAP_4_BIT_DATA,
-   .gpio_cd= -EINVAL,
+   .gpiochip_cd= twl4030_gpio,
+   .gpio_cd= 0,/* mmc0_cd offset in twl4030 */
.gpio_wp= 23,
-   .deferred   = true,
 },
{}  /* Terminator */
  };
@@ -282,10 +282,6 @@ static int
  omap3stalker_twl_gpio_setup(struct device *dev,
unsigned gpio, unsigned ngpio)
  {
-   /* gpio + 0 is mmc0_cd (input/IRQ) */
-   mmc[0].gpio_cd = gpio + 0;
-   omap_hsmmc_late_init(mmc);
-
/*
 * Most GPIOs are for USB OTG.  Some are mostly sent to
 * the P2 connector; notably LEDA for the LCD backlight.
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c 
b/arch/arm/mach-omap2/board-omap3touchbook.c
index 8842e04..cf270b8 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -99,8 

Re: [PATCH 4/4] mmc: omap_hsmmc: Simplify init for twl6030 MMC card detect

2012-03-01 Thread Rajendra Nayak

On Friday 02 March 2012 12:25 AM, Tony Lindgren wrote:

There's no need to use callbacks for this, we can
do it directly between MMC driver and twl6030.

Cc: Samuel Ortizsa...@linux.intel.com
Cc: Chris Ballc...@laptop.org
Cc: Rajendra Nayakrna...@ti.com
Signed-off-by: Tony Lindgrent...@atomide.com
---

[..]

diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index 7ca7a5c..8cf4e54 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -153,8 +153,8 @@ static struct omap2_hsmmc_info mmc[] = {
{
.mmc= 1,
.caps   = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
-   .gpio_wp= -EINVAL,
.gpio_cd= -EINVAL,
+   .gpio_wp= -EINVAL,


stray change.


},

[..]

diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
index c6b456a..ce0002b 100644
--- a/drivers/mfd/twl6030-irq.c
+++ b/drivers/mfd/twl6030-irq.c
@@ -283,35 +283,30 @@ int twl6030_mmc_card_detect_config(void)
 * Card status on TWL6030 for MMC1
 */
ret = twl_i2c_read_u8(TWL6030_MODULE_ID0,reg_val, TWL6030_MMCCTRL);
-   if (ret  0) {
-   pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret);
-   return ret;
-   }
+   if (ret  0)
+   goto err;
reg_val= ~VMMC_AUTO_OFF;
reg_val |= SW_FC;
ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL);
-   if (ret  0) {
-   pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret);
-   return ret;
-   }
+   if (ret  0)
+   goto err;

/* Configuring PullUp-PullDown register */
ret = twl_i2c_read_u8(TWL6030_MODULE_ID0,reg_val,
TWL6030_CFG_INPUT_PUPD3);
-   if (ret  0) {
-   pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error %d\n,
-   ret);
-   return ret;
-   }
+   if (ret  0)
+   goto err;
reg_val= ~(MMC_PU | MMC_PD);
ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val,
TWL6030_CFG_INPUT_PUPD3);
-   if (ret  0) {
-   pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error %d\n,
-   ret);
-   return ret;
-   }
-   return 0;
+   if (ret  0)
+   goto err;
+
+   return twl6030_irq_base + MMCDETECT_INTR_OFFSET;
+
+err:
+   pr_err(twl6030: Failed to initialize MMC card detect: %d\n, ret);
+   return -ENODEV;
  }
  EXPORT_SYMBOL(twl6030_mmc_card_detect_config);

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 1aa2420..7f483b7 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -34,6 +34,7 @@
  #includelinux/gpio.h
  #includelinux/regulator/consumer.h
  #includelinux/pm_runtime.h
+#includelinux/i2c/twl.h
  #includeplat/dma.h
  #includemach/hardware.h
  #includeplat/board.h
@@ -578,6 +579,32 @@ static void omap_hsmmc_gpio_free(struct omap_hsmmc_host 
*host)
gpio_free(host-gpio_cd);
  }

+#ifdef CONFIG_TWL4030_CORE
+static int omap_hsmmc_init_twl6030(struct omap_hsmmc_host *host)
+{
+   struct omap_mmc_platform_data *pdata = host-pdata;
+   struct omap_mmc_slot_data *slot =pdata-slots[0];
+   int irq;
+
+   if (gpio_is_valid(host-gpio_cd) || host-id)


I have a series, which I am asking Chris to pull, which completely
gets rid of all host-id based hard-codings' in the driver.
Isn't there a better way to do this than rely on the device instance?

regards,
Rajendra


+   return 0;
+
+   irq = twl6030_mmc_card_detect_config();
+   if (irq= 0)
+   return irq;
+
+   slot-card_detect_irq = irq;
+   slot-card_detect = twl6030_mmc_card_detect;
+
+   return 0;
+}
+#else
+static inline int omap_hsmmc_init_twl6030(struct omap_hsmmc_host *host)
+{
+   return -ENODEV;
+}
+#endif
+
  /*
   * Start clock to the card
   */
@@ -1933,6 +1960,10 @@ static int __init omap_hsmmc_probe(struct 
platform_device *pdev)
if (ret)
goto err1;

+   ret = omap_hsmmc_init_twl6030(host);
+   if (ret)
+   goto err1;
+
mmc-ops =omap_hsmmc_ops;

/*



--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] mmc: omap_hsmmc: Use gpio_find_by_chip_name() for omap_hsmmc_gpio_init()

2012-03-01 Thread Rajendra Nayak

On Friday 02 March 2012 12:25 AM, Tony Lindgren wrote:

Use gpio_find_by_chip_name() to find the GPIO pins as they can
be dynamically allocated on various gpio_chips.

Note that we don't want to touch the platform data as it can
now specify the GPIO offset on a named gpio_chip.

This removes the need to use callbacks to set the GPIO pins
in platform data.

Cc: Chris Ballc...@laptop.org
Cc: Grant Likelygrant.lik...@secretlab.ca
Cc: Rajendra Nayakrna...@ti.com
Signed-off-by: Tony Lindgrent...@atomide.com
---


some more comments based on my testing with twl4030-gpio
built as a module..


  arch/arm/mach-omap2/hsmmc.c   |3 +
  arch/arm/mach-omap2/hsmmc.h   |5 ++
  arch/arm/plat-omap/include/plat/mmc.h |3 +
  drivers/gpio/gpio-twl4030.c   |2 +
  drivers/mmc/host/omap_hsmmc.c |  109 +
  5 files changed, 82 insertions(+), 40 deletions(-)

diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index a97876d..dda88f7 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -323,7 +323,10 @@ static int __init omap_hsmmc_pdata_init(struct 
omap2_hsmmc_info *c,



@@ -497,55 +502,80 @@ static inline int omap_hsmmc_have_reg(void)

  #endif

-static int omap_hsmmc_gpio_init(struct omap_mmc_platform_data *pdata)
+static int omap_hsmmc_gpio_init(struct omap_hsmmc_host *host)
  {
-   int ret;
-
-   if (gpio_is_valid(pdata-slots[0].switch_pin)) {
-   if (pdata-slots[0].cover)
-   pdata-slots[0].get_cover_state =
+   struct omap_mmc_platform_data *pdata = host-pdata;
+   struct omap_mmc_slot_data *slot =pdata-slots[0];
+   int gpio, ret;
+
+   gpio = slot-switch_pin;
+   if (slot-gpiochip_cd)
+   gpio = gpio_find_by_chip_name(slot-gpiochip_cd, gpio);
+   if (gpio_is_valid(gpio)) {
+   if (slot-cover)
+   slot-get_cover_state =
omap_hsmmc_get_cover_state;
else
-   pdata-slots[0].card_detect = omap_hsmmc_card_detect;
-   pdata-slots[0].card_detect_irq =
-   gpio_to_irq(pdata-slots[0].switch_pin);
-   ret = gpio_request(pdata-slots[0].switch_pin, mmc_cd);
+   slot-card_detect = omap_hsmmc_card_detect;
+   slot-card_detect_irq =
+   gpio_to_irq(gpio);
+   ret = gpio_request(gpio, mmc_cd);
if (ret)
return ret;
-   ret = gpio_direction_input(pdata-slots[0].switch_pin);
+   ret = gpio_direction_input(gpio);
if (ret)
goto err_free_sp;
-   } else
-   pdata-slots[0].switch_pin = -EINVAL;
+   host-gpio_cd = gpio;
+   } else {
+   if (slot-gpiochip_cd) {
+   pr_warning(MMC %s card detect GPIO chip %s 
unavailable\n,
+   slot-name, slot-gpiochip_cd);
+   ret = -ENODEV;
+   goto err_free_sp;


This should just return -ENODEV, nothing really to free here.


+   }
+   host-gpio_cd = -EINVAL;
+   }

-   if (gpio_is_valid(pdata-slots[0].gpio_wp)) {
-   pdata-slots[0].get_ro = omap_hsmmc_get_wp;
-   ret = gpio_request(pdata-slots[0].gpio_wp, mmc_wp);
+   gpio = slot-gpio_wp;
+   if (slot-gpiochip_wp)
+   gpio = gpio_find_by_chip_name(slot-gpiochip_wp, gpio);
+   if (gpio_is_valid(gpio)) {
+   slot-get_ro = omap_hsmmc_get_wp;
+   ret = gpio_request(gpio, mmc_wp);
if (ret)
goto err_free_cd;
-   ret = gpio_direction_input(pdata-slots[0].gpio_wp);
+   ret = gpio_direction_input(gpio);
if (ret)
goto err_free_wp;
-   } else
-   pdata-slots[0].gpio_wp = -EINVAL;
+   host-gpio_wp = gpio;
+   } else {
+   if (slot-gpiochip_wp) {
+   pr_warning(MMC %s write protect GPIO chip %s 
unavailable\n,
+   slot-name, slot-gpiochip_wp);
+   ret = -ENODEV;
+   goto err_free_wp;
+   }
+   host-gpio_wp = -EINVAL;
+   }

return 0;

  err_free_wp:
-   gpio_free(pdata-slots[0].gpio_wp);
+   if (gpio_is_valid(host-gpio_wp))
+   gpio_free(host-gpio_wp);
  err_free_cd:
-   if (gpio_is_valid(pdata-slots[0].switch_pin))
+   if (gpio_is_valid(host-gpio_cd))
  err_free_sp:
-   gpio_free(pdata-slots[0].switch_pin);
+   gpio_free(host-gpio_cd);
return ret;
  }

-static void omap_hsmmc_gpio_free(struct omap_mmc_platform_data *pdata)
+static void omap_hsmmc_gpio_free(struct omap_hsmmc_host *host)
  {

[PATCH 2/6] mmc: omap_hsmmc: Make the driver support hotpluggable devices

2012-02-24 Thread Rajendra Nayak
Make the hsmmc driver register the driver using platform_driver_register()
so it can support hotpluggable devices.

This is needed, for instance, in case of OMAP3, wherein some of the mmc
devices might get added and removed dynamically based on dependent modules
like twl4030-gpio.

Signed-off-by: Rajendra Nayak rna...@ti.com
Cc: Chris Ball c...@laptop.org
Cc: linux-mmc@vger.kernel.org
---
 drivers/mmc/host/omap_hsmmc.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index fd0c661..21b8afa 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1847,7 +1847,7 @@ static void omap_hsmmc_debugfs(struct mmc_host *mmc)
 
 #endif
 
-static int __init omap_hsmmc_probe(struct platform_device *pdev)
+static int omap_hsmmc_probe(struct platform_device *pdev)
 {
struct omap_mmc_platform_data *pdata = pdev-dev.platform_data;
struct mmc_host *mmc;
@@ -2264,6 +2264,7 @@ static struct dev_pm_ops omap_hsmmc_dev_pm_ops = {
 };
 
 static struct platform_driver omap_hsmmc_driver = {
+   .probe  = omap_hsmmc_probe,
.remove = omap_hsmmc_remove,
.driver = {
.name = DRIVER_NAME,
@@ -2275,7 +2276,7 @@ static struct platform_driver omap_hsmmc_driver = {
 static int __init omap_hsmmc_init(void)
 {
/* Register the MMC driver */
-   return platform_driver_probe(omap_hsmmc_driver, omap_hsmmc_probe);
+   return platform_driver_register(omap_hsmmc_driver);
 }
 
 static void __exit omap_hsmmc_cleanup(void)
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] mmc: omap_hsmmc: If probe fails, give out error messages

2012-02-24 Thread Rajendra Nayak
Giving out debug messages even in case of probe failure seems
not very useful. Make them error messages instead.

Signed-off-by: Rajendra Nayak rna...@ti.com
Cc: Chris Ball c...@laptop.org
Cc: linux-mmc@vger.kernel.org
---
 drivers/mmc/host/omap_hsmmc.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 21b8afa..653ffee 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2008,13 +2008,13 @@ static int omap_hsmmc_probe(struct platform_device 
*pdev)
ret = request_irq(host-irq, omap_hsmmc_irq, 0,
mmc_hostname(mmc), host);
if (ret) {
-   dev_dbg(mmc_dev(host-mmc), Unable to grab HSMMC IRQ\n);
+   dev_err(mmc_dev(host-mmc), Unable to grab HSMMC IRQ\n);
goto err_irq;
}
 
if (pdata-init != NULL) {
if (pdata-init(pdev-dev) != 0) {
-   dev_dbg(mmc_dev(host-mmc),
+   dev_err(mmc_dev(host-mmc),
Unable to configure MMC IRQs\n);
goto err_irq_cd_init;
}
@@ -2037,7 +2037,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
   IRQF_TRIGGER_RISING | 
IRQF_TRIGGER_FALLING,
   mmc_hostname(mmc), host);
if (ret) {
-   dev_dbg(mmc_dev(host-mmc),
+   dev_err(mmc_dev(host-mmc),
Unable to grab MMC CD IRQ\n);
goto err_irq_cd;
}
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/6] mmc: omap_hsmmc: Clean up use/abuse of pdev-id

2012-02-24 Thread Rajendra Nayak

Chris,

On Thursday 23 February 2012 04:56 PM, Rajendra Nayak wrote:

Re-sending as these patches did not make it to the lists due to
issues with my 'git send-email'

This series mainly cleans up all instances of hardcoding's in
the driver based on pdev-id. This is cleanup leading to the
DT adaptation of omap_hsmmc driver.

v2 mainly has some minor changes to get rid of a debug print
which was still using host-id and getting rid of 'id' field
entirely from omap_hsmmc_host struct.

The series is tested on OMAP4SDP, OMAP4panda, OMAP3beagle and OMAP2430SDP
boards.


This series is reviewed/tested and acked by Balaji and Venkat.
Care to pull this in for 3.4?

I have one other cleanup patch on top of this series to make all
remaining pr_* prints in the driver to dev_* [1].
It would be great if you could pick that up as well.

These patches are cleanups leading to the DT conversion of omap_hsmmc
driver.

regards,
Rajendra

[1] http://marc.info/?l=linux-mmcm=132999677405098w=3



regards,
Rajendra

Balaji T K (3):
   mmc: omap_hsmmc: use platform_get_resource_byname for tx/rx DMA
 channels
   mmc: omap_hsmmc: remove unused .set_sleep function
   mmc: omap_hsmmc: Use OMAP_HSMMC_SUPPORTS_DUAL_VOLT flag to remove
 host-id based hardcoding

Rajendra Nayak (3):
   mmc: omap_hsmmc: Get rid of omap_hsmmc_1_set_power function
   mmc: omap_hsmmc: Get rid of omap_hsmmc_4_set_power function
   mmc: omap_hsmmc: Don't expect MMC1 to always have vmmc supply

  arch/arm/plat-omap/include/plat/mmc.h |2 -
  drivers/mmc/host/omap_hsmmc.c |  175 +++--
  2 files changed, 16 insertions(+), 161 deletions(-)



--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/4] arm/dts: OMAP4: Add mmc controller nodes and board data

2012-02-24 Thread Rajendra Nayak

On Friday 24 February 2012 03:46 PM, T Krishnamoorthy, Balaji wrote:

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 29f4589..9204f60 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -25,6 +25,11 @@
serial1 =uart2;
serial2 =uart3;
serial3 =uart4;
+   mmc1 =mmc1;
+   mmc2 =mmc2;
+   mmc3 =mmc3;
+   mmc4 =mmc4;
+   mmc5 =mmc5;
};

cpus {
@@ -155,5 +160,31 @@
#size-cells =0;
ti,hwmods = i2c4;
};
+
+   mmc1: mmc@1 {
+   compatible = ti,omap4-hsmmc;
+   ti,hwmods = mmc1;
+   ti,dual-volt;
+   };
+
+   mmc2: mmc@2 {
+   compatible = ti,omap4-hsmmc;
+   ti,hwmods = mmc2;
+   };


Hi Rajendra,
Is there a way to control the device registration order,
eMMC connected to mmc2 needs to be registered as /dev/mmcblk0p ...
irrespective of whether SD card is mount or not on mmc1 card slot.
So that bootargs would not have to be modified when filesystem is on eMMC.


I don't know if we can, but even if we could, we take care of the same
bootargs working on two boards (say sdp and panda) *if* on sdp I have my
filesystem on eMMC and on panda I have it on external card.
What happens if I want to use my filesystem on both boards on external
card?




+
+   mmc3: mmc@3 {
+   compatible = ti,omap4-hsmmc;
+   ti,hwmods = mmc3;
+   };
+
+   mmc4: mmc@4 {
+   compatible = ti,omap4-hsmmc;
+   ti,hwmods = mmc4;
+   };
+
+   mmc5: mmc@5 {
+   compatible = ti,omap4-hsmmc;
+   ti,hwmods = mmc5;
+   };
};
  };
--
1.7.1



--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/4] mmc: omap_hsmmc: Convert hsmmc driver to use device tree

2012-02-24 Thread Rajendra Nayak

On Friday 24 February 2012 05:02 PM, T Krishnamoorthy, Balaji wrote:

On Thu, Feb 23, 2012 at 5:31 PM, Rajendra Nayakrna...@ti.com  wrote:

Define dt bindings for the ti-omap-hsmmc, and adapt
the driver to extract data (which was earlier passed as
platform_data) from device tree.

Signed-off-by: Rajendra Nayakrna...@ti.com
---
  .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |   31 +
  drivers/mmc/host/omap_hsmmc.c  |   68 
  2 files changed, 99 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt

diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
new file mode 100644
index 000..e4fa8f0
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -0,0 +1,31 @@
+* TI Highspeed MMC host controller for OMAP
+
+The Highspeed MMC Host Controller on TI OMAP family
+provides an interface for MMC, SD, and SDIO types of memory cards.
+
+Required properties:
+- compatible:
+ Should be ti,omap2-hsmmc, for OMAP2/3 controllers


omap_hsmmc is applicable for omap2430 and omap3.
omap2420 has non high speed controller mmci-omap - drivers/mmc/host/omap.c
May be omap3-hsmmc compatible with omap2430 ?


Agree. I think its best in that case for me to define a
compatible ti,omap2430-hsmmc for omap2430 and ti,omap3-hsmmc
for omap3. Though the IP blocks are same, I cant think of some
common compatible string without causing confusion.




+ Should be ti,omap4-hsmmc, for OMAP4 controllers
+- ti,hwmods: Must be mmcn, n is controller instance starting 1
+- reg : should contain hsmmc registers location and length
+
+Optional properties:
+ti,dual-volt: boolean, supports dual voltage cards
+supply-name-supply: phandle to the regulator device tree node
+supply-name examples are vmmc, vmmc_aux etc
+ti,bus-width: Number of data lines, default assumed is 1 if the property is 
missing.
+cd-gpios: GPIOs for card detection
+wp-gpios: GPIOs for write protection
+ti,non-removable: non-removable slot (like eMMC)
+
+Example:
+   mmc1: mmc@0x4809c000 {
+   compatible = ti,omap4-hsmmc;
+   reg =0x4809c000 0x400;
+   ti,hwmods = mmc1;
+   ti,dual-volt;
+   ti,bus-width =4;
+   vmmc-supply =vmmc; /* phandle to regulator node */
+   ti,non-removable;
+   };


--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/4] mmc: omap_hsmmc: Convert hsmmc driver to use device tree

2012-02-24 Thread Rajendra Nayak

On Friday 24 February 2012 06:21 PM, Cousson, Benoit wrote:

On 2/24/2012 12:35 PM, Rajendra Nayak wrote:

On Friday 24 February 2012 05:02 PM, T Krishnamoorthy, Balaji wrote:

On Thu, Feb 23, 2012 at 5:31 PM, Rajendra Nayakrna...@ti.com wrote:

Define dt bindings for the ti-omap-hsmmc, and adapt
the driver to extract data (which was earlier passed as
platform_data) from device tree.

Signed-off-by: Rajendra Nayakrna...@ti.com
---
.../devicetree/bindings/mmc/ti-omap-hsmmc.txt | 31 +
drivers/mmc/host/omap_hsmmc.c | 68 
2 files changed, 99 insertions(+), 0 deletions(-)
create mode 100644
Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt

diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
new file mode 100644
index 000..e4fa8f0
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -0,0 +1,31 @@
+* TI Highspeed MMC host controller for OMAP
+
+The Highspeed MMC Host Controller on TI OMAP family
+provides an interface for MMC, SD, and SDIO types of memory cards.
+
+Required properties:
+- compatible:
+ Should be ti,omap2-hsmmc, for OMAP2/3 controllers


omap_hsmmc is applicable for omap2430 and omap3.
omap2420 has non high speed controller mmci-omap -
drivers/mmc/host/omap.c
May be omap3-hsmmc compatible with omap2430 ?


Agree. I think its best in that case for me to define a
compatible ti,omap2430-hsmmc for omap2430 and ti,omap3-hsmmc
for omap3. Though the IP blocks are same, I cant think of some
common compatible string without causing confusion.


It depends, can we detect that using HW revision?


We don't need to. The driver does not do anything different for
2430 or omap3.


In that case, there is no need to differentiate again with compatible.


Thats perfectly fine. But what *common* compatible string would you
use?



Regards,
Benoit






+ Should be ti,omap4-hsmmc, for OMAP4 controllers
+- ti,hwmods: Must be mmcn, n is controller instance starting 1
+- reg : should contain hsmmc registers location and length
+
+Optional properties:
+ti,dual-volt: boolean, supports dual voltage cards
+supply-name-supply: phandle to the regulator device tree node
+supply-name examples are vmmc, vmmc_aux etc
+ti,bus-width: Number of data lines, default assumed is 1 if the
property is missing.
+cd-gpios: GPIOs for card detection
+wp-gpios: GPIOs for write protection
+ti,non-removable: non-removable slot (like eMMC)
+
+Example:
+ mmc1: mmc@0x4809c000 {
+ compatible = ti,omap4-hsmmc;
+ reg =0x4809c000 0x400;
+ ti,hwmods = mmc1;
+ ti,dual-volt;
+ ti,bus-width =4;
+ vmmc-supply =vmmc; /* phandle to regulator node */
+ ti,non-removable;
+ };


___
devicetree-discuss mailing list
devicetree-disc...@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss




--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/4] mmc: omap_hsmmc: Convert hsmmc driver to use device tree

2012-02-24 Thread Rajendra Nayak

On Friday 24 February 2012 06:32 PM, Cousson, Benoit wrote:

On 2/24/2012 1:58 PM, Rajendra Nayak wrote:

On Friday 24 February 2012 06:21 PM, Cousson, Benoit wrote:

On 2/24/2012 12:35 PM, Rajendra Nayak wrote:

On Friday 24 February 2012 05:02 PM, T Krishnamoorthy, Balaji wrote:

On Thu, Feb 23, 2012 at 5:31 PM, Rajendra Nayakrna...@ti.com wrote:

...

+Required properties:
+- compatible:
+ Should be ti,omap2-hsmmc, for OMAP2/3 controllers


omap_hsmmc is applicable for omap2430 and omap3.
omap2420 has non high speed controller mmci-omap -
drivers/mmc/host/omap.c
May be omap3-hsmmc compatible with omap2430 ?


Agree. I think its best in that case for me to define a
compatible ti,omap2430-hsmmc for omap2430 and ti,omap3-hsmmc
for omap3. Though the IP blocks are same, I cant think of some
common compatible string without causing confusion.


It depends, can we detect that using HW revision?


We don't need to. The driver does not do anything different for
2430 or omap3.


I was thinking of OMAP2420 vs OMAP2430. But I'm now wondering if we are
using the same driver for the non-HS controller?


No, we don't. there is a different driver for 2420.




In that case, there is no need to differentiate again with compatible.


Thats perfectly fine. But what *common* compatible string would you
use?


I think that ti,omap2-hsmmc is still fine, because OMAP2420 will have
ti,omap2-mmc and thus we can differentiate the 2 versions.

Does that make sense?


yup, that makes sense. So I don't need to change anything :-)



Regards,
Benoit


--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/6] mmc: omap_hsmmc: remove unused .set_sleep function

2012-02-23 Thread Rajendra Nayak
From: Balaji T K balaj...@ti.com

set_sleep seems to be unused in omap_hsmmc driver. so get rid of it.

Signed-off-by: Balaji T K balaj...@ti.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Tested-by: Venkatraman S svenk...@ti.com
---
 arch/arm/plat-omap/include/plat/mmc.h |2 -
 drivers/mmc/host/omap_hsmmc.c |   60 -
 2 files changed, 0 insertions(+), 62 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index f75946c..7a38750 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -137,8 +137,6 @@ struct omap_mmc_platform_data {
int (*set_power)(struct device *dev, int slot,
 int power_on, int vdd);
int (*get_ro)(struct device *dev, int slot);
-   int (*set_sleep)(struct device *dev, int slot, int sleep,
-int vdd, int cardsleep);
void (*remux)(struct device *dev, int slot, int power_on);
/* Call back before enabling / disabling regulators */
void (*before_set_reg)(struct device *dev, int slot,
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 2a660ab..9955aee 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -324,61 +324,6 @@ static int omap_hsmmc_4_set_power(struct device *dev, int 
slot, int power_on,
return 0;
 }
 
-static int omap_hsmmc_1_set_sleep(struct device *dev, int slot, int sleep,
- int vdd, int cardsleep)
-{
-   struct omap_hsmmc_host *host =
-   platform_get_drvdata(to_platform_device(dev));
-   int mode = sleep ? REGULATOR_MODE_STANDBY : REGULATOR_MODE_NORMAL;
-
-   return regulator_set_mode(host-vcc, mode);
-}
-
-static int omap_hsmmc_235_set_sleep(struct device *dev, int slot, int sleep,
-  int vdd, int cardsleep)
-{
-   struct omap_hsmmc_host *host =
-   platform_get_drvdata(to_platform_device(dev));
-   int err, mode;
-
-   /*
-* If we don't see a Vcc regulator, assume it's a fixed
-* voltage always-on regulator.
-*/
-   if (!host-vcc)
-   return 0;
-
-   mode = sleep ? REGULATOR_MODE_STANDBY : REGULATOR_MODE_NORMAL;
-
-   if (!host-vcc_aux)
-   return regulator_set_mode(host-vcc, mode);
-
-   if (cardsleep) {
-   /* VCC can be turned off if card is asleep */
-   if (sleep)
-   err = mmc_regulator_set_ocr(host-mmc, host-vcc, 0);
-   else
-   err = mmc_regulator_set_ocr(host-mmc, host-vcc, vdd);
-   } else
-   err = regulator_set_mode(host-vcc, mode);
-   if (err)
-   return err;
-
-   if (!mmc_slot(host).vcc_aux_disable_is_sleep)
-   return regulator_set_mode(host-vcc_aux, mode);
-
-   if (sleep)
-   return regulator_disable(host-vcc_aux);
-   else
-   return regulator_enable(host-vcc_aux);
-}
-
-static int omap_hsmmc_4_set_sleep(struct device *dev, int slot, int sleep,
-   int vdd, int cardsleep)
-{
-   return 0;
-}
-
 static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 {
struct regulator *reg;
@@ -389,18 +334,15 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host 
*host)
case OMAP_MMC1_DEVID:
/* On-chip level shifting via PBIAS0/PBIAS1 */
mmc_slot(host).set_power = omap_hsmmc_1_set_power;
-   mmc_slot(host).set_sleep = omap_hsmmc_1_set_sleep;
break;
case OMAP_MMC2_DEVID:
case OMAP_MMC3_DEVID:
case OMAP_MMC5_DEVID:
/* Off-chip level shifting, or none */
mmc_slot(host).set_power = omap_hsmmc_235_set_power;
-   mmc_slot(host).set_sleep = omap_hsmmc_235_set_sleep;
break;
case OMAP_MMC4_DEVID:
mmc_slot(host).set_power = omap_hsmmc_4_set_power;
-   mmc_slot(host).set_sleep = omap_hsmmc_4_set_sleep;
default:
pr_err(MMC%d configuration not supported!\n, host-id);
return -EINVAL;
@@ -462,7 +404,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 
 err:
mmc_slot(host).set_power = NULL;
-   mmc_slot(host).set_sleep = NULL;
return ret;
 }
 
@@ -471,7 +412,6 @@ static void omap_hsmmc_reg_put(struct omap_hsmmc_host *host)
regulator_put(host-vcc);
regulator_put(host-vcc_aux);
mmc_slot(host).set_power = NULL;
-   mmc_slot(host).set_sleep = NULL;
 }
 
 static inline int omap_hsmmc_have_reg(void)
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http

[PATCH v2 4/6] mmc: omap_hsmmc: Get rid of omap_hsmmc_1_set_power function

2012-02-23 Thread Rajendra Nayak
Use omap_hsmmc_235_set_poweri() (now renamed as omap_hsmmc_set_power())
for MMC1 instance as well and get rid of omap_hsmmc_1_set_power()
completely.
omap_hsmmc_235_set_power() seems to implemented as a superset of
omap_hsmmc_1_set_power() with additonal functionality implemented
based on additional checks and hence should just work for MMC1
as well.

Signed-off-by: Rajendra Nayak rna...@ti.com
Tested-by: Venkatraman S svenk...@ti.com
Tested-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   30 +++---
 1 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 91faf42..f98c599 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -241,28 +241,7 @@ static int omap_hsmmc_resume_cdirq(struct device *dev, int 
slot)
 
 #ifdef CONFIG_REGULATOR
 
-static int omap_hsmmc_1_set_power(struct device *dev, int slot, int power_on,
- int vdd)
-{
-   struct omap_hsmmc_host *host =
-   platform_get_drvdata(to_platform_device(dev));
-   int ret;
-
-   if (mmc_slot(host).before_set_reg)
-   mmc_slot(host).before_set_reg(dev, slot, power_on, vdd);
-
-   if (power_on)
-   ret = mmc_regulator_set_ocr(host-mmc, host-vcc, vdd);
-   else
-   ret = mmc_regulator_set_ocr(host-mmc, host-vcc, 0);
-
-   if (mmc_slot(host).after_set_reg)
-   mmc_slot(host).after_set_reg(dev, slot, power_on, vdd);
-
-   return ret;
-}
-
-static int omap_hsmmc_235_set_power(struct device *dev, int slot, int power_on,
+static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
   int vdd)
 {
struct omap_hsmmc_host *host =
@@ -332,14 +311,11 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host 
*host)
 
switch (host-id) {
case OMAP_MMC1_DEVID:
-   /* On-chip level shifting via PBIAS0/PBIAS1 */
-   mmc_slot(host).set_power = omap_hsmmc_1_set_power;
-   break;
case OMAP_MMC2_DEVID:
case OMAP_MMC3_DEVID:
case OMAP_MMC5_DEVID:
-   /* Off-chip level shifting, or none */
-   mmc_slot(host).set_power = omap_hsmmc_235_set_power;
+   /* On-chip level shifting via PBIAS0/PBIAS1 */
+   mmc_slot(host).set_power = omap_hsmmc_set_power;
break;
case OMAP_MMC4_DEVID:
mmc_slot(host).set_power = omap_hsmmc_4_set_power;
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/6] mmc: omap_hsmmc: Clean up use/abuse of pdev-id

2012-02-23 Thread Rajendra Nayak
Re-sending as these patches did not make it to the lists due to
issues with my 'git send-email'

This series mainly cleans up all instances of hardcoding's in
the driver based on pdev-id. This is cleanup leading to the
DT adaptation of omap_hsmmc driver.

v2 mainly has some minor changes to get rid of a debug print
which was still using host-id and getting rid of 'id' field
entirely from omap_hsmmc_host struct.

The series is tested on OMAP4SDP, OMAP4panda, OMAP3beagle and OMAP2430SDP
boards.

regards,
Rajendra

Balaji T K (3):
  mmc: omap_hsmmc: use platform_get_resource_byname for tx/rx DMA
channels
  mmc: omap_hsmmc: remove unused .set_sleep function
  mmc: omap_hsmmc: Use OMAP_HSMMC_SUPPORTS_DUAL_VOLT flag to remove
host-id based hardcoding

Rajendra Nayak (3):
  mmc: omap_hsmmc: Get rid of omap_hsmmc_1_set_power function
  mmc: omap_hsmmc: Get rid of omap_hsmmc_4_set_power function
  mmc: omap_hsmmc: Don't expect MMC1 to always have vmmc supply

 arch/arm/plat-omap/include/plat/mmc.h |2 -
 drivers/mmc/host/omap_hsmmc.c |  175 +++--
 2 files changed, 16 insertions(+), 161 deletions(-)

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 5/6] mmc: omap_hsmmc: Get rid of omap_hsmmc_4_set_power function

2012-02-23 Thread Rajendra Nayak
Now that omap_hsmmc_set_power() already has a check to return 0
if !host-vcc, it seems like it can be used even on MMC4 instead
of the dummy omap_hsmmc_4_set_power().

This also helps get rid of all the host-id based check to
populate the right function for on-chip/external level
shifting and use omap_hsmmc_set_power() for all MMC modules.

Signed-off-by: Rajendra Nayak rna...@ti.com
Tested-by: Venkatraman S svenk...@ti.com
Tested-by: Balaji T K balaj...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   21 +
 1 files changed, 1 insertions(+), 20 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index f98c599..17e264b 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -297,32 +297,13 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
return ret;
 }
 
-static int omap_hsmmc_4_set_power(struct device *dev, int slot, int power_on,
-   int vdd)
-{
-   return 0;
-}
-
 static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 {
struct regulator *reg;
int ret = 0;
int ocr_value = 0;
 
-   switch (host-id) {
-   case OMAP_MMC1_DEVID:
-   case OMAP_MMC2_DEVID:
-   case OMAP_MMC3_DEVID:
-   case OMAP_MMC5_DEVID:
-   /* On-chip level shifting via PBIAS0/PBIAS1 */
-   mmc_slot(host).set_power = omap_hsmmc_set_power;
-   break;
-   case OMAP_MMC4_DEVID:
-   mmc_slot(host).set_power = omap_hsmmc_4_set_power;
-   default:
-   pr_err(MMC%d configuration not supported!\n, host-id);
-   return -EINVAL;
-   }
+   mmc_slot(host).set_power = omap_hsmmc_set_power;
 
reg = regulator_get(host-dev, vmmc);
if (IS_ERR(reg)) {
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/6] mmc: omap_hsmmc: use platform_get_resource_byname for tx/rx DMA channels

2012-02-23 Thread Rajendra Nayak
From: Balaji T K balaj...@ti.com

Git rid of hardcoded tx/rx DMA channels based on pdev-id
and use platform_get_resource_byname() to retrieve them
instead.

Signed-off-by: Balaji T K balaj...@ti.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Tested-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   35 +++
 1 files changed, 11 insertions(+), 24 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index fd0c661..2a660ab 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1977,32 +1977,19 @@ static int __init omap_hsmmc_probe(struct 
platform_device *pdev)
 
omap_hsmmc_conf_bus_power(host);
 
-   /* Select DMA lines */
-   switch (host-id) {
-   case OMAP_MMC1_DEVID:
-   host-dma_line_tx = OMAP24XX_DMA_MMC1_TX;
-   host-dma_line_rx = OMAP24XX_DMA_MMC1_RX;
-   break;
-   case OMAP_MMC2_DEVID:
-   host-dma_line_tx = OMAP24XX_DMA_MMC2_TX;
-   host-dma_line_rx = OMAP24XX_DMA_MMC2_RX;
-   break;
-   case OMAP_MMC3_DEVID:
-   host-dma_line_tx = OMAP34XX_DMA_MMC3_TX;
-   host-dma_line_rx = OMAP34XX_DMA_MMC3_RX;
-   break;
-   case OMAP_MMC4_DEVID:
-   host-dma_line_tx = OMAP44XX_DMA_MMC4_TX;
-   host-dma_line_rx = OMAP44XX_DMA_MMC4_RX;
-   break;
-   case OMAP_MMC5_DEVID:
-   host-dma_line_tx = OMAP44XX_DMA_MMC5_TX;
-   host-dma_line_rx = OMAP44XX_DMA_MMC5_RX;
-   break;
-   default:
-   dev_err(mmc_dev(host-mmc), Invalid MMC id\n);
+   res = platform_get_resource_byname(pdev, IORESOURCE_DMA, tx);
+   if (!res) {
+   dev_err(mmc_dev(host-mmc), cannot get DMA TX channel\n);
+   goto err_irq;
+   }
+   host-dma_line_tx = res-start;
+
+   res = platform_get_resource_byname(pdev, IORESOURCE_DMA, rx);
+   if (!res) {
+   dev_err(mmc_dev(host-mmc), cannot get DMA RX channel\n);
goto err_irq;
}
+   host-dma_line_rx = res-start;
 
/* Request IRQ for MMC operations */
ret = request_irq(host-irq, omap_hsmmc_irq, 0,
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/6] mmc: omap_hsmmc: Use OMAP_HSMMC_SUPPORTS_DUAL_VOLT flag to remove host-id based hardcoding

2012-02-23 Thread Rajendra Nayak
From: Balaji T K balaj...@ti.com

Use OMAP_HSMMC_SUPPORTS_DUAL_VOLT flag instead of host-id
for identifying SD bus voltage capabilities.

Signed-off-by: Balaji T K balaj...@ti.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Tested-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9955aee..91faf42 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -650,7 +650,7 @@ static int omap_hsmmc_context_restore(struct 
omap_hsmmc_host *host)
OMAP_HSMMC_WRITE(host-base, SYSCONFIG,
OMAP_HSMMC_READ(host-base, SYSCONFIG) | AUTOIDLE);
 
-   if (host-id == OMAP_MMC1_DEVID) {
+   if (host-pdata-controller_flags  OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {
if (host-power_mode != MMC_POWER_OFF 
(1  ios-vdd) = MMC_VDD_23_24)
hctl = SDVS18;
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mmc: omap_hsmmc: convert all pr_* to dev_*

2012-02-23 Thread Rajendra Nayak
Convert all instances of pr_* prints within the driver
to instead use dev_* prints.

Reported-by: Russell King rmk+ker...@arm.linux.org.uk
Signed-off-by: Rajendra Nayak rna...@ti.com
---
Re-sending as this patch did not make it to the lists due to
issues with my 'git send-email'

 drivers/mmc/host/omap_hsmmc.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index e3eb9d4..35f6dc1 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -302,7 +302,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
mmc_slot(host).ocr_mask = ocr_value;
} else {
if (!(mmc_slot(host).ocr_mask  ocr_value)) {
-   pr_err(MMC ocrmask %x is not supported\n,
+   dev_err(host-dev, ocrmask %x is not 
supported\n,
mmc_slot(host).ocr_mask);
mmc_slot(host).ocr_mask = 0;
return -EINVAL;
@@ -1132,14 +1132,14 @@ static void omap_hsmmc_protect_card(struct 
omap_hsmmc_host *host)
host-reqs_blocked = 0;
if (mmc_slot(host).get_cover_state(host-dev, host-slot_id)) {
if (host-protect_card) {
-   pr_info(%s: cover is closed, 
+   dev_info(host-dev, %s: cover is closed, 
 card is now accessible\n,
 mmc_hostname(host-mmc));
host-protect_card = 0;
}
} else {
if (!host-protect_card) {
-   pr_info(%s: cover is open, 
+   dev_info(host-dev, %s: cover is open, 
 card is now inaccessible\n,
 mmc_hostname(host-mmc));
host-protect_card = 1;
@@ -1276,7 +1276,7 @@ static int omap_hsmmc_pre_dma_transfer(struct 
omap_hsmmc_host *host,
 
if (!next  data-host_cookie 
data-host_cookie != host-next_data.cookie) {
-   pr_warning([%s] invalid cookie: data-host_cookie %d
+   dev_warn(host-dev, [%s] invalid cookie: data-host_cookie %d
host-next_data.cookie %d\n,
   __func__, data-host_cookie, host-next_data.cookie);
data-host_cookie = 0;
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/7] mmc: omap_hsmmc: Make the driver support hotpluggable devices

2012-02-23 Thread Rajendra Nayak
Make the hsmmc driver register the driver using platform_driver_register()
so it can support hotpluggable devices.

This is needed, for instance, in case of OMAP3, wherein some of the mmc
devices might get added and removed dynamically based on dependent modules
like twl4030-gpio.

Signed-off-by: Rajendra Nayak rna...@ti.com
Cc: Chris Ball c...@laptop.org
Cc: linux-mmc@vger.kernel.org
---
 drivers/mmc/host/omap_hsmmc.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index fd0c661..21b8afa 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1847,7 +1847,7 @@ static void omap_hsmmc_debugfs(struct mmc_host *mmc)
 
 #endif
 
-static int __init omap_hsmmc_probe(struct platform_device *pdev)
+static int omap_hsmmc_probe(struct platform_device *pdev)
 {
struct omap_mmc_platform_data *pdata = pdev-dev.platform_data;
struct mmc_host *mmc;
@@ -2264,6 +2264,7 @@ static struct dev_pm_ops omap_hsmmc_dev_pm_ops = {
 };
 
 static struct platform_driver omap_hsmmc_driver = {
+   .probe  = omap_hsmmc_probe,
.remove = omap_hsmmc_remove,
.driver = {
.name = DRIVER_NAME,
@@ -2275,7 +2276,7 @@ static struct platform_driver omap_hsmmc_driver = {
 static int __init omap_hsmmc_init(void)
 {
/* Register the MMC driver */
-   return platform_driver_probe(omap_hsmmc_driver, omap_hsmmc_probe);
+   return platform_driver_register(omap_hsmmc_driver);
 }
 
 static void __exit omap_hsmmc_cleanup(void)
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 4/7] mmc: omap_hsmmc: If probe fails, give our error messages

2012-02-23 Thread Rajendra Nayak
Giving our debug messages even in case of probe failure seems
not very useful. Make them error messages instead.

Signed-off-by: Rajendra Nayak rna...@ti.com
Cc: Chris Ball c...@laptop.org
Cc: linux-mmc@vger.kernel.org
---
 drivers/mmc/host/omap_hsmmc.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 21b8afa..653ffee 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2008,13 +2008,13 @@ static int omap_hsmmc_probe(struct platform_device 
*pdev)
ret = request_irq(host-irq, omap_hsmmc_irq, 0,
mmc_hostname(mmc), host);
if (ret) {
-   dev_dbg(mmc_dev(host-mmc), Unable to grab HSMMC IRQ\n);
+   dev_err(mmc_dev(host-mmc), Unable to grab HSMMC IRQ\n);
goto err_irq;
}
 
if (pdata-init != NULL) {
if (pdata-init(pdev-dev) != 0) {
-   dev_dbg(mmc_dev(host-mmc),
+   dev_err(mmc_dev(host-mmc),
Unable to configure MMC IRQs\n);
goto err_irq_cd_init;
}
@@ -2037,7 +2037,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
   IRQF_TRIGGER_RISING | 
IRQF_TRIGGER_FALLING,
   mmc_hostname(mmc), host);
if (ret) {
-   dev_dbg(mmc_dev(host-mmc),
+   dev_err(mmc_dev(host-mmc),
Unable to grab MMC CD IRQ\n);
goto err_irq_cd;
}
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/4] omap hsmmc device tree support

2012-02-23 Thread Rajendra Nayak
This series adds device tree support for OMAP hsmmc
driver. The series is dependent on a couple other series,
to add TWL regulator DT support[1] and another to clean
the pdev-id usage within the hsmmc driver[2]

all patches including the dependent series can be
found here
git://gitorious.org/omap-pm/linux.git for-dt/regulator

The series is tested on omap4sdp (both external and emmc),
omap4panda amd omap3beagle boards.

Things to do:
-1- Card detect isn't functional and needs twl4030 gpio
to be DT converted.
-2- pbias cell programming is missing and needs an OMAP
control module driver.

[1] http://marc.info/?l=linux-omapm=132999699905180w=2
[2] http://marc.info/?l=linux-omapm=132999646604985w=2

Rajendra Nayak (4):
  mmc: omap_hsmmc: Convert hsmmc driver to use device tree
  mmc: omap_hsmmc: Avoid a regulator voltage change with dt
  arm/dts: OMAP4: Add mmc controller nodes and board data
  arm/dts: OMAP3: Add mmc controller nodes and board data

 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |   31 +++
 arch/arm/boot/dts/omap3-beagle.dts |6 ++
 arch/arm/boot/dts/omap3.dtsi   |   26 ++
 arch/arm/boot/dts/omap4-panda.dts  |   10 +++
 arch/arm/boot/dts/omap4-sdp.dts|   16 
 arch/arm/boot/dts/omap4.dtsi   |   31 +++
 drivers/mmc/host/omap_hsmmc.c  |   83 +++-
 7 files changed, 202 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/4] mmc: omap_hsmmc: Convert hsmmc driver to use device tree

2012-02-23 Thread Rajendra Nayak
Define dt bindings for the ti-omap-hsmmc, and adapt
the driver to extract data (which was earlier passed as
platform_data) from device tree.

Signed-off-by: Rajendra Nayak rna...@ti.com
---
 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |   31 +
 drivers/mmc/host/omap_hsmmc.c  |   68 
 2 files changed, 99 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt

diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
new file mode 100644
index 000..e4fa8f0
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -0,0 +1,31 @@
+* TI Highspeed MMC host controller for OMAP
+
+The Highspeed MMC Host Controller on TI OMAP family
+provides an interface for MMC, SD, and SDIO types of memory cards.
+
+Required properties:
+- compatible:
+ Should be ti,omap2-hsmmc, for OMAP2/3 controllers
+ Should be ti,omap4-hsmmc, for OMAP4 controllers
+- ti,hwmods: Must be mmcn, n is controller instance starting 1
+- reg : should contain hsmmc registers location and length
+
+Optional properties:
+ti,dual-volt: boolean, supports dual voltage cards
+supply-name-supply: phandle to the regulator device tree node
+supply-name examples are vmmc, vmmc_aux etc
+ti,bus-width: Number of data lines, default assumed is 1 if the property is 
missing.
+cd-gpios: GPIOs for card detection
+wp-gpios: GPIOs for write protection
+ti,non-removable: non-removable slot (like eMMC)
+
+Example:
+   mmc1: mmc@0x4809c000 {
+   compatible = ti,omap4-hsmmc;
+   reg = 0x4809c000 0x400;
+   ti,hwmods = mmc1;
+   ti,dual-volt;
+   ti,bus-width = 4;
+   vmmc-supply = vmmc; /* phandle to regulator node */
+   ti,non-removable;
+   };
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 35f6dc1..0c93d58 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -26,6 +26,9 @@
 #include linux/platform_device.h
 #include linux/timer.h
 #include linux/clk.h
+#include linux/of.h
+#include linux/of_gpio.h
+#include linux/of_device.h
 #include linux/mmc/host.h
 #include linux/mmc/core.h
 #include linux/mmc/mmc.h
@@ -1718,6 +1721,46 @@ static void omap_hsmmc_debugfs(struct mmc_host *mmc)
 
 #endif
 
+#ifdef CONFIG_OF
+static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
+{
+   struct omap_mmc_platform_data *pdata;
+   struct device_node *np = dev-of_node;
+   u32 bus_width;
+
+   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata)
+   return NULL; /* out of memory */
+
+   if (of_find_property(np, ti,dual-volt, NULL))
+   pdata-controller_flags |= OMAP_HSMMC_SUPPORTS_DUAL_VOLT;
+
+   /* This driver only supports 1 slot */
+   pdata-nr_slots = 1;
+   pdata-slots[0].switch_pin = of_get_named_gpio(np, cd-gpios, 0);
+   pdata-slots[0].gpio_wp = of_get_named_gpio(np, wp-gpios, 0);
+
+   if (of_find_property(np, ti,non-removable, NULL)) {
+   pdata-slots[0].nonremovable = true;
+   pdata-slots[0].no_regulator_off_init = true;
+   }
+   of_property_read_u32(np, ti,bus-width, bus_width);
+   if (bus_width == 4)
+   pdata-slots[0].caps |= MMC_CAP_4_BIT_DATA;
+   else if (bus_width == 8)
+   pdata-slots[0].caps |= MMC_CAP_8_BIT_DATA;
+   return pdata;
+}
+#else
+static inline struct omap_mmc_platform_data
+   *of_get_hsmmc_pdata(struct device *dev)
+{
+   return NULL;
+}
+#endif
+
+static const struct of_device_id omap_mmc_of_match[];
+
 static int __init omap_hsmmc_probe(struct platform_device *pdev)
 {
struct omap_mmc_platform_data *pdata = pdev-dev.platform_data;
@@ -1725,6 +1768,14 @@ static int __init omap_hsmmc_probe(struct 
platform_device *pdev)
struct omap_hsmmc_host *host = NULL;
struct resource *res;
int ret, irq;
+   const struct of_device_id *match;
+
+   match = of_match_device(omap_mmc_of_match, pdev-dev);
+   if (match) {
+   pdata = of_get_hsmmc_pdata(pdev-dev);
+   if (match-data)
+   pdata-reg_offset = *(u16 *)match-data;
+   }
 
if (pdata == NULL) {
dev_err(pdev-dev, Platform Data is missing\n);
@@ -2120,12 +2171,29 @@ static struct dev_pm_ops omap_hsmmc_dev_pm_ops = {
.runtime_resume = omap_hsmmc_runtime_resume,
 };
 
+#if defined(CONFIG_OF)
+static u16 omap4_reg_offset = 0x100;
+
+static const struct of_device_id omap_mmc_of_match[] = {
+   {
+   .compatible = ti,omap2-hsmmc,
+   },
+   {
+   .compatible = ti,omap4-hsmmc,
+   .data = omap4_reg_offset,
+   },
+   {},
+}
+MODULE_DEVICE_TABLE(of, omap_mmc_of_match);
+#endif
+
 static struct

[PATCH v2 4/4] arm/dts: OMAP3: Add mmc controller nodes and board data

2012-02-23 Thread Rajendra Nayak
Add omap mmc related device tree data for OMAP3.
Currenly limited to only omap3-beagle board.

Signed-off-by: Rajendra Nayak rna...@ti.com
---
 arch/arm/boot/dts/omap3-beagle.dts |6 ++
 arch/arm/boot/dts/omap3.dtsi   |   26 ++
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap3-beagle.dts 
b/arch/arm/boot/dts/omap3-beagle.dts
index 54556b1..c7b92e6 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -53,3 +53,9 @@
reg = 0x50;
};
 };
+
+mmc1 {
+   vmmc-supply = vmmc1;
+   vmmc_aux-supply = vsim;
+   ti,bus-width = 8;
+};
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index ca37ba5..598467c 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -113,5 +113,31 @@
#size-cells = 0;
ti,hwmods = i2c3;
};
+
+   mmc1: mmc@1 {
+   compatible = ti,omap2-hsmmc;
+   ti,hwmods = mmc1;
+   ti,dual-volt;
+   };
+
+   mmc2: mmc@2 {
+   compatible = ti,omap2-hsmmc;
+   ti,hwmods = mmc2;
+   };
+
+   mmc3: mmc@3 {
+   compatible = ti,omap2-hsmmc;
+   ti,hwmods = mmc3;
+   };
+
+   mmc4: mmc@4 {
+   compatible = ti,omap2-hsmmc;
+   ti,hwmods = mmc4;
+   };
+
+   mmc5: mmc@5 {
+   compatible = ti,omap2-hsmmc;
+   ti,hwmods = mmc5;
+   };
};
 };
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/4] mmc: omap_hsmmc: Avoid a regulator voltage change with dt

2012-02-23 Thread Rajendra Nayak
When booting with Device tree, the omap_hsmmc driver does not
program the pbias cell (inside OMAP control module) during
a regulator voltage change.
In case of non-dt boot, this is handled using callbacks
from within platform_data and implemented in machine code.
To be able to do this with device tree, without invoking
any machine code, a OMAP control module driver is needed
which is yet missing.

The pbias cell is used to provide a 1.8v or 3.0v reference
to the mmc/sd/sdio1 interface supporting both 1.8v and 3.0v
voltages.

Until a OMAP control module driver is available to handle this,
when booting with a device tree blob, never change the regulator
voltage which might then require a pbias cell re-program.
There are 2 instances where in the mmc regulator voltage can be
changed.
-1- when the regulator is turned OFF.
-2- when attempting a switch to 1.8v from 3.0v for dual volt cards

This patch avoids a voltage change in both cases when booting from
device tree, and hence compromises on power savings.
Once the OMAP control module driver is available and hsmmc driver
is modified to then do pbias programming even when booting
with device tree, these limitaions can be removed to achieve better
power savings.

Signed-off-by: Rajendra Nayak rna...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   15 ++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 0c93d58..dffde8d 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -245,6 +245,13 @@ static int omap_hsmmc_set_power(struct device *dev, int 
slot, int power_on,
 */
if (!host-vcc)
return 0;
+   /*
+* With DT, never turn OFF the regulator. This is because
+* the pbias cell programming support is still missing when
+* booting with Device tree
+*/
+   if (of_have_populated_dt()  !vdd)
+   return 0;
 
if (mmc_slot(host).before_set_reg)
mmc_slot(host).before_set_reg(dev, slot, power_on, vdd);
@@ -1537,7 +1544,13 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
 * of external transceiver; but they all handle 1.8V.
 */
if ((OMAP_HSMMC_READ(host-base, HCTL)  SDVSDET) 
-   (ios-vdd == DUAL_VOLT_OCR_BIT)) {
+   (ios-vdd == DUAL_VOLT_OCR_BIT) 
+   /*
+* With pbias cell programming missing, this
+* can't be allowed when booting with device
+* tree.
+*/
+   (!of_have_populated_dt())) {
/*
 * The mmc_select_voltage fn of the core does
 * not seem to set the power_mode to
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/4] arm/dts: OMAP4: Add mmc controller nodes and board data

2012-02-23 Thread Rajendra Nayak
Add omap mmc related device tree data for OMAP4.
Currenly limited to only omap4-panda and omap4-sdp
boards.

Signed-off-by: Rajendra Nayak rna...@ti.com
---
 arch/arm/boot/dts/omap4-panda.dts |   10 ++
 arch/arm/boot/dts/omap4-sdp.dts   |   16 
 arch/arm/boot/dts/omap4.dtsi  |   31 +++
 3 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-panda.dts 
b/arch/arm/boot/dts/omap4-panda.dts
index 29646dc..9fe51b9 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -52,3 +52,13 @@
 i2c4 {
clock-frequency = 40;
 };
+
+mmc1 {
+   vmmc-supply = vmmc;
+   ti,bus-width = 8;
+};
+
+mmc5 {
+   ti,non-removable;
+   ti,bus-width = 4;
+};
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 01db8b7..2fca7a3 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -70,3 +70,19 @@
reg = 0x1e;
};
 };
+
+mmc1 {
+   vmmc-supply = vmmc;
+   ti,bus-width = 8;
+};
+
+mmc2 {
+   vmmc-supply = vaux1;
+   ti,bus-width = 8;
+   ti,non-removable;
+};
+
+mmc5 {
+   ti,bus-width = 4;
+   ti,non-removable;
+};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 29f4589..9204f60 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -25,6 +25,11 @@
serial1 = uart2;
serial2 = uart3;
serial3 = uart4;
+   mmc1 = mmc1;
+   mmc2 = mmc2;
+   mmc3 = mmc3;
+   mmc4 = mmc4;
+   mmc5 = mmc5;
};
 
cpus {
@@ -155,5 +160,31 @@
#size-cells = 0;
ti,hwmods = i2c4;
};
+
+   mmc1: mmc@1 {
+   compatible = ti,omap4-hsmmc;
+   ti,hwmods = mmc1;
+   ti,dual-volt;
+   };
+
+   mmc2: mmc@2 {
+   compatible = ti,omap4-hsmmc;
+   ti,hwmods = mmc2;
+   };
+
+   mmc3: mmc@3 {
+   compatible = ti,omap4-hsmmc;
+   ti,hwmods = mmc3;
+   };
+
+   mmc4: mmc@4 {
+   compatible = ti,omap4-hsmmc;
+   ti,hwmods = mmc4;
+   };
+
+   mmc5: mmc@5 {
+   compatible = ti,omap4-hsmmc;
+   ti,hwmods = mmc5;
+   };
};
 };
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/4] omap hsmmc device tree support

2012-02-23 Thread Rajendra Nayak

On Thursday 23 February 2012 05:31 PM, Rajendra Nayak wrote:

This series adds device tree support for OMAP hsmmc
driver. The series is dependent on a couple other series,
to add TWL regulator DT support[1] and another to clean
the pdev-id usage within the hsmmc driver[2]

all patches including the dependent series can be
found here
git://gitorious.org/omap-pm/linux.git for-dt/regulator


sorry, the right branch is for-dt/mmc



The series is tested on omap4sdp (both external and emmc),
omap4panda amd omap3beagle boards.

Things to do:
-1- Card detect isn't functional and needs twl4030 gpio
to be DT converted.
-2- pbias cell programming is missing and needs an OMAP
control module driver.

[1] http://marc.info/?l=linux-omapm=132999699905180w=2
[2] http://marc.info/?l=linux-omapm=132999646604985w=2

Rajendra Nayak (4):
   mmc: omap_hsmmc: Convert hsmmc driver to use device tree
   mmc: omap_hsmmc: Avoid a regulator voltage change with dt
   arm/dts: OMAP4: Add mmc controller nodes and board data
   arm/dts: OMAP3: Add mmc controller nodes and board data

  .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |   31 +++
  arch/arm/boot/dts/omap3-beagle.dts |6 ++
  arch/arm/boot/dts/omap3.dtsi   |   26 ++
  arch/arm/boot/dts/omap4-panda.dts  |   10 +++
  arch/arm/boot/dts/omap4-sdp.dts|   16 
  arch/arm/boot/dts/omap4.dtsi   |   31 +++
  drivers/mmc/host/omap_hsmmc.c  |   83 +++-
  7 files changed, 202 insertions(+), 1 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt



--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/4] arm/dts: OMAP3: Add mmc controller nodes and board data

2012-02-23 Thread Rajendra Nayak

On Friday 24 February 2012 12:27 AM, Tony Lindgren wrote:

--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -113,5 +113,31 @@
#size-cells =0;
ti,hwmods = i2c3;
};
+
+   mmc1: mmc@1 {
+   compatible = ti,omap2-hsmmc;
+   ti,hwmods = mmc1;
+   ti,dual-volt;
+   };
+
+   mmc2: mmc@2 {
+   compatible = ti,omap2-hsmmc;
+   ti,hwmods = mmc2;
+   };
+
+   mmc3: mmc@3 {
+   compatible = ti,omap2-hsmmc;
+   ti,hwmods = mmc3;
+   };
+
+   mmc4: mmc@4 {
+   compatible = ti,omap2-hsmmc;
+   ti,hwmods = mmc4;
+   };
+
+   mmc5: mmc@5 {
+   compatible = ti,omap2-hsmmc;
+   ti,hwmods = mmc5;
+   };
};
  };


These all should all be ti,omap3-hsmmc I guess?


Well, I defined the binding such that both omap2 and omap3
can use the same compatible ti,omap2-hsmmc since there is
no difference in the way they are defined or handled. If thats
confusing, I can have separate compatibles.
Btw, I guess we do the same with a few other re-used IPs as well,
I just checked and mcpsi does the same.



Tony


--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/6] mmc: omap_hsmmc: Clean up use/abuse of pdev-id

2012-02-13 Thread Rajendra Nayak

On Friday 10 February 2012 06:57 PM, T Krishnamoorthy, Balaji wrote:

On Tue, Feb 7, 2012 at 3:32 PM, S, Venkatramansvenk...@ti.com  wrote:

  On Sat, Feb 4, 2012 at 8:21 PM, Rajendra Nayakrna...@ti.com  wrote:

  This series mainly cleans up all instances of hardcoding's in
  the driver based on pdev-id. This is cleanup leading to the
  DT adaptation of omap_hsmmc driver.

  Patches are based on 3.3-rc2 and can be found here
  git://gitorious.org/omap-pm/linux.git omap_hsmmc_cleanup

  Tested the patches on my omap4 boards (panda and SDP) but
  haven't tested yet on omap3/2 since I did'nt have boards
  handy. So any testing on any omap3/2 boards is really
  appreciated.

Tested this series on 2430SDP with FS on SD card


Thanks, will repost adding Tested-by from you and Venkat, also
getting rid of the one instance of host-id usage left in a
debug print.
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/6] mmc: omap_hsmmc: Clean up use/abuse of pdev-id

2012-02-07 Thread Rajendra Nayak

On Tuesday 07 February 2012 02:02 AM, S, Venkatraman wrote:

I gave it a spin on Beagleboard-XM (OMAP3630) with root filesystem
on the SD card, and checked again on 4430SDP.

Tested-by: Venkatraman Ssvenk...@ti.com


Great, thanks Venkat.
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] mmc: omap: adapt the hsmmc driver to device tree

2011-11-14 Thread Rajendra Nayak

On Tuesday 15 November 2011 03:00 AM, Tony Lindgren wrote:

* Rajendra Nayakrna...@ti.com  [04 04:16]:

@@ -1869,6 +1957,14 @@ static int __init omap_hsmmc_probe(struct 
platform_device *pdev)
struct omap_hsmmc_host *host = NULL;
struct resource *res;
int ret, irq;
+   const struct of_device_id *match;
+
+   match = of_match_device(omap_mmc_of_match,pdev-dev);
+   if (match) {
+   pdata = of_get_hsmmc_pdata(pdev-dev);
+   if (match-data)
+   pdata-reg_offset = *(u16 *)match-data;
+   }


So this is now using both DT and pdata?

We want to use DT only, and get rid of pdata. Other than the
deferred probe, is there some other dependency remaining to
having to use the pdata also?


We are using pdata today mainly for the platform function pointers
that get passed for MMC, which can never be passed from DT.

The  omap_mmc_platform_data structure today has '17' function pointers.
Most might be sparingly used, nevertheless, its an awfully large number.

Here's the list...
-
int (*switch_slot)(struct device *dev, int slot);
int (*init)(struct device *dev);
void (*cleanup)(struct device *dev);
void (*shutdown)(struct device *dev);
int (*suspend)(struct device *dev, int slot);
int (*resume)(struct device *dev, int slot);
int (*get_context_loss_count)(struct device *dev);

per-slot functions

int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
int (*set_power)(struct device *dev, int slot,
 int power_on, int vdd);
int (*get_ro)(struct device *dev, int slot);
int (*set_sleep)(struct device *dev, int slot, int sleep,
 int vdd, int cardsleep);
void (*remux)(struct device *dev, int slot, int power_on);
void (*before_set_reg)(struct device *dev, int slot,
   int power_on, int vdd);
void (*after_set_reg)(struct device *dev, int slot,
  int power_on, int vdd);
void (*init_card)(struct mmc_card *card);
int (*get_cover_state)(struct device *dev, int slot);
int (*card_detect)(struct device *dev, int slot);
-

regards,
Rajendra


Regards,

Tony

___
linux-arm-kernel mailing list
linux-arm-ker...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] mmc: Add additional binding for mmc host controller

2011-11-04 Thread Rajendra Nayak
Add mmc host controller capability binding to support
'MMC_CAP_POWER_OFF_CARD' powering off of the card after boot.

Signed-off-by: Rajendra Nayak rna...@ti.com
---
 .../devicetree/bindings/mmc/linux-mmc-host.txt |1 +
 drivers/mmc/core/host.c|2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/linux-mmc-host.txt 
b/Documentation/devicetree/bindings/mmc/linux-mmc-host.txt
index 714b2b1..cf893ed 100644
--- a/Documentation/devicetree/bindings/mmc/linux-mmc-host.txt
+++ b/Documentation/devicetree/bindings/mmc/linux-mmc-host.txt
@@ -11,3 +11,4 @@ specific mmc host controller capabilities.
 - linux,mmc_cap_disable - Host can be disabled and re-enabled to save power
 - linux,mmc_cap_nonremovable - Host is connected to nonremovable media
 - linux,mmc_cap_erase - Host allows erase/trim commands
+- linux,mmc_cap_power_off_card - Host can power off the card after boot
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 4ee2e43..822337a 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -413,6 +413,8 @@ void mmc_of_parse_host_caps(struct device_node *np, 
unsigned long *caps)
*caps |= MMC_CAP_NONREMOVABLE;
if (of_find_property(np, linux,mmc_cap_erase, NULL))
*caps |= MMC_CAP_ERASE;
+   if (of_find_property(np, linux,mmc_cap_power_off_card, NULL))
+   *caps |= MMC_CAP_POWER_OFF_CARD;
 }
 EXPORT_SYMBOL(mmc_of_parse_host_caps);
 #endif /* CONFIG_OF */
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/4] omap hsmmc device tree support

2011-11-04 Thread Rajendra Nayak
This series adds device tree support for omap hsmmc
driver. The series is currently based on my patch
series[1] to add dt support for twl-regulators, since
hsmmc requires regulators to work.
I have also pulled the patch from Thomas Abraham which
adds mmc host controller bindings[2]
'mmc: Add OF bindings support for mmc host controller capabilities'

The series currently adds supports for only omap4-panda and
omap4-sdp boards and uses auxdata to pass platform specific
function pointers to the driver.

All the dependent patches along with this series can be found here
git://gitorious.org/omap-pm/linux.git for-dt/regulator-i2c-twl-mmc

regards,
Rajendra

[1] 
http://lists.ozlabs.org/pipermail/devicetree-discuss/2011-October/009185.html
[2] 
http://lists.ozlabs.org/pipermail/devicetree-discuss/2011-November/009237.html

Rajendra Nayak (4):
  mmc: Add additional binding for mmc host controller
  mmc: omap: adapt the hsmmc driver to device tree
  omap4: mmc: Pass SoC and board data for omap4 mmc from dt
  omap4: mmc: use auxdata to pass platform function ptrs

 .../devicetree/bindings/mmc/linux-mmc-host.txt |1 +
 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |   50 
 arch/arm/boot/dts/omap4-panda.dts  |   23 
 arch/arm/boot/dts/omap4-sdp.dts|   33 +
 arch/arm/boot/dts/omap4.dtsi   |   46 +++
 arch/arm/mach-omap2/board-generic.c|   19 +++-
 arch/arm/mach-omap2/hsmmc.c|9 +-
 arch/arm/mach-omap2/hsmmc.h|5 +
 drivers/mmc/core/host.c|2 +
 drivers/mmc/host/omap_hsmmc.c  |  125 
 10 files changed, 307 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] omap4: mmc: use auxdata to pass platform function ptrs

2011-11-04 Thread Rajendra Nayak
mmc driver still relies on platform specific functions
being invoked from the driver by means of function pointers
being passed through platform_data structure.
use the auxdata for now to pass these the same way until
we find a way to get rid of these calls from the driver.

Signed-off-by: Rajendra Nayak rna...@ti.com
---
 arch/arm/mach-omap2/board-generic.c |   19 +--
 arch/arm/mach-omap2/hsmmc.c |9 +
 arch/arm/mach-omap2/hsmmc.h |5 +
 drivers/mmc/host/omap_hsmmc.c   |8 
 4 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-generic.c 
b/arch/arm/mach-omap2/board-generic.c
index 62c6b2e..af2fdd9 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -15,14 +15,29 @@
 #include linux/io.h
 #include linux/of_platform.h
 #include linux/irqdomain.h
+#include linux/i2c/twl.h
 
 #include mach/hardware.h
 #include asm/mach/arch.h
 
 #include plat/board.h
 #include plat/common.h
+#include plat/mmc.h
 #include mach/omap4-common.h
+#include hsmmc.h
+
+struct omap_mmc_platform_data omap4_mmc1_pdata = {
+   .init = twl6030_mmc_card_detect_config,
+   .slots[0] = {
+   .before_set_reg = omap4_hsmmc1_before_set_reg,
+   .after_set_reg = omap4_hsmmc1_after_set_reg,
+   },
+};
 
+struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
+   OF_DEV_AUXDATA(ti,omap-hsmmc0, 0x4809c000, omap_hsmmc.0, 
omap4_mmc1_pdata),
+   {}
+};
 
 static struct of_device_id omap_dt_match_table[] __initdata = {
{ .compatible = simple-bus, },
@@ -44,8 +59,8 @@ static void __init omap_generic_init(void)
 
omap_serial_init();
omap_sdrc_init(NULL, NULL);
-
-   of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
+   omap2_hsmmc_init(NULL);
+   of_platform_populate(NULL, omap_dt_match_table, omap_auxdata_lookup, 
NULL);
 }
 
 #if defined(CONFIG_SOC_OMAP2420)
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 7708584..dc698be 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -120,7 +120,7 @@ static void omap_hsmmc1_after_set_reg(struct device *dev, 
int slot,
}
 }
 
-static void omap4_hsmmc1_before_set_reg(struct device *dev, int slot,
+void omap4_hsmmc1_before_set_reg(struct device *dev, int slot,
  int power_on, int vdd)
 {
u32 reg;
@@ -141,7 +141,7 @@ static void omap4_hsmmc1_before_set_reg(struct device *dev, 
int slot,
omap4_ctrl_pad_writel(reg, control_pbias_offset);
 }
 
-static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
+void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
 int power_on, int vdd)
 {
u32 reg;
@@ -495,8 +495,9 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info 
*controllers)
omap4_ctrl_pad_writel(reg, control_mmc1);
}
 
-   for (; controllers-mmc; controllers++)
-   omap_init_hsmmc(controllers, controllers-mmc);
+   if (controllers)
+   for (; controllers-mmc; controllers++)
+   omap_init_hsmmc(controllers, controllers-mmc);
 
 }
 
diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h
index f757e78..543ab4d 100644
--- a/arch/arm/mach-omap2/hsmmc.h
+++ b/arch/arm/mach-omap2/hsmmc.h
@@ -34,6 +34,11 @@ struct omap2_hsmmc_info {
 #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
 
 void omap2_hsmmc_init(struct omap2_hsmmc_info *);
+extern void omap4_hsmmc1_before_set_reg(struct device *dev, int slot,
+   int power_on, int vdd);
+extern void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
+   int power_on, int vdd);
+
 
 #else
 
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 90b4a61..5fb5a95 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1953,6 +1953,7 @@ static const struct of_device_id omap_mmc_of_match[];
 static int __init omap_hsmmc_probe(struct platform_device *pdev)
 {
struct omap_mmc_platform_data *pdata = pdev-dev.platform_data;
+   struct omap_mmc_platform_data *aux_pdata = pdev-dev.platform_data;
struct mmc_host *mmc;
struct omap_hsmmc_host *host = NULL;
struct resource *res;
@@ -1964,6 +1965,13 @@ static int __init omap_hsmmc_probe(struct 
platform_device *pdev)
pdata = of_get_hsmmc_pdata(pdev-dev);
if (match-data)
pdata-reg_offset = *(u16 *)match-data;
+   if (aux_pdata) {
+   pdata-init = aux_pdata-init;
+   pdata-slots[0].before_set_reg =
+aux_pdata-slots[0].before_set_reg;
+   pdata-slots[0].after_set_reg =
+aux_pdata-slots[0

[PATCH 3/4] omap4: mmc: Pass SoC and board data for omap4 mmc from dt

2011-11-04 Thread Rajendra Nayak
Pass all omap4-hsmmc related data from device tree.
Currenly limited to only omap4-panda and omap4-sdp
boards.

Signed-off-by: Rajendra Nayak rna...@ti.com
---
 arch/arm/boot/dts/omap4-panda.dts |   23 ++
 arch/arm/boot/dts/omap4-sdp.dts   |   33 ++
 arch/arm/boot/dts/omap4.dtsi  |   46 +
 3 files changed, 102 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-panda.dts 
b/arch/arm/boot/dts/omap4-panda.dts
index 4c3069f..07c5433 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -105,3 +105,26 @@
 i2c4 {
clock-frequency = 40;
 };
+
+mmc1 {
+   ti,hsmmc-nr-slots = 1;
+   vmmc-supply = vmmc;
+   slot@1 {
+   linux,mmc_cap_4_bit_data;
+   linux,mmc_cap_8_bit_data;
+   ti,hsmmc-has-special-reset;
+   };
+};
+
+mmc5 {
+   ti,hsmmc-nr-slots = 1;
+   vmmc-supply = vwl1271;
+   slot@1 {
+   ti,hsmmc-slot-name = wl1271;
+   linux,mmc_cap_4_bit_data;
+   linux,mmc_cap_power_off_card;
+   ti,hsmmc-ocr-mask = 0x80;
+   ti,hsmmc-nonremovable;
+   ti,hsmmc-has-special-reset;
+   };
+};
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index adc7faf..d37d416 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -125,3 +125,36 @@
reg = 0x1e;
};
 };
+
+mmc1 {
+   ti,hsmmc-nr-slots = 1;
+   vmmc-supply = vmmc;
+   slots@1 {
+   linux,mmc_cap_4_bit_data;
+   linux,mmc_cap_8_bit_data;
+   ti,hsmmc-has-special-reset;
+   };
+};
+
+mmc2 {
+   ti,hsmmc-nr-slots = 1;
+   vmmc-supply = vaux1;
+   slots@1 {
+   linux,mmc_cap_4_bit_data;
+   linux,mmc_cap_8_bit_data;
+   ti,hsmmc-nonremovable;
+   ti,hsmmc-ocr-mask = 0x2;
+   ti,hsmmc-has-special-reset;
+   };
+};
+
+mmc5 {
+   ti,hsmmc-nr-slots = 1;
+   slots@1 {
+   linux,mmc_cap_4_bit_data;
+   linux,mmc_cap_power_off_card;
+   ti,hsmmc-nonremovable;
+   ti,hsmmc-ocr-mask = 0x80;
+   ti,hsmmc-has-special-reset;
+   };
+};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 447f482..f4e0540 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -25,6 +25,11 @@
i2c2 = i2c2;
i2c3 = i2c3;
i2c4 = i2c4;
+   mmc1 = mmc1;
+   mmc2 = mmc2;
+   mmc3 = mmc3;
+   mmc4 = mmc4;
+   mmc5 = mmc5;
};
 
cpus {
@@ -205,5 +210,46 @@
#size-cells = 0;
ti,hwmods = i2c4;
};
+
+   mmc1: mmc@0x4809c000 {
+   compatible = ti,omap-hsmmc0, ti,omap4-hsmmc;
+   reg = 0x4809c000 0x400;
+   ti,hwmods = mmc1;
+   ti,hsmmc-supports-dual-volt;
+   ti,hsmmc-dma-mask = 0x;
+   ti,hsmmc-has-pbias;
+   };
+
+   mmc2: mmc@0x480b4000 {
+   compatible = ti,omap-hsmmc1, ti,omap4-hsmmc;
+   reg = 0x480b4000 0x400;
+   ti,hwmods = mmc2;
+   ti,hsmmc-dma-mask = 0x;
+   ti,hsmmc-has-pbias;
+   };
+
+   mmc3: mmc@0x480ad000 {
+   compatible = ti,omap-hsmmc2, ti,omap4-hsmmc;
+   reg = 0x480ad000 0x400;
+   ti,hwmods = mmc3;
+   ti,hsmmc-dma-mask = 0x;
+   ti,hsmmc-has-pbias;
+   };
+
+   mmc4: mmc@0x480d1000 {
+   compatible = ti,omap-hsmmc3, ti,omap4-hsmmc;
+   reg = 0x480d1000 0x400;
+   ti,hwmods = mmc4;
+   ti,hsmmc-dma-mask = 0x;
+   ti,hsmmc-has-pbias;
+   };
+
+   mmc5: mmc@0x480d5000 {
+   compatible = ti,omap-hsmmc4, ti,omap4-hsmmc;
+   reg = 0x480d5000 0x400;
+   ti,hwmods = mmc5;
+   ti,hsmmc-dma-mask = 0x;
+   ti,hsmmc-has-pbias;
+   };
};
 };
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html