Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1358395rwb; Wed, 16 Nov 2022 16:32:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf5MewtbBsPeJmLPrw9TABAu99mstuCwsx/rdlP2V6UDzRq6LmoLo/vtKpLxw1dtp8304rpa X-Received: by 2002:a17:90b:804:b0:20a:7ec2:c96d with SMTP id bk4-20020a17090b080400b0020a7ec2c96dmr204833pjb.178.1668645129009; Wed, 16 Nov 2022 16:32:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668645129; cv=none; d=google.com; s=arc-20160816; b=WQbS6x71El55jVZEJOeiNYl2lH5+evyEUMBfKDVjQ92xRr/iLSW7HALvI0SSDfAE7N Ik+BXXfVVN9Rtpv+XvoDgKwu1nmAQ+E7ZbWpbAShLIRBOXx2uiTHZnJcM21BhdLdHJoL Yk98GUastDUGO8ng3uu9za8N72GBTtfPIbSAV5uKx3U0Rm5gyT5vz/b2K8GjZRKxpSsf s+Io6oZiD0JKma/n4xfyonlYKHZbth1Zvr6KjOqcvNRHoFEgKlq0wqN/ctjCyrGtQq+S /wAaotBAzrB0K0s5tFfKQFmfqb6oBLi+I17J1uw16wxwmMcAzc2vrsI0lvphI938RUYb vI2g== 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:dkim-signature; bh=THRVaYizhgSM/LrXu2xoRek9BSvZhHKUNBtqQFkqPUY=; b=VECuNnoU1ZoNcMxGgzpZQLTffTw24I1gA/ADed58PUd+/irXCKIC962TDdOJY9TUK1 omiqO2Fh2pgJnCTvv48yoLq1tUU6vyMU/OZ4t47r4VrBrbxuzNPp2hQg522ceH1UOdVs 3ZCIn6SE11/fOKffUaAkIpzx+IqL2knwA8iD4VlJ/OitmWIIexnwMbU7ErJIwRRMwCRX XILeTNAxKI9AHtBG386Xq2EZUHRIt8O2NLbCJ4rkdVtOJTDlnVYumejHnezsWqtIuYec SiYO7GJIlwKsENXii6KbICduJmXPLCSzh2OhfQe2sRvrDHL1RL3S7mFxx4GZznAkgs8l v3lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=UZ44W5ZJ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p20-20020a170902ead400b00186f4d6668csi13628388pld.261.2022.11.16.16.31.57; Wed, 16 Nov 2022 16:32:09 -0800 (PST) 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=pass header.i=@lunn.ch header.s=20171124 header.b=UZ44W5ZJ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229785AbiKPX7F (ORCPT + 90 others); Wed, 16 Nov 2022 18:59:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231300AbiKPX7D (ORCPT ); Wed, 16 Nov 2022 18:59:03 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABB6A17057; Wed, 16 Nov 2022 15:59:02 -0800 (PST) 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=THRVaYizhgSM/LrXu2xoRek9BSvZhHKUNBtqQFkqPUY=; b=UZ44W5ZJPQr4YHN4fXXhJuzJ5L v2xD3zuWI71vGnriO31FhHfCfwcEjqm8T2rlBrHfziE7z2FPdCkKSVY3mxBuEn7mQrMFoyAN60LZ4 m0xWULPZiAAYnx44w3gToRnWOCkcigkDE5zg+PzJpa7UWVrKjbj8yglra1m6U+YfQNzQ=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1ovSHy-002cuv-Tp; Thu, 17 Nov 2022 00:57:54 +0100 Date: Thu, 17 Nov 2022 00:57:54 +0100 From: Andrew Lunn To: Florian Fainelli Cc: Xiaolei Wang , hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] net: fec: Create device link between phy dev and mac dev Message-ID: References: <20221116144305.2317573-1-xiaolei.wang@windriver.com> <20221116144305.2317573-3-xiaolei.wang@windriver.com> <355a8611-b60e-1166-0f7b-87a194debd07@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <355a8611-b60e-1166-0f7b-87a194debd07@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS 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 Wed, Nov 16, 2022 at 03:27:39PM -0800, Florian Fainelli wrote: > On 11/16/22 07:07, Andrew Lunn wrote: > > On Wed, Nov 16, 2022 at 10:43:05PM +0800, Xiaolei Wang wrote: > > > On imx6sx, there are two fec interfaces, but the external > > > phys can only be configured by fec0 mii_bus. That means > > > the fec1 can't work independently, it only work when the > > > fec0 is active. It is alright in the normal boot since the > > > fec0 will be probed first. But then the fec0 maybe moved > > > behind of fec1 in the dpm_list due to various device link. > > Humm, but if FEC1 depends upon its PHY to be available by the FEC0 MDIO bus > provider, then surely we will need to make sure that FEC0's MDIO bus is > always functional, and that includes surviving re-ordering as well as any > sort of run-time power management that can occur. Runtime PM is solved for the FECs MDIO bus, because there are switches hanging off it, which have their own life cycle independent of the MAC. This is something i had to fix many moons ago, when the FEC would power off the MDIO bus when the interface is admin down, stopping access to the switch. The mdio read and write functions now do run time pm get and put as needed. I've never done suspend/resume with a switch, it is not something needed in the use cases i've covered. > > > So in system suspend and resume, we would get the following > > > warning when configuring the external phy of fec1 via the > > > fec0 mii_bus due to the inactive of fec0. In order to fix > > > this issue, we create a device link between phy dev and fec0. > > > This will make sure that fec0 is always active when fec1 > > > is in active mode. > > Still not clear to me how the proposed fix works, let alone how it does not > leak device links since there is no device_link_del(), also you are going to > be creating guaranteed regressions by putting that change in the PHY > library. The reference leak is bad, but i think phylib is the correct place to fix this general issue. It is not specific to the FEC. There are other boards with dual MAC SoCs and they save a couple of pins by putting both PHYs on one MDIO bus. Having the link should help better represent the device tree so that suspend/resume can do stuff in the right order. Andrew