Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp11141752rwd; Thu, 22 Jun 2023 09:12:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6LPoHc7p+Yuu1pnsYvJHH3g8MGvlTobZLBLKNBFrfVA60gbvUjYGfQj8SLUcmbedeaVCy3 X-Received: by 2002:a17:90a:70cf:b0:25e:8fd9:8dc with SMTP id a15-20020a17090a70cf00b0025e8fd908dcmr7694863pjm.42.1687450356497; Thu, 22 Jun 2023 09:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687450356; cv=none; d=google.com; s=arc-20160816; b=Aaj1voraAA0ZZIUqSS1C3PEkYW1KHkN4/UQU7WBXfVnp9+RDCMbeMbgPkTzsRjvueu aRtleYRiUjrAgw8kaSiRRTJ41vkTn/7oNolnUbxGgbRHhEdCkJ6bVjrKrLCku4uOoYd4 KehC3JA6l2w2lqMret5BxtuvDTwB/nJ24hfp7WMkbS9CpZbUsayPFUcJR82O2L58lrvu YniCthRXXucP8Xm6KYiLAvi+lw+uPOJlKlBfFlvgbkQQHFuRip6Av1h6JNIz/9gJciaV lHfQL3gxMWiTAZwDaRZsGqHq+qSIcj0SshaKrIDJqC8ebg9MODm7E/8dR83p4/eZhLqN oXbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=Z3vDIohfmF1jYsM2Mz3VAoJtCwhRX2FSJk3g9dYy9c0=; b=OjJvRV2stg9hkvWHjej9JD7pGIc40R0vs1U+CbxvLypyWMe8+ufVIjnrjZBwJHRfCt gwCgXZ1tl/8IHtNpqGW/NRN0RriC2SQkaYaqWrAz8fygVuw4zZOymqKftgOlWzCJC/Rg 8p094pH1IfJWmVl83ufdbmq5NoO+j3yk09AyJbglEVrRrUyHrFqQFVqBd2NlU1agPh5n ie/z+8R7FQEh3UrNOek+r9p5NwqHhtTN8VKdnJsMPd0sASWcfY8cn6f3lyrImYgI6JSO KdOWpfu8aIrBB0gUWsiH2Ip0v1HNIGaR+ffZCjvARSfjh7uCle0D/FCtsW76SScSaFuD pafQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="fK6S5/hL"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pc16-20020a17090b3b9000b002465d98f18csi15259716pjb.170.2023.06.22.09.12.22; Thu, 22 Jun 2023 09:12:36 -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=@broadcom.com header.s=google header.b="fK6S5/hL"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231168AbjFVPvG (ORCPT + 99 others); Thu, 22 Jun 2023 11:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230201AbjFVPvE (ORCPT ); Thu, 22 Jun 2023 11:51:04 -0400 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90CCA10F6 for ; Thu, 22 Jun 2023 08:51:03 -0700 (PDT) Received: by mail-qk1-x730.google.com with SMTP id af79cd13be357-76246351f0cso632926185a.1 for ; Thu, 22 Jun 2023 08:51:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1687449062; x=1690041062; h=in-reply-to:from:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=Z3vDIohfmF1jYsM2Mz3VAoJtCwhRX2FSJk3g9dYy9c0=; b=fK6S5/hLXQXn+oNLNLwZvHBiQgxcdEXbzKottOEXg+i5D0dktLDcXNuntIbP6k8LoN 9NBxI8Wy41MiQDUYJUNFomVBWCjqh7hJqdSpHv5boqG/7/FD1X0pIeYvue+ha1mvVF// 3S/YtVIwAmrFY1XeqRgIsE4dM2F4lkkOs5NLA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687449062; x=1690041062; h=in-reply-to:from:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Z3vDIohfmF1jYsM2Mz3VAoJtCwhRX2FSJk3g9dYy9c0=; b=ByhxbKUGAPzJdFngvLal3oxsmlY4KceXyE+XzGH/N1AshoghvuFVGrutouYgkpnFhL NhkABzwiF93xh+rey9kDuA+AF1Wszo1zQdhNzam9IfDU8lNV9IPn+xlpM0lA3XOXrOe0 d+CVuj2wW49GjzauZhUgyBKA6aBt0ZYs/ZxnNt5LsCM5sVvDxO7Ax8YEwLfNN3jy63Wm ADeps97zHAajCBlDrVNSKG7rZpxLm49UhvVgmwk2x/0FGvp2M9qdfBJ53a4cXyPRzI3Y NAmZkUHszsNZFxBI6BLsZR9Xh+aE/lKVrawPAf5R7a+OrqgdZmq+mO6Jc40k0kdHJorI LyGA== X-Gm-Message-State: AC+VfDxeHUgQXOhXtuENa7/qmY/zs0LeHwPKjeW/LXXXMDOMCX7bbeH1 1FPxiww+5zoHilfR1K6E6tTv5TVSmxoxPCTUtiQG+A== X-Received: by 2002:a05:620a:3e0c:b0:763:df67:5c11 with SMTP id tt12-20020a05620a3e0c00b00763df675c11mr3698913qkn.65.1687449062648; Thu, 22 Jun 2023 08:51:02 -0700 (PDT) Received: from [10.178.67.29] ([192.19.248.250]) by smtp.gmail.com with ESMTPSA id m25-20020ae9e719000000b00761ff1e23e1sm3491126qka.109.2023.06.22.08.51.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Jun 2023 08:51:02 -0700 (PDT) Message-ID: <463a64a4-d629-27bc-2269-3fcdbf8b7e50@broadcom.com> Date: Thu, 22 Jun 2023 16:50:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH net] net: bcmgenet: Ensure MDIO unregistration has clocks enabled To: Andrew Lunn Cc: netdev@vger.kernel.org, hkallweit1@gmail.com, ansuelsmth@gmail.com, rmk+kernel@armlinux.org.uk, Doug Berger , Broadcom internal kernel review list , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , open list References: <20230622103107.1760280-1-florian.fainelli@broadcom.com> <533872e1-b323-4bca-aacc-4d3cfbed53bd@lunn.ch> From: Florian Fainelli In-Reply-To: <533872e1-b323-4bca-aacc-4d3cfbed53bd@lunn.ch> Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000f97cb105feb9d9da" X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,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 --000000000000f97cb105feb9d9da Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/22/2023 4:36 PM, Andrew Lunn wrote: > On Thu, Jun 22, 2023 at 03:31:07AM -0700, Florian Fainelli wrote: >> With support for Ethernet PHY LEDs having been added, while >> unregistering a MDIO bus and its child device liks PHYs there may be >> "late" accesses to the MDIO bus. One typical use case is setting the PHY >> LEDs brightness to OFF for instance. >> >> We need to ensure that the MDIO bus controller remains entirely >> functional since it runs off the main GENET adapter clock. > > So this clock is enabled in bcmgenet_open() and disabled in > bcmgenet_close(). The assumption being, the MDIO bus is only used when > the interface is up. > > How does this work when there is an MDIO based switch attached? I had > similar problems with the FEC and mv88e6xxx. DSA would try to talk to > the switch with the master interface down, and MDIO would time out. I > needed to add runtime PM support to the MDIO bus ops. We do not have that configuration to support today, and given the way that we do register the MDIO bus, it could actually be a bit challenging to support DSA here, I might still have a board around to test, one day. Passing the clock to the MDIO driver does require quite a bit of restructuring in the driver such that the clock is only acquired around mii_bus::write and read operations, otherwise the clock remains constantly enabled, even if the network device is brought down, which burns power unnecessarily. Since this is a fix, I went with the more targeted approach here. -- Florian --000000000000f97cb105feb9d9da Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIQeQYJKoZIhvcNAQcCoIIQajCCEGYCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg gg3QMIIFDTCCA/WgAwIBAgIQeEqpED+lv77edQixNJMdADANBgkqhkiG9w0BAQsFADBMMSAwHgYD VQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UE AxMKR2xvYmFsU2lnbjAeFw0yMDA5MTYwMDAwMDBaFw0yODA5MTYwMDAwMDBaMFsxCzAJBgNVBAYT AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNh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