From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4120C43334 for ; Fri, 1 Jul 2022 09:14:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233919AbiGAJOE (ORCPT ); Fri, 1 Jul 2022 05:14:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235277AbiGAJOD (ORCPT ); Fri, 1 Jul 2022 05:14:03 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 683C53ED20; Fri, 1 Jul 2022 02:14:02 -0700 (PDT) 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=myLZG8Fxe2O1i1vWy67IytiAd7jdr/N9oCZa6x7j0I0=; b=GP62mLwq01G1gJMQGK4N5R3ehZ dpxwXJclqNQfsMA+0LkxdldsKE2DPcyytkGkBrT/jaByY9FYa3mT2VVflo7pZ4iSWP0gJJhu6R/0N 9ZGBNiEdtdbimqRi61aReO7rF+3UX6QIUY0Uzevp2ZdZ37bcXDWuVvhK6hgrCx7BZJ5c=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1o7Cia-008v8d-Tw; Fri, 01 Jul 2022 11:13:40 +0200 Date: Fri, 1 Jul 2022 11:13:40 +0200 From: Andrew Lunn To: Radhey Shyam Pandey Cc: nicolas.ferre@microchip.com, claudiu.beznea@microchip.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, hkallweit1@gmail.com, linux@armlinux.org.uk, gregkh@linuxfoundation.org, rafael@kernel.org, saravanak@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, git@amd.com Subject: Re: [PATCH net-next v2] net: macb: In shared MDIO usecase make MDIO producer ethernet node to probe first Message-ID: References: <1656618906-29881-1-git-send-email-radhey.shyam.pandey@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1656618906-29881-1-git-send-email-radhey.shyam.pandey@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 01, 2022 at 01:25:06AM +0530, Radhey Shyam Pandey wrote: > In shared MDIO suspend/resume usecase for ex. with MDIO producer > (0xff0c0000) eth1 and MDIO consumer(0xff0b0000) eth0 there is a > constraint that ethernet interface(ff0c0000) MDIO bus producer > has to be resumed before the consumer ethernet interface(ff0b0000). > > However above constraint is not met when GEM0(ff0b0000) is resumed first. > There is phy_error on GEM0 and interface becomes non-functional on resume. > > suspend: > [ 46.477795] macb ff0c0000.ethernet eth1: Link is Down > [ 46.483058] macb ff0c0000.ethernet: gem-ptp-timer ptp clock unregistered. > [ 46.490097] macb ff0b0000.ethernet eth0: Link is Down > [ 46.495298] macb ff0b0000.ethernet: gem-ptp-timer ptp clock unregistered. > > resume: > [ 46.633840] macb ff0b0000.ethernet eth0: configuring for phy/sgmii link mode > macb_mdio_read -> pm_runtime_get_sync(GEM1) it return -EACCES error. > > The suspend/resume is dependent on probe order so to fix this dependency > ensure that MDIO producer ethernet node is always probed first followed > by MDIO consumer ethernet node. > > During MDIO registration find out if MDIO bus is shared and check if MDIO > producer platform node(traverse by 'phy-handle' property) is bound. If not > bound then defer the MDIO consumer ethernet node probe. Doing it ensures > that in suspend/resume MDIO producer is resumed followed by MDIO consumer > ethernet node. I don't think there is anything specific to MACB here. There are Freescale boards which have an MDIO bus shared by two interfaces etc. Please try to solve this in a generic way, not specific to one MAC and MDIO combination. Andrew