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 6424EC4332F for ; Wed, 9 Mar 2022 13:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233132AbiCINca (ORCPT ); Wed, 9 Mar 2022 08:32:30 -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> 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