netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [net-next] net: ethernet: rtsn: Add support for Renesas Ethernet-TSN
Date: Fri, 3 May 2024 12:20:06 +0200	[thread overview]
Message-ID: <20240503102006.GI3927860@ragnatech.se> (raw)
In-Reply-To: <5fd25c58-b421-4ec0-8b4f-24f86f054a44@lunn.ch>

Hi Andrew,

Thanks for your review.

On 2024-04-16 00:55:12 +0200, Andrew Lunn wrote:

<snip>

> > +static int rtsn_mii_access_indirect(struct mii_bus *bus, bool read, 
> > int phyad,
> > +				    int devnum, int regnum, u16 data)
> > +{
> > +	int ret;
> > +
> > +	ret = rtsn_mii_access(bus, false, phyad, MII_MMD_CTRL, devnum);
> > +	if (ret)
> > +		return ret;
> > +
> > +	ret = rtsn_mii_access(bus, false, phyad, MII_MMD_DATA, regnum);
> > +	if (ret)
> > +		return ret;
> > +
> > +	ret = rtsn_mii_access(bus, false, phyad, MII_MMD_CTRL,
> > +			      devnum | MII_MMD_CTRL_NOINCR);
> 
> This looks to be C45 over C22. phylib core knows how to do this, since
> it should be the same for all PHYs which implement C45 over C22. So
> there is no need for you to implement it again.
> 
> > +static int rtsn_mii_register(struct rtsn_private *priv)
> > +{
> > +	struct platform_device *pdev = priv->pdev;
> > +	struct device *dev = &pdev->dev;
> > +	struct device_node *mdio_node;
> > +	struct mii_bus *mii;
> > +	int ret;
> > +
> > +	mii = mdiobus_alloc();
> > +	if (!mii)
> > +		return -ENOMEM;
> > +
> > +	mdio_node = of_get_child_by_name(dev->of_node, "mdio");
> > +	if (!mdio_node) {
> > +		ret = -ENODEV;
> > +		goto out_free_bus;
> > +	};
> > +
> > +	mii->name = "rtsn_mii";
> > +	sprintf(mii->id, "%s-%x", pdev->name, pdev->id);
> > +	mii->priv = priv;
> > +	mii->read = rtsn_mii_read;
> > +	mii->write = rtsn_mii_write;
> > +	mii->read_c45 = rtsn_mii_read_c45;
> > +	mii->write_c45 = rtsn_mii_write_c45;
> 
> Just leave these two empty, and the core will do C45 over C22 for you.

Does this not require the bus to be created/allocated with an 
implementation that support this, for example mdio_i2c_alloc() or 
alloc_mdio_bitbang()?  This bus is allocated with mdiobus_alloc() which 
do not implement this. Removing the C45 functions here result in 
__mdiobus_c45_read() returning -EOPNOTSUPP as bus->read_c45 is not set.

The allocator in question here could possibly be alloc_mdio_bitbang(), 
but I see no easy way for me to implement the mdiobb_ops struct. Is 
there a different bus implementation I should use that is able to talk 
C45 over C22 ?

-- 
Kind Regards,
Niklas Söderlund

  parent reply	other threads:[~2024-05-03 10:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-14 13:59 [net-next] net: ethernet: rtsn: Add support for Renesas Ethernet-TSN Niklas Söderlund
2024-04-15  7:34 ` Paul Barker
2024-04-16  8:36   ` Niklas Söderlund
2024-04-15 22:55 ` Andrew Lunn
2024-04-16  8:58   ` Niklas Söderlund
2024-04-16 13:05     ` Andrew Lunn
2024-04-19  8:16       ` Geert Uytterhoeven
2024-04-19 12:56         ` Andrew Lunn
2024-05-03 10:20   ` Niklas Söderlund [this message]
2024-05-03 11:59     ` Andrew Lunn
2024-05-03 13:30       ` Niklas Söderlund
2024-05-06  1:51         ` Andrew Lunn
2024-05-06 14:05           ` Niklas Söderlund
2024-05-06 17:43             ` Geert Uytterhoeven
2024-05-06 18:26               ` Niklas Söderlund
2024-05-06 20:00                 ` Andrew Lunn
2024-05-07 11:18                   ` Niklas Söderlund
2024-05-06 19:53             ` Andrew Lunn
2024-05-07 11:14               ` Niklas Söderlund
2024-04-18 18:32 ` Simon Horman
2024-04-18 19:03   ` Arnd Bergmann
2024-05-03  8:50     ` Niklas Söderlund
2024-04-18 18:35 ` Simon Horman

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=20240503102006.GI3927860@ragnatech.se \
    --to=niklas.soderlund+renesas@ragnatech.se \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yoshihiro.shimoda.uh@renesas.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;
as well as URLs for NNTP newsgroup(s).