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 ED22DC00A5A for ; Thu, 19 Jan 2023 14:11:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231491AbjASOLQ (ORCPT ); Thu, 19 Jan 2023 09:11:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231605AbjASOKl (ORCPT ); Thu, 19 Jan 2023 09:10:41 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C9654CE50; Thu, 19 Jan 2023 06:09:17 -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=nhR/k9DW9kXSzNpwAtuxVVbCeGJmwMg8MjsoC/QOJkE=; b=Q2OnfJvG4Xbl6i3pJkLjSvmhmC lzMoINnlWCG6iNiFXnAIJEo/G6fNuEQhBymp1b1pkY7viYRqclqGpEZxiQx9+iLW5GDjFB2hu6flv 0RRBdmyGOidQ2kD4SRZXG6M/bRiWzNiQ90gyJrhv7mp33bBiwtzz8BX9oqCCnfcEeRVY=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pIVb9-002ZtK-TV; Thu, 19 Jan 2023 15:08:59 +0100 Date: Thu, 19 Jan 2023 15:08:59 +0100 From: Andrew Lunn To: Oleksij Rempel Cc: Woojung Huh , UNGLinuxDriver@microchip.com, Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Arun.Ramadoss@microchip.com Subject: Re: [PATCH net-next v1 2/4] net: phy: micrel: add EEE configuration support for KSZ9477 variants of PHYs Message-ID: References: <20230119131821.3832456-1-o.rempel@pengutronix.de> <20230119131821.3832456-3-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230119131821.3832456-3-o.rempel@pengutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +static int ksz9477_get_eee_caps(struct phy_device *phydev, > + struct ethtool_eee *data) > +{ > + int val; > + > + /* At least on KSZ8563 (which has same PHY_ID as KSZ9477), the > + * MDIO_PCS_EEE_ABLE register is a mirror of MDIO_AN_EEE_ADV register. > + * So, we need to provide this information by driver. > + */ > + data->supported = SUPPORTED_100baseT_Full; > + > + /* KSZ8563 is able to advertise not supported MDIO_EEE_1000T. > + * We need to test if the PHY is 1Gbit capable. > + */ > + val = phy_read(phydev, MII_BMSR); > + if (val < 0) > + return val; > + > + if (val & BMSR_ERCAP) > + data->supported |= SUPPORTED_1000baseT_Full; This works, but you could also look at phydev->supported and see if one of the 1G modes is listed. That should be faster, since there is no MDIO transaction involved. Not that this is on any sort of hot path. Andrew