Devicetree
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: "Albrecht Dreß" <albrecht.dress-KvP5wT2u2U0@public.gmane.org>
Cc: linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org
Subject: Re: [PATCH 2/3] mpc52xx/wdt: merge WDT code into the GPT
Date: Wed, 11 Nov 2009 13:11:15 -0700	[thread overview]
Message-ID: <fa686aa40911111211m41197cddl451165bebed6edd8@mail.gmail.com> (raw)
In-Reply-To: <1980629.1257928058732.JavaMail.ngmail-hrWuGRo80rRiK3oW1guXusM6rOWSkUom@public.gmane.org>

On Wed, Nov 11, 2009 at 1:27 AM, Albrecht Dreß <albrecht.dress-KvP5wT2u2U0@public.gmane.org> wrote:
> Hi Grant:
>
> Thanks a lot for your comments!
>
>> On Tue, Nov 10, 2009 at 12:41 PM, Albrecht Dreß <albrecht.dress@arcor.de>
>> > +#if defined(HAVE_MPC5200_WDT)
>> > +       /* check if this device could be a watchdog */
>> > +       if (of_get_property(ofdev->node, "fsl,has-wdt", NULL) ||
>> > +           of_get_property(ofdev->node, "has-wdt", NULL)) {
>> > +               const u32 *on_boot_wdt;
>> > +
>> > +               gpt->wdt_mode = MPC52xx_GPT_CAN_WDT;
>> > +
>> > +               /* check if the device shall be used as on-boot watchdog
>> */
>> > +               on_boot_wdt = of_get_property(ofdev->node, "wdt,on-boot",
>> NULL);
>> > +               if (on_boot_wdt) {
>> > +                       gpt->wdt_mode |= MPC52xx_GPT_IS_WDT;
>> > +                       if (*on_boot_wdt > 0 &&
>> > +                           mpc52xx_gpt_wdt_start(gpt, *on_boot_wdt) ==
>> 0)
>> > +                               dev_info(gpt->dev,
>> > +                                        "running as wdt, timeout %us\n",
>> > +                                        *on_boot_wdt);
>> > +                       else
>> > +                               dev_info(gpt->dev, "reserved as wdt\n");
>> > +               } else
>> > +                       dev_info(gpt->dev, "can function as wdt\n");
>> > +       }
>> > +#endif
>>
>> Ditto on the #if/endif
>
> I don't think it can be removed here.  Think about the following:
> - user has a dtb with fsl,has-wdt and fsl,wdt-on-boot properties and
> - disables 5200 WDT in the kernel config.
>
> Now the system refuses to use GPT0 as GPT, although the WDT functionality has been disabled.  Of course, the dts doesn't fit the kernel config now, but I think we should catch this case.

I think the behaviour should be consistent regardless of what support
is compiled into the kernel.  If the wdt-on-boot property is set, the
it does make sense for the kernel to never use it as a GPT.  Otherwise
the kernel behaviour becomes subtly different in ways non-obvious to
the user.

> Actually I tried to implement your requirements from <http://lists.ozlabs.org/pipermail/linuxppc-dev/2009-August/074595.html>:
> - fsl,has-wdt indicates that the GPT can serve as WDT;
> - any access through the wdt api to a wdt-capable gpt actually reserves it as wdt;
> - the new of property forces reserving the wdt before any gpt api function has chance to grab it as gpt.
>
> Or did I get something wrong here?

No, you got it right...  Well, I can't even remember what I said
yesterday, but this list of requirements looks sane.  :-)

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

  parent reply	other threads:[~2009-11-11 20:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-11  8:27 [PATCH 2/3] mpc52xx/wdt: merge WDT code into the GPT Albrecht Dreß
     [not found] ` <1980629.1257928058732.JavaMail.ngmail-hrWuGRo80rRiK3oW1guXusM6rOWSkUom@public.gmane.org>
2009-11-11 20:11   ` Grant Likely [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-11-10 19:41 Albrecht Dreß
2009-11-10 20:59 ` Grant Likely

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=fa686aa40911111211m41197cddl451165bebed6edd8@mail.gmail.com \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=albrecht.dress-KvP5wT2u2U0@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
    --cc=wim-IQzOog9fTRqzQB+pC5nmwQ@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