Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2910201rwe; Mon, 29 Aug 2022 02:27:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR54xQeuxcW6cmD/Do4ikKC+G40IydkTtsEZIbN4n478ilil+kMOXoaVAAANteGcVc99AVxh X-Received: by 2002:a05:6402:40c3:b0:442:d798:48ad with SMTP id z3-20020a05640240c300b00442d79848admr15555379edb.154.1661765240219; Mon, 29 Aug 2022 02:27:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661765240; cv=none; d=google.com; s=arc-20160816; b=vFTBsMh59ARzGbslv3u2sO9lTipWVcFMWVsYo4w5B6d8OedNBjDI4o5xcjMkkeqHaH Hl7aR3f27LiHqG4JfyBb0m/nqqyAPlQtHnqvJq5QkzYU1zfAyEBsAGbAqqZ7MQVmHJr2 hb1TWDNLpu/qgZtNPT3LUlMIfwiyznnb23WQfCdGLAfBZS3UUquUApqI3y8zKZPlOP2j om9Kn47x4n/m0DT8scZm2TrXevjEDQU7aksUY/4I6j/EbEBhbCqlsgB2TBfJWD+vOxEG gDrPynT7AJNJEC1BT6YocIt1KTE6irbKw5eDShanoOK7TVnlKtRdG6E4bdpZpjVk13MA Rcqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=SkoUiCpoaLtos4E0x642lOYDy66PcPTByQrF05aPtKw=; b=x92y4lnxhnGXBTaxtvSTXv1CdiO3HPgWZaDpcdbuCmnnDPd8oSsf30SVFygQTWYw6A MGOExVP1Y66U/Ku2UHZcmjwcW9vAo6ZAlqU9glIIsw4Beiyqe/dKnZ6lw1js9r2VN7P0 5M80kqglbM+zX8FqUTwgxjbin6QAo0t3aezaogWjc4t5YYp5C9cKfZL36xFemuMrsakN UPtpByDgaA9o7ysrVYoeWUzfUFBXfoy2xu8Dpez0J0anodkdOipljLFDS4kF5MC7jbKc 3wRMhN+sSLyL9RjXzPwYSUTVR5/7hAo10wLptq4icuynNH1y791urSQPy8aVS74N+WQB DDpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=Hq6j4yBU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wv13-20020a170907080d00b0073c14b6560bsi6482223ejb.177.2022.08.29.02.26.54; Mon, 29 Aug 2022 02:27:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=Hq6j4yBU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229853AbiH2JO3 (ORCPT + 99 others); Mon, 29 Aug 2022 05:14:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbiH2JO0 (ORCPT ); Mon, 29 Aug 2022 05:14:26 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 263395A888; Mon, 29 Aug 2022 02:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1661764463; x=1693300463; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=SkoUiCpoaLtos4E0x642lOYDy66PcPTByQrF05aPtKw=; b=Hq6j4yBUoW5re95Oy4CzPcpTQ26RwbaAN99ZAf368XHSraEQBjc82fQW 5z2+tXlOshDZY1YXJqJ4U4h8dqaFoucL2Hvecno9LZ9lXV6Xk1Y2agrkI Djn3uVDyi6KAQsNl9lBjsqxb83myxbr6PeNTV2yzgBjAA30hG0E3qWWUc sG7VdFa3saONO7495pbbGjqqsb91V8WzivM5NVLA03b8B7rtnfrefXliO PUEfEyyNHHzf4ZkNLTj7MxM9xfPvIvdisjRMc4UprBMpXxRiAxUjpZTj9 FLipomQBqa+EYvK7QAjdLX76QNKjdODrAFWB7jRhnmoe/5FVkRWa3BjMh Q==; X-IronPort-AV: E=Sophos;i="5.93,272,1654585200"; d="scan'208";a="174590204" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 29 Aug 2022 02:14:22 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Mon, 29 Aug 2022 02:14:22 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Mon, 29 Aug 2022 02:14:19 -0700 Message-ID: <578bdccee9a92dd74bb6a1b87fb5011bf7279e57.camel@microchip.com> Subject: Re: [PATCH 1/3] reset: microchip-sparx5: issue a reset on startup From: Steen Hegelund To: Michael Walle , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Lars Povlsen , Horatiu Vultur , Philipp Zabel CC: , , , , Date: Mon, 29 Aug 2022 11:14:18 +0200 In-Reply-To: <20220826115607.1148489-2-michael@walle.cc> References: <20220826115607.1148489-1-michael@walle.cc> <20220826115607.1148489-2-michael@walle.cc> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Michael, On Fri, 2022-08-26 at 13:56 +0200, Michael Walle wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know th= e content is safe >=20 > Originally this was used in by the switch core driver to issue a reset. > But it turns out, this isn't just a switch core reset but instead it > will reset almost the complete SoC. >=20 > Instead of adding almost all devices of the SoC a shared reset line, > issue the reset once early on startup. Keep the reset controller for > backwards compatibility, but make the actual reset a noop. >=20 > Suggested-by: Philipp Zabel > Signed-off-by: Michael Walle > --- > =C2=A0drivers/reset/reset-microchip-sparx5.c | 22 +++++++++++++++++----- > =C2=A01 file changed, 17 insertions(+), 5 deletions(-) >=20 > diff --git a/drivers/reset/reset-microchip-sparx5.c b/drivers/reset/reset= -microchip-sparx5.c > index 00b612a0effa..f3528dd1d084 100644 > --- a/drivers/reset/reset-microchip-sparx5.c > +++ b/drivers/reset/reset-microchip-sparx5.c > @@ -33,11 +33,8 @@ static struct regmap_config sparx5_reset_regmap_config= =3D { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .reg_stride=C2=A0=C2=A0=C2=A0= =C2=A0 =3D 4, > =C2=A0}; >=20 > -static int sparx5_switch_reset(struct reset_controller_dev *rcdev, > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 unsigned long id) > +static int sparx5_switch_reset(struct mchp_reset_context *ctx) > =C2=A0{ > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct mchp_reset_context *ctx =3D > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 container_of(rcdev, struct mchp_reset_context, rcdev); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 u32 val; >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* Make sure the core is PROTE= CTED from reset */ > @@ -54,8 +51,14 @@ static int sparx5_switch_reset(struct reset_controller= _dev *rcdev, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 1, 100); > =C2=A0} >=20 > +static int sparx5_reset_noop(struct reset_controller_dev *rcdev, > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 unsigned long id) > +{ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return 0; > +} > + > =C2=A0static const struct reset_control_ops sparx5_reset_ops =3D { > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .reset =3D sparx5_switch_reset, > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .reset =3D sparx5_reset_noop, > =C2=A0}; >=20 > =C2=A0static int mchp_sparx5_map_syscon(struct platform_device *pdev, cha= r *name, > @@ -122,6 +125,11 @@ static int mchp_sparx5_reset_probe(struct platform_d= evice *pdev) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ctx->rcdev.of_node =3D dn; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ctx->props =3D device_get_matc= h_data(&pdev->dev); >=20 > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* Issue the reset very early, our = actual reset callback is a noop. */ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 err =3D sparx5_switch_reset(ctx); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (err) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 return err; > + > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return devm_reset_controller_r= egister(&pdev->dev, &ctx->rcdev); > =C2=A0} >=20 > @@ -163,6 +171,10 @@ static int __init mchp_sparx5_reset_init(void) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return platform_driver_registe= r(&mchp_sparx5_reset_driver); > =C2=A0} >=20 > +/* > + * Because this is a global reset, keep this postcore_initcall() to issu= e the > + * reset as early as possible during the kernel startup. > + */ > =C2=A0postcore_initcall(mchp_sparx5_reset_init); >=20 > =C2=A0MODULE_DESCRIPTION("Microchip Sparx5 switch reset driver"); > -- > 2.30.2 >=20 Tested-by: Steen Hegelund on Sparx5 BR Steen