Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp484527imn; Thu, 28 Jul 2022 06:48:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tNiQ9CJWIE6daO16sH0UUTqqVO7VwRXjDGfKrDQ9+3J1F5wT9UeLATw/eQfiOkY1S3XNO7 X-Received: by 2002:a17:906:9b14:b0:72b:97ac:c30c with SMTP id eo20-20020a1709069b1400b0072b97acc30cmr21450681ejc.588.1659016092310; Thu, 28 Jul 2022 06:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659016092; cv=none; d=google.com; s=arc-20160816; b=08Y/mZzyzT97qEn1FZ3gKpasSsXc80IzzBJ2aIe+YKXQ/Y1r3d5p1sCizyrNW5cfYZ KWC20Jmm3s07ngqJn8zFyjOwkJTHxElFeFjuAtYpDTLIlHFxXjmNxLDe4wYaFo9/34au TyKV2WHnBdIeKr+Aranv6qxyhHqQWLSnnb6gstl7qp8/XHDWXg2Ts67JamtH4TItotFQ Ct7ucLQ6wyPGzINNFJRJpV/BLUAXefd0bg6mAFCmRsd3fg+STLraoCoWYL4JXMNk6VUj Fb1OjsPgZFpBs3oPPPe8sDBCL7+BTfqAsuEV/6D50SXi5BLa8s3l4LPcHyJc27GM5t7t /DdQ== 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=peZ+13VgmLg1pDFTO+fq8ryBpDliOWbSHN81NMjexw0=; b=jDU/zudRsAriMX4d8l2PmzJ9EBkAI3BTRRFwG9AB4YRvZhzVg7AfqtA/ekLPksR3zM vm32gVAtrWjfPPbmtPL/nmGGSXtSUs7nzhVH0IVsisd4KS+WUCJ8LB0RmiE7D0PefFFO CIEVukxTjEqXbUbonoW2gXncSnpR4GXUuz/5ej9mVt2EhiK2kAxj714cLIIibT8env35 QlW340q3lwqxP23CaGIxUROojwRur4wqZ000hCxBRi+EabivCeG/fBcmEwbwLJr+lph8 SIDubFv02gqeGoSW9oCtQv0p/ZzcT+W3pJR5LWMNi6GtTmUoi/6KUQySv0P5dAkxcqwo XPdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=ORrgfgod; 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 ne19-20020a1709077b9300b00710487d3a4fsi826713ejc.67.2022.07.28.06.47.46; Thu, 28 Jul 2022 06:48:12 -0700 (PDT) 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=ORrgfgod; 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 S235080AbiG1NZw (ORCPT + 99 others); Thu, 28 Jul 2022 09:25:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234892AbiG1NZs (ORCPT ); Thu, 28 Jul 2022 09:25:48 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ECB732045; Thu, 28 Jul 2022 06:25:47 -0700 (PDT) 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=peZ+13VgmLg1pDFTO+fq8ryBpDliOWbSHN81NMjexw0=; b=ORrgfgodViWK5Uxl3mST9lVpLX zJlKUu7oAHHRWhZH9i7vAj0jgfPeaXdtw7TWdHF6x7akxEFQ/0l+u1uJE1e2ydfT1MSahrOtiKQwC g7bKpUgQxfCqt5CJkSSoLc1KW5/jcE9HfnFXRDip/YFfsaCRSjCkPqaB6VrJZHEG9mfs=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1oH3WB-00Bo9r-QO; Thu, 28 Jul 2022 15:25:35 +0200 Date: Thu, 28 Jul 2022 15:25:35 +0200 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 Subject: Re: [PATCH net v1 1/1] net: dsa: microchip: don't try do read Gbit registers on non Gbit chips Message-ID: References: <20220728131725.40492-1-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220728131725.40492-1-o.rempel@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 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 Thu, Jul 28, 2022 at 03:17:25PM +0200, Oleksij Rempel wrote: > Do not try to read not existing or wrong register on chips without > GBIT_SUPPORT. > > Fixes: c2e866911e25 ("net: dsa: microchip: break KSZ9477 DSA driver into two files") > Signed-off-by: Oleksij Rempel > --- > drivers/net/dsa/microchip/ksz9477.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c > index c73bb6d383ad..f6bbd9646c85 100644 > --- a/drivers/net/dsa/microchip/ksz9477.c > +++ b/drivers/net/dsa/microchip/ksz9477.c > @@ -316,7 +316,13 @@ void ksz9477_r_phy(struct ksz_device *dev, u16 addr, u16 reg, u16 *data) > break; > } > } else { > - ksz_pread16(dev, addr, 0x100 + (reg << 1), &val); > + /* No gigabit support. Do not read wrong registers. */ > + if (!(dev->features & GBIT_SUPPORT) && > + (reg == MII_CTRL1000 || reg == MII_ESTATUS || > + reg == MII_STAT1000)) Does this actually happen? If i remember this code correctly, it tries to make the oddly looking PHY look like a normal PHY. phylib is then used to drive the PHY? If i have that correct, why is phylib trying to read these registers? It should know there is no 1G support, and should skip them. Andrew