Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp669473pxu; Tue, 6 Oct 2020 16:30:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymGQ0KevPUJh5n578CLDIVxHifkbww8KOycSgcWoypBfa7ze00+U7VOkNBjWPqsXjSKiJM X-Received: by 2002:a17:906:4e06:: with SMTP id z6mr468810eju.370.1602027012950; Tue, 06 Oct 2020 16:30:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602027012; cv=none; d=google.com; s=arc-20160816; b=ikt74bYzb75ajwA7efpSTw8lcsNRBdwo8l3wtvUEE7oShwjp1Jo1De3kmGaQVeX62R AYdL0F3EjSNpB/nt2NN2lFFrTvf1tHhd6A3GqwnbqNyadATouEVmnVQ2EEL3JKUb/0i/ 8IoMW3ncmdMsW5TB0bOJuFzfyRadXQ1OtOJPAq6ygporRAFUekU7KShRHGQIP2jYRdBx Xe+84cz7sYb1hihRL6tukmxO2v/PA8eSpl4MGy+JrJSE+btoGzv6nRagTCgsFdSIq+57 NtwJHGYp3KPc5sZ96N2d6YLPzl7CeWtIpS1/RXOeF8mCH3PcdblAICSNPqSbtTiblY1s I5nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=FccgklG4D86mal2voz8y6nqzxFuXB4G9oO3RegYUDes=; b=bFd+ei9g11dUmzk5JeJwG1z/h+/ElxoxvfpE6F80oMPGPTbpCLZcRUy0UJvVHKNeD+ 2Zhr/9Int5qtUVBOYtB1p6UU+4N2fD52xrNoIfR1+hdYTkINn/Q1+rC4nBLKV02r0XIg ipre86evnicJx2Z8xm8ZQP81M4pkEh5u26BJ/BtS5abBnlbZEU3E9DOhnFQ7hcY52+59 A8znbsNQ7/1S+H2IsxqnD4aG/QfLT/aM4JiFMke3Hw5zlqYGaJDX6aEbta/8KheUtxRX SZSw1sDX+eExH3bHT1+MGMIocjivpx+MPAHnFHejdo8WZwI92QSvchVcmGF2JTCydz1V JFCg== 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 dk22si76914edb.258.2020.10.06.16.29.50; Tue, 06 Oct 2020 16:30:12 -0700 (PDT) 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 S1726841AbgJFWYU (ORCPT + 99 others); Tue, 6 Oct 2020 18:24:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726171AbgJFWYU (ORCPT ); Tue, 6 Oct 2020 18:24:20 -0400 Received: from mail-out.m-online.net (mail-out.m-online.net [IPv6:2001:a60:0:28:0:1:25:1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5ACCC061755; Tue, 6 Oct 2020 15:24:19 -0700 (PDT) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4C5X7k3F8Tz1s8vN; Wed, 7 Oct 2020 00:24:17 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4C5X7j2nldz1qql5; Wed, 7 Oct 2020 00:24:17 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id Y9zUkKaVGMCi; Wed, 7 Oct 2020 00:24:14 +0200 (CEST) X-Auth-Info: Ii+nhy4Y3fudnAwmzlaCA1OAbSKRBjLZTPNCq8y+MYw= Received: from [IPv6:::1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Wed, 7 Oct 2020 00:24:14 +0200 (CEST) Subject: Re: PHY reset question To: Florian Fainelli , Oleksij Rempel , Andrew Lunn Cc: David Jander , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , mkl@pengutronix.de References: <20201006080424.GA6988@pengutronix.de> <2cc5ea02-707e-dbb5-c081-4c5202bd5815@gmail.com> <42d4c4b2-d3ea-9130-ef7f-3d1955116fdc@denx.de> <0687984c-5768-7c71-5796-8e16169f5192@gmail.com> From: Marek Vasut Message-ID: <59dced0b-3630-3a40-435a-bfa99e23df0e@denx.de> Date: Wed, 7 Oct 2020 00:24:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <0687984c-5768-7c71-5796-8e16169f5192@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/6/20 11:11 PM, Florian Fainelli wrote: > > > On 10/6/2020 1:24 PM, Marek Vasut wrote: >> On 10/6/20 9:36 PM, Florian Fainelli wrote: >> [...] >>>> - Use compatible ("compatible = "ethernet-phy-id0022.1560") in the >>>> devicetree, >>>>     so that reading the PHYID is not needed >>>>     - easy to solve. >>>>     Disadvantage: >>>>     - losing PHY auto-detection capability >>>>     - need a new devicetree if different PHY is used (for example in >>>> different >>>>       board revision) >>> >>> Or you can punt that to the boot loader to be able to tell the >>> difference and populate different compatible, or even manage the PHY >>> reset to be able to read the actual PHY OUI. To me that is still the >>> best solution around. >> >> Wasn't there some requirement for Linux to be bootloader-independent ? > > What kind of dependency does this create here? The fact that Linux is > capable of parsing a compatible string of the form > "ethernet-phyAAAA.BBBB" is not something that is exclusively applicable > to Linux. Linux just so happens to support that, but so could FreeBSD or > any OS for that matter. > > This is exactly the way firmware should be going, that is to describe > accurately the hardware, while making the life of the OS much easier > when it can. If we supported ACPI that is exactly what would have to > happen IMHO. I should have been more specific, I meant the part where bootloader should handle the PHY reset. If the kernel code depends on the fact that the bootloader did PHY reset, then it depends on the bootloader behavior, and I think that used to be frowned upon. >> Some systems cannot replace their bootloaders, e.g. if the bootloader is >> in ROM, so this might not be a solution. > > It is always possible to chain load a field updateable boot loader Not always, but that's another discussion. >, and > even when that is not desirable you could devise a solution that allows > to utilize say a slightly different DTB that you could append to the > kernel. Again, if you want to use strictly the same DTB, then you have > to do what I just suggested and have the boot loader absorb some of this > complexit That sounds like moving the problem one level down without really solving it, the bootloader will have this exact same problem -- how does it determine that the PHY needs reset if it cannot reads its ID ? >>>> - modify PHY framework to deassert reset before identifying the PHY. >>>>     Disadvantages? >> >> If this happens on MX6 with FEC, can you please try these two patches? >> >> https://patchwork.ozlabs.org/project/netdev/patch/20201006135253.97395-1-marex@denx.de/ >> >> >> https://patchwork.ozlabs.org/project/netdev/patch/20201006202029.254212-1-marex@denx.de/ >> > > Your patches are not scaling across multiple Ethernet MAC drivers > unfortunately, so I am not sure this should be even remotely considered > a viable solution. Sorry for that . Since Oleksij was running into this problem on MX6 and I had similar issue on MX6 with LAN8710 PHY, I thought this might be helpful.