Received: by 2002:ac0:c50a:0:0:0:0:0 with SMTP id y10csp1066842imi; Fri, 1 Jul 2022 02:17:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vDst/kbm4XNPhfPCmTKGxb/AjStzu6sRQt5asyuRVhJ6/Ar7mcTz+8CH+hfwUQFJWY1Vh7 X-Received: by 2002:aa7:900a:0:b0:525:1e54:e64e with SMTP id m10-20020aa7900a000000b005251e54e64emr19932874pfo.35.1656667038949; Fri, 01 Jul 2022 02:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656667038; cv=none; d=google.com; s=arc-20160816; b=oFAPc3lonqz4qq0K7ki8lP5ioF07Y6F4j/Jtm6p/t2mQ/bgnMB9dPmn0tpoK4QPKma 70kSAjHwFgNhZyjCkvYnR//vpnaIxHQfjmmtbNCBRWlz8JFFtBBsGT35jMMY3ghK4Yrl bt8YXuHLUkbqvVAxd9PYXdF93HNOUR1rLZglkuvZBTUwWAITaN/vm9Ha4lQbehyuGY/9 EntQnT7gAw5CwKw+HkhL8LuE3WUsodg081D/C8/7KZ+US/pc35A64SHjil2SR4ZZLcN9 cpYhnPJf4HWTCo1iNRk7cqfLJap94NkT8oKtc1uclDL1O7afTqxad4V5fM+Hmz3S8EWa 4j3A== 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=myLZG8Fxe2O1i1vWy67IytiAd7jdr/N9oCZa6x7j0I0=; b=zeHO2VOVx1CGXMN0p9HtUAC9nDbdehkeRlsrOiGJaTzUMBUC0t88wPbUyEO82vfOwx bPSST/cy7EFz87geL2tP/A4l2KXGaa6u3v4d8u6eGpxEdH94Z9pOMLT4PhfKFL461/7z /1U0R1MeN8ba48zVsQsYqXtPr3epAzeiXlYwxq/vATJNuxjAS+z5OcX3w6AE0fIzk7sF pQW+eOyIuhGRAa1ErvnWIOW250v00fUi/9MQUFJJZN8iM2xoebtQa11KUL9Wyff3Sjlu Z9q1yTQMKcLl8tDzaA7+WlaqooeXZTXi/BXDdMx9/a5yUz/1BPNQPgUioyL0mfaMZ9O0 MLnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=GP62mLwq; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020a170902aa8400b0016a639db6e9si30811715plr.183.2022.07.01.02.17.07; Fri, 01 Jul 2022 02:17:18 -0700 (PDT) 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=GP62mLwq; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232319AbiGAJOE (ORCPT + 99 others); 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> 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, T_SCC_BODY_TEXT_LINE 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 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