diff mbox

mmc: host: omap_hsmmc: add a verbose print to enable CONFIG_REGULATOR_PBIAS

Message ID 1452762920-2588-1-git-send-email-kishon@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kishon Vijay Abraham I Jan. 14, 2016, 9:15 a.m. UTC
Since v4.3+, CONFIG_REGULATOR_PBIAS should be enabled (for platforms that
have PBIAS regulator) in order for MMC1 to work.

Add a more verbose print to help enable CONFIG_REGULATOR_PBIAS for users
using a olddefconfig or a custom .config.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/mmc/host/omap_hsmmc.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Sebastian Reichel Jan. 14, 2016, 12:07 p.m. UTC | #1
Hi,

On Thu, Jan 14, 2016 at 02:45:20PM +0530, Kishon Vijay Abraham I wrote:
> Since v4.3+, CONFIG_REGULATOR_PBIAS should be enabled (for platforms that
> have PBIAS regulator) in order for MMC1 to work.
> 
> Add a more verbose print to help enable CONFIG_REGULATOR_PBIAS for users
> using a olddefconfig or a custom .config.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  drivers/mmc/host/omap_hsmmc.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 7fb0753..7086bd6 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -503,8 +503,11 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
>  	host->pbias = devm_regulator_get_optional(host->dev, "pbias");
>  	if (IS_ERR(host->pbias)) {
>  		ret = PTR_ERR(host->pbias);
> -		if ((ret != -ENODEV) && host->dev->of_node)
> +		if ((ret != -ENODEV) && host->dev->of_node) {
> +			dev_err(host->dev,
> +			"SD card detect fail? enable CONFIG_REGULATOR_PBIAS\n");
>  			return ret;
> +		}
>  		dev_dbg(host->dev, "unable to get pbias regulator %ld\n",
>  			PTR_ERR(host->pbias));
>  		host->pbias = NULL;


Is there a good reason against adding "depends on REGULATOR_PBIAS"
to MMC_OMAP_HS? I guess it's required for most systems and the regulator
driver is just 250 loc. I am aware, that this will disable the
hsmmc driver for 'make oldconfig', but I guess that will be noticed
in a similar way your warning is noticed.

The advantage of having the depends line is, that people configuring
their kernel have a chance to notice the regulator requirement
during configuration.

Anyways, this message improves the situation, so:

Acked-By: Sebastian Reichel <sre@kernel.org>

-- Sebastian
Kishon Vijay Abraham I Jan. 14, 2016, 12:39 p.m. UTC | #2
Hi,

On Thursday 14 January 2016 05:37 PM, Sebastian Reichel wrote:
> Hi,
> 
> On Thu, Jan 14, 2016 at 02:45:20PM +0530, Kishon Vijay Abraham I wrote:
>> Since v4.3+, CONFIG_REGULATOR_PBIAS should be enabled (for platforms that
>> have PBIAS regulator) in order for MMC1 to work.
>>
>> Add a more verbose print to help enable CONFIG_REGULATOR_PBIAS for users
>> using a olddefconfig or a custom .config.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  drivers/mmc/host/omap_hsmmc.c |    5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>> index 7fb0753..7086bd6 100644
>> --- a/drivers/mmc/host/omap_hsmmc.c
>> +++ b/drivers/mmc/host/omap_hsmmc.c
>> @@ -503,8 +503,11 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
>>  	host->pbias = devm_regulator_get_optional(host->dev, "pbias");
>>  	if (IS_ERR(host->pbias)) {
>>  		ret = PTR_ERR(host->pbias);
>> -		if ((ret != -ENODEV) && host->dev->of_node)
>> +		if ((ret != -ENODEV) && host->dev->of_node) {
>> +			dev_err(host->dev,
>> +			"SD card detect fail? enable CONFIG_REGULATOR_PBIAS\n");
>>  			return ret;
>> +		}
>>  		dev_dbg(host->dev, "unable to get pbias regulator %ld\n",
>>  			PTR_ERR(host->pbias));
>>  		host->pbias = NULL;
> 
> 
> Is there a good reason against adding "depends on REGULATOR_PBIAS"
> to MMC_OMAP_HS? I guess it's required for most systems and the regulator
> driver is just 250 loc. I am aware, that this will disable the
> hsmmc driver for 'make oldconfig', but I guess that will be noticed
> in a similar way your warning is noticed.

hmm.. only MMC1 requires PBIAS so I'm not sure if it's okay to add depends on
REGULATOR_PBIAS for the HSMMC driver as such. And as you said it'll also
disable the hsmmc driver if oldconfig is used. But do we get a warning?

Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren Jan. 14, 2016, 4:49 p.m. UTC | #3
* Kishon Vijay Abraham I <kishon@ti.com> [160114 04:39]:
> On Thursday 14 January 2016 05:37 PM, Sebastian Reichel wrote:
> > 
> > Is there a good reason against adding "depends on REGULATOR_PBIAS"
> > to MMC_OMAP_HS? I guess it's required for most systems and the regulator
> > driver is just 250 loc. I am aware, that this will disable the
> > hsmmc driver for 'make oldconfig', but I guess that will be noticed
> > in a similar way your warning is noticed.
> 
> hmm.. only MMC1 requires PBIAS so I'm not sure if it's okay to add depends on
> REGULATOR_PBIAS for the HSMMC driver as such. And as you said it'll also
> disable the hsmmc driver if oldconfig is used. But do we get a warning?

Adding depends there is a bit wrong, many designs are not using MMC1
but use eMMC on the other controllers instead. I think the runtime
warning is best we can do here to keep things modular.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Russell King - ARM Linux Jan. 14, 2016, 5:25 p.m. UTC | #4
On Thu, Jan 14, 2016 at 01:07:06PM +0100, Sebastian Reichel wrote:
> Hi,
> 
> On Thu, Jan 14, 2016 at 02:45:20PM +0530, Kishon Vijay Abraham I wrote:
> > Since v4.3+, CONFIG_REGULATOR_PBIAS should be enabled (for platforms that
> > have PBIAS regulator) in order for MMC1 to work.
> > 
> > Add a more verbose print to help enable CONFIG_REGULATOR_PBIAS for users
> > using a olddefconfig or a custom .config.
> > 
> > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> > ---
> >  drivers/mmc/host/omap_hsmmc.c |    5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> > index 7fb0753..7086bd6 100644
> > --- a/drivers/mmc/host/omap_hsmmc.c
> > +++ b/drivers/mmc/host/omap_hsmmc.c
> > @@ -503,8 +503,11 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
> >  	host->pbias = devm_regulator_get_optional(host->dev, "pbias");
> >  	if (IS_ERR(host->pbias)) {
> >  		ret = PTR_ERR(host->pbias);
> > -		if ((ret != -ENODEV) && host->dev->of_node)
> > +		if ((ret != -ENODEV) && host->dev->of_node) {
> > +			dev_err(host->dev,
> > +			"SD card detect fail? enable CONFIG_REGULATOR_PBIAS\n");
> >  			return ret;
> > +		}
> >  		dev_dbg(host->dev, "unable to get pbias regulator %ld\n",
> >  			PTR_ERR(host->pbias));
> >  		host->pbias = NULL;
> 
> 
> Is there a good reason against adding "depends on REGULATOR_PBIAS"
> to MMC_OMAP_HS?

There are very good reasons not to do this: that will result in
configurations where MMC_OMAP_HS was set but without REGULATOR_PBIAS
ending up with MMC_OMAP_HS being disabled.  That doesn't help the
root problem, which is "why has the kernel boot regressed for my
previous working configuration?"

The solution proposed here adds a message to the boot which points
out fair and square what needs to be done to rectify the boot
failure.  Adding a dependency just brings up the question "where
has my MMC driver gone?"
Sebastian Reichel Jan. 14, 2016, 10:40 p.m. UTC | #5
Hi,

On Thu, Jan 14, 2016 at 05:25:49PM +0000, Russell King - ARM Linux wrote:
> On Thu, Jan 14, 2016 at 01:07:06PM +0100, Sebastian Reichel wrote:
> > On Thu, Jan 14, 2016 at 02:45:20PM +0530, Kishon Vijay Abraham I wrote:
> > > Since v4.3+, CONFIG_REGULATOR_PBIAS should be enabled (for platforms that
> > > have PBIAS regulator) in order for MMC1 to work.
> > > 
> > > Add a more verbose print to help enable CONFIG_REGULATOR_PBIAS for users
> > > using a olddefconfig or a custom .config.
> > > 
> > > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> > > ---
> > >  drivers/mmc/host/omap_hsmmc.c |    5 ++++-
> > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> > > index 7fb0753..7086bd6 100644
> > > --- a/drivers/mmc/host/omap_hsmmc.c
> > > +++ b/drivers/mmc/host/omap_hsmmc.c
> > > @@ -503,8 +503,11 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
> > >  	host->pbias = devm_regulator_get_optional(host->dev, "pbias");
> > >  	if (IS_ERR(host->pbias)) {
> > >  		ret = PTR_ERR(host->pbias);
> > > -		if ((ret != -ENODEV) && host->dev->of_node)
> > > +		if ((ret != -ENODEV) && host->dev->of_node) {
> > > +			dev_err(host->dev,
> > > +			"SD card detect fail? enable CONFIG_REGULATOR_PBIAS\n");
> > >  			return ret;
> > > +		}
> > >  		dev_dbg(host->dev, "unable to get pbias regulator %ld\n",
> > >  			PTR_ERR(host->pbias));
> > >  		host->pbias = NULL;
> > 
> > 
> > Is there a good reason against adding "depends on REGULATOR_PBIAS"
> > to MMC_OMAP_HS?
> 
> There are very good reasons not to do this: that will result in
> configurations where MMC_OMAP_HS was set but without REGULATOR_PBIAS
> ending up with MMC_OMAP_HS being disabled.  That doesn't help the
> root problem, which is "why has the kernel boot regressed for my
> previous working configuration?"
> 
> The solution proposed here adds a message to the boot which points
> out fair and square what needs to be done to rectify the boot
> failure.  Adding a dependency just brings up the question "where
> has my MMC driver gone?"

The best thing would be to have no regression. Just printing a
message means I have to build another kernel. But more importantly
the message may not be visible by the user - e.g. if the display has
not yet been initialized.

-- Sebastian
Russell King - ARM Linux Jan. 15, 2016, 9:14 a.m. UTC | #6
On Thu, Jan 14, 2016 at 11:40:25PM +0100, Sebastian Reichel wrote:
> On Thu, Jan 14, 2016 at 05:25:49PM +0000, Russell King - ARM Linux wrote:
> > There are very good reasons not to do this: that will result in
> > configurations where MMC_OMAP_HS was set but without REGULATOR_PBIAS
> > ending up with MMC_OMAP_HS being disabled.  That doesn't help the
> > root problem, which is "why has the kernel boot regressed for my
> > previous working configuration?"
> > 
> > The solution proposed here adds a message to the boot which points
> > out fair and square what needs to be done to rectify the boot
> > failure.  Adding a dependency just brings up the question "where
> > has my MMC driver gone?"
> 
> The best thing would be to have no regression. Just printing a
> message means I have to build another kernel. But more importantly
> the message may not be visible by the user - e.g. if the display has
> not yet been initialized.

I agree in principle, but that's not possible here (see Tony's mails
on why the PBIAS stuff needs to be optional.)  I'd agree with changing
the Kconfig if PBIAS were a hard and fast requirement, but it isn't.
Tony Lindgren Jan. 15, 2016, 4:02 p.m. UTC | #7
* Russell King - ARM Linux <linux@arm.linux.org.uk> [160115 01:15]:
> On Thu, Jan 14, 2016 at 11:40:25PM +0100, Sebastian Reichel wrote:
> > On Thu, Jan 14, 2016 at 05:25:49PM +0000, Russell King - ARM Linux wrote:
> > > There are very good reasons not to do this: that will result in
> > > configurations where MMC_OMAP_HS was set but without REGULATOR_PBIAS
> > > ending up with MMC_OMAP_HS being disabled.  That doesn't help the
> > > root problem, which is "why has the kernel boot regressed for my
> > > previous working configuration?"
> > > 
> > > The solution proposed here adds a message to the boot which points
> > > out fair and square what needs to be done to rectify the boot
> > > failure.  Adding a dependency just brings up the question "where
> > > has my MMC driver gone?"
> > 
> > The best thing would be to have no regression. Just printing a
> > message means I have to build another kernel. But more importantly
> > the message may not be visible by the user - e.g. if the display has
> > not yet been initialized.
> 
> I agree in principle, but that's not possible here (see Tony's mails
> on why the PBIAS stuff needs to be optional.)  I'd agree with changing
> the Kconfig if PBIAS were a hard and fast requirement, but it isn't.

Yeah. Probably the best solution for cases like this is to boot with
a small initrd. That way you can get usb console and networking going
before mounting the real root and you will see kernel messages with
only minimal things built in. You can build a small initramfs with
CONFIG_INITRAMFS_SOURCE that is appended to the kernel so you can
also boot the legacy user space too with that if needed.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson Jan. 27, 2016, 2:15 p.m. UTC | #8
On 14 January 2016 at 10:15, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> Since v4.3+, CONFIG_REGULATOR_PBIAS should be enabled (for platforms that
> have PBIAS regulator) in order for MMC1 to work.
>
> Add a more verbose print to help enable CONFIG_REGULATOR_PBIAS for users
> using a olddefconfig or a custom .config.
>
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

Thanks,applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/host/omap_hsmmc.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 7fb0753..7086bd6 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -503,8 +503,11 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
>         host->pbias = devm_regulator_get_optional(host->dev, "pbias");
>         if (IS_ERR(host->pbias)) {
>                 ret = PTR_ERR(host->pbias);
> -               if ((ret != -ENODEV) && host->dev->of_node)
> +               if ((ret != -ENODEV) && host->dev->of_node) {
> +                       dev_err(host->dev,
> +                       "SD card detect fail? enable CONFIG_REGULATOR_PBIAS\n");
>                         return ret;
> +               }
>                 dev_dbg(host->dev, "unable to get pbias regulator %ld\n",
>                         PTR_ERR(host->pbias));
>                 host->pbias = NULL;
> --
> 1.7.9.5
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 7fb0753..7086bd6 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -503,8 +503,11 @@  static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 	host->pbias = devm_regulator_get_optional(host->dev, "pbias");
 	if (IS_ERR(host->pbias)) {
 		ret = PTR_ERR(host->pbias);
-		if ((ret != -ENODEV) && host->dev->of_node)
+		if ((ret != -ENODEV) && host->dev->of_node) {
+			dev_err(host->dev,
+			"SD card detect fail? enable CONFIG_REGULATOR_PBIAS\n");
 			return ret;
+		}
 		dev_dbg(host->dev, "unable to get pbias regulator %ld\n",
 			PTR_ERR(host->pbias));
 		host->pbias = NULL;