Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp460933ybx; Wed, 6 Nov 2019 03:27:00 -0800 (PST) X-Google-Smtp-Source: APXvYqy0AOGcy9/nBkLLCcasz7yXCFvDyyBAEfVPLsZ6D3u/i26cWQc1Q35hNmCRsIyTN2noyl1g X-Received: by 2002:a50:fb14:: with SMTP id d20mr1951902edq.190.1573039619892; Wed, 06 Nov 2019 03:26:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573039619; cv=none; d=google.com; s=arc-20160816; b=b/1Lo/yMV/R8HTEmdEInk605szdY71xRni2cxC5wSGNbO3X/GiSjclsShrzdWqZZbQ quJRG6ahSKrxziEb2zwAtej6Nb9YMIar/dsgy5pKSNWReAWaRvYRQLd5+vsGrBvrlKWI SS+8jEdzCs/oql0UGvz3wM+Jq7vKAakfP92zRfcj6f6E3wCEnWLBsoA545aRGDQheB5Y smqcL+lI8dMc0l2nGFrnaECI9/jshdio1RPiKTYEuar6b2kY3WMabJqbkDvCroymCNFi uw247W+UbSm5RpC5b0lqd3stPXPaDRb13/bqwcyMnnUd+JUm9YsDapSDduoJZ7vRkwYB zy8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=EJSxYk3Xvv7RTST2+V8b/wMSMrSdx/CvRd48u5DTpZ0=; b=b8u8vIz0GpaQ2EZraCIzSUrGFx5bbLAeE3wAnQJgK9jH5muYcNEDXWH0fv3QyPuQ1M Oahwplg622N3vcRevS6i4E2Nf2Fwzy2eM46Bz6/gfo5qzHipNpozpg5InSmH19zwvwxL DcgU7GSKHZl8ztKn8oS6JshdW8qPTiqkPX/yvh5t0uW7dBl6rQd2mNpPEeWKdvsNyKMs 7kuFnVA78SyJzCs+iq5jvAe5SxJ+IxaZfzeyB6QTf0kfttgTJBZdNEwKs4x6fKa8oN6A 3BC7bbVLoMaiqYvYlqAxw1wRf1TxCT2aHHt+5qIqKo7Da3EnXAjCaScM3xI7xtMrfM7E ELRw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23si1464734edc.46.2019.11.06.03.26.36; Wed, 06 Nov 2019 03:26:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731264AbfKFLZv (ORCPT + 99 others); Wed, 6 Nov 2019 06:25:51 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:51945 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725890AbfKFLZv (ORCPT ); Wed, 6 Nov 2019 06:25:51 -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: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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