Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1389973pxb; Thu, 24 Mar 2022 19:33:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwW/klUMmHfnfivcNeMRcHnbYxi5ThxJyTPvqdHPcjYBPnwrxN6dJwHneT3pmR6If+n6PiR X-Received: by 2002:a17:90a:4590:b0:1bc:4afa:1778 with SMTP id v16-20020a17090a459000b001bc4afa1778mr21998018pjg.14.1648175629985; Thu, 24 Mar 2022 19:33:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648175629; cv=none; d=google.com; s=arc-20160816; b=o1/Uwm2EbOsEfDO1yC425QpjfocV/yzJQH8ciWvNMj5OsY7G6omS7od91nYumm0/es BdF8rt3e15kaPIyIAe05fsZdHATDjVo18kUhcJh2IHJv7eyUdPndr8Nk+4J44OxXJn6H hyXDUWmiMr4lGbRF5zh8zOUZSHwiXrz+LkB47xGbcN2vErxc2QQ9X7yFV2jgCCYXGyYx VzMUDjmLE60030BIBt425yU+YzOLzluzMT7eLGzNUnjxoaiJ+xAoNN0CpBVy1cPvHuhb TQGApcByaSeC08opjujLpDnyZ+XfVXbafVSK3fHy+sMWZ3iBmBd/c8FKrsd2uLtZ3Uyu dJvg== 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=IqDHStJy0CawvNenzFeGPEaQ0ePnoq1IZcZH5bz6PPU=; b=I7/eb3JTjCB1WYsiwT4GOYiHjbgfF5Q5juQQ2+yneQYtvoJHzxz06/f7sVU7+ynw/B Yq+lHJdBhznAcv80G+Mif+b3mky1z0rVAAFc3Aw9Vpll8bsw4PhCGDxTfwJlLBzJPPG9 AKq2IdlU0pzIC127H/4P4e7Xa703EcuYV5ZT41A5k/Io/z7PnDYj08uzTmk5gq2OSuSO 6kYu7MqxAMLmWNKiAPX0Ha0e3JQW5DE4GouNdRJpxhMlb4eKrdBBUlE2zodX6cQjvM3H 9UQ2e1HLYf7Knu2jEIA4S3oYGoduzaQbuwGOy4i4POfstHz4YPEPXTYpToNb6A9BKKyP nOuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=Hr4CHPcu; 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 q3-20020a63ae03000000b003816043ef09si1123677pgf.254.2022.03.24.19.33.36; Thu, 24 Mar 2022 19:33:49 -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=@walle.cc header.s=mail2016061301 header.b=Hr4CHPcu; 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 S1343879AbiCWSgY (ORCPT + 99 others); Wed, 23 Mar 2022 14:36:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240059AbiCWSgB (ORCPT ); Wed, 23 Mar 2022 14:36:01 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7281271EC3; Wed, 23 Mar 2022 11:34:31 -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 6B032223EA; Wed, 23 Mar 2022 19:34:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1648060469; 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=IqDHStJy0CawvNenzFeGPEaQ0ePnoq1IZcZH5bz6PPU=; b=Hr4CHPcuX+pFr29lrtcdKFcmrD/djeTTnmzeLJhQLwSdSubon8rTaBpdTWrmi9APQOaVrN YRKW8I8+5UwpnRMfRa5NuwDA5DkZScVCGiY83mMvJVazf9AsDPuTfy/Wke0fOm3y1zVQWM bxeJelAIznHjYnyLbup8bkUh72edDKE= 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 1/5] net: phy: mscc-miim: reject clause 45 register accesses Date: Wed, 23 Mar 2022 19:34:15 +0100 Message-Id: <20220323183419.2278676-2-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220323183419.2278676-1-michael@walle.cc> References: <20220323183419.2278676-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 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 --- 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