linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes
@ 2015-08-27  9:13 Kishon Vijay Abraham I
  2015-08-27  9:13 ` [PATCH v3 01/15] mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc Kishon Vijay Abraham I
                   ` (15 more replies)
  0 siblings, 16 replies; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:13 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

This patch series does the following
*) Uses devm_regulator_get_optional() for vmmc and then removes the
   CONFIG_REGULATOR check altogether.
*) return on -EPROBE_DEFER and any other fatal errors
*) enable/disable vmmc_aux regulator based on prior state

Changes from v2:
*) rebased to mmc -next branch
*) dropped using "mmc_of_parse_voltage" to get ocr_avail patch.

Changes from v1:
*) return on -EPROBE_DEFER and other fatal errors. (Don't return only
   if the return value is -ENODEV)
*) Remove the beagle x15 dts patch. It can be part of a different
   series.
*) Avoid using regulator_is_enabled for vqmmc since if the regulator
   is shared and the other users are not using regulator_is_enabled
   then there can be unbalanced regulator_enable/regulator_disable

I've pushed this patch series to
git://git.ti.com/linux-phy/linux-phy.git mmc_for-next

Please note the branch also has the pbias fixes [1].
[1] -> https://lkml.org/lkml/2015/7/27/358

This series is in preparation for implementing the voltage switch
sequence so that UHS cards can be supported.

Did basic read/write test in J6, J6 Eco, Beagle-x15, AM437x EVM,
Beaglebone black, OMAP5 uEVM, OMAP4 PANDA and OMAP3gle xm.

Kishon Vijay Abraham I (15):
  mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc
  mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
  mmc: host: omap_hsmmc: cleanup omap_hsmmc_reg_get()
  mmc: host: omap_hsmmc: use the ocrmask provided by the vmmc regulator
  mmc: host: omap_hsmmc: use mmc_host's vmmc and vqmmc
  mmc: host: omap_hsmmc: remove unnecessary pbias set_voltage
  mmc: host: omap_hsmmc: return error if any of the regulator APIs fail
  mmc: host: omap_hsmmc: add separate functions for enable/disable
    supply
  mmc: host: omap_hsmmc: add separate function to set pbias
  mmc: host: omap_hsmmc: avoid pbias regulator enable on power off
  mmc: host: omap_hsmmc: don't use ->set_power to set initial regulator
    state
  mmc: host: omap_hsmmc: enable/disable vmmc_aux regulator based on
    previous state
  mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
  mmc: host: omap_hsmmc: use ios->vdd for setting vmmc voltage
  mmc: host: omap_hsmmc: remove CONFIG_REGULATOR check

 drivers/mmc/host/omap_hsmmc.c |  326 +++++++++++++++++++++++++++--------------
 1 file changed, 212 insertions(+), 114 deletions(-)

-- 
1.7.9.5


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

