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=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 3E42DC4743C for ; Mon, 7 Jun 2021 08:15:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0A7BE610A1 for ; Mon, 7 Jun 2021 08:15:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A7BE610A1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rvSrCeOQvYMpvoeFLo9L1ptpbXVCRqQbvPH61N/vniQ=; b=JJCSt1xmmIFz42 oEpLlE245R29A7N1RIH9nOJgpcJh8zYGrJjiCrjy7tfTdKtJ5/4fwJeqmkmk1R5KhiuiBvD9TuHRh Hse9DLE4iwgHC6h3lZTFBTZm+t2aizt1SwjGTeNF/b7e6b/g6a3vWTTXMrz9/aUPn7maU3RnowpiP pbOqbhNvxx0BDjEkeKlBhJr7E+MZIpPcbFGjWCtuj3wlK5q3Go6kd21Vylz+Vj7KGyYL6KXezuevN jLOlDZy+dbW5z1F47RLzfxGno5VqF4V8R/aYugwAONysyOw98QetcJN1s2fsTf869xazhRnVX/WfH BR/UnzyNIrfKs5Yt6k7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqAOh-002ED2-9m; Mon, 07 Jun 2021 08:14:11 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqAOZ-002E98-3n for linux-arm-kernel@lists.infradead.org; Mon, 07 Jun 2021 08:14:07 +0000 Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqAOO-0002eo-8s; Mon, 07 Jun 2021 10:13:52 +0200 Received: from pza by lupine with local (Exim 4.92) (envelope-from ) id 1lqAOM-0000nj-Qq; Mon, 07 Jun 2021 10:13:50 +0200 Message-ID: Subject: Re: [PATCH net-next v3 02/10] net: sparx5: add the basic sparx5 driver From: Philipp Zabel To: Steen Hegelund , "David S. Miller" , Jakub Kicinski Cc: Andrew Lunn , Russell King , Microchip Linux Driver Support , Alexandre Belloni , Madalin Bucur , Mark Einon , Masahiro Yamada , Arnd Bergmann , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bjarni Jonasson , Lars Povlsen Date: Mon, 07 Jun 2021 10:13:50 +0200 In-Reply-To: References: <20210604085600.3014532-1-steen.hegelund@microchip.com> <20210604085600.3014532-3-steen.hegelund@microchip.com> <6a1500fb623e6513e39a468ac53d1caf6a2cf7c5.camel@pengutronix.de> User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 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-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210607_011403_187485_93E0EE5C X-CRM114-Status: GOOD ( 26.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 2021-06-07 at 09:34 +0200, Steen Hegelund wrote: > Hi Philipp, > > Thanks for your comments. > > On Fri, 2021-06-04 at 11:28 +0200, Philipp Zabel wrote: > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > > > Hi Steen, > > > > On Fri, 2021-06-04 at 10:55 +0200, Steen Hegelund wrote: > > > This adds the Sparx5 basic SwitchDev driver framework with IO range > > > mapping, switch device detection and core clock configuration. > > > > > > Support for ports, phylink, netdev, mactable etc. are in the following > > > patches. > > > > > > Signed-off-by: Steen Hegelund > > > Signed-off-by: Bjarni Jonasson > > > Signed-off-by: Lars Povlsen > > > --- > > > drivers/net/ethernet/microchip/Kconfig | 2 + > > > drivers/net/ethernet/microchip/Makefile | 2 + > > > drivers/net/ethernet/microchip/sparx5/Kconfig | 9 + > > > .../net/ethernet/microchip/sparx5/Makefile | 8 + > > > .../ethernet/microchip/sparx5/sparx5_main.c | 746 +++ > > > .../ethernet/microchip/sparx5/sparx5_main.h | 273 + > > > .../microchip/sparx5/sparx5_main_regs.h | 4642 +++++++++++++++++ > > > 7 files changed, 5682 insertions(+) > > > create mode 100644 drivers/net/ethernet/microchip/sparx5/Kconfig > > > create mode 100644 drivers/net/ethernet/microchip/sparx5/Makefile > > > create mode 100644 drivers/net/ethernet/microchip/sparx5/sparx5_main.c > > > create mode 100644 drivers/net/ethernet/microchip/sparx5/sparx5_main.h > > > create mode 100644 drivers/net/ethernet/microchip/sparx5/sparx5_main_regs.h > > > > > [...] > > > diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c > > > b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c > > > new file mode 100644 > > > index 000000000000..73beb85bc52d > > > --- /dev/null > > > +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c > > > @@ -0,0 +1,746 @@ > > [...] > > > +static int mchp_sparx5_probe(struct platform_device *pdev) > > > +{ > > [...] > > > + > > > + sparx5->reset = devm_reset_control_get_shared(&pdev->dev, "switch"); > > > + if (IS_ERR(sparx5->reset)) { > > > > Could you use devm_reset_control_get_optional_shared() instead of > > ignoring this error? That would just return NULL if there's no "switch" > > reset specified in the device tree. > > Yes. That sounds like a good idea. I assume that the devm_reset_control_get_optional_shared() > would also return null if another driver has already performed the reset? It returns the same (shared) reset control. But the following reset_control_reset() [1] is a no-op if the control has already triggered once. If multiple drivers need to coordinate to trigger the reset more than once (for example once after suspend/resume), both have to use reset_control_rearm() [2]. [1] https://www.kernel.org/doc/html/latest/driver-api/reset.html#c.reset_control_reset [2] https://www.kernel.org/doc/html/latest/driver-api/reset.html#c.reset_control_rearm regards Philipp _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel