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=-13.8 required=3.0 tests=BAYES_00, 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 A7A13C4743C for ; Mon, 7 Jun 2021 08:14:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 87356610A1 for ; Mon, 7 Jun 2021 08:14:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230220AbhFGIPw convert rfc822-to-8bit (ORCPT ); Mon, 7 Jun 2021 04:15:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbhFGIPv (ORCPT ); Mon, 7 Jun 2021 04:15:51 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 600A2C061787 for ; Mon, 7 Jun 2021 01:14:00 -0700 (PDT) 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> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT 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-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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