Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10035972rwr; Fri, 12 May 2023 02:56:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5jk4ir+T4MQM1fFPNd9YKxyT20vZ0u6LQjRyrZatA7cNKew0W1MwMreMUbU55ol/FMRfsJ X-Received: by 2002:a05:6a20:728d:b0:101:b080:e763 with SMTP id o13-20020a056a20728d00b00101b080e763mr10243500pzk.31.1683885369369; Fri, 12 May 2023 02:56:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683885369; cv=none; d=google.com; s=arc-20160816; b=U71aV32Xv4VOK4erhXkA/wn4yK0IURv8wOc9ZyCm5ffRvq07tQ4Ymb26wpxIQw7vj+ 0ziWD2t4t2AkzknAxTkSSx4u6i0TSmWR9qqRtlIPclwbqtyKrVhHunkpvyeM3H3L0pxs wuA6ChVcZD/H9IIjlkZO13dZKYoa385ZjIzNSqewNH8nvJwdIHRw/nW2djbIxw/F+tJG lGIEu/TaPZtozsoY6SWBRZVnMSDEfuKlQ5aKW9Z485vVGmdBHvS6G5BxADggIRCNpBp0 MGNGO9QK6l8W9pXJY4/WKmtSpU7vTXNikOJwczkLw6zJipO3TPz0Y4CNIUIHWU7+4Xri WhpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=7IRubd/9LUDaS7AZzS9MSSlrTD+Lz1RxX42jUzfFNis=; b=yqjIJgizeKqvv2S0dAKviMIsNSbtdrK+EfpNjC+ZzIjswbUv79Vyc+NuhSxZHmMjYG fiEcYIgqbd/mzmKe3OMVzwztoa3sXpKOBHZ5sutKncrE2MbUHaTLtnynZDwflrBWZ7tu ++PZxKdNA5j1p8CCYKv73A7bOv8nkiTebhjKT+fXIOgT1sOVhYhRIZ3TRMOBSbaNtpFX Aq5ASIcWiVW3lazNU8jF6t9ZJipnAb7SzP3OV4Cy40sJR0t32TTkRonr0dToBRZEQVsr E3mrFaoc3xwMPeZz9z9YfOg/Xrs6Gr2/fRdKiFT5cA/4f3ZrFjPUBv+bcDCe6oKjMM0k QBNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=qZECOHXy; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v4-20020a637a04000000b005303a7ca04bsi8790020pgc.486.2023.05.12.02.55.55; Fri, 12 May 2023 02:56:09 -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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=qZECOHXy; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240555AbjELJnA (ORCPT + 99 others); Fri, 12 May 2023 05:43:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240618AbjELJmT (ORCPT ); Fri, 12 May 2023 05:42:19 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D98811DAF; Fri, 12 May 2023 02:41:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7IRubd/9LUDaS7AZzS9MSSlrTD+Lz1RxX42jUzfFNis=; b=qZECOHXy4PsT+NcZQUsq6/3ZQH MOKcOYAQDHgL5BDNC7W37CmfNq82INs3FUVzxmJO9ofFepVuA/lmdd7B27ea+TrqCEDXOiesozFCZ HmEFwmCTtrSuoSMt8rGMCmVGI4WHY2600Dlpz88KW2NEEHdNS3lSkhvEfX3VGOEIwWFRDzyEFU/gD kNiDYQI+essXwyQRc/DqfbO0cIZNGVLvXD/9xOsGFf5Ett8di61JhVhbqio9hfLm01Wk1Oh1XdgHT 1RA11imCbi4fCSxusHES6zHE5odbSJ6sZRiFiVu7nwvhMo2yY3XDewd+M0xmXM48qt3oMc869nL4X 5mO9qzKw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:60252) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pxPHT-00085g-GI; Fri, 12 May 2023 10:41:43 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pxPHR-0004y9-Oq; Fri, 12 May 2023 10:41:41 +0100 Date: Fri, 12 May 2023 10:41:41 +0100 From: "Russell King (Oracle)" To: Yan Wang Cc: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5] net: mdiobus: Add a function to deassert reset Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Fri, May 12, 2023 at 05:28:47PM +0800, Yan Wang wrote: > > > On 5/12/2023 5:02 PM, Russell King (Oracle) wrote: > > On Fri, May 12, 2023 at 03:08:53PM +0800, Yan Wang wrote: > > > + gpiod_set_value_cansleep(reset, gpiod_is_active_low(reset)); > > > + fsleep(reset_assert_delay); > > > + gpiod_set_value_cansleep(reset, !gpiod_is_active_low(reset)); > > Andrew, one of the phylib maintainers and thus is responsible for code > > in the area you are touching. Andrew has complained about the above > > which asserts and then deasserts reset on two occasions now, explained > > why it is wrong, but still the code persists in doing this. > > > > I am going to add my voice as another phylib maintainer to this and say > > NO to this code, for the exact same reasons that Andrew has given. > > > > You now have two people responsible for the code in question telling > > you that this is the wrong approach. > > > > Until this is addressed in some way, it is pointless you posting > > another version of this patch. > > > > Thanks. > > > I'm very sorry, I didn't have their previous intention. > The meaning of the two assertions is reset and reset release. > If you believe this is the wrong method, please ignore it. As Andrew has told you twice: We do not want to be resetting the PHY while we are probing the bus, and he has given one reason for it. The reason Andrew gave is that hardware resetting a PHY that was not already in reset means that any link is immediately terminated, and the PHY has to renegotiate with its link partner when your code subsequently releases the reset signal. This is *not* the behaviour that phylib maintainers want to see. The second problem that Andrew didn't mention is that always hardware resetting the PHY will clear out any firmware setup that has happened before the kernel has been booted. Again, that's a no-no. The final issue I have is that your patch is described as "add a function do *DEASSERT* reset" not "add a function to *ALWAYS* *RESET*" which is what you are actually doing here. So the commit message and the code disagree with what's going on - the summary line is at best misleading. If your hardware case is that the PHY is already in reset, then of course you don't see any of the above as a problem, but that is not universally true - and that is exactly why Andrew is bringing this up. There are platforms out there where the reset is described in the firmware hardware description, *but* when the kernel boots, the reset signal is already deasserted. Raising it during kernel boot as you are doing will terminate the PHY's link with the remote end, and then deasserting it will cause it to renegotiate. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!