Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp522822pxp; Wed, 9 Mar 2022 07:31:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzpduFmwDbSjfLMrNd8PjGxDpPOF4ZKcbohf7dC66vK2yHt6QbdhO2OOizUpC8Hr83ZSiOy X-Received: by 2002:a05:6402:2812:b0:416:46ab:818c with SMTP id h18-20020a056402281200b0041646ab818cmr15537156ede.258.1646839866673; Wed, 09 Mar 2022 07:31:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646839866; cv=none; d=google.com; s=arc-20160816; b=dhuDlSbdQRv7gTie6ddEszoHHFrsBTQNwpFEE+1Tjvnndqr/NAMyChH0A21EKATEfs 04+9HWZ3NX3GxwGRcr95IUQUqa7F5n6dQ0wiRwgexL+gNqHSkTPiBcM1YR82bcGL7S+5 0f5xIe/KZ86NqCckw38/6615xUoB6+vrXl9oxBW66fqpYtSij5iLVUtmrBE6hV15A1Cz TkvW0E4G+4LMNvBVzRQ3X/9J988WERYBmdI3nNBuvH5YZbqGLlrvGYuo4am29kiFkHyK 2vMZFMbiO6GES4fsFfDoLi7WmYpt/yTzutQw2iRnanbS3MSyjPEK+NrcBE7NpSg8QkwI oL2w== 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=Urf5AMFUlUt0z9yjEQ9K60ga9QadTuTjAogX2k+fhjU=; b=ZQ/jlhWe9TnYu4Et4yqF+6oO3nbmC1sHI4nq9+nbk64JDS20FxVayRUTH6jMkDHj1V BG+JstEmirFF1SQsXo1zSCi6FOIfulxhVZ5gUBa4jpbVds0yCrmTDvzW2R+8kWEXtm0f nrXxL2BYHMRa5fiyidrXv1x9Vryv8+rL6uVnF9sllQ2EdQXaOtlpMogcOwkYq86DptuB HwPO31l5O7CT1ma9pTOOaaXtXqjEruv9FEHknu0Di6yGWf4PQ9bcqmm8+RyAbOoN9WVp 55cmK+aO6yu8yxCECgAozkuTVkv7lpADkqob4HJsPjAmBCFeaBhQo2pK+f4yLChM+8fS 9Z3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=Z8LOIqAh; 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 n10-20020a1709062bca00b006b66ac8983fsi1267381ejg.509.2022.03.09.07.30.42; Wed, 09 Mar 2022 07:31:06 -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=Z8LOIqAh; 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 S233115AbiCINc3 (ORCPT + 99 others); Wed, 9 Mar 2022 08:32:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbiCINc2 (ORCPT ); Wed, 9 Mar 2022 08:32:28 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B251179A3E; Wed, 9 Mar 2022 05:31:29 -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=Urf5AMFUlUt0z9yjEQ9K60ga9QadTuTjAogX2k+fhjU=; b=Z8LOIqAh0iqXPDCglEJQh3h0vT 4EryRmu+7AQe1g6Hqguy6OoqTFmTNJu2wkEWM2CaoALXKFNcSWppJ8i6XLeu7+vZBiVKwFlB6QoWT R31EUcs6bgMc8oPK7m/7324WeN+83/IuxZ9rqB4mxJq+lehe3WyYDr7bO2yB5krRRz0M=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nRwPO-009xwW-2U; Wed, 09 Mar 2022 14:31:18 +0100 Date: Wed, 9 Mar 2022 14:31:18 +0100 From: Andrew Lunn To: Oleksij Rempel Cc: "David S. Miller" , Jakub Kicinski , Heiner Kallweit , Russell King , kernel@pengutronix.de, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, netdev@vger.kernel.org, paskripkin@gmail.com Subject: Re: net: asix: best way to handle orphan PHYs Message-ID: References: <20220309121835.GA15680@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220309121835.GA15680@pengutronix.de> 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 Wed, Mar 09, 2022 at 01:18:35PM +0100, Oleksij Rempel wrote: > Hello all, > > I have ASIX based USB Ethernet adapter with two PHYs: internal and > external. The internal PHY is enabled by default and there seems to be > no way to disable internal PHY on the MAC level without affecting the > external PHY. > > What is the preferred method to suspend internal PHY? > Currently I have following options: > - suspend PHY in the probe function of the PHY driver > - get the phydev in the MAC driver and call phy_suspend() > - whisper magic numbers from the MAC driver directly this the MDIO bus. > > Are there other options? Hi Oleksij Can you unique identity this device? Does it have a custom VID:PID? It seems like suspending it in the PHY driver would be messy. How do you identify the PHY is part of your devices and should be suspended? Doing it from the MAC driver seems better, your identification information is close to hand. I would avoid the magic numbers, since phy_suspend() makes it clear what you are doing. Is there one MDIO bus with two devices, or two MDIO busses? If there are two busses, you could maybe add an extra flag to the bus structure you pass to mdiobus_register() which indicates it should suspend all PHY it finds on the bus during enumeration of the bus. Generally we don't want this, if the PHY has link already we want to keep it, to avoid the 1.5s delay causes by autoneg. But if we know the PHYs on the bus are not going to be used, it would be a good point to suspend them. Andrew