* [PATCH v3 01/15] mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
@ 2015-08-27  9:13 ` Kishon Vijay Abraham I
  2015-08-27  9:13 ` [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get Kishon Vijay Abraham I
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:13 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

Since vmmc can be optional for some platforms, use
devm_regulator_get_optional() for vmmc. Now return error only
if the return value of devm_regulator_get_optional() is not the
same as -ENODEV, since with -EPROBE_DEFER, the regulator can be
obtained later and all other errors are fatal.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/omap_hsmmc.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 19ae7e6..9b335af 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -345,15 +345,19 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 {
 	struct regulator *reg;
 	int ocr_value = 0;
+	int ret;
 
 	if (mmc_pdata(host)->set_power)
 		return 0;
 
-	reg = devm_regulator_get(host->dev, "vmmc");
+	reg = devm_regulator_get_optional(host->dev, "vmmc");
 	if (IS_ERR(reg)) {
-		dev_err(host->dev, "unable to get vmmc regulator %ld\n",
+		ret = PTR_ERR(reg);
+		if (ret != -ENODEV)
+			return ret;
+		host->vcc = NULL;
+		dev_dbg(host->dev, "unable to get vmmc regulator %ld\n",
 			PTR_ERR(reg));
-		return PTR_ERR(reg);
 	} else {
 		host->vcc = reg;
 		ocr_value = mmc_regulator_get_ocrmask(reg);
-- 
1.7.9.5


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

* [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
  2015-08-27  9:13 ` [PATCH v3 01/15] mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc Kishon Vijay Abraham I
@ 2015-08-27  9:13 ` Kishon Vijay Abraham I
  2015-08-28 18:07   ` Olof Johansson
  2015-08-27  9:13 ` [PATCH v3 03/15] mmc: host: omap_hsmmc: cleanup omap_hsmmc_reg_get() Kishon Vijay Abraham I
                   ` (13 subsequent siblings)
  15 siblings, 1 reply; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:13 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

Now return error only if the return value of
devm_regulator_get_optional() is not the same as -ENODEV, since with
-EPROBE_DEFER, the regulator can be obtained later and all other
errors are fatal.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/omap_hsmmc.c |   22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9b335af..2eafd6f 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -375,10 +375,28 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 
 	/* Allow an aux regulator */
 	reg = devm_regulator_get_optional(host->dev, "vmmc_aux");
-	host->vcc_aux = IS_ERR(reg) ? NULL : reg;
+	if (IS_ERR(reg)) {
+		ret = PTR_ERR(reg);
+		if (ret != -ENODEV)
+			return ret;
+		host->vcc_aux = NULL;
+		dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n",
+			PTR_ERR(reg));
+	} else {
+		host->vcc_aux = reg;
+	}
 
 	reg = devm_regulator_get_optional(host->dev, "pbias");
-	host->pbias = IS_ERR(reg) ? NULL : reg;
+	if (IS_ERR(reg)) {
+		ret = PTR_ERR(reg);
+		if (ret != -ENODEV)
+			return ret;
+		host->pbias = NULL;
+		dev_dbg(host->dev, "unable to get pbias regulator %ld\n",
+			PTR_ERR(reg));
+	} else {
+		host->pbias = reg;
+	}
 
 	/* For eMMC do not power off when not in sleep state */
 	if (mmc_pdata(host)->no_regulator_off_init)
-- 
1.7.9.5


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

* [PATCH v3 03/15] mmc: host: omap_hsmmc: cleanup omap_hsmmc_reg_get()
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
  2015-08-27  9:13 ` [PATCH v3 01/15] mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc Kishon Vijay Abraham I
  2015-08-27  9:13 ` [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get Kishon Vijay Abraham I
@ 2015-08-27  9:13 ` Kishon Vijay Abraham I
  2015-08-27  9:13 ` [PATCH v3 04/15] mmc: host: omap_hsmmc: use the ocrmask provided by the vmmc regulator Kishon Vijay Abraham I
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:13 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

No functional change. Instead of using a local regulator variable
in omap_hsmmc_reg_get() for holding the return value of
devm_regulator_get_optional() and then assigning to omap_hsmmc_host
regulator members: vcc, vcc_aux and pbias, directly use the
omap_hsmmc_host regulator members.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/omap_hsmmc.c |   38 ++++++++++++++++----------------------
 1 file changed, 16 insertions(+), 22 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 2eafd6f..3fde2f9 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -343,24 +343,22 @@ error_set_power:
 
 static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 {
-	struct regulator *reg;
 	int ocr_value = 0;
 	int ret;
 
 	if (mmc_pdata(host)->set_power)
 		return 0;
 
-	reg = devm_regulator_get_optional(host->dev, "vmmc");
-	if (IS_ERR(reg)) {
-		ret = PTR_ERR(reg);
+	host->vcc = devm_regulator_get_optional(host->dev, "vmmc");
+	if (IS_ERR(host->vcc)) {
+		ret = PTR_ERR(host->vcc);
 		if (ret != -ENODEV)
 			return ret;
-		host->vcc = NULL;
 		dev_dbg(host->dev, "unable to get vmmc regulator %ld\n",
-			PTR_ERR(reg));
+			PTR_ERR(host->vcc));
+		host->vcc = NULL;
 	} else {
-		host->vcc = reg;
-		ocr_value = mmc_regulator_get_ocrmask(reg);
+		ocr_value = mmc_regulator_get_ocrmask(host->vcc);
 		if (!mmc_pdata(host)->ocr_mask) {
 			mmc_pdata(host)->ocr_mask = ocr_value;
 		} else {
@@ -374,28 +372,24 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 	}
 
 	/* Allow an aux regulator */
-	reg = devm_regulator_get_optional(host->dev, "vmmc_aux");
-	if (IS_ERR(reg)) {
-		ret = PTR_ERR(reg);
+	host->vcc_aux = devm_regulator_get_optional(host->dev, "vmmc_aux");
+	if (IS_ERR(host->vcc_aux)) {
+		ret = PTR_ERR(host->vcc_aux);
 		if (ret != -ENODEV)
 			return ret;
-		host->vcc_aux = NULL;
 		dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n",
-			PTR_ERR(reg));
-	} else {
-		host->vcc_aux = reg;
+			PTR_ERR(host->vcc_aux));
+		host->vcc_aux = NULL;
 	}
 
-	reg = devm_regulator_get_optional(host->dev, "pbias");
-	if (IS_ERR(reg)) {
-		ret = PTR_ERR(reg);
+	host->pbias = devm_regulator_get_optional(host->dev, "pbias");
+	if (IS_ERR(host->pbias)) {
+		ret = PTR_ERR(host->pbias);
 		if (ret != -ENODEV)
 			return ret;
-		host->pbias = NULL;
 		dev_dbg(host->dev, "unable to get pbias regulator %ld\n",
-			PTR_ERR(reg));
-	} else {
-		host->pbias = reg;
+			PTR_ERR(host->pbias));
+		host->pbias = NULL;
 	}
 
 	/* For eMMC do not power off when not in sleep state */
-- 
1.7.9.5


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

* [PATCH v3 04/15] mmc: host: omap_hsmmc: use the ocrmask provided by the vmmc regulator
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
                   ` (2 preceding siblings ...)
  2015-08-27  9:13 ` [PATCH v3 03/15] mmc: host: omap_hsmmc: cleanup omap_hsmmc_reg_get() Kishon Vijay Abraham I
@ 2015-08-27  9:13 ` Kishon Vijay Abraham I
  2015-08-27  9:13 ` [PATCH v3 05/15] mmc: host: omap_hsmmc: use mmc_host's vmmc and vqmmc Kishon Vijay Abraham I
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:13 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

If the vmmc regulator provides a valid ocrmask, use it. By this even if
the pdata has a valid ocrmask, it will be overwritten with the ocrmask
of the vmmc regulator.
Also remove the unnecessary compatibility check between the ocrmask in
the pdata and the ocrmask from the vmmc regulator.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/omap_hsmmc.c |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 3fde2f9..30f363d 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -359,16 +359,8 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 		host->vcc = NULL;
 	} else {
 		ocr_value = mmc_regulator_get_ocrmask(host->vcc);
-		if (!mmc_pdata(host)->ocr_mask) {
+		if (ocr_value > 0)
 			mmc_pdata(host)->ocr_mask = ocr_value;
-		} else {
-			if (!(mmc_pdata(host)->ocr_mask & ocr_value)) {
-				dev_err(host->dev, "ocrmask %x is not supported\n",
-					mmc_pdata(host)->ocr_mask);
-				mmc_pdata(host)->ocr_mask = 0;
-				return -EINVAL;
-			}
-		}
 	}
 
 	/* Allow an aux regulator */
-- 
1.7.9.5


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

* [PATCH v3 05/15] mmc: host: omap_hsmmc: use mmc_host's vmmc and vqmmc
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
                   ` (3 preceding siblings ...)
  2015-08-27  9:13 ` [PATCH v3 04/15] mmc: host: omap_hsmmc: use the ocrmask provided by the vmmc regulator Kishon Vijay Abraham I
@ 2015-08-27  9:13 ` Kishon Vijay Abraham I
  2015-08-27  9:13 ` [PATCH v3 06/15] mmc: host: omap_hsmmc: remove unnecessary pbias set_voltage Kishon Vijay Abraham I
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:13 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

No functional change. Instead of using omap_hsmmc_host's vcc and vcc_aux
members, use vmmc and vqmmc present in mmc_host which is present
for the same purpose.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/omap_hsmmc.c |   63 ++++++++++++++++++-----------------------
 1 file changed, 28 insertions(+), 35 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 30f363d..58e4ffd 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -181,15 +181,6 @@ struct omap_hsmmc_host {
 	struct	mmc_data	*data;
 	struct	clk		*fclk;
 	struct	clk		*dbclk;
-	/*
-	 * vcc == configured supply
-	 * vcc_aux == optional
-	 *   -	MMC1, supply for DAT4..DAT7
-	 *   -	MMC2/MMC2, external level shifter voltage supply, for
-	 *	chip (SDIO, eMMC, etc) or transceiver (MMC2 only)
-	 */
-	struct	regulator	*vcc;
-	struct	regulator	*vcc_aux;
 	struct	regulator	*pbias;
 	bool			pbias_enabled;
 	void	__iomem		*base;
@@ -259,6 +250,7 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
 {
 	struct omap_hsmmc_host *host =
 		platform_get_drvdata(to_platform_device(dev));
+	struct mmc_host *mmc = host->mmc;
 	int ret = 0;
 
 	if (mmc_pdata(host)->set_power)
@@ -268,7 +260,7 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
 	 * If we don't see a Vcc regulator, assume it's a fixed
 	 * voltage always-on regulator.
 	 */
-	if (!host->vcc)
+	if (!mmc->supply.vmmc)
 		return 0;
 
 	if (mmc_pdata(host)->before_set_reg)
@@ -297,23 +289,23 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
 	 * chips/cards need an interface voltage rail too.
 	 */
 	if (power_on) {
-		if (host->vcc)
-			ret = mmc_regulator_set_ocr(host->mmc, host->vcc, vdd);
+		if (mmc->supply.vmmc)
+			ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
 		/* Enable interface voltage rail, if needed */
-		if (ret == 0 && host->vcc_aux) {
-			ret = regulator_enable(host->vcc_aux);
-			if (ret < 0 && host->vcc)
-				ret = mmc_regulator_set_ocr(host->mmc,
-							host->vcc, 0);
+		if (ret == 0 && mmc->supply.vqmmc) {
+			ret = regulator_enable(mmc->supply.vqmmc);
+			if (ret < 0 && mmc->supply.vmmc)
+				ret = mmc_regulator_set_ocr(mmc,
+							    mmc->supply.vmmc,
+							    0);
 		}
 	} else {
 		/* Shut down the rail */
-		if (host->vcc_aux)
-			ret = regulator_disable(host->vcc_aux);
-		if (host->vcc) {
+		if (mmc->supply.vqmmc)
+			ret = regulator_disable(mmc->supply.vqmmc);
+		if (mmc->supply.vmmc) {
 			/* Then proceed to shut down the local regulator */
-			ret = mmc_regulator_set_ocr(host->mmc,
-						host->vcc, 0);
+			ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
 		}
 	}
 
@@ -345,33 +337,34 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 {
 	int ocr_value = 0;
 	int ret;
+	struct mmc_host *mmc = host->mmc;
 
 	if (mmc_pdata(host)->set_power)
 		return 0;
 
-	host->vcc = devm_regulator_get_optional(host->dev, "vmmc");
-	if (IS_ERR(host->vcc)) {
-		ret = PTR_ERR(host->vcc);
+	mmc->supply.vmmc = devm_regulator_get_optional(host->dev, "vmmc");
+	if (IS_ERR(mmc->supply.vmmc)) {
+		ret = PTR_ERR(mmc->supply.vmmc);
 		if (ret != -ENODEV)
 			return ret;
 		dev_dbg(host->dev, "unable to get vmmc regulator %ld\n",
-			PTR_ERR(host->vcc));
-		host->vcc = NULL;
+			PTR_ERR(mmc->supply.vmmc));
+		mmc->supply.vmmc = NULL;
 	} else {
-		ocr_value = mmc_regulator_get_ocrmask(host->vcc);
+		ocr_value = mmc_regulator_get_ocrmask(mmc->supply.vmmc);
 		if (ocr_value > 0)
 			mmc_pdata(host)->ocr_mask = ocr_value;
 	}
 
 	/* Allow an aux regulator */
-	host->vcc_aux = devm_regulator_get_optional(host->dev, "vmmc_aux");
-	if (IS_ERR(host->vcc_aux)) {
-		ret = PTR_ERR(host->vcc_aux);
+	mmc->supply.vqmmc = devm_regulator_get_optional(host->dev, "vmmc_aux");
+	if (IS_ERR(mmc->supply.vqmmc)) {
+		ret = PTR_ERR(mmc->supply.vqmmc);
 		if (ret != -ENODEV)
 			return ret;
 		dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n",
-			PTR_ERR(host->vcc_aux));
-		host->vcc_aux = NULL;
+			PTR_ERR(mmc->supply.vqmmc));
+		mmc->supply.vqmmc = NULL;
 	}
 
 	host->pbias = devm_regulator_get_optional(host->dev, "pbias");
@@ -391,8 +384,8 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 	 * To disable boot_on regulator, enable regulator
 	 * to increase usecount and then disable it.
 	 */
-	if ((host->vcc && regulator_is_enabled(host->vcc) > 0) ||
-	    (host->vcc_aux && regulator_is_enabled(host->vcc_aux))) {
+	if ((mmc->supply.vmmc && regulator_is_enabled(mmc->supply.vmmc) > 0) ||
+	    (mmc->supply.vqmmc && regulator_is_enabled(mmc->supply.vqmmc))) {
 		int vdd = ffs(mmc_pdata(host)->ocr_mask) - 1;
 
 		omap_hsmmc_set_power(host->dev, 1, vdd);
-- 
1.7.9.5


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

* [PATCH v3 06/15] mmc: host: omap_hsmmc: remove unnecessary pbias set_voltage
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
                   ` (4 preceding siblings ...)
  2015-08-27  9:13 ` [PATCH v3 05/15] mmc: host: omap_hsmmc: use mmc_host's vmmc and vqmmc Kishon Vijay Abraham I
@ 2015-08-27  9:13 ` Kishon Vijay Abraham I
  2015-08-27  9:13 ` [PATCH v3 07/15] mmc: host: omap_hsmmc: return error if any of the regulator APIs fail Kishon Vijay Abraham I
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:13 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

Remove the unnecessary pbias regulator_set_voltage done after
pbias regulator_disable in omap_hsmmc_set_power.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/omap_hsmmc.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 58e4ffd..c4c284e 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -272,7 +272,6 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
 			if (!ret)
 				host->pbias_enabled = 0;
 		}
-		regulator_set_voltage(host->pbias, VDD_3V0, VDD_3V0);
 	}
 
 	/*
-- 
1.7.9.5


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

* [PATCH v3 07/15] mmc: host: omap_hsmmc: return error if any of the regulator APIs fail
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
                   ` (5 preceding siblings ...)
  2015-08-27  9:13 ` [PATCH v3 06/15] mmc: host: omap_hsmmc: remove unnecessary pbias set_voltage Kishon Vijay Abraham I
@ 2015-08-27  9:13 ` Kishon Vijay Abraham I
  2015-08-27  9:14 ` [PATCH v3 08/15] mmc: host: omap_hsmmc: add separate functions for enable/disable supply Kishon Vijay Abraham I
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:13 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

Return error if any of the regulator APIs (regulator_enable,
regulator_disable, regulator_set_voltage) fails in
omap_hsmmc_set_power to avoid undefined behavior.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/omap_hsmmc.c |   52 +++++++++++++++++++++++++++++++----------
 1 file changed, 40 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index c4c284e..284ab00 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -269,8 +269,11 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
 	if (host->pbias) {
 		if (host->pbias_enabled == 1) {
 			ret = regulator_disable(host->pbias);
-			if (!ret)
-				host->pbias_enabled = 0;
+			if (ret) {
+				dev_err(dev, "pbias reg disable failed\n");
+				return ret;
+			}
+			host->pbias_enabled = 0;
 		}
 	}
 
@@ -288,23 +291,35 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
 	 * chips/cards need an interface voltage rail too.
 	 */
 	if (power_on) {
-		if (mmc->supply.vmmc)
+		if (mmc->supply.vmmc) {
 			ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
+			if (ret)
+				return ret;
+		}
+
 		/* Enable interface voltage rail, if needed */
-		if (ret == 0 && mmc->supply.vqmmc) {
+		if (mmc->supply.vqmmc) {
 			ret = regulator_enable(mmc->supply.vqmmc);
-			if (ret < 0 && mmc->supply.vmmc)
-				ret = mmc_regulator_set_ocr(mmc,
-							    mmc->supply.vmmc,
-							    0);
+			if (ret) {
+				dev_err(dev, "vmmc_aux reg enable failed\n");
+				goto err_set_vqmmc;
+			}
 		}
 	} else {
 		/* Shut down the rail */
-		if (mmc->supply.vqmmc)
+		if (mmc->supply.vqmmc) {
 			ret = regulator_disable(mmc->supply.vqmmc);
+			if (ret) {
+				dev_err(dev, "vmmc_aux reg disable failed\n");
+				return ret;
+			}
+		}
+
 		if (mmc->supply.vmmc) {
 			/* Then proceed to shut down the local regulator */
 			ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
+			if (ret)
+				return ret;
 		}
 	}
 
@@ -316,19 +331,32 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
 			ret = regulator_set_voltage(host->pbias, VDD_3V0,
 								VDD_3V0);
 		if (ret < 0)
-			goto error_set_power;
+			goto err_set_voltage;
 
 		if (host->pbias_enabled == 0) {
 			ret = regulator_enable(host->pbias);
-			if (!ret)
+			if (ret) {
+				dev_err(dev, "pbias reg enable failed\n");
+				goto err_set_voltage;
+			} else {
 				host->pbias_enabled = 1;
+			}
 		}
 	}
 
 	if (mmc_pdata(host)->after_set_reg)
 		mmc_pdata(host)->after_set_reg(dev, power_on, vdd);
 
-error_set_power:
+	return 0;
+
+err_set_voltage:
+	if (mmc->supply.vqmmc)
+		regulator_disable(mmc->supply.vqmmc);
+
+err_set_vqmmc:
+	if (mmc->supply.vmmc)
+		mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
+
 	return ret;
 }
 
-- 
1.7.9.5


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

* [PATCH v3 08/15] mmc: host: omap_hsmmc: add separate functions for enable/disable supply
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
                   ` (6 preceding siblings ...)
  2015-08-27  9:13 ` [PATCH v3 07/15] mmc: host: omap_hsmmc: return error if any of the regulator APIs fail Kishon Vijay Abraham I
@ 2015-08-27  9:14 ` Kishon Vijay Abraham I
  2015-08-27  9:14 ` [PATCH v3 09/15] mmc: host: omap_hsmmc: add separate function to set pbias Kishon Vijay Abraham I
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:14 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

No functional change. Cleanup omap_hsmmc_set_power by adding separate
functions for enable/disable supply and invoke it from
omap_hsmmc_set_power.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/omap_hsmmc.c |  101 +++++++++++++++++++++++++++--------------
 1 file changed, 66 insertions(+), 35 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 284ab00..3fa78d4 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -246,6 +246,65 @@ static int omap_hsmmc_get_cover_state(struct device *dev)
 
 #ifdef CONFIG_REGULATOR
 
+static int omap_hsmmc_enable_supply(struct mmc_host *mmc, int vdd)
+{
+	int ret;
+
+	if (mmc->supply.vmmc) {
+		ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
+		if (ret)
+			return ret;
+	}
+
+	/* Enable interface voltage rail, if needed */
+	if (mmc->supply.vqmmc) {
+		ret = regulator_enable(mmc->supply.vqmmc);
+		if (ret) {
+			dev_err(mmc_dev(mmc), "vmmc_aux reg enable failed\n");
+			goto err_vqmmc;
+		}
+	}
+
+	return 0;
+
+err_vqmmc:
+	if (mmc->supply.vmmc)
+		mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
+
+	return ret;
+}
+
+static int omap_hsmmc_disable_supply(struct mmc_host *mmc)
+{
+	int ret;
+	int status;
+
+	if (mmc->supply.vqmmc) {
+		ret = regulator_disable(mmc->supply.vqmmc);
+		if (ret) {
+			dev_err(mmc_dev(mmc), "vmmc_aux reg disable failed\n");
+			return ret;
+		}
+	}
+
+	if (mmc->supply.vmmc) {
+		ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
+		if (ret)
+			goto err_set_ocr;
+	}
+
+	return 0;
+
+err_set_ocr:
+	if (mmc->supply.vqmmc) {
+		status = regulator_enable(mmc->supply.vqmmc);
+		if (status)
+			dev_err(mmc_dev(mmc), "vmmc_aux re-enable failed\n");
+	}
+
+	return ret;
+}
+
 static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
 {
 	struct omap_hsmmc_host *host =
@@ -291,36 +350,13 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
 	 * chips/cards need an interface voltage rail too.
 	 */
 	if (power_on) {
-		if (mmc->supply.vmmc) {
-			ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
-			if (ret)
-				return ret;
-		}
-
-		/* Enable interface voltage rail, if needed */
-		if (mmc->supply.vqmmc) {
-			ret = regulator_enable(mmc->supply.vqmmc);
-			if (ret) {
-				dev_err(dev, "vmmc_aux reg enable failed\n");
-				goto err_set_vqmmc;
-			}
-		}
+		ret = omap_hsmmc_enable_supply(mmc, vdd);
+		if (ret)
+			return ret;
 	} else {
-		/* Shut down the rail */
-		if (mmc->supply.vqmmc) {
-			ret = regulator_disable(mmc->supply.vqmmc);
-			if (ret) {
-				dev_err(dev, "vmmc_aux reg disable failed\n");
-				return ret;
-			}
-		}
-
-		if (mmc->supply.vmmc) {
-			/* Then proceed to shut down the local regulator */
-			ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
-			if (ret)
-				return ret;
-		}
+		ret = omap_hsmmc_disable_supply(mmc);
+		if (ret)
+			return ret;
 	}
 
 	if (host->pbias) {
@@ -350,12 +386,7 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
 	return 0;
 
 err_set_voltage:
-	if (mmc->supply.vqmmc)
-		regulator_disable(mmc->supply.vqmmc);
-
-err_set_vqmmc:
-	if (mmc->supply.vmmc)
-		mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
+	omap_hsmmc_disable_supply(mmc);
 
 	return ret;
 }
-- 
1.7.9.5


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

* [PATCH v3 09/15] mmc: host: omap_hsmmc: add separate function to set pbias
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
                   ` (7 preceding siblings ...)
  2015-08-27  9:14 ` [PATCH v3 08/15] mmc: host: omap_hsmmc: add separate functions for enable/disable supply Kishon Vijay Abraham I
@ 2015-08-27  9:14 ` Kishon Vijay Abraham I
  2015-08-27  9:14 ` [PATCH v3 10/15] mmc: host: omap_hsmmc: avoid pbias regulator enable on power off Kishon Vijay Abraham I
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:14 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

No functional change. Cleanup omap_hsmmc_set_power by adding separate
functions to set pbias and invoke it from omap_hsmmc_set_power.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/omap_hsmmc.c |   78 +++++++++++++++++++++++++----------------
 1 file changed, 48 insertions(+), 30 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 3fa78d4..810d612 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -305,6 +305,48 @@ err_set_ocr:
 	return ret;
 }
 
+static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,
+				int vdd)
+{
+	int ret;
+
+	if (!host->pbias)
+		return 0;
+
+	if (power_on) {
+		if (vdd <= VDD_165_195)
+			ret = regulator_set_voltage(host->pbias, VDD_1V8,
+						    VDD_1V8);
+		else
+			ret = regulator_set_voltage(host->pbias, VDD_3V0,
+						    VDD_3V0);
+		if (ret < 0) {
+			dev_err(host->dev, "pbias set voltage fail\n");
+			return ret;
+		}
+
+		if (host->pbias_enabled == 0) {
+			ret = regulator_enable(host->pbias);
+			if (ret) {
+				dev_err(host->dev, "pbias reg enable fail\n");
+				return ret;
+			}
+			host->pbias_enabled = 1;
+		}
+	} else {
+		if (host->pbias_enabled == 1) {
+			ret = regulator_disable(host->pbias);
+			if (ret) {
+				dev_err(host->dev, "pbias reg disable fail\n");
+				return ret;
+			}
+			host->pbias_enabled = 0;
+		}
+	}
+
+	return 0;
+}
+
 static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
 {
 	struct omap_hsmmc_host *host =
@@ -325,16 +367,9 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
 	if (mmc_pdata(host)->before_set_reg)
 		mmc_pdata(host)->before_set_reg(dev, power_on, vdd);
 
-	if (host->pbias) {
-		if (host->pbias_enabled == 1) {
-			ret = regulator_disable(host->pbias);
-			if (ret) {
-				dev_err(dev, "pbias reg disable failed\n");
-				return ret;
-			}
-			host->pbias_enabled = 0;
-		}
-	}
+	ret = omap_hsmmc_set_pbias(host, false, 0);
+	if (ret)
+		return ret;
 
 	/*
 	 * Assume Vcc regulator is used only to power the card ... OMAP
@@ -359,26 +394,9 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
 			return ret;
 	}
 
-	if (host->pbias) {
-		if (vdd <= VDD_165_195)
-			ret = regulator_set_voltage(host->pbias, VDD_1V8,
-								VDD_1V8);
-		else
-			ret = regulator_set_voltage(host->pbias, VDD_3V0,
-								VDD_3V0);
-		if (ret < 0)
-			goto err_set_voltage;
-
-		if (host->pbias_enabled == 0) {
-			ret = regulator_enable(host->pbias);
-			if (ret) {
-				dev_err(dev, "pbias reg enable failed\n");
-				goto err_set_voltage;
-			} else {
-				host->pbias_enabled = 1;
-			}
-		}
-	}
+	ret = omap_hsmmc_set_pbias(host, true, vdd);
+	if (ret)
+		goto err_set_voltage;
 
 	if (mmc_pdata(host)->after_set_reg)
 		mmc_pdata(host)->after_set_reg(dev, power_on, vdd);
-- 
1.7.9.5


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

* [PATCH v3 10/15] mmc: host: omap_hsmmc: avoid pbias regulator enable on power off
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
                   ` (8 preceding siblings ...)
  2015-08-27  9:14 ` [PATCH v3 09/15] mmc: host: omap_hsmmc: add separate function to set pbias Kishon Vijay Abraham I
@ 2015-08-27  9:14 ` Kishon Vijay Abraham I
  2015-08-27  9:14 ` [PATCH v3 11/15] mmc: host: omap_hsmmc: don't use ->set_power to set initial regulator state Kishon Vijay Abraham I
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:14 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

Fix omap_hsmmc_set_power so that pbias regulator is not enabled
during power off.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/omap_hsmmc.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 810d612..eec6975 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -388,16 +388,16 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
 		ret = omap_hsmmc_enable_supply(mmc, vdd);
 		if (ret)
 			return ret;
+
+		ret = omap_hsmmc_set_pbias(host, true, vdd);
+		if (ret)
+			goto err_set_voltage;
 	} else {
 		ret = omap_hsmmc_disable_supply(mmc);
 		if (ret)
 			return ret;
 	}
 
-	ret = omap_hsmmc_set_pbias(host, true, vdd);
-	if (ret)
-		goto err_set_voltage;
-
 	if (mmc_pdata(host)->after_set_reg)
 		mmc_pdata(host)->after_set_reg(dev, power_on, vdd);
 
-- 
1.7.9.5


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

* [PATCH v3 11/15] mmc: host: omap_hsmmc: don't use ->set_power to set initial regulator state
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
                   ` (9 preceding siblings ...)
  2015-08-27  9:14 ` [PATCH v3 10/15] mmc: host: omap_hsmmc: avoid pbias regulator enable on power off Kishon Vijay Abraham I
@ 2015-08-27  9:14 ` Kishon Vijay Abraham I
  2015-08-27  9:14 ` [PATCH v3 12/15] mmc: host: omap_hsmmc: enable/disable vmmc_aux regulator based on previous state Kishon Vijay Abraham I
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:14 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

If the regulator is enabled on boot (checked using regulator_is_enabled),
invoke regulator_enable() so that the usecount reflects the correct
state of the regulator and then disable the regulator so that the
initial state of the regulator is disabled. Avoid using ->set_power,
since set_power also takes care of setting the voltages which is not
needed at this point.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/omap_hsmmc.c |   66 ++++++++++++++++++++++++++++++++++-------
 1 file changed, 56 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index eec6975..cd4bd6d 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -409,6 +409,59 @@ err_set_voltage:
 	return ret;
 }
 
+static int omap_hsmmc_disable_boot_regulator(struct regulator *reg)
+{
+	int ret;
+
+	if (!reg)
+		return 0;
+
+	if (regulator_is_enabled(reg)) {
+		ret = regulator_enable(reg);
+		if (ret)
+			return ret;
+
+		ret = regulator_disable(reg);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
+static int omap_hsmmc_disable_boot_regulators(struct omap_hsmmc_host *host)
+{
+	struct mmc_host *mmc = host->mmc;
+	int ret;
+
+	/*
+	 * disable regulators enabled during boot and get the usecount
+	 * right so that regulators can be enabled/disabled by checking
+	 * the return value of regulator_is_enabled
+	 */
+	ret = omap_hsmmc_disable_boot_regulator(mmc->supply.vmmc);
+	if (ret) {
+		dev_err(host->dev, "fail to disable boot enabled vmmc reg\n");
+		return ret;
+	}
+
+	ret = omap_hsmmc_disable_boot_regulator(mmc->supply.vqmmc);
+	if (ret) {
+		dev_err(host->dev,
+			"fail to disable boot enabled vmmc_aux reg\n");
+		return ret;
+	}
+
+	ret = omap_hsmmc_disable_boot_regulator(host->pbias);
+	if (ret) {
+		dev_err(host->dev,
+			"failed to disable boot enabled pbias reg\n");
+		return ret;
+	}
+
+	return 0;
+}
+
 static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 {
 	int ocr_value = 0;
@@ -456,17 +509,10 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 	/* For eMMC do not power off when not in sleep state */
 	if (mmc_pdata(host)->no_regulator_off_init)
 		return 0;
-	/*
-	 * To disable boot_on regulator, enable regulator
-	 * to increase usecount and then disable it.
-	 */
-	if ((mmc->supply.vmmc && regulator_is_enabled(mmc->supply.vmmc) > 0) ||
-	    (mmc->supply.vqmmc && regulator_is_enabled(mmc->supply.vqmmc))) {
-		int vdd = ffs(mmc_pdata(host)->ocr_mask) - 1;
 
-		omap_hsmmc_set_power(host->dev, 1, vdd);
-		omap_hsmmc_set_power(host->dev, 0, 0);
-	}
+	ret = omap_hsmmc_disable_boot_regulators(host);
+	if (ret)
+		return ret;
 
 	return 0;
 }
-- 
1.7.9.5


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

* [PATCH v3 12/15] mmc: host: omap_hsmmc: enable/disable vmmc_aux regulator based on previous state
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
                   ` (10 preceding siblings ...)
  2015-08-27  9:14 ` [PATCH v3 11/15] mmc: host: omap_hsmmc: don't use ->set_power to set initial regulator state Kishon Vijay Abraham I
@ 2015-08-27  9:14 ` Kishon Vijay Abraham I
  2015-08-27  9:14 ` [PATCH v3 13/15] mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status Kishon Vijay Abraham I
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:14 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

enable vmmc_aux regulator only if it is in disabled state and disable
vmmc_aux regulator only if it is in enabled state.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/omap_hsmmc.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index cd4bd6d..5a5946a 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -184,6 +184,7 @@ struct omap_hsmmc_host {
 	struct	regulator	*pbias;
 	bool			pbias_enabled;
 	void	__iomem		*base;
+	int			vqmmc_enabled;
 	resource_size_t		mapbase;
 	spinlock_t		irq_lock; /* Prevent races with irq handler */
 	unsigned int		dma_len;
@@ -249,6 +250,7 @@ static int omap_hsmmc_get_cover_state(struct device *dev)
 static int omap_hsmmc_enable_supply(struct mmc_host *mmc, int vdd)
 {
 	int ret;
+	struct omap_hsmmc_host *host = mmc_priv(mmc);
 
 	if (mmc->supply.vmmc) {
 		ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
@@ -257,12 +259,13 @@ static int omap_hsmmc_enable_supply(struct mmc_host *mmc, int vdd)
 	}
 
 	/* Enable interface voltage rail, if needed */
-	if (mmc->supply.vqmmc) {
+	if (mmc->supply.vqmmc && !host->vqmmc_enabled) {
 		ret = regulator_enable(mmc->supply.vqmmc);
 		if (ret) {
 			dev_err(mmc_dev(mmc), "vmmc_aux reg enable failed\n");
 			goto err_vqmmc;
 		}
+		host->vqmmc_enabled = 1;
 	}
 
 	return 0;
@@ -278,13 +281,15 @@ static int omap_hsmmc_disable_supply(struct mmc_host *mmc)
 {
 	int ret;
 	int status;
+	struct omap_hsmmc_host *host = mmc_priv(mmc);
 
-	if (mmc->supply.vqmmc) {
+	if (mmc->supply.vqmmc && host->vqmmc_enabled) {
 		ret = regulator_disable(mmc->supply.vqmmc);
 		if (ret) {
 			dev_err(mmc_dev(mmc), "vmmc_aux reg disable failed\n");
 			return ret;
 		}
+		host->vqmmc_enabled = 0;
 	}
 
 	if (mmc->supply.vmmc) {
@@ -2077,6 +2082,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 	host->power_mode = MMC_POWER_OFF;
 	host->next_data.cookie = 1;
 	host->pbias_enabled = 0;
+	host->vqmmc_enabled = 0;
 
 	ret = omap_hsmmc_gpio_init(mmc, host, pdata);
 	if (ret)
-- 
1.7.9.5


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

* [PATCH v3 13/15] mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
                   ` (11 preceding siblings ...)
  2015-08-27  9:14 ` [PATCH v3 12/15] mmc: host: omap_hsmmc: enable/disable vmmc_aux regulator based on previous state Kishon Vijay Abraham I
@ 2015-08-27  9:14 ` Kishon Vijay Abraham I
  2015-08-27 12:41   ` Ulf Hansson
  2015-08-27  9:14 ` [PATCH v3 14/15] mmc: host: omap_hsmmc: use ios->vdd for setting vmmc voltage Kishon Vijay Abraham I
                   ` (2 subsequent siblings)
  15 siblings, 1 reply; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:14 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

Use regulator_is_enabled of pbias regulator to find pbias regulator
status instead of maintaining a custom bookkeeping
pbias_enabled variable.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/omap_hsmmc.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 5a5946a..4cd7a58 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -182,7 +182,6 @@ struct omap_hsmmc_host {
 	struct	clk		*fclk;
 	struct	clk		*dbclk;
 	struct	regulator	*pbias;
-	bool			pbias_enabled;
 	void	__iomem		*base;
 	int			vqmmc_enabled;
 	resource_size_t		mapbase;
@@ -330,22 +329,20 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,
 			return ret;
 		}
 
-		if (host->pbias_enabled == 0) {
+		if (!regulator_is_enabled(host->pbias)) {
 			ret = regulator_enable(host->pbias);
 			if (ret) {
 				dev_err(host->dev, "pbias reg enable fail\n");
 				return ret;
 			}
-			host->pbias_enabled = 1;
 		}
 	} else {
-		if (host->pbias_enabled == 1) {
+		if (regulator_is_enabled(host->pbias)) {
 			ret = regulator_disable(host->pbias);
 			if (ret) {
 				dev_err(host->dev, "pbias reg disable fail\n");
 				return ret;
 			}
-			host->pbias_enabled = 0;
 		}
 	}
 
@@ -2081,7 +2078,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 	host->base	= base + pdata->reg_offset;
 	host->power_mode = MMC_POWER_OFF;
 	host->next_data.cookie = 1;
-	host->pbias_enabled = 0;
 	host->vqmmc_enabled = 0;
 
 	ret = omap_hsmmc_gpio_init(mmc, host, pdata);
-- 
1.7.9.5


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

* [PATCH v3 14/15] mmc: host: omap_hsmmc: use ios->vdd for setting vmmc voltage
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
                   ` (12 preceding siblings ...)
  2015-08-27  9:14 ` [PATCH v3 13/15] mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status Kishon Vijay Abraham I
@ 2015-08-27  9:14 ` Kishon Vijay Abraham I
  2015-08-27  9:14 ` [PATCH v3 15/15] mmc: host: omap_hsmmc: remove CONFIG_REGULATOR check Kishon Vijay Abraham I
  2015-08-27 13:09 ` [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Ulf Hansson
  15 siblings, 0 replies; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:14 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

vdd voltage is set in mmc core to ios->vdd and vmmc should actually
be set to this voltage. Modify omap_hsmmc_enable_supply
to not take vdd as argument since now it's directly set to
the voltage in ios->vdd.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/omap_hsmmc.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 4cd7a58..58683b3 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -246,13 +246,14 @@ static int omap_hsmmc_get_cover_state(struct device *dev)
 
 #ifdef CONFIG_REGULATOR
 
-static int omap_hsmmc_enable_supply(struct mmc_host *mmc, int vdd)
+static int omap_hsmmc_enable_supply(struct mmc_host *mmc)
 {
 	int ret;
 	struct omap_hsmmc_host *host = mmc_priv(mmc);
+	struct mmc_ios *ios = &mmc->ios;
 
 	if (mmc->supply.vmmc) {
-		ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
+		ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
 		if (ret)
 			return ret;
 	}
@@ -387,7 +388,7 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
 	 * chips/cards need an interface voltage rail too.
 	 */
 	if (power_on) {
-		ret = omap_hsmmc_enable_supply(mmc, vdd);
+		ret = omap_hsmmc_enable_supply(mmc);
 		if (ret)
 			return ret;
 
-- 
1.7.9.5


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

* [PATCH v3 15/15] mmc: host: omap_hsmmc: remove CONFIG_REGULATOR check
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
                   ` (13 preceding siblings ...)
  2015-08-27  9:14 ` [PATCH v3 14/15] mmc: host: omap_hsmmc: use ios->vdd for setting vmmc voltage Kishon Vijay Abraham I
@ 2015-08-27  9:14 ` Kishon Vijay Abraham I
  2015-08-27 13:09 ` [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Ulf Hansson
  15 siblings, 0 replies; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27  9:14 UTC (permalink / raw)
  To: ulf.hansson, afenkart, tony, linux-mmc, linux-omap, linux-kernel,
	nsekhar
  Cc: neilb, kishon

Now that support for platforms which have optional regulator is added,
remove CONFIG_REGULATOR check in omap_hsmmc.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/omap_hsmmc.c |   34 +++-------------------------------
 1 file changed, 3 insertions(+), 31 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 58683b3..781e4db3 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -244,8 +244,6 @@ static int omap_hsmmc_get_cover_state(struct device *dev)
 	return mmc_gpio_get_cd(host->mmc);
 }
 
-#ifdef CONFIG_REGULATOR
-
 static int omap_hsmmc_enable_supply(struct mmc_host *mmc)
 {
 	int ret;
@@ -520,30 +518,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 	return 0;
 }
 
-static inline int omap_hsmmc_have_reg(void)
-{
-	return 1;
-}
-
-#else
-
-static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
-{
-	return 0;
-}
-
-static inline int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
-{
-	return -EINVAL;
-}
-
-static inline int omap_hsmmc_have_reg(void)
-{
-	return 0;
-}
-
-#endif
-
 static irqreturn_t omap_hsmmc_cover_irq(int irq, void *dev_id);
 
 static int omap_hsmmc_gpio_init(struct mmc_host *mmc,
@@ -2204,11 +2178,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 		goto err_irq;
 	}
 
-	if (omap_hsmmc_have_reg()) {
-		ret = omap_hsmmc_reg_get(host);
-		if (ret)
-			goto err_irq;
-	}
+	ret = omap_hsmmc_reg_get(host);
+	if (ret)
+		goto err_irq;
 
 	mmc->ocr_avail = mmc_pdata(host)->ocr_mask;
 
-- 
1.7.9.5


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

* Re: [PATCH v3 13/15] mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
  2015-08-27  9:14 ` [PATCH v3 13/15] mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status Kishon Vijay Abraham I
@ 2015-08-27 12:41   ` Ulf Hansson
  2015-08-27 12:42     ` Ulf Hansson
  0 siblings, 1 reply; 33+ messages in thread
From: Ulf Hansson @ 2015-08-27 12:41 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Andreas Fenkart, Tony Lindgren, linux-mmc, linux-omap,
	linux-kernel, Sekhar Nori, Neil Brown

On 27 August 2015 at 11:14, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> Use regulator_is_enabled of pbias regulator to find pbias regulator
> status instead of maintaining a custom bookkeeping
> pbias_enabled variable.

Doesn't this cause a problem for the scenario when the initial state
of the regulator is enabled?

Both in the sense that you will increase the enable count for it
(potentially it may then become disabled when you need it enabled) but
also from a enable/disable imbalance point of view.

Kind regards
Uffe

>
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> Tested-by: Tony Lindgren <tony@atomide.com>
> ---
>  drivers/mmc/host/omap_hsmmc.c |    8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 5a5946a..4cd7a58 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -182,7 +182,6 @@ struct omap_hsmmc_host {
>         struct  clk             *fclk;
>         struct  clk             *dbclk;
>         struct  regulator       *pbias;
> -       bool                    pbias_enabled;
>         void    __iomem         *base;
>         int                     vqmmc_enabled;
>         resource_size_t         mapbase;
> @@ -330,22 +329,20 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,
>                         return ret;
>                 }
>
> -               if (host->pbias_enabled == 0) {
> +               if (!regulator_is_enabled(host->pbias)) {
>                         ret = regulator_enable(host->pbias);
>                         if (ret) {
>                                 dev_err(host->dev, "pbias reg enable fail\n");
>                                 return ret;
>                         }
> -                       host->pbias_enabled = 1;
>                 }
>         } else {
> -               if (host->pbias_enabled == 1) {
> +               if (regulator_is_enabled(host->pbias)) {
>                         ret = regulator_disable(host->pbias);
>                         if (ret) {
>                                 dev_err(host->dev, "pbias reg disable fail\n");
>                                 return ret;
>                         }
> -                       host->pbias_enabled = 0;
>                 }
>         }
>
> @@ -2081,7 +2078,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
>         host->base      = base + pdata->reg_offset;
>         host->power_mode = MMC_POWER_OFF;
>         host->next_data.cookie = 1;
> -       host->pbias_enabled = 0;
>         host->vqmmc_enabled = 0;
>
>         ret = omap_hsmmc_gpio_init(mmc, host, pdata);
> --
> 1.7.9.5
>

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

* Re: [PATCH v3 13/15] mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
  2015-08-27 12:41   ` Ulf Hansson
@ 2015-08-27 12:42     ` Ulf Hansson
  2015-08-27 12:47       ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 33+ messages in thread
From: Ulf Hansson @ 2015-08-27 12:42 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Andreas Fenkart, Tony Lindgren, linux-mmc, linux-omap,
	linux-kernel, Sekhar Nori, Neil Brown

On 27 August 2015 at 14:41, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 27 August 2015 at 11:14, Kishon Vijay Abraham I <kishon@ti.com> wrote:
>> Use regulator_is_enabled of pbias regulator to find pbias regulator
>> status instead of maintaining a custom bookkeeping
>> pbias_enabled variable.
>
> Doesn't this cause a problem for the scenario when the initial state
> of the regulator is enabled?
>
> Both in the sense that you will increase the enable count for it

/s/will/won't

> (potentially it may then become disabled when you need it enabled) but
> also from a enable/disable imbalance point of view.
>
> Kind regards
> Uffe
>
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> Tested-by: Tony Lindgren <tony@atomide.com>
>> ---
>>  drivers/mmc/host/omap_hsmmc.c |    8 ++------
>>  1 file changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>> index 5a5946a..4cd7a58 100644
>> --- a/drivers/mmc/host/omap_hsmmc.c
>> +++ b/drivers/mmc/host/omap_hsmmc.c
>> @@ -182,7 +182,6 @@ struct omap_hsmmc_host {
>>         struct  clk             *fclk;
>>         struct  clk             *dbclk;
>>         struct  regulator       *pbias;
>> -       bool                    pbias_enabled;
>>         void    __iomem         *base;
>>         int                     vqmmc_enabled;
>>         resource_size_t         mapbase;
>> @@ -330,22 +329,20 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,
>>                         return ret;
>>                 }
>>
>> -               if (host->pbias_enabled == 0) {
>> +               if (!regulator_is_enabled(host->pbias)) {
>>                         ret = regulator_enable(host->pbias);
>>                         if (ret) {
>>                                 dev_err(host->dev, "pbias reg enable fail\n");
>>                                 return ret;
>>                         }
>> -                       host->pbias_enabled = 1;
>>                 }
>>         } else {
>> -               if (host->pbias_enabled == 1) {
>> +               if (regulator_is_enabled(host->pbias)) {
>>                         ret = regulator_disable(host->pbias);
>>                         if (ret) {
>>                                 dev_err(host->dev, "pbias reg disable fail\n");
>>                                 return ret;
>>                         }
>> -                       host->pbias_enabled = 0;
>>                 }
>>         }
>>
>> @@ -2081,7 +2078,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
>>         host->base      = base + pdata->reg_offset;
>>         host->power_mode = MMC_POWER_OFF;
>>         host->next_data.cookie = 1;
>> -       host->pbias_enabled = 0;
>>         host->vqmmc_enabled = 0;
>>
>>         ret = omap_hsmmc_gpio_init(mmc, host, pdata);
>> --
>> 1.7.9.5
>>

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

* Re: [PATCH v3 13/15] mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
  2015-08-27 12:42     ` Ulf Hansson
@ 2015-08-27 12:47       ` Kishon Vijay Abraham I
  2015-08-27 12:49         ` Ulf Hansson
  0 siblings, 1 reply; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27 12:47 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Andreas Fenkart, Tony Lindgren, linux-mmc, linux-omap,
	linux-kernel, Sekhar Nori, Neil Brown

Hi Uffe,

On Thursday 27 August 2015 06:12 PM, Ulf Hansson wrote:
> On 27 August 2015 at 14:41, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>> On 27 August 2015 at 11:14, Kishon Vijay Abraham I <kishon@ti.com> wrote:
>>> Use regulator_is_enabled of pbias regulator to find pbias regulator
>>> status instead of maintaining a custom bookkeeping
>>> pbias_enabled variable.
>>
>> Doesn't this cause a problem for the scenario when the initial state
>> of the regulator is enabled?

Patch 11 of this series "mmc: host: omap_hsmmc: don't use ->set_power to
set initial regulator state" disables the pbias regulator if the initial
state of the regulator is enabled.

Thanks
Kishon
>>
>> Both in the sense that you will increase the enable count for it
> 
> /s/will/won't
> 
>> (potentially it may then become disabled when you need it enabled) but
>> also from a enable/disable imbalance point of view.
>>
>> Kind regards
>> Uffe
>>
>>>
>>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>>> Tested-by: Tony Lindgren <tony@atomide.com>
>>> ---
>>>  drivers/mmc/host/omap_hsmmc.c |    8 ++------
>>>  1 file changed, 2 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>>> index 5a5946a..4cd7a58 100644
>>> --- a/drivers/mmc/host/omap_hsmmc.c
>>> +++ b/drivers/mmc/host/omap_hsmmc.c
>>> @@ -182,7 +182,6 @@ struct omap_hsmmc_host {
>>>         struct  clk             *fclk;
>>>         struct  clk             *dbclk;
>>>         struct  regulator       *pbias;
>>> -       bool                    pbias_enabled;
>>>         void    __iomem         *base;
>>>         int                     vqmmc_enabled;
>>>         resource_size_t         mapbase;
>>> @@ -330,22 +329,20 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,
>>>                         return ret;
>>>                 }
>>>
>>> -               if (host->pbias_enabled == 0) {
>>> +               if (!regulator_is_enabled(host->pbias)) {
>>>                         ret = regulator_enable(host->pbias);
>>>                         if (ret) {
>>>                                 dev_err(host->dev, "pbias reg enable fail\n");
>>>                                 return ret;
>>>                         }
>>> -                       host->pbias_enabled = 1;
>>>                 }
>>>         } else {
>>> -               if (host->pbias_enabled == 1) {
>>> +               if (regulator_is_enabled(host->pbias)) {
>>>                         ret = regulator_disable(host->pbias);
>>>                         if (ret) {
>>>                                 dev_err(host->dev, "pbias reg disable fail\n");
>>>                                 return ret;
>>>                         }
>>> -                       host->pbias_enabled = 0;
>>>                 }
>>>         }
>>>
>>> @@ -2081,7 +2078,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
>>>         host->base      = base + pdata->reg_offset;
>>>         host->power_mode = MMC_POWER_OFF;
>>>         host->next_data.cookie = 1;
>>> -       host->pbias_enabled = 0;
>>>         host->vqmmc_enabled = 0;
>>>
>>>         ret = omap_hsmmc_gpio_init(mmc, host, pdata);
>>> --
>>> 1.7.9.5
>>>

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

* Re: [PATCH v3 13/15] mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
  2015-08-27 12:47       ` Kishon Vijay Abraham I
@ 2015-08-27 12:49         ` Ulf Hansson
  0 siblings, 0 replies; 33+ messages in thread
From: Ulf Hansson @ 2015-08-27 12:49 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Andreas Fenkart, Tony Lindgren, linux-mmc, linux-omap,
	linux-kernel, Sekhar Nori, Neil Brown

On 27 August 2015 at 14:47, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> Hi Uffe,
>
> On Thursday 27 August 2015 06:12 PM, Ulf Hansson wrote:
>> On 27 August 2015 at 14:41, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>>> On 27 August 2015 at 11:14, Kishon Vijay Abraham I <kishon@ti.com> wrote:
>>>> Use regulator_is_enabled of pbias regulator to find pbias regulator
>>>> status instead of maintaining a custom bookkeeping
>>>> pbias_enabled variable.
>>>
>>> Doesn't this cause a problem for the scenario when the initial state
>>> of the regulator is enabled?
>
> Patch 11 of this series "mmc: host: omap_hsmmc: don't use ->set_power to
> set initial regulator state" disables the pbias regulator if the initial
> state of the regulator is enabled.
>

Got it, thanks!

[...]

Kind regards
Uffe

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

* Re: [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes
  2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
                   ` (14 preceding siblings ...)
  2015-08-27  9:14 ` [PATCH v3 15/15] mmc: host: omap_hsmmc: remove CONFIG_REGULATOR check Kishon Vijay Abraham I
@ 2015-08-27 13:09 ` Ulf Hansson
  2015-08-27 13:20   ` Kishon Vijay Abraham I
  15 siblings, 1 reply; 33+ messages in thread
From: Ulf Hansson @ 2015-08-27 13:09 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Andreas Fenkart, Tony Lindgren, linux-mmc, linux-omap,
	linux-kernel, Sekhar Nori, Neil Brown

On 27 August 2015 at 11:13, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> This patch series does the following
> *) Uses devm_regulator_get_optional() for vmmc and then removes the
>    CONFIG_REGULATOR check altogether.
> *) return on -EPROBE_DEFER and any other fatal errors
> *) enable/disable vmmc_aux regulator based on prior state
>
> Changes from v2:
> *) rebased to mmc -next branch
> *) dropped using "mmc_of_parse_voltage" to get ocr_avail patch.
>
> Changes from v1:
> *) return on -EPROBE_DEFER and other fatal errors. (Don't return only
>    if the return value is -ENODEV)
> *) Remove the beagle x15 dts patch. It can be part of a different
>    series.
> *) Avoid using regulator_is_enabled for vqmmc since if the regulator
>    is shared and the other users are not using regulator_is_enabled
>    then there can be unbalanced regulator_enable/regulator_disable
>
> I've pushed this patch series to
> git://git.ti.com/linux-phy/linux-phy.git mmc_for-next
>
> Please note the branch also has the pbias fixes [1].
> [1] -> https://lkml.org/lkml/2015/7/27/358
>
> This series is in preparation for implementing the voltage switch
> sequence so that UHS cards can be supported.
>
> Did basic read/write test in J6, J6 Eco, Beagle-x15, AM437x EVM,
> Beaglebone black, OMAP5 uEVM, OMAP4 PANDA and OMAP3gle xm.
>
> Kishon Vijay Abraham I (15):
>   mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc
>   mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
>   mmc: host: omap_hsmmc: cleanup omap_hsmmc_reg_get()
>   mmc: host: omap_hsmmc: use the ocrmask provided by the vmmc regulator
>   mmc: host: omap_hsmmc: use mmc_host's vmmc and vqmmc
>   mmc: host: omap_hsmmc: remove unnecessary pbias set_voltage
>   mmc: host: omap_hsmmc: return error if any of the regulator APIs fail
>   mmc: host: omap_hsmmc: add separate functions for enable/disable
>     supply
>   mmc: host: omap_hsmmc: add separate function to set pbias
>   mmc: host: omap_hsmmc: avoid pbias regulator enable on power off
>   mmc: host: omap_hsmmc: don't use ->set_power to set initial regulator
>     state
>   mmc: host: omap_hsmmc: enable/disable vmmc_aux regulator based on
>     previous state
>   mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
>   mmc: host: omap_hsmmc: use ios->vdd for setting vmmc voltage
>   mmc: host: omap_hsmmc: remove CONFIG_REGULATOR check
>
>  drivers/mmc/host/omap_hsmmc.c |  326 +++++++++++++++++++++++++++--------------
>  1 file changed, 212 insertions(+), 114 deletions(-)
>
> --
> 1.7.9.5
>

Thanks, applied for next!

Kind regards
Uffe

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

* Re: [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes
  2015-08-27 13:09 ` [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Ulf Hansson
@ 2015-08-27 13:20   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-27 13:20 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Andreas Fenkart, Tony Lindgren, linux-mmc, linux-omap,
	linux-kernel, Sekhar Nori, Neil Brown



On Thursday 27 August 2015 06:39 PM, Ulf Hansson wrote:
> On 27 August 2015 at 11:13, Kishon Vijay Abraham I <kishon@ti.com> wrote:
>> This patch series does the following
>> *) Uses devm_regulator_get_optional() for vmmc and then removes the
>>    CONFIG_REGULATOR check altogether.
>> *) return on -EPROBE_DEFER and any other fatal errors
>> *) enable/disable vmmc_aux regulator based on prior state
>>
>> Changes from v2:
>> *) rebased to mmc -next branch
>> *) dropped using "mmc_of_parse_voltage" to get ocr_avail patch.
>>
>> Changes from v1:
>> *) return on -EPROBE_DEFER and other fatal errors. (Don't return only
>>    if the return value is -ENODEV)
>> *) Remove the beagle x15 dts patch. It can be part of a different
>>    series.
>> *) Avoid using regulator_is_enabled for vqmmc since if the regulator
>>    is shared and the other users are not using regulator_is_enabled
>>    then there can be unbalanced regulator_enable/regulator_disable
>>
>> I've pushed this patch series to
>> git://git.ti.com/linux-phy/linux-phy.git mmc_for-next
>>
>> Please note the branch also has the pbias fixes [1].
>> [1] -> https://lkml.org/lkml/2015/7/27/358
>>
>> This series is in preparation for implementing the voltage switch
>> sequence so that UHS cards can be supported.
>>
>> Did basic read/write test in J6, J6 Eco, Beagle-x15, AM437x EVM,
>> Beaglebone black, OMAP5 uEVM, OMAP4 PANDA and OMAP3gle xm.
>>
>> Kishon Vijay Abraham I (15):
>>   mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc
>>   mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
>>   mmc: host: omap_hsmmc: cleanup omap_hsmmc_reg_get()
>>   mmc: host: omap_hsmmc: use the ocrmask provided by the vmmc regulator
>>   mmc: host: omap_hsmmc: use mmc_host's vmmc and vqmmc
>>   mmc: host: omap_hsmmc: remove unnecessary pbias set_voltage
>>   mmc: host: omap_hsmmc: return error if any of the regulator APIs fail
>>   mmc: host: omap_hsmmc: add separate functions for enable/disable
>>     supply
>>   mmc: host: omap_hsmmc: add separate function to set pbias
>>   mmc: host: omap_hsmmc: avoid pbias regulator enable on power off
>>   mmc: host: omap_hsmmc: don't use ->set_power to set initial regulator
>>     state
>>   mmc: host: omap_hsmmc: enable/disable vmmc_aux regulator based on
>>     previous state
>>   mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
>>   mmc: host: omap_hsmmc: use ios->vdd for setting vmmc voltage
>>   mmc: host: omap_hsmmc: remove CONFIG_REGULATOR check
>>
>>  drivers/mmc/host/omap_hsmmc.c |  326 +++++++++++++++++++++++++++--------------
>>  1 file changed, 212 insertions(+), 114 deletions(-)
>>
>> --
>> 1.7.9.5
>>
> 
> Thanks, applied for next!

Thank you.

-Kishon

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

* Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
  2015-08-27  9:13 ` [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get Kishon Vijay Abraham I
@ 2015-08-28 18:07   ` Olof Johansson
  2015-08-28 19:03     ` Tony Lindgren
  0 siblings, 1 reply; 33+ messages in thread
From: Olof Johansson @ 2015-08-28 18:07 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Ulf Hansson, afenkart, Tony Lindgren, linux-mmc, linux-omap,
	linux-kernel, Sekhar Nori, Neil Brown

Hi,

On Thu, Aug 27, 2015 at 2:13 AM, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> Now return error only if the return value of
> devm_regulator_get_optional() is not the same as -ENODEV, since with
> -EPROBE_DEFER, the regulator can be obtained later and all other
> errors are fatal.
>
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> Tested-by: Tony Lindgren <tony@atomide.com>

I bisected boot failures on Panda ES with multi_v7_defconfig down to
this commit on last night's -next build:

http://arm-soc.lixom.net/bootlogs/next/next-20150828/pandaes-arm-multi_v7_defconfig.html

-Olof

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

* Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
  2015-08-28 18:07   ` Olof Johansson
@ 2015-08-28 19:03     ` Tony Lindgren
  2015-08-31  5:44       ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 33+ messages in thread
From: Tony Lindgren @ 2015-08-28 19:03 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Kishon Vijay Abraham I, Ulf Hansson, afenkart, linux-mmc,
	linux-omap, linux-kernel, Sekhar Nori, Neil Brown

* Olof Johansson <olof@lixom.net> [150828 11:11]:
> Hi,
> 
> On Thu, Aug 27, 2015 at 2:13 AM, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> > Now return error only if the return value of
> > devm_regulator_get_optional() is not the same as -ENODEV, since with
> > -EPROBE_DEFER, the regulator can be obtained later and all other
> > errors are fatal.
> >
> > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> > Tested-by: Tony Lindgren <tony@atomide.com>
> 
> I bisected boot failures on Panda ES with multi_v7_defconfig down to
> this commit on last night's -next build:
> 
> http://arm-soc.lixom.net/bootlogs/next/next-20150828/pandaes-arm-multi_v7_defconfig.html

MMC is working for me at least on Duovero. Interesting that you also
have all kind of errors there, I guess this is some older revision
of the board.

Anyways, Kishon, care to look into what might be causing this?

Regards,

Tony

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

* Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
  2015-08-28 19:03     ` Tony Lindgren
@ 2015-08-31  5:44       ` Kishon Vijay Abraham I
  2015-08-31 20:58         ` Tony Lindgren
  0 siblings, 1 reply; 33+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-31  5:44 UTC (permalink / raw)
  To: Tony Lindgren, Olof Johansson
  Cc: Ulf Hansson, afenkart, linux-mmc, linux-omap, linux-kernel,
	Sekhar Nori, Neil Brown

Hi,

On Saturday 29 August 2015 12:33 AM, Tony Lindgren wrote:
> * Olof Johansson <olof@lixom.net> [150828 11:11]:
>> Hi,
>>
>> On Thu, Aug 27, 2015 at 2:13 AM, Kishon Vijay Abraham I <kishon@ti.com> wrote:
>>> Now return error only if the return value of
>>> devm_regulator_get_optional() is not the same as -ENODEV, since with
>>> -EPROBE_DEFER, the regulator can be obtained later and all other
>>> errors are fatal.
>>>
>>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>>> Tested-by: Tony Lindgren <tony@atomide.com>
>>
>> I bisected boot failures on Panda ES with multi_v7_defconfig down to
>> this commit on last night's -next build:
>>
>> http://arm-soc.lixom.net/bootlogs/next/next-20150828/pandaes-arm-multi_v7_defconfig.html
> 
> MMC is working for me at least on Duovero. Interesting that you also
> have all kind of errors there, I guess this is some older revision
> of the board.
> 
> Anyways, Kishon, care to look into what might be causing this?

I think this might be because my pbias fix [1] patch wasn't merged yet.
I'll try to get that resolved asap.

Thanks
Kishon

[1] -> http://lkml.iu.edu/hypermail/linux/kernel/1507.3/01594.html
> 
> Regards,
> 
> Tony
> 

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

* Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
  2015-08-31  5:44       ` Kishon Vijay Abraham I
@ 2015-08-31 20:58         ` Tony Lindgren
  2015-08-31 21:14           ` Tony Lindgren
  0 siblings, 1 reply; 33+ messages in thread
From: Tony Lindgren @ 2015-08-31 20:58 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Olof Johansson, Ulf Hansson, afenkart, linux-mmc, linux-omap,
	linux-kernel, Sekhar Nori, Neil Brown

* Kishon Vijay Abraham I <kishon@ti.com> [150830 22:47]:
> Hi,
> 
> On Saturday 29 August 2015 12:33 AM, Tony Lindgren wrote:
> > * Olof Johansson <olof@lixom.net> [150828 11:11]:
> >> Hi,
> >>
> >> On Thu, Aug 27, 2015 at 2:13 AM, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> >>> Now return error only if the return value of
> >>> devm_regulator_get_optional() is not the same as -ENODEV, since with
> >>> -EPROBE_DEFER, the regulator can be obtained later and all other
> >>> errors are fatal.
> >>>
> >>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> >>> Tested-by: Tony Lindgren <tony@atomide.com>
> >>
> >> I bisected boot failures on Panda ES with multi_v7_defconfig down to
> >> this commit on last night's -next build:
> >>
> >> http://arm-soc.lixom.net/bootlogs/next/next-20150828/pandaes-arm-multi_v7_defconfig.html
> > 
> > MMC is working for me at least on Duovero. Interesting that you also
> > have all kind of errors there, I guess this is some older revision
> > of the board.
> > 
> > Anyways, Kishon, care to look into what might be causing this?
> 
> I think this might be because my pbias fix [1] patch wasn't merged yet.
> I'll try to get that resolved asap.

Kishon, as there seems to be an ongoing discussion with the regulator regmap
stuff for pbias, I suggest you provide a fix for the hsmmc driver instead for
now or revert some patches to remove the dependency and get things working.

And I must have tested next-20150827 instead of next-20150828. Or
else it does not happen on every boot. In any case, I'm now getting
the following on next-20150831 most of the time:

[    9.493133] omap_hsmmc 4809c000.mmc: using lookup tables for GPIO lookup
[    9.500274] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed
[    9.506378] ------------[ cut here ]------------
[    9.508941] WARNING: CPU: 0 PID: 6 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x224/0x350()
[    9.520568] 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4PER2 (Read): Data Access in User mode during Functional access
[    9.524810] Modules linked in: rtc_twl twl4030_wdt
[    9.534820] CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 4.2.0-next-20150831-00002-gf55bad8 #1113
[    9.544830] Hardware name: Generic OMAP4 (Flattened Device Tree)
[    9.544830] Workqueue: deferwq deferred_probe_work_func
[    9.554809] [<c001770c>] (unwind_backtrace) from [<c0013a58>] (show_stack+0x10/0x14)
[    9.564819] [<c0013a58>] (show_stack) from [<c034efb4>] (dump_stack+0x84/0x9c)
[    9.574829] [<c034efb4>] (dump_stack) from [<c003e994>] (warn_slowpath_common+0x78/0xb4)
[    9.574951] [<c003e994>] (warn_slowpath_common) from [<c003ea00>] (warn_slowpath_fmt+0x30/0x40)
[    9.584686] [<c003ea00>] (warn_slowpath_fmt) from [<c037cc7c>] (l3_interrupt_handler+0x224/0x350)
[    9.594818] [<c037cc7c>] (l3_interrupt_handler) from [<c009e7b4>] (handle_irq_event_percpu+0x44/0x1f0)
[    9.604827] [<c009e7b4>] (handle_irq_event_percpu) from [<c009e9a0>] (handle_irq_event+0x40/0x64)
[    9.614807] [<c009e9a0>] (handle_irq_event) from [<c00a1a4c>] (handle_fasteoi_irq+0xcc/0x1c4)
[    9.625396] [<c00a1a4c>] (handle_fasteoi_irq) from [<c009de58>] (generic_handle_irq+0x28/0x3c)
[    9.638732] [<c009de58>] (generic_handle_irq) from [<c009e140>] (__handle_domain_irq+0x64/0xe0)
[    9.647827] [<c009e140>] (__handle_domain_irq) from [<c0009514>] (gic_handle_irq+0x40/0x8c)
[    9.654693] [<c0009514>] (gic_handle_irq) from [<c064ccb8>] (__irq_svc+0x58/0x78)
[    9.664367] Exception stack(0xee0cfd80 to 0xee0cfdc8)
[    9.665130] fd80: ee1ec010 c082f174 000000d0 00000000 ee6b0800 ee6ae850 ee1ec000 ee1ec010
[    9.674835] fda0: 00000000 ee6b0cc0 000000ee fa09c000 00000003 ee0cfdd0 c04cd748 c04df4e0
[    9.684814] fdc0: 20000113 ffffffff
[    9.684814] [<c064ccb8>] (__irq_svc) from [<c04df4e0>] (devm_clk_get+0x8/0x70)
[    9.694824] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0)
[    9.704833] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac)
[    9.714691] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0)
[    9.724548] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98)
[    9.733459] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118)
[    9.734832] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90)
[    9.744812] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90)
[    9.760040] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558)
[    9.769470] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514)
[    9.774688] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0)
[    9.785614] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24)
[    9.785614] ---[ end trace 402743bd8cfdde2f ]---
 
