stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Sangbeom Kim <sbkim73@samsung.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-mmc@vger.kernel.org,
	Javier Martinez Canillas <javier@osg.samsung.com>,
	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: Tue, 29 Mar 2016 10:08:56 +0100	[thread overview]
Message-ID: <20160329090856.GB8659@x1> (raw)
In-Reply-To: <1459126489-18311-1-git-send-email-k.kozlowski@samsung.com>

On Mon, 28 Mar 2016, Krzysztof Kozlowski wrote:

> The buck9 regulator of S2MPS11 PMIC lacked minimal selector for linear
> mapping. The mapping starts from 0x40 (3 V).
> 
> This buck9 provides power to other regulators, including LDO13 and LDO19
> which supply the MMC2 (SD card).
> 
> 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/include/linux/mfd/samsung/s2mps11.h b/include/linux/mfd/samsung/s2mps11.h
> index b288965e8101..3937a932bfe0 100644
> --- a/include/linux/mfd/samsung/s2mps11.h
> +++ b/include/linux/mfd/samsung/s2mps11.h
> @@ -173,10 +173,19 @@ enum s2mps11_regulators {
>  
>  #define S2MPS11_LDO_VSEL_MASK	0x3F
>  #define S2MPS11_BUCK_VSEL_MASK	0xFF
> +#define S2MPS11_BUCK9_MIN_VSEL	0x40
>  #define S2MPS11_ENABLE_MASK	(0x03 << S2MPS11_ENABLE_SHIFT)
>  #define S2MPS11_ENABLE_SHIFT	0x06
>  #define S2MPS11_LDO_N_VOLTAGES	(S2MPS11_LDO_VSEL_MASK + 1)
>  #define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)
> +/*
> + * Buck9 supports only 32 voltages (values from 0x40 to 0x5F) but bootloader
> + * initializes the register with value of 0xff so when probing this would
> + * cause a failure (Odroid XU3):
> + *	vdd_2.8v_ldo: failed to get the current voltage(-22)
> + * Instead pretend we support up to 0xff (5 V).
> + */
> +#define S2MPS11_BUCK9_N_VOLTAGES	192

Err... NACK.

Please go and fix the bootloader instead of hacking the kernel.

>  #define S2MPS11_RAMP_DELAY	25000		/* uV/us */
>  
>  #define S2MPS11_CTRL1_PWRHOLD_MASK	BIT(4)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  parent reply	other threads:[~2016-03-29  9:09 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
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 [this message]
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=20160329090856.GB8659@x1 \
    --to=lee.jones@linaro.org \
    --cc=broonie@kernel.org \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=javier@osg.samsung.com \
    --cc=k.kozlowski@samsung.com \
    --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 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).