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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 EBDF0C433E0 for ; Mon, 8 Mar 2021 13:37:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A7864651DC for ; Mon, 8 Mar 2021 13:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229575AbhCHNgn (ORCPT ); Mon, 8 Mar 2021 08:36:43 -0500 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:50287 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbhCHNgU (ORCPT ); Mon, 8 Mar 2021 08:36:20 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 664655C0068; Mon, 8 Mar 2021 08:36:20 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 08 Mar 2021 08:36:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=TTahe+wXAe5+AmDWe9ALzhxYcrf llGdYAx4mFMAY3U4=; b=wBL8Efh/hN/S3EdW+ydUkJw6prLzavvukZpP7uxSNSJ Tuhqh3+Kl69a3O6iopw1sGfbccjCOtmilcXp34kqBFVCWvcGBOiz7wzehkOt9Z33 822bJyvC2rvpEL/JBZEexv1hcSoMv+cn6x1s9nws5llTJISWB2lEI1g6AtAop7Yh cqpaKrj6MpGHLktmqNcDzwoOxa+8mUYNsXJQZapt+16W4cz0B0lBNJwDludHTh7z B9d+APPE0Cp8wqSJ8ljdYl8LYisz4ooyDqYV7wVz54JI3z8CrTtPSMdqGAsdYV/u kp3wsA+UjhmaV0obtcXsZu7m5einQ01O8x6lSXJAsoQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=TTahe+ wXAe5+AmDWe9ALzhxYcrfllGdYAx4mFMAY3U4=; b=W3NlReHgtEbICdq3rDkIvU sKuGSKffHyINIE5kFVGfEAh3OYfw/EeNDTL/u4nRSW9H0nnJJL5znq+ZK74LxOGl QVdD7+HzXvknhcrbI8G7lXV44G5qJ3jCtbfxzZ4R5y7YlxLvwTMqQyEAViBe8ip9 QcI5haYhEZoddYq7P7OLpOyLE/HTmArui0/pKs2RhF4T6qCPrvL1o8b1sIJ+0Oeu mXEU4X1sw/8drC+99EUocgM3trzwdHQFJ6QUp59L0PYZt0Fs5dS5RuA8Dxo5VoXc +XlkjQcZkGovA3DWNoRjUoNv0lwf9xI92Dj6uWklSAMYWNTir7LyuJ9a8ddUOHHA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudduvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepleekgeehhfdutdeljefgleejffehfffgieejhffgueefhfdtveetgeehieeh gedunecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 608FD24005D; Mon, 8 Mar 2021 08:36:19 -0500 (EST) Date: Mon, 8 Mar 2021 14:36:17 +0100 From: Maxime Ripard To: Evgeny Boger Cc: Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring Subject: Re: [PATCH 1/2] net: allwinner: reset control support Message-ID: <20210308133617.xqbjv7jybxbbqa27@gilmour> References: <20210307031353.12643-1-boger@wirenboard.com> <20210307031353.12643-2-boger@wirenboard.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ewe555g6kvoja7ml" Content-Disposition: inline In-Reply-To: <20210307031353.12643-2-boger@wirenboard.com> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org --ewe555g6kvoja7ml Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Sun, Mar 07, 2021 at 06:13:51AM +0300, Evgeny Boger wrote: > R40 (aka V40/A40i/T3) and A10/A20 share the same EMAC IP. > However, on R40 the EMAC is gated by default. >=20 > Signed-off-by: Evgeny Boger On which device was it tested? > --- > drivers/net/ethernet/allwinner/sun4i-emac.c | 21 ++++++++++++++++++++- > 1 file changed, 20 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/et= hernet/allwinner/sun4i-emac.c > index 5ed80d9a6b9f..c0ae06dd922c 100644 > --- a/drivers/net/ethernet/allwinner/sun4i-emac.c > +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c > @@ -28,6 +28,7 @@ > #include > #include > #include > +#include > #include > =20 > #include "sun4i-emac.h" > @@ -85,6 +86,7 @@ struct emac_board_info { > unsigned int link; > unsigned int speed; > unsigned int duplex; > + struct reset_control *reset; You should align this with the rest of the other fields=20 > =20 > phy_interface_t phy_interface; > }; > @@ -791,6 +793,7 @@ static int emac_probe(struct platform_device *pdev) > struct net_device *ndev; > int ret =3D 0; > const char *mac_addr; > + struct reset_control *reset; > =20 > ndev =3D alloc_etherdev(sizeof(struct emac_board_info)); > if (!ndev) { > @@ -852,6 +855,19 @@ static int emac_probe(struct platform_device *pdev) > goto out_release_sram; > } > =20 > + reset =3D devm_reset_control_get_optional_exclusive(&pdev->dev, NULL); > + if (IS_ERR(reset)) { > + dev_err(&pdev->dev, "unable to request reset\n"); > + ret =3D -ENODEV; > + goto out_release_sram; > + } Judging from your commit log, it's not really optional for the R40. The way we usually deal with this is to have a structure associated with a new compatible and have a flag tell if that compatible requires a reset line or not. The dt binding should also be amended to allow the reset property > + db->reset =3D reset; > + ret =3D reset_control_deassert(db->reset); > + if (ret) { > + dev_err(&pdev->dev, "could not deassert EMAC reset\n"); > + goto out_release_sram; > + } > + The programming guidelines in the datasheet ask that the reset line must be deasserted before the clock in enabled. Maxime --ewe555g6kvoja7ml Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYEYoUQAKCRDj7w1vZxhR xfiWAQCmzG8cWMGjCBXi5j9wpuuEfYactSHbKResEOSEXVP79QEAl8UpKf5diHue LQQ9yJ9t3bab6YlcQkAt5TV6jLqPRwM= =/Tfm -----END PGP SIGNATURE----- --ewe555g6kvoja7ml--