Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2301352pxb; Fri, 25 Mar 2022 15:01:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6lmAYIWmYH5KyGykqKHV9dxtba98DSVxvCFVL3NtpOIQfbo+H88D7fSwCs96iRwFyDHVo X-Received: by 2002:a17:903:2311:b0:154:609e:1e2d with SMTP id d17-20020a170903231100b00154609e1e2dmr13914332plh.30.1648245680603; Fri, 25 Mar 2022 15:01:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648245680; cv=none; d=google.com; s=arc-20160816; b=zNTHaC7lHho3Sd2sQM8DLpp9xmWzCGWNFJhy009ozMqOhtQSp8YW/f3iG1bQ4wZgz9 xaACEGAOyzUtrD28y164y/981nSf6vG6BZszkefWJ7zUj2xr/0yxglev1Wo5cLqISdwt +AouVXTFzYODAafcPE5aXa2AgUBpc1G2n44px+mo7KNxGXwRlx2LZWTbPFMm1eBchdaT Tqhqf6NlXD8aAZLMEGCk4S9KDl4SUSS74G7bZEpKD49DlJ2dvQa5FgkQjy94Zw5xl7Ly E088wkVzNHjF/aVJsp8TEcc2LEiBqATZvI1AZWQqURWyR59EWxQuJu5SrdIcRSZS2nOW WyWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bWBsiGXBmlYd0EaKgmARKG3hBGZ0ztGZamwzdx+gZPM=; b=NPefCZpQKoNxijTC1SvKHt+MJqFV4AJPFnxAtkAVZ/jxHQ4WfWMvqjpD2zI3f1dqG1 zGrmMmvpCBaoauA/2DioVaDug7G7Vm0rzwyRvdaXnQ2itwnHXiMaC6R+IEtlSeFWzs79 c+ShDJiLbUmF0lf2rtuUijIT6A7xGjIj8J5qy9sV/LGrsfjM4y5Jlu2OAd/+nS9c+4fZ nYuWDr7TvbdvFpQZwo9IDSAHM7b4jvrJ+WrCN3UZ0vuU4AlPIdXSJlX/O2Gs62GJJ/o5 J3n/gyMzoHhXKKP5xnZ4wRbwR/W51S4uFSKGM7Cf+wQr2w2duPLqYLDRWBT9uBIkIrPK pnJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=pSlCgaFU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k17-20020a170902c41100b00153b2d165f5si3820600plk.509.2022.03.25.15.01.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 15:01:20 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=pSlCgaFU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 15C4651326; Fri, 25 Mar 2022 14:35:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233492AbiCYVhK (ORCPT + 99 others); Fri, 25 Mar 2022 17:37:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233439AbiCYVhE (ORCPT ); Fri, 25 Mar 2022 17:37:04 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37B8D4AE10; Fri, 25 Mar 2022 14:35:28 -0700 (PDT) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 69EE1223EA; Fri, 25 Mar 2022 22:35:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1648244125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bWBsiGXBmlYd0EaKgmARKG3hBGZ0ztGZamwzdx+gZPM=; b=pSlCgaFUXFdyGbiNVbxf1PY2f/5CA3uJi7GkcuqK13SU9Gf86votoFRFu1fZPjzvSzi2lm E1mvXQ0UIgictW/yeZTyoCDe9+m7O2s9XJipX3edvaa/qs4BCCsgfFvB2JdJd037iNNpUA 4EcrAomZdjk2LWX4HQk3OMPR4osbBoI= From: Michael Walle To: Andrew Lunn , Heiner Kallweit , Russell King , Jakub Kicinski , Paolo Abeni Cc: "David S . Miller" , Xu Liang , Alexandre Belloni , Florian Fainelli , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Walle Subject: [PATCH RFC net-next v2 1/8] net: phy: mscc-miim: reject clause 45 register accesses Date: Fri, 25 Mar 2022 22:35:11 +0100 Message-Id: <20220325213518.2668832-2-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220325213518.2668832-1-michael@walle.cc> References: <20220325213518.2668832-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 The driver doesn't support clause 45 register access yet, but doesn't check if the access is a c45 one either. This leads to spurious register reads and writes. Add the check. Fixes: 542671fe4d86 ("net: phy: mscc-miim: Add MDIO driver") Signed-off-by: Michael Walle Reviewed-by: Andrew Lunn Reviewed-by: Florian Fainelli --- drivers/net/mdio/mdio-mscc-miim.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c index c483ba67c21f..582969751b4c 100644 --- a/drivers/net/mdio/mdio-mscc-miim.c +++ b/drivers/net/mdio/mdio-mscc-miim.c @@ -102,6 +102,9 @@ static int mscc_miim_read(struct mii_bus *bus, int mii_id, int regnum) u32 val; int ret; + if (regnum & MII_ADDR_C45) + return -EOPNOTSUPP; + ret = mscc_miim_wait_pending(bus); if (ret) goto out; @@ -145,6 +148,9 @@ static int mscc_miim_write(struct mii_bus *bus, int mii_id, struct mscc_miim_dev *miim = bus->priv; int ret; + if (regnum & MII_ADDR_C45) + return -EOPNOTSUPP; + ret = mscc_miim_wait_pending(bus); if (ret < 0) goto out; -- 2.30.2