devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Giuseppe CAVALLARO <peppe.cavallaro-qxv4g6HH51o@public.gmane.org>
To: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Peter Griffin
	<peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	srinivas.kandagatla-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	maxime.coquelin-qxv4g6HH51o@public.gmane.org,
	patrice.chotard-qxv4g6HH51o@public.gmane.org,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Youssef TRIKI <youssef.triki-qxv4g6HH51o@public.gmane.org>
Subject: Re: [PATCH 2/5] regulator: st-flashss: Add a regulator driver for flashss vsense.
Date: Wed, 13 Apr 2016 09:59:00 +0200	[thread overview]
Message-ID: <570DFC44.8060408@st.com> (raw)
In-Reply-To: <20160413061514.GI14664-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>

On 4/13/2016 8:15 AM, Mark Brown wrote:
>> >+static void st_get_satinize_powerup_voltage(struct st_vsense *vsense)
>> >+{
>> >+	void __iomem *ioaddr = vsense->ioaddr;
>> >+	u32 value = readl_relaxed(ioaddr);
>> >+
>> >+	dev_dbg(vsense->dev, "Initial start-up value: (0x%08x)\n", value);
>> >+
>> >+	/* Sanitize voltage values forcing what is provided from start-up */
>> >+	if (value & TOP_VSENSE_CONFIG_LATCHED_PSW_EMMC)
>> >+		value |= TOP_VSENSE_CONFIG_REG_PSW_EMMC;
>> >+	else
>> >+		value &= ~TOP_VSENSE_CONFIG_REG_PSW_EMMC;
>> >+
>> >+	if (value & TOP_VSENSE_CONFIG_LATCHED_PSW_NAND)
>> >+		value |= TOP_VSENSE_CONFIG_REG_PSW_NAND;
>> >+	else
>> >+		value &= ~TOP_VSENSE_CONFIG_REG_PSW_NAND;
>> >+
>> >+	if (value & TOP_VSENSE_CONFIG_LATCHED_PSW_SPI)
>> >+		value |= TOP_VSENSE_CONFIG_REG_PSW_SPI;
>> >+	else
>> >+		value &= ~TOP_VSENSE_CONFIG_REG_PSW_SPI;
> This looks like a very complicated way of writing
>
> 	value &= TOP_VSENSE_CONFIG_LATCHED_PSW_SPI |
> 		TOP_VSENSE_CONFIG_LATCHED_PSW_NAND |
> 		TOP_VSENSE_CONFIG_REG_PSW_EMMC
>
> or am I missing something?  Why do we need to do this anyway, it's very
> surprsing?
>

This functions is to sanitize the vsense voltages when the regulator
is probed and in some circumstances the reset value of this register
does not reflect the hw status/config. For example, by default, after
the reset, the bit 0 is set so the EMMC, inside the flash subsystem,
is supposed to operate at 3v3. But the latched bit 24 can be 0 on
a platform where it is actually set at 1v8.
So the bit 0 must be reset to keep this coherent and to allow MMC
framework to properly setup the Vdd when the framework starts.

Hoping this can help.

Regards
peppe
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-04-13  7:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12 15:16 [PATCH 0/5] Add st-flashss vsense regulator driver Peter Griffin
2016-04-12 15:16 ` [PATCH 1/5] regulator: st-flashss: Add DT binding documentation for flashss regulator Peter Griffin
2016-04-18 16:53   ` Rob Herring
2016-04-12 15:16 ` [PATCH 2/5] regulator: st-flashss: Add a regulator driver for flashss vsense Peter Griffin
     [not found]   ` <1460474204-5351-3-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-04-13  6:15     ` Mark Brown
     [not found]       ` <20160413061514.GI14664-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-04-13  7:59         ` Giuseppe CAVALLARO [this message]
     [not found]           ` <570DFC44.8060408-qxv4g6HH51o@public.gmane.org>
2016-04-13 17:23             ` Mark Brown
     [not found]               ` <20160413172318.GC29471-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-04-14 14:15                 ` Giuseppe CAVALLARO
     [not found]                   ` <570FA606.4070908-qxv4g6HH51o@public.gmane.org>
2016-04-14 15:25                     ` Mark Brown
2016-04-12 15:16 ` [PATCH 3/5] MAINTAINERS: Add st-flashss driver to STi section Peter Griffin
2016-04-12 15:16 ` [PATCH 4/5] ARM: multi_v7_defconfig: Enable flashss regulator driver Peter Griffin
2016-04-12 15:16 ` [PATCH 5/5] ARM: STi: DT: STiH407: Add the flashss voltage regulator DT node Peter Griffin

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=570DFC44.8060408@st.com \
    --to=peppe.cavallaro-qxv4g6hh51o@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=maxime.coquelin-qxv4g6HH51o@public.gmane.org \
    --cc=patrice.chotard-qxv4g6HH51o@public.gmane.org \
    --cc=peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=srinivas.kandagatla-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=youssef.triki-qxv4g6HH51o@public.gmane.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).