devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Tomer Maimon <tmaimon77@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Nancy Yuen <yuenn@google.com>,
	Patrick Venture <venture@google.com>,
	Benjamin Fair <benjaminfair@google.com>,
	Avi Fishman <avifishman70@gmail.com>,
	Joel Stanley <joel@jms.id.au>,
	OpenBMC Maillist <openbmc@lists.ozlabs.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>
Subject: Re: [PATCH v4 3/3] reset: npcm: add NPCM reset controller driver
Date: Wed, 06 Nov 2019 12:25:42 +0100	[thread overview]
Message-ID: <aaada00902c84b9f375555ee98946631b7de3280.camel@pengutronix.de> (raw)
In-Reply-To: <CAP6Zq1iYKKkcEKt-WW3sDRJ1ktWgQug9SQc2AF473fWnooUxeQ@mail.gmail.com>

Hi Tomer,

On Wed, 2019-11-06 at 13:14 +0200, Tomer Maimon wrote:
[...]
> On Wed, 6 Nov 2019 at 12:39, Philipp Zabel <p.zabel@pengutronix.de> wrote:
[...]
> > Is this npcm750 specific? If so, you could call it npcm750_usb_reset and
> > only call it if the compatible matches.
> 
> No, we will need it also in future BMC's

Ok, thank you for clarifying.

> > 
> > +{
> > > +     struct device_node *np = pdev->dev.of_node;
> > > +     u32 mdlr, iprst1, iprst2, iprst3;
> > > +     struct regmap *gcr_regmap = NULL;
> > > +     u32 ipsrst1_bits = 0;
> > > +     u32 ipsrst2_bits = NPCM_IPSRST2_USB_HOST;
> > > +     u32 ipsrst3_bits = 0;
> > > +
> > > +     if (of_device_is_compatible(np, "nuvoton,npcm750-reset")) {
> > 
> > Better use of_match_device(). Also see above, I think this check could
> > be done in probe() already?
> > 
> I will use  of_match_device. because the nuvoton,npcm750-reset used only at
> npcm_usb_reset and in the next BMC version we will need to get other
> reset device I prefer to leave it the  npcm_usb_reset function, is it O.K?

Yes, that is fine. I would store the GCR lookup compatible string in a
per-device const struct that is accessible through of_device_id->data.

> > > +             gcr_regmap =
> > syscon_regmap_lookup_by_compatible("nuvoton,npcm750-gcr");
> > > +             if (IS_ERR(gcr_regmap)) {
> > > +                     dev_err(&pdev->dev, "Failed to find
> > nuvoton,npcm750-gcr\n");
> > > +                     return PTR_ERR(gcr_regmap);
> > > +             }
> > > +     }
> > > +     if (!gcr_regmap)
> > > +             return -ENXIO;

^ This code could then be the same for all platforms.

regards
Philipp


      parent reply	other threads:[~2019-11-06 11:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06  9:58 [PATCH v4 0/3] reset: npcm: add NPCM reset driver support Tomer Maimon
2019-11-06  9:58 ` [PATCH v4 1/3] dt-bindings: reset: add NPCM reset controller documentation Tomer Maimon
2019-11-06  9:58 ` [PATCH v4 2/3] dt-bindings: reset: Add binding constants for NPCM7xx reset controller Tomer Maimon
2019-11-06  9:58 ` [PATCH v4 3/3] reset: npcm: add NPCM reset controller driver Tomer Maimon
2019-11-06 10:39   ` Philipp Zabel
     [not found]     ` <CAP6Zq1iYKKkcEKt-WW3sDRJ1ktWgQug9SQc2AF473fWnooUxeQ@mail.gmail.com>
2019-11-06 11:25       ` Philipp Zabel [this message]

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=aaada00902c84b9f375555ee98946631b7de3280.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=avifishman70@gmail.com \
    --cc=benjaminfair@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=joel@jms.id.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=robh+dt@kernel.org \
    --cc=tmaimon77@gmail.com \
    --cc=venture@google.com \
    --cc=yuenn@google.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;
as well as URLs for NNTP newsgroup(s).