From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75736C5DF62 for ; Wed, 6 Nov 2019 11:25:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F713206A3 for ; Wed, 6 Nov 2019 11:25:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730165AbfKFLZy (ORCPT ); Wed, 6 Nov 2019 06:25:54 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:50399 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725890AbfKFLZw (ORCPT ); Wed, 6 Nov 2019 06:25:52 -0500 Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1iSJRW-0001jd-TJ; Wed, 06 Nov 2019 12:25:42 +0100 Message-ID: Subject: Re: [PATCH v4 3/3] reset: npcm: add NPCM reset controller driver From: Philipp Zabel To: Tomer Maimon Cc: Rob Herring , Mark Rutland , Nancy Yuen , Patrick Venture , Benjamin Fair , Avi Fishman , Joel Stanley , OpenBMC Maillist , Linux Kernel Mailing List , devicetree Date: Wed, 06 Nov 2019 12:25:42 +0100 In-Reply-To: References: <20191106095832.236766-1-tmaimon77@gmail.com> <20191106095832.236766-4-tmaimon77@gmail.com> <89250d485d05d4d671203ae615ebcf514b4d6705.camel@pengutronix.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: devicetree@vger.kernel.org Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Tomer, On Wed, 2019-11-06 at 13:14 +0200, Tomer Maimon wrote: [...] > On Wed, 6 Nov 2019 at 12:39, Philipp Zabel 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