> [1] -> http://lkml.iu.edu/hypermail/linux/kernel/1507.3/01594.html

With patch 1/2 of the above applied, I'm getting this instead:

[    2.930938] ------------[ cut here ]------------
[    2.935852] WARNING: CPU: 0 PID: 6 at drivers/regulator/core.c:2105 _regulator_disable+0x13c/0x1d4()
[    2.945465] unbalanced disables for pbias_mmc_omap4
[    2.945465] Modules linked in:
[    2.950592] CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 4.2.0-next-20150831-00003-gc5112ac-dirty #1114
[    2.963684] Hardware name: Generic OMAP4 (Flattened Device Tree)
[    2.970031] Workqueue: deferwq deferred_probe_work_func
[    2.975585] [<c001770c>] (unwind_backtrace) from [<c0013a58>] (show_stack+0x10/0x14)
[    2.983764] [<c0013a58>] (show_stack) from [<c034efb4>] (dump_stack+0x84/0x9c)
[    2.983764] [<c034efb4>] (dump_stack) from [<c003e994>] (warn_slowpath_common+0x78/0xb4)
[    2.999877] [<c003e994>] (warn_slowpath_common) from [<c003ea00>] (warn_slowpath_fmt+0x30/0x40)
[    3.009063] [<c003ea00>] (warn_slowpath_fmt) from [<c03ad830>] (_regulator_disable+0x13c/0x1d4)
[    3.018218] [<c03ad830>] (_regulator_disable) from [<c03ad8f8>] (regulator_disable+0x30/0x6c)
[    3.027221] [<c03ad8f8>] (regulator_disable) from [<c04cdfe8>] (omap_hsmmc_set_power+0x158/0x1e8)
[    3.027252] [<c04cdfe8>] (omap_hsmmc_set_power) from [<c04ce210>] (omap_hsmmc_set_ios+0x198/0x318)
[    3.046020] [<c04ce210>] (omap_hsmmc_set_ios) from [<c04b7da4>] (mmc_power_up.part.10+0x30/0xf8)
[    3.055267] [<c04b7da4>] (mmc_power_up.part.10) from [<c04b8cb0>] (mmc_start_host+0x40/0x7c)
[    3.064178] [<c04b8cb0>] (mmc_start_host) from [<c04b9dc4>] (mmc_add_host+0x5c/0x84)
[    3.072326] [<c04b9dc4>] (mmc_add_host) from [<c04cda50>] (omap_hsmmc_probe+0x5b0/0x9f0)
[    3.080871] [<c04cda50>] (omap_hsmmc_probe) from [<c03e9834>] (platform_drv_probe+0x44/0xac)
[    3.089752] [<c03e9834>] (platform_drv_probe) from [<c03e7ee8>] (driver_probe_device+0x1f4/0x2f0)
[    3.099090] [<c03e7ee8>] (driver_probe_device) from [<c03e63f4>] (bus_for_each_drv+0x64/0x98)
[    3.108093] [<c03e63f4>] (bus_for_each_drv) from [<c03e7c68>] (__device_attach+0xb0/0x118)
[    3.116790] [<c03e7c68>] (__device_attach) from [<c03e7210>] (bus_probe_device+0x88/0x90)
[    3.125427] [<c03e7210>] (bus_probe_device) from [<c03e7638>] (deferred_probe_work_func+0x60/0x90)
[    3.125427] [<c03e7638>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558)
[    3.144470] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514)
[    3.152984] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0)
[    3.160614] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24)
[    3.160644] ---[ end trace 2869621ad5ef511c ]---

Regards,

Tony


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

* Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
  2015-08-31 20:58         ` Tony Lindgren
@ 2015-08-31 21:14           ` Tony Lindgren
  2015-09-01 14:33             ` Grygorii Strashko
  0 siblings, 1 reply; 33+ messages in thread
From: Tony Lindgren @ 2015-08-31 21:14 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Olof Johansson, Ulf Hansson, afenkart, linux-mmc, linux-omap,
	linux-kernel, Sekhar Nori, Neil Brown

* Tony Lindgren <tony@atomide.com> [150831 14:02]:
> 
> And I must have tested next-20150827 instead of next-20150828. Or
> else it does not happen on every boot. In any case, I'm now getting
> the following on next-20150831 most of the time:
> 
> [    9.493133] omap_hsmmc 4809c000.mmc: using lookup tables for GPIO lookup
> [    9.500274] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed
> [    9.506378] ------------[ cut here ]------------
> [    9.508941] WARNING: CPU: 0 PID: 6 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x224/0x350()
> [    9.520568] 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4PER2 (Read): Data Access in User mode during Functional access
> [    9.524810] Modules linked in: rtc_twl twl4030_wdt
> [    9.534820] CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 4.2.0-next-20150831-00002-gf55bad8 #1113
> [    9.544830] Hardware name: Generic OMAP4 (Flattened Device Tree)
> [    9.544830] Workqueue: deferwq deferred_probe_work_func
> [    9.554809] [<c001770c>] (unwind_backtrace) from [<c0013a58>] (show_stack+0x10/0x14)
> [    9.564819] [<c0013a58>] (show_stack) from [<c034efb4>] (dump_stack+0x84/0x9c)
> [    9.574829] [<c034efb4>] (dump_stack) from [<c003e994>] (warn_slowpath_common+0x78/0xb4)
> [    9.574951] [<c003e994>] (warn_slowpath_common) from [<c003ea00>] (warn_slowpath_fmt+0x30/0x40)
> [    9.584686] [<c003ea00>] (warn_slowpath_fmt) from [<c037cc7c>] (l3_interrupt_handler+0x224/0x350)
> [    9.594818] [<c037cc7c>] (l3_interrupt_handler) from [<c009e7b4>] (handle_irq_event_percpu+0x44/0x1f0)
> [    9.604827] [<c009e7b4>] (handle_irq_event_percpu) from [<c009e9a0>] (handle_irq_event+0x40/0x64)
> [    9.614807] [<c009e9a0>] (handle_irq_event) from [<c00a1a4c>] (handle_fasteoi_irq+0xcc/0x1c4)
> [    9.625396] [<c00a1a4c>] (handle_fasteoi_irq) from [<c009de58>] (generic_handle_irq+0x28/0x3c)
> [    9.638732] [<c009de58>] (generic_handle_irq) from [<c009e140>] (__handle_domain_irq+0x64/0xe0)
> [    9.647827] [<c009e140>] (__handle_domain_irq) from [<c0009514>] (gic_handle_irq+0x40/0x8c)
> [    9.654693] [<c0009514>] (gic_handle_irq) from [<c064ccb8>] (__irq_svc+0x58/0x78)
> [    9.664367] Exception stack(0xee0cfd80 to 0xee0cfdc8)
> [    9.665130] fd80: ee1ec010 c082f174 000000d0 00000000 ee6b0800 ee6ae850 ee1ec000 ee1ec010
> [    9.674835] fda0: 00000000 ee6b0cc0 000000ee fa09c000 00000003 ee0cfdd0 c04cd748 c04df4e0
> [    9.684814] fdc0: 20000113 ffffffff
> [    9.684814] [<c064ccb8>] (__irq_svc) from [<c04df4e0>] (devm_clk_get+0x8/0x70)
> [    9.694824] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0)
> [    9.704833] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac)
> [    9.714691] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0)
> [    9.724548] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98)
> [    9.733459] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118)
> [    9.734832] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90)
> [    9.744812] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90)
> [    9.760040] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558)
> [    9.769470] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514)
> [    9.774688] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0)
> [    9.785614] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24)
> [    9.785614] ---[ end trace 402743bd8cfdde2f ]---

And with the (currently almost useless) l3 interrupt stuff taken out by
removing the ti,omap4-l3-noc compatible from omap4.dtsi, we get a real
trace that might be of some help to you:

[    8.440917] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed
[    8.447418] Unhandled fault: imprecise external abort (0x1406) at 0xbeafaa10
[    8.454925] pgd = c0004000
[    8.454986] [beafaa10] *pgd=00000000/root/init: line 14: /sys/devices/68000000.ocp/4
8098000.spi/spi_master/spi1/spi1[    8.461334] Internal error: : 1406 [#1] SMP ARM
.2/backlight/acx565akm/brightness: No such file [    8.473175] Modules linked in:or directory
 rtc_twl twl4030_wdt
[    8.483520] CPU: 1 PID: 66 Comm: kworker/u4:1 Not tainted 4.2.0-next-20150831-00002-gf55bad8-dirty #1115
[    8.493652] Hardware name: Generic OMAP4 (Flattened Device Tree)
[    8.498352] Workqueue: deferwq deferred_probe_work_func
[    8.505493] task: ee5f4f40 ti: ee5f6000 task.ti: ee5f6000
[    8.510803] PC is at devm_clk_get+0x8/0x70
[    8.514801] LR is at omap_hsmmc_probe+0x2e8/0x9f0
[    8.520385] pc : [<c04df4e0>]    lr : [<c04cd748>]    psr: 20010013
[    8.520385] sp : ee5f7dd0  ip : 00000003  fp : fa09c000
[    8.532470] r10: 000000ee  r9 : ee6904c0  r8 : 00000000
[    8.537963] r7 : ee1ec010  r6 : ee1ec000  r5 : ee6e7dd0  r4 : ee690000
[    8.544769] r3 : 00000000  r2 : 000000d0  r1 : c082f184  r0 : ee1ec010
[    8.551666] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[    8.559143] Control: 10c5387d  Table: ae73804a  DAC: 00000051
[    8.564727] Process kworker/u4:1 (pid: 66, stack limit = 0xee5f6218)
[    8.571441] Stack: (0xee5f7dd0 to 0xee5f8000)
[    8.576263] 7dc0:                                     ee690000 ee6e7dd0 ee1ec000 c04cd748
[    8.584930] 7de0: 00000000 c09cf8f8 ee1ed270 ee5de150 00000000 ee090248 c11cb0d4 c09ae55c
[    8.593597] 7e00: 00000000 ee1ec010 ee1ec010 c09ae55c fffffdfb 0000001d c09cf8f8 00000000
[    8.601837] 7e20: c09cf8f8 c03e97f4 ee1ec010 c11cb118 c09ae55c 00000000 0000001d c03e7ea8
[    8.610107] 7e40: 00000000 ee5f7e70 c03e803c 00000001 ee5f7ec8 c03e63b4 ee0f2ed4 ee5d6594
[    8.619323] 7e60: ee1ec010 ee1ec010 ee1ec044 c03e7c28 ee1ec010 00000001 c099b110 ee1ec010
[    8.627777] 7e80: ee1ec010 c099a708 ee61cf00 c03e71d0 ee1ec010 c099a3fc c099a3b8 c03e75f8
[    8.636535] 7ea0: c099a434 ee371940 ee08a400 c00589f8 00000001 00000000 c0058968 ee08a400
[    8.644805] 7ec0: c0058e5c 00000001 c099a434 c0b2a770 00000000 c0811a00 ee08a400 ee08a400
[    8.653503] 7ee0: ee371958 ee08a430 ee5f6000 00000088 c09cf04c ee371940 ee08a400 c0058de8
[    8.662261] 7f00: ee08a5d0 00000000 c0058dac 00000000 ee56af40 ee371940 c0058dac 00000000
[    8.670532] 7f20: 00000000 00000000 00000000 c005eb88 1c4eefdf 00000000 00000000 ee371940
[    8.679290] 7f40: 00000000 00000000 dead4ead ffffffff ffffffff c09d6da0 00000000 00000000
[    8.679290] 7f60: c07d16a0 ee5f7f64 ee5f7f64 00000000 00000000 dead4ead ffffffff ffffffff
[    8.696411] 7f80: c09d6da0 00000000 00000000 c07d16a0 ee5f7f90 ee5f7f90 ee5f7fac ee56af40
[    8.705047] 7fa0: c005eab4 00000000 00000000 c000f710 00000000 00000000 00000000 00000000
[    8.713562] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    8.721435] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 2eade3dd cf5fffcd
[    8.730743] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0)
[    8.738952] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac)
[    8.748077] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0)
[    8.757385] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98)
[    8.766326] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118)
[    8.774993] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90)
[    8.783538] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90)
[    8.792907] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558)
[    8.802490] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514)
[    8.810943] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0)
[    8.818511] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24)
[    8.824737] Code: e5910000 ea000091 e92d4070 e3a020d0 (e1a06000) 
[    8.826141] ---[ end trace a89146bc4a70cc4d ]---

Regards,

Tony

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

* Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
  2015-08-31 21:14           ` Tony Lindgren
