From: Javier Martinez Canillas <javier@osg.samsung.com>
To: Doug Anderson <dianders@chromium.org>,
Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Markus Reichl" <m.reichl@fivetechno.de>,
"Anand Moon" <linux.amoon@gmail.com>,
linux-samsung-soc <linux-samsung-soc@vger.kernel.org>,
"Alim Akhtar" <alim.akhtar@samsung.com>,
"Marek Szyprowski" <m.szyprowski@samsung.com>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Ulf Hansson" <ulf.hansson@linaro.org>,
"Heiko Stübner" <heiko@sntech.de>
Subject: Re: [PATCH] mmc: pwrseq: Use highest priority for eMMC restart handler
Date: Thu, 22 Oct 2015 18:07:58 +0200 [thread overview]
Message-ID: <562909DE.1000202@osg.samsung.com> (raw)
In-Reply-To: <CAD=FV=VZJ9Tc4G-Xiw60DmfC4izU_6dVwwa0N0ePM0eaJfcqkg@mail.gmail.com>
Hello Doug,
On 10/22/2015 05:34 PM, Doug Anderson wrote:
> Krzysztof,
>
> On Wed, Oct 21, 2015 at 6:43 PM, Krzysztof Kozlowski
> <k.kozlowski@samsung.com> wrote:
>> I think at least one platform may be affected because it used
>> mmc-pwrseq-emmc and gpio-restart.
>>
>> Look at rk3288-veyron.dtsi.
>>
>> Both of restart handlers had the priority of 129 which means that the
>> order of execution depends on probing sequence. Now you will make the
>> sequence strict - first mmc then gpio.
>>
>> You seems convinced that this is not a problem... I don't know. I would
>> prefer test this on affected platforms before risking to break them.
>> It's annoying if fix for one SoC breaks another.
>
> Assuming I'm understanding things properly, veyron isn't using 129 as
> a priority. In the dts file:
>
> gpio-restart {
> compatible = "gpio-restart";
> gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
> pinctrl-names = "default";
> pinctrl-0 = <&ap_warm_reset_h>;
> priority = <200>;
> };
>
> ...so it overrides the default 129 with 200. Ah, but Javier already
> pointed that out in his reply.
>
>>> Since the current mmc_pwrseq_emmc_reset_nb notifier priority is 129,
>>> eMMC reset will not work if one of the platforms you mentioned needs
>>> this since the system restart handler with prio 192 will be executed
>>> before the eMMC one, leaving the eMMC in an unknown state on reboot.
>>
>> And now you will "fix this" by making eMMC working correctly. So let's
>> make it straight:
>> 1. Previously the eMMC could be left on these platforms in an unknown
>> state (because emmc handler was not executed).
>> 2. No one complained! Which could mean that in fact this was working fine...
>> 3. Now you will change it.
>> 4. Maybe someone will complain?
>
> On veyron boards the reset shouldn't hurt. The eMMC reset will
> actually get asserted at reset anyway since the reset will reset GPIO
> states and the default GPIO state for the eMMC line asserts reset.
>
Exactly, that was my point. Either the board is wired to do a eMMC reset
on reboot (like veyron), the SoC ROM bootloader has some logic to reset
the eMMC or the boards requires the kernel to do a eMMC reset so the hw
is in a known state to read from the eMMC on reboot (like Odroids).
So that's why I was arguing that it's very unlikely that doing an eMMC
reset could cause issues in other boards... but Krzysztof is correct
that you can't be sure without testing.
> OK, I just picked this onto Heiko's somewhat "stable-tree"
> (v4.3-rc3-876-g6509232) from
> <https://github.com/mmind/linux-rockchip/>. I put printouts in
> __mmc_pwrseq_emmc_reset() to confirm it was getting called. I then
> rebooted. I then saw:
>
> [ 36.175732] reboot: Restarting system
> [ 36.179400] DOUG: resetting emmc
> [ 36.182829] DOUG: resetting emmc done
>
> ...and the reboot worked normally (which means that the GPIO restart
> got called since otherwise I would have gotten TPM errors).
>
> So I'd say that for rk3288-veyron-jerry:
>
> Tested-by: Douglas Anderson <dianders@chromium.org>
>
Thanks a lot for testing!
>
> Note that personally I would only choose the "highest" priority as an
> absolute last resort. Leaving a little extra slack in there means
> that when the next person comes up with a really good reason to run
> before you do that they can do it without changing your code. All
> good BASIC programmers know to skip "10" in their first version for
> just this reason. ;)
>
> If I were to pick a number, I suppose I'd pick something like "220",
> but that's pretty arbitrary. I would have picked 200 except that it
> appears that would race with veyron's choice.
>
Yes, I actually gave some thought about choosing a number since I didn't
want to come with another arbitrary one. That's why I tried to understand
the policy as I mentioned before but I didn't find anything besides the
values listed in the register_restart_handler() doc: 0, 128 and 255.
It seems that most default system restart handlers use 128 and that's
the reason why gpio-restart and mmc-pwrseq-emmc use 129 and other restart
handlers that can be registered via DT use 192 (which is in the middle of
128 and 255).
So I actually thought to use a number in between 192 and 255 (i.e: 220)
but then there could be another platform that uses 221 instead of 200
so eMMC restart won't work there. That's why I finally chose the highest.
Do you know why the priority 200 was chosen for veyron gpi-restart ooi?
> -Doug
> --
Best regards,
--
Javier Martinez Canillas
Open Source Group
Samsung Research America
next prev parent reply other threads:[~2015-10-22 16:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-21 15:15 [PATCH] mmc: pwrseq: Use highest priority for eMMC restart handler Javier Martinez Canillas
2015-10-22 0:36 ` Krzysztof Kozlowski
2015-10-22 1:20 ` Javier Martinez Canillas
2015-10-22 1:43 ` Krzysztof Kozlowski
2015-10-22 2:52 ` Javier Martinez Canillas
2015-10-22 4:14 ` Alim Akhtar
2015-10-22 10:07 ` Marek Szyprowski
2015-10-22 11:02 ` Javier Martinez Canillas
2015-10-22 5:03 ` Anand Moon
2015-10-22 8:36 ` Javier Martinez Canillas
2015-10-22 9:42 ` Anand Moon
2015-10-22 15:34 ` Doug Anderson
2015-10-22 15:51 ` Heiko Stübner
2015-10-22 16:07 ` Javier Martinez Canillas [this message]
2015-10-22 17:33 ` Doug Anderson
2015-10-22 17:53 ` Javier Martinez Canillas
2015-10-24 4:55 ` Alim Akhtar
2015-10-27 10:10 ` Ulf Hansson
2015-10-28 11:02 ` Javier Martinez Canillas
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=562909DE.1000202@osg.samsung.com \
--to=javier@osg.samsung.com \
--cc=acourbot@nvidia.com \
--cc=alim.akhtar@samsung.com \
--cc=dianders@chromium.org \
--cc=heiko@sntech.de \
--cc=k.kozlowski@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux.amoon@gmail.com \
--cc=m.reichl@fivetechno.de \
--cc=m.szyprowski@samsung.com \
--cc=ulf.hansson@linaro.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).