All of lore.kernel.org
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javier@osg.samsung.com>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Sangbeom Kim <sbkim73@samsung.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Lee Jones <lee.jones@linaro.org>,
	linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org
Cc: linux-mmc@vger.kernel.org,
	Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] regulator: s2mps11: Fix invalid minimal selector for buck9 supplying SD card
Date: Sun, 27 Mar 2016 21:59:41 -0400	[thread overview]
Message-ID: <56F8900D.3080203@osg.samsung.com> (raw)
In-Reply-To: <1459126489-18311-1-git-send-email-k.kozlowski@samsung.com>

Hello Krzysztof,

On 03/27/2016 08:54 PM, Krzysztof Kozlowski wrote:
> The buck9 regulator of S2MPS11 PMIC lacked minimal selector for linear
> mapping. The mapping starts from 0x40 (3 V).
>

This patch is a real fix since the the SD error goes away and the regulator
driver probes correctly now.
 
> This buck9 provides power to other regulators, including LDO13 and LDO19
> which supply the MMC2 (SD card).
>

I think it's worth mentioning that this is the case for the Exynos5422 Odroid
XU{3,4} boards. I mean, the regulators can be used for anything but are those
boards that use LDO19 as the SD card supply.

In fact, I wonder if the subject line shouldn't be changed to something like:

"regulator: s2mps11: Fix invalid min selector and voltages num for buck9"

since the real problem is that the .linear_min_sel and .n_voltages are wrong.
The fact that the SD was failing on Odroids is just a consequence of that
(although I agree that this information should be part of the commit message).

> Bootloader initializes the regulator with value of 0xff (5 V) which is
> outside of supported voltage range. When (during boot) constraints to
> buck9 were applied, the driver wrote value counting from 0x00, not 0x40.
> Effectively driver set lower voltage than required leading to SD card
> detection errors on Odroid XU3/XU4:
> 	mmc1: card never left busy state
> 	mmc1: error -110 whilst initialising SD card
> 
> Fixes: cb74685ecb39 ("regulator: s2mps11: Add samsung s2mps11 regulator driver")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> 
> ---
> 
> The issue can be reproduced on next-20160324 with
> bae4fdc88d7f7dda1 (regulator: core: Ensure we are at least in bounds
> for our constraints).
> ---
>  drivers/regulator/s2mps11.c         | 19 ++++++++++++++++++-
>  include/linux/mfd/samsung/s2mps11.h |  9 +++++++++
>  2 files changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
> index d24e2c783dc5..caeefc38ac47 100644
> --- a/drivers/regulator/s2mps11.c
> +++ b/drivers/regulator/s2mps11.c
> @@ -324,6 +324,23 @@ static struct regulator_ops s2mps11_buck_ops = {
>  	.enable_mask	= S2MPS11_ENABLE_MASK			\
>  }
>  
> +#define regulator_desc_s2mps11_buck9 {				\
> +	.name		= "BUCK9",				\
> +	.id		= S2MPS11_BUCK9,			\
> +	.ops		= &s2mps11_buck_ops,			\
> +	.type		= REGULATOR_VOLTAGE,			\
> +	.owner		= THIS_MODULE,				\
> +	.min_uV		= MIN_3000_MV,				\
> +	.uV_step	= STEP_25_MV,				\
> +	.linear_min_sel	= S2MPS11_BUCK9_MIN_VSEL,		\

I don't have a datasheet for this PMIC but I wonder if buck9 is the only
buck regulator whose minimal register value is != 0. If that's not the
case, it would be good to fix the descriptions for all other regulators.

> +	.n_voltages	= S2MPS11_BUCK9_N_VOLTAGES,		\
> +	.ramp_delay	= S2MPS11_RAMP_DELAY,			\
> +	.vsel_reg	= S2MPS11_REG_B9CTRL2,			\
> +	.vsel_mask	= S2MPS11_BUCK_VSEL_MASK,		\
> +	.enable_reg	= S2MPS11_REG_B9CTRL1,			\
> +	.enable_mask	= S2MPS11_ENABLE_MASK			\
> +}
> +
>  static const struct regulator_desc s2mps11_regulators[] = {
>  	regulator_desc_s2mps11_ldo(1, STEP_25_MV),
>  	regulator_desc_s2mps11_ldo(2, STEP_50_MV),
> @@ -371,7 +388,7 @@ static const struct regulator_desc s2mps11_regulators[] = {
>  	regulator_desc_s2mps11_buck6_10(6, MIN_600_MV, STEP_6_25_MV),
>  	regulator_desc_s2mps11_buck6_10(7, MIN_600_MV, STEP_6_25_MV),
>  	regulator_desc_s2mps11_buck6_10(8, MIN_600_MV, STEP_6_25_MV),
> -	regulator_desc_s2mps11_buck6_10(9, MIN_3000_MV, STEP_25_MV),

Maybe the regulator_desc_s2mps11_buck6_10() define should be renamed?
Since it's no longer true that can be used for buck6-10, so the name
is misleading now.

Patch looks good to me though and as I said it fixes the issue so:

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

  reply	other threads:[~2016-03-28  1:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-28  0:54 [PATCH] regulator: s2mps11: Fix invalid minimal selector for buck9 supplying SD card Krzysztof Kozlowski
2016-03-28  1:59 ` Javier Martinez Canillas [this message]
2016-03-28  3:32   ` Krzysztof Kozlowski
2016-03-28  5:35     ` Anand Moon
2016-03-28  5:37       ` Krzysztof Kozlowski
2016-03-29  9:08 ` Lee Jones
2016-03-29  9:23   ` Krzysztof Kozlowski
2016-03-29  9:40     ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56F8900D.3080203@osg.samsung.com \
    --to=javier@osg.samsung.com \
    --cc=broonie@kernel.org \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=k.kozlowski@samsung.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=sbkim73@samsung.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.