@ 2015-09-01 14:33             ` Grygorii Strashko
  2015-09-01 14:50               ` Tony Lindgren
  0 siblings, 1 reply; 33+ messages in thread
From: Grygorii Strashko @ 2015-09-01 14:33 UTC (permalink / raw)
  To: Tony Lindgren, Kishon Vijay Abraham I
  Cc: Olof Johansson, Ulf Hansson, afenkart, linux-mmc, linux-omap,
	linux-kernel, Sekhar Nori, Neil Brown

On 09/01/2015 12:14 AM, Tony Lindgren wrote:
> * Tony Lindgren <tony@atomide.com> [150831 14:02]:
>>
>> And I must have tested next-20150827 instead of next-20150828. Or
>> else it does not happen on every boot. In any case, I'm now getting
>> the following on next-20150831 most of the time:
>>
>> [    9.493133] omap_hsmmc 4809c000.mmc: using lookup tables for GPIO lookup
>> [    9.500274] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed
>> [    9.506378] ------------[ cut here ]------------
>> [    9.508941] WARNING: CPU: 0 PID: 6 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x224/0x350()
>> [    9.520568] 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4PER2 (Read): Data Access in User mode during Functional access
>> [    9.524810] Modules linked in: rtc_twl twl4030_wdt
>> [    9.534820] CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 4.2.0-next-20150831-00002-gf55bad8 #1113
>> [    9.544830] Hardware name: Generic OMAP4 (Flattened Device Tree)
>> [    9.544830] Workqueue: deferwq deferred_probe_work_func
>> [    9.554809] [<c001770c>] (unwind_backtrace) from [<c0013a58>] (show_stack+0x10/0x14)
>> [    9.564819] [<c0013a58>] (show_stack) from [<c034efb4>] (dump_stack+0x84/0x9c)
>> [    9.574829] [<c034efb4>] (dump_stack) from [<c003e994>] (warn_slowpath_common+0x78/0xb4)
>> [    9.574951] [<c003e994>] (warn_slowpath_common) from [<c003ea00>] (warn_slowpath_fmt+0x30/0x40)
>> [    9.584686] [<c003ea00>] (warn_slowpath_fmt) from [<c037cc7c>] (l3_interrupt_handler+0x224/0x350)
>> [    9.594818] [<c037cc7c>] (l3_interrupt_handler) from [<c009e7b4>] (handle_irq_event_percpu+0x44/0x1f0)
>> [    9.604827] [<c009e7b4>] (handle_irq_event_percpu) from [<c009e9a0>] (handle_irq_event+0x40/0x64)
>> [    9.614807] [<c009e9a0>] (handle_irq_event) from [<c00a1a4c>] (handle_fasteoi_irq+0xcc/0x1c4)
>> [    9.625396] [<c00a1a4c>] (handle_fasteoi_irq) from [<c009de58>] (generic_handle_irq+0x28/0x3c)
>> [    9.638732] [<c009de58>] (generic_handle_irq) from [<c009e140>] (__handle_domain_irq+0x64/0xe0)
>> [    9.647827] [<c009e140>] (__handle_domain_irq) from [<c0009514>] (gic_handle_irq+0x40/0x8c)
>> [    9.654693] [<c0009514>] (gic_handle_irq) from [<c064ccb8>] (__irq_svc+0x58/0x78)
>> [    9.664367] Exception stack(0xee0cfd80 to 0xee0cfdc8)
>> [    9.665130] fd80: ee1ec010 c082f174 000000d0 00000000 ee6b0800 ee6ae850 ee1ec000 ee1ec010
>> [    9.674835] fda0: 00000000 ee6b0cc0 000000ee fa09c000 00000003 ee0cfdd0 c04cd748 c04df4e0
>> [    9.684814] fdc0: 20000113 ffffffff
>> [    9.684814] [<c064ccb8>] (__irq_svc) from [<c04df4e0>] (devm_clk_get+0x8/0x70)
>> [    9.694824] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0)
>> [    9.704833] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac)
>> [    9.714691] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0)
>> [    9.724548] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98)
>> [    9.733459] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118)
>> [    9.734832] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90)
>> [    9.744812] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90)
>> [    9.760040] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558)
>> [    9.769470] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514)
>> [    9.774688] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0)
>> [    9.785614] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24)
>> [    9.785614] ---[ end trace 402743bd8cfdde2f ]---
> 
> And with the (currently almost useless) l3 interrupt stuff taken out by
> removing the ti,omap4-l3-noc compatible from omap4.dtsi, we get a real
> trace that might be of some help to you:
> 
> [    8.440917] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed
> [    8.447418] Unhandled fault: imprecise external abort (0x1406) at 0xbeafaa10
> [    8.454925] pgd = c0004000
> [    8.454986] [beafaa10] *pgd=00000000/root/init: line 14: /sys/devices/68000000.ocp/4
> 8098000.spi/spi_master/spi1/spi1[    8.461334] Internal error: : 1406 [#1] SMP ARM
> .2/backlight/acx565akm/brightness: No such file [    8.473175] Modules linked in:or directory
>   rtc_twl twl4030_wdt
> [    8.483520] CPU: 1 PID: 66 Comm: kworker/u4:1 Not tainted 4.2.0-next-20150831-00002-gf55bad8-dirty #1115
> [    8.493652] Hardware name: Generic OMAP4 (Flattened Device Tree)
> [    8.498352] Workqueue: deferwq deferred_probe_work_func
> [    8.505493] task: ee5f4f40 ti: ee5f6000 task.ti: ee5f6000
> [    8.510803] PC is at devm_clk_get+0x8/0x70
> [    8.514801] LR is at omap_hsmmc_probe+0x2e8/0x9f0
> [    8.520385] pc : [<c04df4e0>]    lr : [<c04cd748>]    psr: 20010013
> [    8.520385] sp : ee5f7dd0  ip : 00000003  fp : fa09c000
> [    8.532470] r10: 000000ee  r9 : ee6904c0  r8 : 00000000
> [    8.537963] r7 : ee1ec010  r6 : ee1ec000  r5 : ee6e7dd0  r4 : ee690000
> [    8.544769] r3 : 00000000  r2 : 000000d0  r1 : c082f184  r0 : ee1ec010
> [    8.551666] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
> [    8.559143] Control: 10c5387d  Table: ae73804a  DAC: 00000051
> [    8.564727] Process kworker/u4:1 (pid: 66, stack limit = 0xee5f6218)
> [    8.571441] Stack: (0xee5f7dd0 to 0xee5f8000)
> [    8.576263] 7dc0:                                     ee690000 ee6e7dd0 ee1ec000 c04cd748
> [    8.584930] 7de0: 00000000 c09cf8f8 ee1ed270 ee5de150 00000000 ee090248 c11cb0d4 c09ae55c
> [    8.593597] 7e00: 00000000 ee1ec010 ee1ec010 c09ae55c fffffdfb 0000001d c09cf8f8 00000000
> [    8.601837] 7e20: c09cf8f8 c03e97f4 ee1ec010 c11cb118 c09ae55c 00000000 0000001d c03e7ea8
> [    8.610107] 7e40: 00000000 ee5f7e70 c03e803c 00000001 ee5f7ec8 c03e63b4 ee0f2ed4 ee5d6594
> [    8.619323] 7e60: ee1ec010 ee1ec010 ee1ec044 c03e7c28 ee1ec010 00000001 c099b110 ee1ec010
> [    8.627777] 7e80: ee1ec010 c099a708 ee61cf00 c03e71d0 ee1ec010 c099a3fc c099a3b8 c03e75f8
> [    8.636535] 7ea0: c099a434 ee371940 ee08a400 c00589f8 00000001 00000000 c0058968 ee08a400
> [    8.644805] 7ec0: c0058e5c 00000001 c099a434 c0b2a770 00000000 c0811a00 ee08a400 ee08a400
> [    8.653503] 7ee0: ee371958 ee08a430 ee5f6000 00000088 c09cf04c ee371940 ee08a400 c0058de8
> [    8.662261] 7f00: ee08a5d0 00000000 c0058dac 00000000 ee56af40 ee371940 c0058dac 00000000
> [    8.670532] 7f20: 00000000 00000000 00000000 c005eb88 1c4eefdf 00000000 00000000 ee371940
> [    8.679290] 7f40: 00000000 00000000 dead4ead ffffffff ffffffff c09d6da0 00000000 00000000
> [    8.679290] 7f60: c07d16a0 ee5f7f64 ee5f7f64 00000000 00000000 dead4ead ffffffff ffffffff
> [    8.696411] 7f80: c09d6da0 00000000 00000000 c07d16a0 ee5f7f90 ee5f7f90 ee5f7fac ee56af40
> [    8.705047] 7fa0: c005eab4 00000000 00000000 c000f710 00000000 00000000 00000000 00000000
> [    8.713562] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> [    8.721435] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 2eade3dd cf5fffcd
> [    8.730743] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0)
> [    8.738952] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac)
> [    8.748077] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0)
> [    8.757385] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98)
> [    8.766326] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118)
> [    8.774993] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90)
> [    8.783538] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90)
> [    8.792907] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558)
> [    8.802490] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514)
> [    8.810943] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0)
> [    8.818511] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24)
> [    8.824737] Code: e5910000 ea000091 e92d4070 e3a020d0 (e1a06000)
> [    8.826141] ---[ end trace a89146bc4a70cc4d ]---
> 

