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 25903C7EE23 for ; Mon, 27 Feb 2023 13:09:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229691AbjB0NJT (ORCPT ); Mon, 27 Feb 2023 08:09:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229557AbjB0NJR (ORCPT ); Mon, 27 Feb 2023 08:09:17 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E396CDCF; Mon, 27 Feb 2023 05:08:38 -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=S/7WtCGaQMhXLXtk7Vr0qWEeT3/0Qv7S0/Mtts2Gzn0=; b=kDGxtBGgY7u9qf1RnK+vtQTBir uorUoWl/XnfkFfXHPt0L2r6hu/z+jQQ/fqlrWMeCRWQXBUZu6pS9Pw4t8ky1lPKSy/b0AxG1bcUSx Yocm97Qfq2bNDlKufQfsKscqyVzrcLX7a4tRwsLnw/mkEMyCIuj6WU2We/SvJAfn6wgE=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pWdEx-0064oo-Pg; Mon, 27 Feb 2023 14:08:27 +0100 Date: Mon, 27 Feb 2023 14:08:27 +0100 From: Andrew Lunn To: Guenter Roeck Cc: Oleksij Rempel , Woojung Huh , Arun.Ramadoss@microchip.com, Florian Fainelli , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, UNGLinuxDriver@microchip.com, Eric Dumazet , Paolo Abeni , Wei Fang , kernel@pengutronix.de, intel-wired-lan@lists.osuosl.org, Jakub Kicinski , Vladimir Oltean , Vivien Didelot , Heiner Kallweit Subject: Re: [PATCH net-next v8 6/9] net: phy: c22: migrate to genphy_c45_write_eee_adv() Message-ID: References: <20230211074113.2782508-1-o.rempel@pengutronix.de> <20230211074113.2782508-7-o.rempel@pengutronix.de> <20230224035553.GA1089605@roeck-us.net> <20230224041604.GA1353778@roeck-us.net> <20230224045340.GN19238@pengutronix.de> <363517fc-d16e-5bcd-763d-fc0e32c2301a@roeck-us.net> <20230224165213.GO19238@pengutronix.de> <20230224174132.GA1224969@roeck-us.net> <20230224183646.GA26307@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c > > index f595acd0a895..67dac9f0e71d 100644 > > --- a/drivers/net/phy/phy-c45.c > > +++ b/drivers/net/phy/phy-c45.c > > @@ -799,6 +799,7 @@ static int genphy_c45_read_eee_cap1(struct phy_device *phydev) > > * (Register 3.20) > > */ > > val = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE); > > + printk("MDIO_PCS_EEE_ABLE = 0x%04x", val); > > if (val < 0) > > return val; > > > > For cubieboard: > > MDIO_PCS_EEE_ABLE = 0x0000 > > qemu reports attempts to access unsupported registers. MDIO is a serial bus with two lines, clock driven by the bus master and data. There is a pull up on the data line, so if the device does not respond to a read request, you get 0xffff. That value is all i've ever seen a real PHY do when asked to read a register which does not exist. So i would say QEMU could be better emulate this. The code actually looks for the value 0xffff and then decides that EEE is not supporting in the PHY. The value of 0x0 is probably being interpreted as meaning EEE is supported, but none of the link modes, 10Mbps, 100Mbps etc support EEE. I would say it is then legitimate to read/write other EEE registers, so long as those writes take into account that no link modes are actually supported. Reading the other messages in this thread, a bug has been found in the patches. But i would also say QEMU could do better. Andrew