mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Selvamani Rajagopal <Selvamani.Rajagopal@onsemi.com>
Cc: Piergiorgio Beruto <Pier.Beruto@onsemi.com>,
	"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v3 12/14] onsemi: s2500: Add driver support for TS2500 MAC-PHY
Date: Tue, 2 Jun 2026 15:02:49 +0200	[thread overview]
Message-ID: <7fe02d9d-3409-43c3-884b-4a0107400a7a@lunn.ch> (raw)
In-Reply-To: <CY8PR02MB92498165068F7C2FAF9635C883122@CY8PR02MB9249.namprd02.prod.outlook.com>

On Tue, Jun 02, 2026 at 02:30:02AM +0000, Selvamani Rajagopal wrote:
> > 
> > > +#define S2500_MMS_MII (S2500_OA_TC6_MACPHY_MMS0 << 16)
> > > +#define S2500_MMS_MAC (S2500_OA_TC6_MAC_MMS1 << 16)
> > > +#define S2500_MMS_PCS (OA_TC6_PHY_C45_PCS_MMS2 << 16)
> > > +#define S2500_MMS_PMDPMA (OA_TC6_PHY_C45_PMA_PMD_MMS3 << 16)
> > > +#define S2500_MMS_VS1 (S2500_OA_TC6_VS1_MMS12 << 16)
> > > +#define S2500_MMS_VS2 (OA_TC6_PHY_C45_VS_PLCA_MMS4 << 16)
> > 
> > This kind of suggests we should rethink the API for reading/writing
> > registers. It should be possible to pass MMS and register as seperate
> > values, and let the core combine them.
> 
> 
> I agree. In fact, onsemi's original implementation had MMS and address as separate parameter. 
> It is going to touch all the files. Let me know whether you want to do, If so, when.

I already suggested adding _mms() versions for register read/write. We
can leave any using MMS 0 alone, and only use these wrappers for !
0. That should make the patch smaller.

> > > + /* Convert the OID in host byte order */
> > > + for (i = 2; i >= 0; --i) {
> > > + addr[i] = 0;
> > > + for (j = 0; j < 8; ++j) {
> > > + addr[i] |= (val & 1) << (7 - j);
> > > + val >>= 1;
> > > + }
> > > + }
> > 
> > That seems pretty complex. What exactly is it doing?
> 
> Could have been well commented. According to datesheet, phy-id-reg[16:31] mapped to OUI[2:17] and 
> phy-id-reg[8:15] mapped to OUI[18:23]. I will add this to the comment.

What you might want to use FIELD_PREP, etc. See if that makes the code
more readable.

	Andrew

  reply	other threads:[~2026-06-02 13:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 18:41 Selvamani Rajagopal
2026-05-31 15:16 ` Andrew Lunn
2026-06-02  2:30   ` Selvamani Rajagopal
2026-06-02 13:02     ` Andrew Lunn [this message]
2026-05-31 15:17 ` Andrew Lunn
2026-05-31 15:20 ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7fe02d9d-3409-43c3-884b-4a0107400a7a@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Pier.Beruto@onsemi.com \
    --cc=Selvamani.Rajagopal@onsemi.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®