Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp4067132rwl; Sat, 7 Jan 2023 10:24:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXuYXHeu81t8O4aapI0A0OXdX++SRfnGQQ4/06P1pUAd+17LrQtG0BAJ268uTjli978RueQ/ X-Received: by 2002:a17:907:c388:b0:849:e96f:51f4 with SMTP id tm8-20020a170907c38800b00849e96f51f4mr43236543ejc.23.1673115864811; Sat, 07 Jan 2023 10:24:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673115864; cv=none; d=google.com; s=arc-20160816; b=y/ZgR8eLWqddp+MHuTkZBNCkFJ73q/MbjIFXB9R169LN9Q7WQ3K/dWaWYSFdxMrfTM oB6gYi3/Vevqb3DSdpl9RR78HZhwETveKtgywzBJ0OCg/aK5Z36CumqouL5D726iVstd qvlCYBVHby5ZZSn3yHGQN/bolVoooFW1tz3pc4NPB8hsjfvmotBFBzDZDupXJiEBPng4 uqvijlr8pAP0kWyLZbAQuL+/QI5+N9xhZR1H8F4+NmicknnxhPlza31k5Mnv0lz8vQ1o Zbzyln+kRHfiLxWpUsBqzYV0fVhhcNcljWxxZEb6J9BZ4L4zopU1ypKt0ZXVpug6Ixww e2Uw== 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=MWOG1/eoo2lMKL+kIYISY5kixiwMhP8ydoboKwnTI1w=; b=emU+xh60LLzMOlRAyd2f2Cx2VghcnlYvgpX7KfwVW14xETMyNRYE+oorFhAS51KlWe DGEQJuFiKRZyfFhWcxvtg12y1vR4DiYPX4SMpA/95suj9i4ElLJ6CaQ1XxTE+C2xMHC9 xzStsNdEwu9VnDGCZG00IVnHonP3BA8EevStYkSB3sHgiJ7xPt05Al84LJ+qm85LQqQK 0Q1SEFKQKzshGkJxrVgZM0XdapmG5hv30VOIccw/0kgNCynD0FpPizBQKWzHmbz6OKtL 5q6u4To+j8AJ7zhT3ausj/3capfl4t2N1C5JfqwUplpsTgNLxSMbtRKdDsdpOuO0ePhA 8LuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b="3L212PM/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xg3-20020a170907320300b007c109e62bfdsi4557255ejb.984.2023.01.07.10.24.11; Sat, 07 Jan 2023 10:24:24 -0800 (PST) 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="3L212PM/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231718AbjAGSII (ORCPT + 54 others); Sat, 7 Jan 2023 13:08:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbjAGSIF (ORCPT ); Sat, 7 Jan 2023 13:08:05 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17A1F3592E; Sat, 7 Jan 2023 10:08:04 -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=MWOG1/eoo2lMKL+kIYISY5kixiwMhP8ydoboKwnTI1w=; b=3L212PM/xxJ52x8Frf4u9lfgjw POEnTw6m3gJs3hSYOIFD8I++2kHrVplyR1Zd1ykhIXzSgHOdzFACpqhFz0PWhsGf4b0/xldEWjwPM loAaGgTk1XJX+vlTkbLWavMq4GXZCzMgk2Jqb04Qqwix5YxnBTfs9qmDllV7bzCZLp5Q=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pEDbk-001RAA-9L; Sat, 07 Jan 2023 19:07:52 +0100 Date: Sat, 7 Jan 2023 19:07:52 +0100 From: Andrew Lunn To: Piergiorgio Beruto Cc: Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Oleksij Rempel , mailhol.vincent@wanadoo.fr, sudheer.mogilappagari@intel.com, sbhatta@marvell.com, linux-doc@vger.kernel.org, wangjie125@huawei.com, corbet@lwn.net, lkp@intel.com, gal@nvidia.com, gustavoars@kernel.org Subject: Re: [PATCH v2 net-next 4/5] drivers/net/phy: add helpers to get/set PLCA configuration Message-ID: References: <35720efb893ac9ae2667110d4c2dc2828e9d4222.1673030528.git.piergiorgio.beruto@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <35720efb893ac9ae2667110d4c2dc2828e9d4222.1673030528.git.piergiorgio.beruto@gmail.com> 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 > +/** > + * genphy_c45_plca_set_cfg - set PLCA configuration using standard registers > + * @phydev: target phy_device struct > + * @plca_cfg: structure containing the PLCA configuration. Fields set to -1 are > + * not to be changed. > + * > + * Description: if the PHY complies to the Open Alliance TC14 10BASE-T1S PLCA > + * Management Registers specifications, this function can be used to modify > + * the PLCA configuration using the standard registers in MMD 31. > + */ > +int genphy_c45_plca_set_cfg(struct phy_device *phydev, > + const struct phy_plca_cfg *plca_cfg) > +{ > + int ret; > + u16 val; > + > + // PLCA IDVER is read-only > + if (plca_cfg->version >= 0) > + return -EINVAL; > + > + // first of all, disable PLCA if required > + if (plca_cfg->enabled == 0) { > + ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, > + MDIO_OATC14_PLCA_CTRL0, > + MDIO_OATC14_PLCA_EN); > + > + if (ret < 0) > + return ret; > + } > + > + if (plca_cfg->node_cnt >= 0 || plca_cfg->node_id >= 0) { > + if (plca_cfg->node_cnt < 0 || plca_cfg->node_id < 0) { I think it would be good to add some comments since this code is not immediately obvious to me. I had to think about it for a while. > + if (plca_cfg->burst_cnt >= 0 || plca_cfg->burst_tmr >= 0) { > + if (plca_cfg->burst_cnt < 0 || plca_cfg->burst_tmr < 0) { > + ret = phy_read_mmd(phydev, MDIO_MMD_VEND2, > + MDIO_OATC14_PLCA_BURST); > + This follows the same patterns, so maybe comments here as well? With that, you can add my Reviewed-by. Andrew