Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp179301rdb; Fri, 5 Jan 2024 06:36:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHH7QvWe5kO5JQCrrs/sfZNepgNndDTGvbjFg7psyLgERrau+TTz5yGfE3XS3P253wVnAfB X-Received: by 2002:a05:6871:22c5:b0:203:ca41:6943 with SMTP id se5-20020a05687122c500b00203ca416943mr2256452oab.112.1704465413973; Fri, 05 Jan 2024 06:36:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704465413; cv=none; d=google.com; s=arc-20160816; b=VVV/X8ETHrIkdT8awXNP7tWmPM0ZjHPS9QBtebfXu740uitkpONF7hwPCrANdt/2HE AzJHstxyTHQoqNaJWLWbwdovfmmSwNQSo2tIyc6gwcxrH+nc6s/cZzztdEn2D/Z5jQoO HF0MnHlU/hRpWlNcyJOnOg3KMm4cES/dadVGX5/yZOBLU0KhhukI0nLR98fRKYTVJ3Hl gXujGlAZyImlkOai23mfUeqeJA88gJzv8goHUrGh/m5Jgc46j5JBbHxaf8jLJdcBj5QN yaXEjujh8rSqTypbDSnyJOLoRKhWPZBk378X2xKbaO4ua17Qbsk6A1Kf2XcoGBxHzE+w 70ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=izopWTWvdqzt1HzQ9a3B+UE3STlG/reta5QRNgEBykU=; fh=cgGrOi7cci1kSOREUyv1SbVgUIRSEHRS60abFB6OVF0=; b=qEz12Hj22BpQYb1IHlUz0hZrRjwH9xJowPgApprjAqriHzyia2IE/eafPF1E5RAcZa F4MmgFaVHcfY/WiUyoEi6r1ppW8mKuNO5EH/8CA5GLVd6QnmzytZemLqI1ztG55yOPht AdRj8/deypqkQeev5ZfjQ/L7EM2l/D65bUWd742fvZ9SG6DxoSriiIr3k8+swnuWxcNj UUJe66/3pJ8z9qkJqPzv07MZw3KwyitMa5/W6CdJPf/GSSy9BAVdxuJ5rId9SM/hYwHc Zk0SDf9pxPVFEm/AH/x3VDDTIp1g438LwJ1ScxzS4/itUDXZkSk35SJ1FC0Bzcn3Y7Ta OBDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=BJufwjuX; spf=pass (google.com: domain of linux-kernel+bounces-17940-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17940-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w16-20020a05620a0e9000b0077dc416a858si1874794qkm.105.2024.01.05.06.36.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 06:36:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17940-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=BJufwjuX; spf=pass (google.com: domain of linux-kernel+bounces-17940-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17940-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B26011C217C1 for ; Fri, 5 Jan 2024 14:36:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 774462DF95; Fri, 5 Jan 2024 14:36:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="BJufwjuX" X-Original-To: linux-kernel@vger.kernel.org Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00D132D7B0; Fri, 5 Jan 2024 14:36:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=izopWTWvdqzt1HzQ9a3B+UE3STlG/reta5QRNgEBykU=; b=BJufwjuXkd2K8Y6wocFOxdsPKC csMjMCug1ybY6/Lmv51EdvEHQ1myeL+3dCo1ucFwPgtxsGkkN8TU1vmwtJX3nyTobXRVTNfNzSFDl gtg6OMpPktlAJW4DUAdjbAX3Ru52VkA69gsBRTlc3pjWwAXbqya90BeEAg291X4/m3pc=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rLlJF-004Seu-Dj; Fri, 05 Jan 2024 15:36:29 +0100 Date: Fri, 5 Jan 2024 15:36:29 +0100 From: Andrew Lunn To: "Russell King (Oracle)" Cc: Claudiu , hkallweit1@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, yuiko.oshino@microchip.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: Re: [PATCH net] net: phy: micrel: populate .soft_reset for KSZ9131 Message-ID: References: <20240105085242.1471050-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Jan 05, 2024 at 09:43:22AM +0000, Russell King (Oracle) wrote: > On Fri, Jan 05, 2024 at 10:52:42AM +0200, Claudiu wrote: > > The order of PHY-related operations in ravb_open() is as follows: > > ravb_open() -> > > ravb_phy_start() -> > > ravb_phy_init() -> > > of_phy_connect() -> > > phy_connect_direct() -> > > phy_attach_direct() -> > > phy_init_hw() -> > > phydev->drv->soft_reset() > > phydev->drv->config_init() > > phydev->drv->config_intr() > > phy_resume() > > kszphy_resume() > > > > The order of PHY-related operations in ravb_close is as follows: > > ravb_close() -> > > phy_stop() -> > > phy_suspend() -> > > kszphy_suspend() -> > > genphy_suspend() > > // set BMCR_PDOWN bit in MII_BMCR > > Andrew, > > This looks wrong to me - shouldn't we be resuming the PHY before > attempting to configure it? Hummm. The opposite of phy_stop() is phy_start(). So it would be the logical order to perform the resume as the first action of phy_start(), not phy_attach_direct(). In phy_connect_direct(), we don't need the PHY to be operational yet. That happens with phy_start(). The standard says: 22.2.4.1.5 Power down The PHY may be placed in a low-power consumption state by setting bit 0.11 to a logic one. Clearing bit 0.11 to zero allows normal operation. The specific behavior of a PHY in the power-down state is implementation specific. While in the power-down state, the PHY shall respond to management transactions. So i would say this PHY is broken, its not responding to all management transactions. So in that respect, Claudiu fix is correct. But i also somewhat agree with you, this looks wrong, but in a different way to how you see it. However, moving the phy_resume() to phy_start() seems a bit risky. So i'm not sure we should actually do that. Andrew