Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1639602imw; Tue, 5 Jul 2022 12:53:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s0vI9cpdMA4K1twnye4BBANDMeGxe+cNM1PtIvTJxliJT2rSfU5zJL6VsRp3Vu44vF0aUR X-Received: by 2002:a05:6a00:c84:b0:528:3c39:f42d with SMTP id a4-20020a056a000c8400b005283c39f42dmr23687836pfv.76.1657050832353; Tue, 05 Jul 2022 12:53:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657050832; cv=none; d=google.com; s=arc-20160816; b=cz9kazq2vl5G6wL6TyDln1s4Oi23U2GD3GMwUILoyiP8O6R8r2dqPW5mWEPbo/9NkT aG7VYCj/f/QmlZ6oRNFqBgeXUh2aDJfGBs8f2LubYI/vwO3gCF+rmGCuRl7yBBvIxvsA VsRnKTFjl7PIbLZXSJ7th3AGnc6vGdmaqhh3YNuMUOuJ9AueUDiOMlqwEMcVCr5iqA4a ZMo5LdEMsHVMFe6UkKIZbMe/rRfViTTxefmFQgxEGNYqjEJVY/a8wCKOzB9e4Zr88k/b IMtdFnYmt9vpoI1s7E+bcFCF1SdjNDE37CcDEhW+WHERvISPjq/hRrRB8Mnif9vovXVO Y9+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=3raL3Db4m4kOl7wusjljlVNOD4iTwESZC4E355aPMLQ=; b=x2mhp8t3Uf1OU5veVax05B9k6oN4QVPfcPKWwIObVNWQ41LuoliVGhPyiMa4/+Bm6W NuhBKl6WXNGNwnMMFRollSe9BcC+NKehm/tUO76iJ7oknMI+hJKYqmi7op2rmmQS9u5r kQW1Pbgx1AHWxOV1rWqLhsd08cZtNFzLOs6PWWlxrYBy2dUXPSUpd3WZUg7GzqrsD5Sx MuYFn93qQrteCuvmdCm3JaAwOfk71olkE9Vbdv8gPvMiNpvDXWKEhozMOySFowyoChhf nzWJ+xXrr+w1SffwGUKDM6AFebFtFr7xkC5Gbh+Axe5rs+nI95SZ5yMXbxVqGCOxuNn/ I9Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=fKq9b41n; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id on18-20020a17090b1d1200b001df1faf6ee8si17296486pjb.58.2022.07.05.12.53.40; Tue, 05 Jul 2022 12:53:52 -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=@google.com header.s=20210112 header.b=fKq9b41n; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231750AbiGES6M (ORCPT + 99 others); Tue, 5 Jul 2022 14:58:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230383AbiGES6K (ORCPT ); Tue, 5 Jul 2022 14:58:10 -0400 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C135B1F617 for ; Tue, 5 Jul 2022 11:58:09 -0700 (PDT) Received: by mail-yb1-xb35.google.com with SMTP id r3so23488370ybr.6 for ; Tue, 05 Jul 2022 11:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3raL3Db4m4kOl7wusjljlVNOD4iTwESZC4E355aPMLQ=; b=fKq9b41nbWN7wF44/PdWV6ZHCe+bYPNXmJfAcWcc3evXl6sPwIO9uyvv2VC4w6L0DP sKwam9/qNxgDRfLB646tXiegomZk8axE/kQUaMlrssfqcIE0RTN4XbxrFXQuDscSNVDk 0oVlqk1okzJX+nWb9vs9d+aAUWYbjVMztRxqmXpV/mVrgcLEdc/SCnR0NFBic3nyOhXM cuZVnWr89P5+sCo8pcSOYUMDSff0hWXOdoz8NGicbWeuOb8RVTetzSXliwZlq7HuuyXP mdruvajGc47PV240hYYshZQcU3L1mo7DIIBce2hF6bYaOJboGcmDkH4pQAg4xC1oZIQT zuPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3raL3Db4m4kOl7wusjljlVNOD4iTwESZC4E355aPMLQ=; b=ROnwuxbs0Vf4SGKLccAwaqJQxdL4Ov48U7SMZHdHquI3wCbDpf5Dnn9itimdqjeg58 R/J4C1xC/cv+BXGBF6KMHrwABQ2DtKEn+fVZYna/uLSUYX/eCMldVhG/6QO8iF51UD+t FG2U9FBjasS61ClsVk18R/FznW0cv+fOPSvWfqxJECS3jPHwlgwMozVev0LMBVbxn/YK fGW4UrCXlzdENP4h/zTd8iz2XD18zhPmbI3VGp50YELg8vFD4gSo7yEEjn95RicdY9NR QGpRHyelvPZAyD/YKNOWg5gjAiED42MucoNoN2CNQHHwGwfwbRe45Ua6cbBdCqYJ9859 sKKw== X-Gm-Message-State: AJIora+JFiqDoHsI5DnTTcVkHpvbHWzqk23pfT6BZ3KZktnKalDWLebS XcqERvqIAVVgIPmn0y4bG+f9j8vyzXWO1XGH8XUcvw== X-Received: by 2002:a25:2d62:0:b0:66e:7510:8de7 with SMTP id s34-20020a252d62000000b0066e75108de7mr4623018ybe.530.1657047488745; Tue, 05 Jul 2022 11:58:08 -0700 (PDT) MIME-Version: 1.0 References: <1656618906-29881-1-git-send-email-radhey.shyam.pandey@amd.com> In-Reply-To: From: Saravana Kannan Date: Tue, 5 Jul 2022 11:57:32 -0700 Message-ID: Subject: Re: [PATCH net-next v2] net: macb: In shared MDIO usecase make MDIO producer ethernet node to probe first To: "Pandey, Radhey Shyam" Cc: Andrew Lunn , "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" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "git (AMD-Xilinx)" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Tue, Jul 5, 2022 at 11:49 AM Pandey, Radhey Shyam wrote: > > > -----Original Message----- > > From: Andrew Lunn > > Sent: Friday, July 1, 2022 2:44 PM > > To: Pandey, Radhey Shyam > > 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-Xilinx) > > > > Subject: Re: [PATCH net-next v2] net: macb: In shared MDIO usecase make > > MDIO producer ethernet node to probe first > > > > 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. > > Thanks for the review. I want to get your thoughts on the outline of > the generic solution. Is the current approach fine and we can extend it > for all shared MDIO use cases/ or do we see any limitations? > > a) Figure out if the MDIO bus is shared. (new binding or reuse existing) > b) If the MDIO bus is shared based on DT property then figure out if the > MDIO producer platform device is probed. If not, defer MDIO consumer > MDIO bus registration. Radhey, I think Andrew added me because he's pointing you towards fw_devlink. Andrew, I have intentionally not added phy-handle support to fw_devlink because it would also prevent the generic driver from binding/cause issues with DSA. I have some high level ideas on fixing that but haven't gotten around to it yet. -Saravana