On -next, Above crash signature could be related to race 
"ARM: OMAP2+: omap-device: fix race deferred probe of omap_hsmmc vs omap_device_late_init"
http://www.spinics.net/lists/linux-omap/msg121622.html

Especially if before crash smth. like below appears in log:
> [ 1.840364] omap_hsmmc 480b4000.mmc: omap_device_late_idle: enabled but no driver. Idling
> [ 1.840634] ldousb: disabling


-- 
regards,
-grygorii

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

* Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
  2015-09-01 14:33             ` Grygorii Strashko
@ 2015-09-01 14:50               ` Tony Lindgren
  2015-09-01 14:54                 ` Grygorii Strashko
  0 siblings, 1 reply; 33+ messages in thread
From: Tony Lindgren @ 2015-09-01 14:50 UTC (permalink / raw)
  To: Grygorii Strashko
  Cc: Kishon Vijay Abraham I, Olof Johansson, Ulf Hansson, afenkart,
	linux-mmc, linux-omap, linux-kernel, Sekhar Nori, Neil Brown

* Grygorii Strashko <grygorii.strashko@ti.com> [150901 07:36]:
> On 09/01/2015 12:14 AM, Tony Lindgren wrote:
> > * Tony Lindgren <tony@atomide.com> [150831 14:02]:
> >>
> >> And I must have tested next-20150827 instead of next-20150828. Or
> >> else it does not happen on every boot. In any case, I'm now getting
> >> the following on next-20150831 most of the time:
> >>
> >> [    9.493133] omap_hsmmc 4809c000.mmc: using lookup tables for GPIO lookup
> >> [    9.500274] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed
> >> [    9.506378] ------------[ cut here ]------------
> >> [    9.508941] WARNING: CPU: 0 PID: 6 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x224/0x350()
> >> [    9.520568] 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4PER2 (Read): Data Access in User mode during Functional access
> >> [    9.524810] Modules linked in: rtc_twl twl4030_wdt
> >> [    9.534820] CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 4.2.0-next-20150831-00002-gf55bad8 #1113
> >> [    9.544830] Hardware name: Generic OMAP4 (Flattened Device Tree)
> >> [    9.544830] Workqueue: deferwq deferred_probe_work_func
> >> [    9.554809] [<c001770c>] (unwind_backtrace) from [<c0013a58>] (show_stack+0x10/0x14)
> >> [    9.564819] [<c0013a58>] (show_stack) from [<c034efb4>] (dump_stack+0x84/0x9c)
> >> [    9.574829] [<c034efb4>] (dump_stack) from [<c003e994>] (warn_slowpath_common+0x78/0xb4)
> >> [    9.574951] [<c003e994>] (warn_slowpath_common) from [<c003ea00>] (warn_slowpath_fmt+0x30/0x40)
> >> [    9.584686] [<c003ea00>] (warn_slowpath_fmt) from [<c037cc7c>] (l3_interrupt_handler+0x224/0x350)
> >> [    9.594818] [<c037cc7c>] (l3_interrupt_handler) from [<c009e7b4>] (handle_irq_event_percpu+0x44/0x1f0)
> >> [    9.604827] [<c009e7b4>] (handle_irq_event_percpu) from [<c009e9a0>] (handle_irq_event+0x40/0x64)
> >> [    9.614807] [<c009e9a0>] (handle_irq_event) from [<c00a1a4c>] (handle_fasteoi_irq+0xcc/0x1c4)
> >> [    9.625396] [<c00a1a4c>] (handle_fasteoi_irq) from [<c009de58>] (generic_handle_irq+0x28/0x3c)
> >> [    9.638732] [<c009de58>] (generic_handle_irq) from [<c009e140>] (__handle_domain_irq+0x64/0xe0)
> >> [    9.647827] [<c009e140>] (__handle_domain_irq) from [<c0009514>] (gic_handle_irq+0x40/0x8c)
> >> [    9.654693] [<c0009514>] (gic_handle_irq) from [<c064ccb8>] (__irq_svc+0x58/0x78)
> >> [    9.664367] Exception stack(0xee0cfd80 to 0xee0cfdc8)
> >> [    9.665130] fd80: ee1ec010 c082f174 000000d0 00000000 ee6b0800 ee6ae850 ee1ec000 ee1ec010
> >> [    9.674835] fda0: 00000000 ee6b0cc0 000000ee fa09c000 00000003 ee0cfdd0 c04cd748 c04df4e0
> >> [    9.684814] fdc0: 20000113 ffffffff
> >> [    9.684814] [<c064ccb8>] (__irq_svc) from [<c04df4e0>] (devm_clk_get+0x8/0x70)
> >> [    9.694824] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0)
> >> [    9.704833] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac)
> >> [    9.714691] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0)
> >> [    9.724548] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98)
> >> [    9.733459] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118)
> >> [    9.734832] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90)
> >> [    9.744812] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90)
> >> [    9.760040] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558)
> >> [    9.769470] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514)
> >> [    9.774688] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0)
> >> [    9.785614] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24)
> >> [    9.785614] ---[ end trace 402743bd8cfdde2f ]---
> > 
> > And with the (currently almost useless) l3 interrupt stuff taken out by
> > removing the ti,omap4-l3-noc compatible from omap4.dtsi, we get a real
> > trace that might be of some help to you:
> > 
> > [    8.440917] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed
> > [    8.447418] Unhandled fault: imprecise external abort (0x1406) at 0xbeafaa10
> > [    8.454925] pgd = c0004000
> > [    8.454986] [beafaa10] *pgd=00000000/root/init: line 14: /sys/devices/68000000.ocp/4
> > 8098000.spi/spi_master/spi1/spi1[    8.461334] Internal error: : 1406 [#1] SMP ARM
> > .2/backlight/acx565akm/brightness: No such file [    8.473175] Modules linked in:or directory
> >   rtc_twl twl4030_wdt
> > [    8.483520] CPU: 1 PID: 66 Comm: kworker/u4:1 Not tainted 4.2.0-next-20150831-00002-gf55bad8-dirty #1115
> > [    8.493652] Hardware name: Generic OMAP4 (Flattened Device Tree)
> > [    8.498352] Workqueue: deferwq deferred_probe_work_func
> > [    8.505493] task: ee5f4f40 ti: ee5f6000 task.ti: ee5f6000
> > [    8.510803] PC is at devm_clk_get+0x8/0x70
> > [    8.514801] LR is at omap_hsmmc_probe+0x2e8/0x9f0
> > [    8.520385] pc : [<c04df4e0>]    lr : [<c04cd748>]    psr: 20010013
> > [    8.520385] sp : ee5f7dd0  ip : 00000003  fp : fa09c000
> > [    8.532470] r10: 000000ee  r9 : ee6904c0  r8 : 00000000
> > [    8.537963] r7 : ee1ec010  r6 : ee1ec000  r5 : ee6e7dd0  r4 : ee690000
> > [    8.544769] r3 : 00000000  r2 : 000000d0  r1 : c082f184  r0 : ee1ec010
> > [    8.551666] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
> > [    8.559143] Control: 10c5387d  Table: ae73804a  DAC: 00000051
> > [    8.564727] Process kworker/u4:1 (pid: 66, stack limit = 0xee5f6218)
> > [    8.571441] Stack: (0xee5f7dd0 to 0xee5f8000)
> > [    8.576263] 7dc0:                                     ee690000 ee6e7dd0 ee1ec000 c04cd748
> > [    8.584930] 7de0: 00000000 c09cf8f8 ee1ed270 ee5de150 00000000 ee090248 c11cb0d4 c09ae55c
> > [    8.593597] 7e00: 00000000 ee1ec010 ee1ec010 c09ae55c fffffdfb 0000001d c09cf8f8 00000000
> > [    8.601837] 7e20: c09cf8f8 c03e97f4 ee1ec010 c11cb118 c09ae55c 00000000 0000001d c03e7ea8
> > [    8.610107] 7e40: 00000000 ee5f7e70 c03e803c 00000001 ee5f7ec8 c03e63b4 ee0f2ed4 ee5d6594
> > [    8.619323] 7e60: ee1ec010 ee1ec010 ee1ec044 c03e7c28 ee1ec010 00000001 c099b110 ee1ec010
> > [    8.627777] 7e80: ee1ec010 c099a708 ee61cf00 c03e71d0 ee1ec010 c099a3fc c099a3b8 c03e75f8
> > [    8.636535] 7ea0: c099a434 ee371940 ee08a400 c00589f8 00000001 00000000 c0058968 ee08a400
> > [    8.644805] 7ec0: c0058e5c 00000001 c099a434 c0b2a770 00000000 c0811a00 ee08a400 ee08a400
> > [    8.653503] 7ee0: ee371958 ee08a430 ee5f6000 00000088 c09cf04c ee371940 ee08a400 c0058de8
> > [    8.662261] 7f00: ee08a5d0 00000000 c0058dac 00000000 ee56af40 ee371940 c0058dac 00000000
> > [    8.670532] 7f20: 00000000 00000000 00000000 c005eb88 1c4eefdf 00000000 00000000 ee371940
> > [    8.679290] 7f40: 00000000 00000000 dead4ead ffffffff ffffffff c09d6da0 00000000 00000000
> > [    8.679290] 7f60: c07d16a0 ee5f7f64 ee5f7f64 00000000 00000000 dead4ead ffffffff ffffffff
> > [    8.696411] 7f80: c09d6da0 00000000 00000000 c07d16a0 ee5f7f90 ee5f7f90 ee5f7fac ee56af40
> > [    8.705047] 7fa0: c005eab4 00000000 00000000 c000f710 00000000 00000000 00000000 00000000
> > [    8.713562] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> > [    8.721435] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 2eade3dd cf5fffcd
> > [    8.730743] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0)
> > [    8.738952] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac)
> > [    8.748077] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0)
> > [    8.757385] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98)
> > [    8.766326] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118)
> > [    8.774993] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90)
> > [    8.783538] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90)
> > [    8.792907] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558)
> > [    8.802490] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514)
> > [    8.810943] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0)
> > [    8.818511] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24)
> > [    8.824737] Code: e5910000 ea000091 e92d4070 e3a020d0 (e1a06000)
> > [    8.826141] ---[ end trace a89146bc4a70cc4d ]---
> > 
> 
> On -next, Above crash signature could be related to race 
> "ARM: OMAP2+: omap-device: fix race deferred probe of omap_hsmmc vs omap_device_late_init"
> http://www.spinics.net/lists/linux-omap/msg121622.html

Good point thanks, yes that's the case. MMC probing fails and then we hit this
separate issue while MMC is trying to probe. Applying your fix makes the
abort disappear, but naturally does not get MMC working again.

Regards,

Tony 

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

* Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
  2015-09-01 14:50               ` Tony Lindgren
