mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>,
	Grant Likely <grant.likely@linaro.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-omap <linux-omap@vger.kernel.org>,
	Nishanth Menon <nm@ti.com>, Tero Kristo <t-kristo@ti.com>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states
Date: Mon, 29 Aug 2016 17:39:22 -0700	[thread overview]
Message-ID: <20160830003922.462byzmpnq277h2u@atomide.com> (raw)
In-Reply-To: <CAL_JsqK=JLN+ujvyVv62E-d1sB_DgeZCGP5Pddt9ohPkypHdEg@mail.gmail.com>

* Rob Herring <robh+dt@kernel.org> [160829 17:24]:
> On Mon, Aug 29, 2016 at 5:35 PM, Tony Lindgren <tony@atomide.com> wrote:
> > It seems we can use the ePAPR 1.1 status fail-sss to do this.
> > Quoting "Table 2-4 Values for status property" we have "fail-sss":
> >
> > "Indicates that the device is not operational. A serious error was
> >  detected in the device and it is unlikely to become operational
> >  without repair. The sss portion of the value is specific to the
> >  device and indicates the error condition detected."
> 
> I had read this as 'sss' is just 3 characters, but I guess that doesn't matter.

Yeah I'd assume it does not matter for the length.

> > We can handle these fail states can be handled in a generic
> > way. So let's introduce a generic status = "fail-" that
> > describes a situation where a device driver probe should just
> > shut down or idle the device if possible and then bail out.
> > This allows the SoC variant and board specific dts files to set
> > the status as needed.
> >
> > The suggested usage in a device driver probe is:
> >
> > static int foo_probe(struct platform_device *pdev)
> > {
> >         int err;
> >         const char *status;
> >         ...
> >
> >         pm_runtime_enable(&pdev->dev);
> >         pm_runtime_get_sync(&pdev->dev);
> >         pm_runtime_use_autosuspend(&pdev->dev);
> >         ...
> >
> >         /* Configure device, load firmware, idle device */
> >         ...
> >
> >         if (of_device_is_incomplete(pdev->dev.of_node, status)) {
> 
> &status

Oops, I guess I should compile test the example.

> >                 if (!strcmp("hw-incomplete-pins", status)) {
> >                         dev_info(&pdev->dev,
> >                                  "Unusable hardware: Not pinned out\n");
> >                         err = -ENODEV;
> >                         goto out;
> >                 }
> >                 if (!strcmp("hw-missing-daughter-card")) {
> >                         err = -EPROBE_DEFER;
> 
> This implies we're going to change this on the fly? I guess
> disabled->okay can already happen.

Well let's assume the bootloader sets some i2c controlled daughter
board with "fail-hw-missing-daughter-card", then in theory kernel
could probe it if it pops up on the i2c bus later on. Not sure if
we want to do this, but it seems we could..

> > +static bool __of_device_is_incomplete(const struct device_node *device,
> > +                                     const char **status)
> > +{
> > +       const char *s, *m = "fail-";
> > +       int slen, mlen;
> > +
> > +       if (!device)
> > +               return false;
> > +
> > +       s = __of_get_property(device, "status", &slen);
> 
> You can use the string helper function here (or is the lock a problem?).

I'll check.

> Overall, seems okay to me.

OK thanks for looking.

Regards,

Tony

  reply	other threads:[~2016-08-30  0:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29 22:35 Tony Lindgren
2016-08-30  0:23 ` Rob Herring
2016-08-30  0:39   ` Tony Lindgren [this message]
2016-08-31 17:47     ` Tony Lindgren
2016-08-31 20:50 ` Frank Rowand
2016-08-31 21:41   ` Tony Lindgren
2016-09-08 13:38     ` Rob Herring
2016-09-08 14:20       ` Nishanth Menon
2016-09-08 15:58       ` Tony Lindgren
2016-09-08 19:09         ` Frank Rowand
2016-09-08 19:17           ` Frank Rowand
2016-09-08 20:19             ` Tony Lindgren
2016-09-08 19:05       ` Frank Rowand
2016-09-09  2:43         ` Rob Herring
2016-09-09 14:10           ` Tom Rini
2016-09-10  1:11             ` Matthijs van Duin
2016-09-12 13:35               ` Tom Rini
2016-09-12 13:46                 ` Matthijs van Duin
2016-09-12 13:49                   ` Tom Rini
2016-09-12 13:38               ` Tom Rini

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=20160830003922.462byzmpnq277h2u@atomide.com \
    --to=tony@atomide.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=grant.likely@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=robh+dt@kernel.org \
    --cc=t-kristo@ti.com \
    --cc=trini@konsulko.com \
    /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

all inboxes | Powered by JetHome®