Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3160247rdg; Tue, 17 Oct 2023 06:31:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNbt60yiJTWt/Vy9GVnumKT6JbY0SIef5Ae4ybCkMNhAU0jNAc/2Ql5+j63CgnhQrq72mU X-Received: by 2002:a05:6a21:9996:b0:142:aced:c643 with SMTP id ve22-20020a056a21999600b00142acedc643mr2135079pzb.31.1697549504289; Tue, 17 Oct 2023 06:31:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697549504; cv=none; d=google.com; s=arc-20160816; b=yw4MBMcafwBUftYvFkYehhc+IiUgvDvlsyZLRZaEpiZ/pglrLwjQELrq/wjwKfyW0T XRbSSLNuFQe78RGltevhCJl1Cmr6tlwxPifCEDrAxPNCEtEOeL/8Lq8VdkLPkpFNFyIA kDqu1pyRPhtK7mRvr+CZab0N3q1pp8CO18DBv7WJgz03xMWU2/uBy8spufI+q9ENLMVd JUPaivlsflLTWdwWAUSe4eGho9c/iPFyQvEXQnzFd6R1O9RWLY7GV22X8zcL3NBF2UDw rHhudrFr5ZhrqRTh8bKqApbcXYFxgDVi0hoBXKv5GgoWei5zeVW85ITwAUFIzXmEpYDS l1kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=5UMBSoXh6IILW9YyX2/MRn867bDMWY7Lg7IduUgaZaU=; fh=+tGgt73IQw2SkgicAnRQwUErA6WBJIe19x/L/KfcsZY=; b=A3GGhtTjK94Upaxp23DHjMQJz73hRhYxMxrc4sVBxFiOKvo2i8e/IGBXytnNC4mbqU +zRnnLYVwdNUcW/kJ2whtvqcXF7g+A0fzYiYkuuDRQE7LsJuSqdKAIIwMfi4Cn6EkLJT IuVeukpeMYeAULwOeVIZGniU1qZ7Ko4OFMdF0wlNLq0YF5tJ4XKVrtecMfENTK1WQZ0t 1hJ64CVVAj527NdYAwza17T2RLs54FhHxXyggDO4h3k/MNFo7B7qwZA+VonhG2XvZ9Xt PwBlOH2nEc+4H2WFcivQ9u0m0VXRCtGafN60Tj+8/y5BOWxLB/OEOn8SG5h+WUx23tSm wzLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=hd0vtH8x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id 80-20020a630253000000b005ac08e723f0si1842127pgc.10.2023.10.17.06.31.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 06:31:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=hd0vtH8x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 2DCEA801B73C; Tue, 17 Oct 2023 06:31:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343660AbjJQNbj (ORCPT + 99 others); Tue, 17 Oct 2023 09:31:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234903AbjJQNbi (ORCPT ); Tue, 17 Oct 2023 09:31:38 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA9CEED; Tue, 17 Oct 2023 06:31:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5UMBSoXh6IILW9YyX2/MRn867bDMWY7Lg7IduUgaZaU=; b=hd0vtH8xR45nyajazw33Ze8KlG Jez7dJNjz6tSR3610P0xEel9vJNlk8LlY4MkixjcLe2fLDbH/bMn2LFTVhyUZLdwrH7tHPr+DnUL1 Oz0/EY0DblqXTpe+y2szH3+L1tPQv2ROKx6fNkpK9u1n9CpEBwlptcrBqQWhQHYcA79Iwc6vfWE5b vh8gJwZmOOAvGzRQwsrCrTd2HoH2QZVifVtbMvPxJh95JolZKkTf/SNC6rh5q645TAyfhpaBOKl7K xxsIEGYrj0p8vKYRujFoFFPvOuQSjPmwSvev9BDfdghWqyVmoxiM03Bve0OCLeT9Uz2q1S8+yfv7N pYNUifGA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:45450) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qskAU-0003JA-2m; Tue, 17 Oct 2023 14:31:30 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qskAU-0006ii-SB; Tue, 17 Oct 2023 14:31:30 +0100 Date: Tue, 17 Oct 2023 14:31:30 +0100 From: "Russell King (Oracle)" To: Vladimir Oltean Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Heiner Kallweit , Florian Fainelli , Michael Walle , linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: mdio-mux: fix C45 access returning -EIO after API change Message-ID: References: <20231017113222.3135895-1-vladimir.oltean@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231017113222.3135895-1-vladimir.oltean@nxp.com> Sender: Russell King (Oracle) 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_NONE,SPF_NONE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 17 Oct 2023 06:31:43 -0700 (PDT) On Tue, Oct 17, 2023 at 02:32:22PM +0300, Vladimir Oltean wrote: > The mii_bus API conversion to read_c45() and write_c45() did not cover > the mdio-mux driver before read() and write() were made C22-only. > > This broke arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-13bb.dtso. > The -EOPNOTSUPP from mdiobus_c45_read() is transformed by > get_phy_c45_devs_in_pkg() into -EIO, is further propagated to > of_mdiobus_register() and this makes the mdio-mux driver fail to probe > the entire child buses, not just the PHYs that cause access errors. > > Fix the regression by introducing special c45 read and write accessors > to mdio-mux which forward the operation to the parent MDIO bus. > > Fixes: db1a63aed89c ("net: phy: Remove fallback to old C45 method") > Signed-off-by: Vladimir Oltean > --- > drivers/net/mdio/mdio-mux.c | 45 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 45 insertions(+) > > diff --git a/drivers/net/mdio/mdio-mux.c b/drivers/net/mdio/mdio-mux.c > index a881e3523328..7d322c08c1e9 100644 > --- a/drivers/net/mdio/mdio-mux.c > +++ b/drivers/net/mdio/mdio-mux.c > @@ -55,6 +55,27 @@ static int mdio_mux_read(struct mii_bus *bus, int phy_id, int regnum) > return r; > } > > +static int mdio_mux_read_c45(struct mii_bus *bus, int phy_id, int dev_addr, > + int regnum) > +{ > + struct mdio_mux_child_bus *cb = bus->priv; > + struct mdio_mux_parent_bus *pb = cb->parent; > + int r; > + > + mutex_lock_nested(&pb->mii_bus->mdio_lock, MDIO_MUTEX_MUX); > + r = pb->switch_fn(pb->current_child, cb->bus_number, pb->switch_data); > + if (r) > + goto out; > + > + pb->current_child = cb->bus_number; > + > + r = pb->mii_bus->read_c45(pb->mii_bus, phy_id, dev_addr, regnum); What if the parent bus doesn't have read_c45 or write_c45 ? > @@ -173,6 +216,8 @@ int mdio_mux_init(struct device *dev, > cb->mii_bus->parent = dev; > cb->mii_bus->read = mdio_mux_read; > cb->mii_bus->write = mdio_mux_write; > + cb->mii_bus->read_c45 = mdio_mux_read_c45; > + cb->mii_bus->write_c45 = mdio_mux_write_c45; Maybe make these conditional on the parent bus implementing the c45 read/write ops? -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!