Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp560432pxp; Wed, 9 Mar 2022 08:11:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXMzdEUZNnexMz/e0+6somRL4ippzNlDtQ/JWQtvnhKg/5zl5q5+0j/HMzZvlJIa8aUIGD X-Received: by 2002:a17:907:2da1:b0:6da:8e01:8313 with SMTP id gt33-20020a1709072da100b006da8e018313mr492413ejc.32.1646842292085; Wed, 09 Mar 2022 08:11:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646842292; cv=none; d=google.com; s=arc-20160816; b=A/bZAEv5GcxC6RVhOrTXJz+8QYYV+o+S2FyfWNuyphxAaBu4888TOzVgPaKIDR2L84 n6BzvcS6IfIbdgamQPNtshFOGetP/RNM+lvp42Px+ViDZvmC4LknT57EhCoVi0mmsgTR A21zqbDigQCfWLRZhr+m0kOkke9zk8M8jzyuRgcrWgAndS3R7nBzBBqPWrWBR8bUcg6V UqkJF7GP53Ng53m4USzg8VDa21yt9mOMSX0C5BvvDCxQQIsZHfuoIfKITvJ09xyp2C7i WG3B6FHQWoHsGdpFLvd/c115s3ZdubLkvOaUyCn9Dv+6O9aSapAppS9xfR1+cbbww6kI Pq3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=oqH17qRrNgnyr+OrNR0SfU+bRDEJNoAwRUKHrBZpLqA=; b=qIz+pQ7tmjHcsFdBXPKHBEwTqbSaKfvtPe4mQplxSHtZ8PqcZNH8QgAB91A/A8l3fH It4azA6WhiyA+m+xi8MCVVL5kugzquybfVuH6UaPQLSkn1GEGURzJbOUU6lxkFztU+JY gv6A+WgDhIsID8WFew+l3UdBzTUCknzqn2noJRaK6UgQJiNvIl81lVqOE9B5HkqbIW4t vUhgIVDI6uaOwmdvBxGVAzrn91zcY4Kz3WsnptbcpeVqB+L2W+iSy/K+Sy3Sj2Kd4rFY 4WWyAdCTJ6HexG0+sxui5A+QngmezwYTlhKNnCJmFgXZpEnEHgRsHyEG0rY5rzsJkVVT 9kAw== ARC-Authentication-Results: i=1; mx.google.com; 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 dd5-20020a1709069b8500b006a744d0cdeesi1692723ejc.875.2022.03.09.08.11.08; Wed, 09 Mar 2022 08:11:32 -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; 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 S233340AbiCIOqa (ORCPT + 99 others); Wed, 9 Mar 2022 09:46:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229755AbiCIOq3 (ORCPT ); Wed, 9 Mar 2022 09:46:29 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0561A13C9EA for ; Wed, 9 Mar 2022 06:45:30 -0800 (PST) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nRxZ6-00016d-RG; Wed, 09 Mar 2022 15:45:24 +0100 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1nRxZ5-0001o8-Uy; Wed, 09 Mar 2022 15:45:23 +0100 Date: Wed, 9 Mar 2022 15:45:23 +0100 From: Oleksij Rempel To: Andrew Lunn 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: <20220309144523.GE15680@pengutronix.de> References: <20220309121835.GA15680@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 14:34:30 up 88 days, 22:20, 90 users, load average: 2.55, 1.39, 0.69 User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,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 Hi Andrew, On Wed, Mar 09, 2022 at 02:31:18PM +0100, Andrew Lunn wrote: > 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? No, currently it has generic 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? EEPROM provides information, which PHY address should be used. If address is 0x10, it is internal PHY. Different parts of ASIX driver use this logic. > 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. It is one MDIO bus with multiple PHYs one of them is the internal PHY. ax88772 seems to provide way to put the PHY to reset from one of MAC register. See drivers/net/usb/asix_devices.c ax88772_hw_reset() if (priv->embd_phy) ... else asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL, But this way is not working for the ax88772b variant. Ok, so if phy_suspend() is the preffered way, I need to get phydev without attaching it. Correct? Do we already have some helpers to do it? Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |