Re: [PATCH v4 3/3] reset: npcm: add NPCM reset controller driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx> 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




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux