Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2357634pxb; Sat, 7 Nov 2020 20:17:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4mMNvXHMyVDjjF46DRzvVgCEP81yUPU2k+JVmWG3JbkfKwrqiVpy9GswXqff4swj99iED X-Received: by 2002:aa7:d84a:: with SMTP id f10mr9430382eds.163.1604809068688; Sat, 07 Nov 2020 20:17:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604809068; cv=none; d=google.com; s=arc-20160816; b=lre65HwrZO5VPK662mco69NsGzPcwurcpTUlxxRc02FCm/QpJDOilgsAOBdvh/AZwp QLir4plPYZMOFDcU0RaNY3bOlcEaMsWblWG86Osn16Uo9O4jSfsIs9+P7CVjbtr4S9Zx KLqBfljkqwkFTPHWTA061hY/SsWkYITTrATLzL/f6ciI2xzDycu8d9/DJd40TKTp4wg/ m7/T4nmyrSVUzvCO3YrTNJsLbHWki4gAyHiCrC94iKwso7vfOh2j/kY7R2eeBHGTR3uy B2xzd5hD3Lmso3RYKeQ2dXs78t4Hkwgaa6r3kedRKeU7NslzlFEpmPFtBUK8rOOltQDq ocvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Pa8MVYdKTduMpUuLrQkmA/sIjp6IKCQ1giy9tnXddcA=; b=CvkB37UwBCQWG9oSh3wqM2CcbXNblWagll/9edPGod9aUZhPdhjlNyu4re9cOJXqBt DrMaS6huVly/L31vsCJ/sPPwTAkOWJ4xiVCUnBawjNyJV/JesdpJ2eqDNQpV41pMxO2y uCbK+8FU+FzS/yMmJOPmuTJMBV21ddr31pmeMXG46PvVkUdsqn76vyAL/VGfl37m3CDA Ngwb7md3q7eX+AaIlRNj6TKJRw65KPVuSa0me/Al5kVKcjCdzGJUjiHajkj8vew/6IkT qpleLPmrWtYOzLuCsQIdWg9wExc8IPFfYIX4td7GvsjfjPEDXKCKY3Tb/k2xkgoqHVpE kvqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p9si4337914edm.38.2020.11.07.20.17.25; Sat, 07 Nov 2020 20:17:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727683AbgKHEO7 (ORCPT + 99 others); Sat, 7 Nov 2020 23:14:59 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:41234 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726062AbgKHEO7 (ORCPT ); Sat, 7 Nov 2020 23:14:59 -0500 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kbc6J-005rwH-Hv; Sun, 08 Nov 2020 05:14:47 +0100 Date: Sun, 8 Nov 2020 05:14:47 +0100 From: Andrew Lunn To: Sven Van Asbroeck Cc: Bryan Whitehead , David S Miller , Jakub Kicinski , Microchip Linux Driver Support , Roelof Berg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] lan743x: correctly handle chips with internal PHY Message-ID: <20201108041447.GZ933237@lunn.ch> References: <20201106134324.20656-1-TheSven73@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201106134324.20656-1-TheSven73@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 06, 2020 at 08:43:24AM -0500, Sven Van Asbroeck wrote: > From: Sven Van Asbroeck > > Commit 6f197fb63850 ("lan743x: Added fixed link and RGMII support") > assumes that chips with an internal PHY will never have a devicetree > entry. This is incorrect: even for these chips, a devicetree entry > can be useful e.g. to pass the mac address from bootloader to chip: > > &pcie { > status = "okay"; > > host@0 { > reg = <0 0 0 0 0>; > > #address-cells = <3>; > #size-cells = <2>; > > lan7430: ethernet@0 { > /* LAN7430 with internal PHY */ > compatible = "microchip,lan743x"; > status = "okay"; > reg = <0 0 0 0 0>; > /* filled in by bootloader */ > local-mac-address = [00 00 00 00 00 00]; > }; > }; > }; > > If a devicetree entry is present, the driver will not attach the chip > to its internal phy, and the chip will be non-operational. > > Fix by tweaking the phy connection algorithm: > - first try to connect to a phy specified in the devicetree > (could be 'real' phy, or just a 'fixed-link') > - if that doesn't succeed, try to connect to an internal phy, even > if the chip has a devnode > > Tested on a LAN7430 with internal PHY. I cannot test a device using > fixed-link, as I do not have access to one. > > Fixes: 6f197fb63850 ("lan743x: Added fixed link and RGMII support") > Tested-by: Sven Van Asbroeck # lan7430 > Signed-off-by: Sven Van Asbroeck > --- > > v1 -> v2: > Andrew Lunn: keep patch minimal and correct, so keep open-coded version > of of_phy_get_and_connect(). Hi Sven Why is it required to remove adapter->phy_mode? It is not clear to me what this change has to do with not looking for an internal PHY. > @@ -1063,6 +1065,7 @@ static int lan743x_phy_open(struct lan743x_adapter *adapter) > > phy_start(phydev); > phy_start_aneg(phydev); > + phy_attached_info(phydev); This also has nothing to do with the problem you are fixing. It is a sensible thing to do, but it should be a separate patch, and target net-next, since it is not a fix. Andrew