@ 2015-09-01 14:54                 ` Grygorii Strashko
  2015-09-01 15:03                   ` Tony Lindgren
  0 siblings, 1 reply; 33+ messages in thread
From: Grygorii Strashko @ 2015-09-01 14:54 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Kishon Vijay Abraham I, Olof Johansson, Ulf Hansson, afenkart,
	linux-mmc, linux-omap, linux-kernel, Sekhar Nori, Neil Brown

On 09/01/2015 05:50 PM, Tony Lindgren wrote:
> * Grygorii Strashko <grygorii.strashko@ti.com> [150901 07:36]:
>> On 09/01/2015 12:14 AM, Tony Lindgren wrote:
>>> * Tony Lindgren <tony@atomide.com> [150831 14:02]:
>>>>
>>>> And I must have tested next-20150827 instead of next-20150828. Or
>>>> else it does not happen on every boot. In any case, I'm now getting
>>>> the following on next-20150831 most of the time:
>>>>
>>>> [    9.493133] omap_hsmmc 4809c000.mmc: using lookup tables for GPIO lookup
>>>> [    9.500274] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed
>>>> [    9.506378] ------------[ cut here ]------------
>>>> [    9.508941] WARNING: CPU: 0 PID: 6 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x224/0x350()
>>>> [    9.520568] 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4PER2 (Read): Data Access in User mode during Functional access
>>>> [    9.524810] Modules linked in: rtc_twl twl4030_wdt
>>>> [    9.534820] CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 4.2.0-next-20150831-00002-gf55bad8 #1113
>>>> [    9.544830] Hardware name: Generic OMAP4 (Flattened Device Tree)
>>>> [    9.544830] Workqueue: deferwq deferred_probe_work_func
>>>> [    9.554809] [<c001770c>] (unwind_backtrace) from [<c0013a58>] (show_stack+0x10/0x14)
>>>> [    9.564819] [<c0013a58>] (show_stack) from [<c034efb4>] (dump_stack+0x84/0x9c)
>>>> [    9.574829] [<c034efb4>] (dump_stack) from [<c003e994>] (warn_slowpath_common+0x78/0xb4)
>>>> [    9.574951] [<c003e994>] (warn_slowpath_common) from [<c003ea00>] (warn_slowpath_fmt+0x30/0x40)
>>>> [    9.584686] [<c003ea00>] (warn_slowpath_fmt) from [<c037cc7c>] (l3_interrupt_handler+0x224/0x350)
>>>> [    9.594818] [<c037cc7c>] (l3_interrupt_handler) from [<c009e7b4>] (handle_irq_event_percpu+0x44/0x1f0)
>>>> [    9.604827] [<c009e7b4>] (handle_irq_event_percpu) from [<c009e9a0>] (handle_irq_event+0x40/0x64)
>>>> [    9.614807] [<c009e9a0>] (handle_irq_event) from [<c00a1a4c>] (handle_fasteoi_irq+0xcc/0x1c4)
>>>> [    9.625396] [<c00a1a4c>] (handle_fasteoi_irq) from [<c009de58>] (generic_handle_irq+0x28/0x3c)
>>>> [    9.638732] [<c009de58>] (generic_handle_irq) from [<c009e140>] (__handle_domain_irq+0x64/0xe0)
>>>> [    9.647827] [<c009e140>] (__handle_domain_irq) from [<c0009514>] (gic_handle_irq+0x40/0x8c)
>>>> [    9.654693] [<c0009514>] (gic_handle_irq) from [<c064ccb8>] (__irq_svc+0x58/0x78)
>>>> [    9.664367] Exception stack(0xee0cfd80 to 0xee0cfdc8)
>>>> [    9.665130] fd80: ee1ec010 c082f174 000000d0 00000000 ee6b0800 ee6ae850 ee1ec000 ee1ec010
>>>> [    9.674835] fda0: 00000000 ee6b0cc0 000000ee fa09c000 00000003 ee0cfdd0 c04cd748 c04df4e0
>>>> [    9.684814] fdc0: 20000113 ffffffff
>>>> [    9.684814] [<c064ccb8>] (__irq_svc) from [<c04df4e0>] (devm_clk_get+0x8/0x70)
>>>> [    9.694824] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0)
>>>> [    9.704833] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac)
>>>> [    9.714691] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0)
>>>> [    9.724548] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98)
>>>> [    9.733459] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118)
>>>> [    9.734832] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90)
>>>> [    9.744812] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90)
>>>> [    9.760040] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558)
>>>> [    9.769470] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514)
>>>> [    9.774688] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0)
>>>> [    9.785614] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24)
>>>> [    9.785614] ---[ end trace 402743bd8cfdde2f ]---
>>>
>>> And with the (currently almost useless) l3 interrupt stuff taken out by
>>> removing the ti,omap4-l3-noc compatible from omap4.dtsi, we get a real
>>> trace that might be of some help to you:
>>>
>>> [    8.440917] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed
>>> [    8.447418] Unhandled fault: imprecise external abort (0x1406) at 0xbeafaa10
>>> [    8.454925] pgd = c0004000
>>> [    8.454986] [beafaa10] *pgd=00000000/root/init: line 14: /sys/devices/68000000.ocp/4
>>> 8098000.spi/spi_master/spi1/spi1[    8.461334] Internal error: : 1406 [#1] SMP ARM
>>> .2/backlight/acx565akm/brightness: No such file [    8.473175] Modules linked in:or directory
>>>    rtc_twl twl4030_wdt
>>> [    8.483520] CPU: 1 PID: 66 Comm: kworker/u4:1 Not tainted 4.2.0-next-20150831-00002-gf55bad8-dirty #1115
>>> [    8.493652] Hardware name: Generic OMAP4 (Flattened Device Tree)
>>> [    8.498352] Workqueue: deferwq deferred_probe_work_func
>>> [    8.505493] task: ee5f4f40 ti: ee5f6000 task.ti: ee5f6000
>>> [    8.510803] PC is at devm_clk_get+0x8/0x70
>>> [    8.514801] LR is at omap_hsmmc_probe+0x2e8/0x9f0
>>> [    8.520385] pc : [<c04df4e0>]    lr : [<c04cd748>]    psr: 20010013
>>> [    8.520385] sp : ee5f7dd0  ip : 00000003  fp : fa09c000
>>> [    8.532470] r10: 000000ee  r9 : ee6904c0  r8 : 00000000
>>> [    8.537963] r7 : ee1ec010  r6 : ee1ec000  r5 : ee6e7dd0  r4 : ee690000
>>> [    8.544769] r3 : 00000000  r2 : 000000d0  r1 : c082f184  r0 : ee1ec010
>>> [    8.551666] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
>>> [    8.559143] Control: 10c5387d  Table: ae73804a  DAC: 00000051
>>> [    8.564727] Process kworker/u4:1 (pid: 66, stack limit = 0xee5f6218)
>>> [    8.571441] Stack: (0xee5f7dd0 to 0xee5f8000)
>>> [    8.576263] 7dc0:                                     ee690000 ee6e7dd0 ee1ec000 c04cd748
>>> [    8.584930] 7de0: 00000000 c09cf8f8 ee1ed270 ee5de150 00000000 ee090248 c11cb0d4 c09ae55c
>>> [    8.593597] 7e00: 00000000 ee1ec010 ee1ec010 c09ae55c fffffdfb 0000001d c09cf8f8 00000000
>>> [    8.601837] 7e20: c09cf8f8 c03e97f4 ee1ec010 c11cb118 c09ae55c 00000000 0000001d c03e7ea8
>>> [    8.610107] 7e40: 00000000 ee5f7e70 c03e803c 00000001 ee5f7ec8 c03e63b4 ee0f2ed4 ee5d6594
>>> [    8.619323] 7e60: ee1ec010 ee1ec010 ee1ec044 c03e7c28 ee1ec010 00000001 c099b110 ee1ec010
>>> [    8.627777] 7e80: ee1ec010 c099a708 ee61cf00 c03e71d0 ee1ec010 c099a3fc c099a3b8 c03e75f8
>>> [    8.636535] 7ea0: c099a434 ee371940 ee08a400 c00589f8 00000001 00000000 c0058968 ee08a400
>>> [    8.644805] 7ec0: c0058e5c 00000001 c099a434 c0b2a770 00000000 c0811a00 ee08a400 ee08a400
>>> [    8.653503] 7ee0: ee371958 ee08a430 ee5f6000 00000088 c09cf04c ee371940 ee08a400 c0058de8
>>> [    8.662261] 7f00: ee08a5d0 00000000 c0058dac 00000000 ee56af40 ee371940 c0058dac 00000000
>>> [    8.670532] 7f20: 00000000 00000000 00000000 c005eb88 1c4eefdf 00000000 00000000 ee371940
>>> [    8.679290] 7f40: 00000000 00000000 dead4ead ffffffff ffffffff c09d6da0 00000000 00000000
>>> [    8.679290] 7f60: c07d16a0 ee5f7f64 ee5f7f64 00000000 00000000 dead4ead ffffffff ffffffff
>>> [    8.696411] 7f80: c09d6da0 00000000 00000000 c07d16a0 ee5f7f90 ee5f7f90 ee5f7fac ee56af40
>>> [    8.705047] 7fa0: c005eab4 00000000 00000000 c000f710 00000000 00000000 00000000 00000000
>>> [    8.713562] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
>>> [    8.721435] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 2eade3dd cf5fffcd
>>> [    8.730743] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0)
>>> [    8.738952] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac)
>>> [    8.748077] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0)
>>> [    8.757385] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98)
>>> [    8.766326] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118)
>>> [    8.774993] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90)
>>> [    8.783538] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90)
>>> [    8.792907] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558)
>>> [    8.802490] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514)
>>> [    8.810943] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0)
>>> [    8.818511] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24)
>>> [    8.824737] Code: e5910000 ea000091 e92d4070 e3a020d0 (e1a06000)
>>> [    8.826141] ---[ end trace a89146bc4a70cc4d ]---
>>>
>>
>> On -next, Above crash signature could be related to race
>> "ARM: OMAP2+: omap-device: fix race deferred probe of omap_hsmmc vs omap_device_late_init"
>> http://www.spinics.net/lists/linux-omap/msg121622.html
>
> Good point thanks, yes that's the case. MMC probing fails and then we hit this
> separate issue while MMC is trying to probe. Applying your fix makes the
> abort disappear, but naturally does not get MMC working again.

