From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7CBEC4167B for ; Tue, 28 Nov 2023 00:51:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234088AbjK1AvL (ORCPT ); Mon, 27 Nov 2023 19:51:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbjK1AvI (ORCPT ); Mon, 27 Nov 2023 19:51:08 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9B2F1AD; Mon, 27 Nov 2023 16:51:14 -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=3k930X9SZ1xl7hqd5sIP8eSDgOCRA4zfABZQSE/mjjw=; b=kzCl7mU4ZFsAPnXZ6ZXSivhecJ vhJYGJfX9edWsDN0Wcotd30VM23RsEKfcF8arhsNjXX7b0uIrh5ULBI2OTD0vtIRMMp7RxYUZRe3w 6XYmhCuuNaItkSvXj+dXDMyoL2b7aNZiXRusFpaWCZpPl+Wb/GwltnCC5rArCFBCCPDM=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1r7mJd-001P0K-TJ; Tue, 28 Nov 2023 01:51:05 +0100 Date: Tue, 28 Nov 2023 01:51:05 +0100 From: Andrew Lunn To: Christian Marangi Cc: Florian Fainelli , Broadcom internal kernel review list , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Vladimir Oltean , David Epping , "Russell King (Oracle)" , Harini Katakam , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [net-next PATCH v2 4/4] net: phy: add support for PHY package MMD read/write Message-ID: <43255cdd-9e1e-472a-9263-04db0259b3cb@lunn.ch> References: <20231126235141.17996-1-ansuelsmth@gmail.com> <20231126235141.17996-4-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231126235141.17996-4-ansuelsmth@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 27, 2023 at 12:51:41AM +0100, Christian Marangi wrote: > Some PHY in PHY package may require to read/write MMD regs to correctly > configure the PHY package. > > Add support for these additional required function in both lock and no > lock variant. > > It's possible to set is_c45 bool for phy_package_read/write to true to > access mmd regs for accessing C45 PHY in PHY package for global > configuration. I would just use phydev->is_c45. I would be very surprised if you have a package with some PHYs being only C22 and some C45. > > Signed-off-by: Christian Marangi > --- > Changes v2: > - Rework to use newly introduced helper > - Add common check for regnum and devad > > include/linux/phy.h | 78 +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 78 insertions(+) > > diff --git a/include/linux/phy.h b/include/linux/phy.h > index 96f6f34be051..3e507bd2c3b4 100644 > --- a/include/linux/phy.h > +++ b/include/linux/phy.h > @@ -2085,6 +2085,84 @@ static inline int __phy_package_write(struct phy_device *phydev, > return __mdiobus_write(phydev->mdio.bus, addr, regnum, val); > } > > +static inline int phy_package_read_mmd(struct phy_device *phydev, > + unsigned int addr_offset, bool is_c45, > + int devad, u32 regnum) > +{ I also don't know why this should be in the header file? Andrew