[<prev] [next>] [day] [month] [year] [list]
Message-ID: <aaada00902c84b9f375555ee98946631b7de3280.camel@pengutronix.de>
Date: Wed, 06 Nov 2019 12:25:42 +0100
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Tomer Maimon <tmaimon77@...il.com>
Cc: Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Nancy Yuen <yuenn@...gle.com>,
Patrick Venture <venture@...gle.com>,
Benjamin Fair <benjaminfair@...gle.com>,
Avi Fishman <avifishman70@...il.com>,
Joel Stanley <joel@....id.au>,
OpenBMC Maillist <openbmc@...ts.ozlabs.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>
Subject: Re: [PATCH v4 3/3] reset: npcm: add NPCM reset controller driver
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@...gutronix.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
Powered by blists - more mailing lists