you may need CONFIG_GPIO_PCF857X=y for dra7-evm

-- 
regards,
-grygorii

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

* Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
  2015-09-01 14:54                 ` Grygorii Strashko
@ 2015-09-01 15:03                   ` Tony Lindgren
  2015-09-10 16:59                     ` Kevin Hilman
  0 siblings, 1 reply; 33+ messages in thread
From: Tony Lindgren @ 2015-09-01 15:03 UTC (permalink / raw)
  To: Grygorii Strashko
  Cc: Kishon Vijay Abraham I, Olof Johansson, Ulf Hansson, afenkart,
	linux-mmc, linux-omap, linux-kernel, Sekhar Nori, Neil Brown

* Grygorii Strashko <grygorii.strashko@ti.com> [150901 07:57]:
> On 09/01/2015 05:50 PM, Tony Lindgren wrote:
> >>
> >>On -next, Above crash signature could be related to race
> >>"ARM: OMAP2+: omap-device: fix race deferred probe of omap_hsmmc vs omap_device_late_init"
> >>http://www.spinics.net/lists/linux-omap/msg121622.html
> >
> >Good point thanks, yes that's the case. MMC probing fails and then we hit this
> >separate issue while MMC is trying to probe. Applying your fix makes the
> >abort disappear, but naturally does not get MMC working again.
> 
> you may need CONFIG_GPIO_PCF857X=y for dra7-evm

This is a regression at least on omap4 as pointed out by Olof.

Regards,

Tony

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

* Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
  2015-09-01 15:03                   ` Tony Lindgren
@ 2015-09-10 16:59                     ` Kevin Hilman
  2015-09-10 20:45                       ` Tony Lindgren
  0 siblings, 1 reply; 33+ messages in thread
From: Kevin Hilman @ 2015-09-10 16:59 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Grygorii Strashko, Kishon Vijay Abraham I, Olof Johansson,
	Ulf Hansson, afenkart, linux-mmc, linux-omap, linux-kernel,
	Sekhar Nori, Neil Brown, Tyler Baker

On Tue, Sep 1, 2015 at 8:03 AM, Tony Lindgren <tony@atomide.com> wrote:
> * Grygorii Strashko <grygorii.strashko@ti.com> [150901 07:57]:
>> On 09/01/2015 05:50 PM, Tony Lindgren wrote:
>> >>
>> >>On -next, Above crash signature could be related to race
>> >>"ARM: OMAP2+: omap-device: fix race deferred probe of omap_hsmmc vs omap_device_late_init"
>> >>http://www.spinics.net/lists/linux-omap/msg121622.html
>> >
>> >Good point thanks, yes that's the case. MMC probing fails and then we hit this
>> >separate issue while MMC is trying to probe. Applying your fix makes the
>> >abort disappear, but naturally does not get MMC working again.
>>
>> you may need CONFIG_GPIO_PCF857X=y for dra7-evm
>
> This is a regression at least on omap4 as pointed out by Olof.

FWIW, this problem still exists in mainline[1], and note that it fails
for omap2plus_defconfig which already has CONFIG_REGULATOR_PBIAS=y, so
that is not the fix for this issue.

Kevin

[1] http://kernelci.org/boot/omap4-panda-es/?mainline&omap2plus_defconfig&lab-khilman

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

* Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
  2015-09-10 16:59                     ` Kevin Hilman
@ 2015-09-10 20:45                       ` Tony Lindgren
  0 siblings, 0 replies; 33+ messages in thread
From: Tony Lindgren @ 2015-09-10 20:45 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: Grygorii Strashko, Kishon Vijay Abraham I, Olof Johansson,
	Ulf Hansson, afenkart, linux-mmc, linux-omap, linux-kernel,
	Sekhar Nori, Neil Brown, Tyler Baker

* Kevin Hilman <khilman@kernel.org> [150910 10:03]:
> On Tue, Sep 1, 2015 at 8:03 AM, Tony Lindgren <tony@atomide.com> wrote:
> > * Grygorii Strashko <grygorii.strashko@ti.com> [150901 07:57]:
> >> On 09/01/2015 05:50 PM, Tony Lindgren wrote:
> >> >>
> >> >>On -next, Above crash signature could be related to race
> >> >>"ARM: OMAP2+: omap-device: fix race deferred probe of omap_hsmmc vs omap_device_late_init"
> >> >>http://www.spinics.net/lists/linux-omap/msg121622.html
> >> >
> >> >Good point thanks, yes that's the case. MMC probing fails and then we hit this
> >> >separate issue while MMC is trying to probe. Applying your fix makes the
> >> >abort disappear, but naturally does not get MMC working again.
> >>
> >> you may need CONFIG_GPIO_PCF857X=y for dra7-evm
> >
> > This is a regression at least on omap4 as pointed out by Olof.
> 
> FWIW, this problem still exists in mainline[1], and note that it fails
> for omap2plus_defconfig which already has CONFIG_REGULATOR_PBIAS=y, so
> that is not the fix for this issue.

There are also the pbias regulator fixes pending.. And the .dts
fixes pending.. So looks like it's going to be few more days.

AFAIK, also the multi_v7_defconfig change is needed..

Regards,

Tony
 
> [1] http://kernelci.org/boot/omap4-panda-es/?mainline&omap2plus_defconfig&lab-khilman

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

end of thread, other threads:[~2015-09-10 20:45 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-27  9:13 [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
2015-08-27  9:13 ` [PATCH v3 01/15] mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc Kishon Vijay Abraham I
2015-08-27  9:13 ` [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get Kishon Vijay Abraham I
2015-08-28 18:07   ` Olof Johansson
2015-08-28 19:03     ` Tony Lindgren
2015-08-31  5:44       ` Kishon Vijay Abraham I
2015-08-31 20:58         ` Tony Lindgren
2015-08-31 21:14           ` Tony Lindgren
2015-09-01 14:33             ` Grygorii Strashko
2015-09-01 14:50               ` Tony Lindgren
2015-09-01 14:54                 ` Grygorii Strashko
2015-09-01 15:03                   ` Tony Lindgren
2015-09-10 16:59                     ` Kevin Hilman
2015-09-10 20:45                       ` Tony Lindgren
2015-08-27  9:13 ` [PATCH v3 03/15] mmc: host: omap_hsmmc: cleanup omap_hsmmc_reg_get() Kishon Vijay Abraham I
2015-08-27  9:13 ` [PATCH v3 04/15] mmc: host: omap_hsmmc: use the ocrmask provided by the vmmc regulator Kishon Vijay Abraham I
2015-08-27  9:13 ` [PATCH v3 05/15] mmc: host: omap_hsmmc: use mmc_host's vmmc and vqmmc Kishon Vijay Abraham I
2015-08-27  9:13 ` [PATCH v3 06/15] mmc: host: omap_hsmmc: remove unnecessary pbias set_voltage Kishon Vijay Abraham I
2015-08-27  9:13 ` [PATCH v3 07/15] mmc: host: omap_hsmmc: return error if any of the regulator APIs fail Kishon Vijay Abraham I
2015-08-27  9:14 ` [PATCH v3 08/15] mmc: host: omap_hsmmc: add separate functions for enable/disable supply Kishon Vijay Abraham I
2015-08-27  9:14 ` [PATCH v3 09/15] mmc: host: omap_hsmmc: add separate function to set pbias Kishon Vijay Abraham I
2015-08-27  9:14 ` [PATCH v3 10/15] mmc: host: omap_hsmmc: avoid pbias regulator enable on power off Kishon Vijay Abraham I
2015-08-27  9:14 ` [PATCH v3 11/15] mmc: host: omap_hsmmc: don't use ->set_power to set initial regulator state Kishon Vijay Abraham I
2015-08-27  9:14 ` [PATCH v3 12/15] mmc: host: omap_hsmmc: enable/disable vmmc_aux regulator based on previous state Kishon Vijay Abraham I
2015-08-27  9:14 ` [PATCH v3 13/15] mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status Kishon Vijay Abraham I
2015-08-27 12:41   ` Ulf Hansson
2015-08-27 12:42     ` Ulf Hansson
2015-08-27 12:47       ` Kishon Vijay Abraham I
2015-08-27 12:49         ` Ulf Hansson
2015-08-27  9:14 ` [PATCH v3 14/15] mmc: host: omap_hsmmc: use ios->vdd for setting vmmc voltage Kishon Vijay Abraham I
2015-08-27  9:14 ` [PATCH v3 15/15] mmc: host: omap_hsmmc: remove CONFIG_REGULATOR check Kishon Vijay Abraham I
2015-08-27 13:09 ` [PATCH v3 00/15] omap_hsmmc: regulator usage cleanup and fixes Ulf Hansson
2015-08-27 13:20   ` Kishon Vijay Abraham I

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).