public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: "Neeli, Srinivas" <srinivas.neeli@amd.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "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>,
	"Simek, Michal" <michal.simek@amd.com>,
	"robh@kernel.org" <robh@kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"richardcochran@gmail.com" <richardcochran@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"git (AMD-Xilinx)" <git@amd.com>
Subject: RE: [RFC PATCH 4/8] xilinx: tsn: Add Ethernet MAC (EMAC) and MDIO support to the TSN driver
Date: Fri, 20 Feb 2026 13:08:35 +0000	[thread overview]
Message-ID: <SN7PR12MB8147BA0300639B61306EDC949368A@SN7PR12MB8147.namprd12.prod.outlook.com> (raw)
In-Reply-To: <b408cad2-90de-44df-85a6-64a028216290@lunn.ch>

[AMD Official Use Only - AMD Internal Distribution Only]

Hi,

> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Thursday, February 19, 2026 10:36 PM
> To: Neeli, Srinivas <srinivas.neeli@amd.com>
> Cc: andrew+netdev@lunn.ch; davem@davemloft.net;
> edumazet@google.com; kuba@kernel.org; pabeni@redhat.com; Simek,
> Michal <michal.simek@amd.com>; robh@kernel.org; krzk+dt@kernel.org;
> conor+dt@kernel.org; richardcochran@gmail.com; netdev@vger.kernel.org;
> linux-kernel@vger.kernel.org; devicetree@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; git (AMD-Xilinx) <git@amd.com>
> Subject: Re: [RFC PATCH 4/8] xilinx: tsn: Add Ethernet MAC (EMAC) and MDIO
> support to the TSN driver
>
> > +static int tsn_mdio_read(struct mii_bus *bus, int phy_id, int reg) {
> > +   u32 rc;
> > +   int ret;
> > +   struct tsn_emac *emac = bus->priv;
> > +   struct tsn_priv *common = emac->common;
> > +
> > +   scoped_guard(mutex, &common->mdio_lock) {
>
> What is this mutex protecting?
>

The mutex serializes access to the MDIO controller register block. The MDIO core already serializes bus accesses via bus->mdio_lock,
so the additional driver level mutex is redundant.
I will remove the extra mutex from the driver and rely on the MDIO core locking instead.

> > +           tsn_mdio_mdc_enable(emac);
>
> It is unusual to stop MDC. I suspect some PHYs will not like this.
> What is your reason for doing this.
>
The intention is to reduce power consumption by gating  the clock when it is not required.

> > +/**
> > + * tsn_mdio_setup - Setup MDIO bus for TSN EMAC
> > + * @emac: Pointer to TSN EMAC structure
> > + * @mac_np: Device tree node for MAC
> > + *
> > + * This function initializes the MDIO bus for the TSN EMAC interface.
> > + * It allocates an MII bus structure, configures MDIO timing, finds
> > + * the MDIO device tree node, and registers the MDIO bus with the kernel.
> > + *
> > + * Return: 0 on success, negative error code on failure  */ int
> > +tsn_mdio_setup(struct tsn_emac *emac, struct device_node *mac_np) {
> > +   struct tsn_priv *common = emac->common;
> > +   struct device_node *mdio_node;
> > +   struct mii_bus *bus;
> > +   int ret;
> > +
> > +   bus = mdiobus_alloc();
> > +   if (!bus)
> > +           return -ENOMEM;
> > +
> > +   snprintf(bus->id, MII_BUS_ID_SIZE, "tsn-mac-%.8llx",
> > +            (unsigned long long)emac->regs_start);
> > +
> > +   bus->priv = emac;
> > +   bus->name = "Xilinx TSN Ethernet MDIO";
> > +   bus->read = tsn_mdio_read;
> > +   bus->write = tsn_mdio_write;
> > +   bus->parent = common->dev;
> > +   emac->mii_bus = bus;
> > +
> > +   mdio_node = of_get_child_by_name(mac_np, "mdio");
> > +   if (!mdio_node) {
> > +           dev_err(common->dev, "MAC%d: missing 'mdio' child
> node\n",
> > +                   emac->emac_num);
> > +           ret = -ENODEV;
> > +           goto unregister;
> > +   }
>
> I forget, does the binding have a required: for the MDIO node?
>

MDIO node is not mandatory in binding. I will update the driver to treat the mdio chaild node as optional.

> > +   ret = tsn_mdio_enable(emac);
> > +   if (ret < 0)
> > +           goto unregister;
> > +   ret = of_mdiobus_register(bus, mdio_node);
>
> Having a node in DT is generally optional. You can pass NULL to
> of_mdiobus_register() and it will do the right thing.
>
>       Andrew
Yes, agreed. I will update the implementation to pass NULL to of_mdiobus_register() when the MDIO DT node is absent, instead of failing probe.

Thanks
Neeli Srinivas

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

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-19  5:49 [RFC PATCH 0/8] xilinx: tsn: Add TSN Endpoint Ethernet MAC driver support Srinivas Neeli
2026-02-19  5:49 ` [RFC PATCH 1/8] dt-bindings: net: Add TSN Endpoint Ethernet MAC support Srinivas Neeli
2026-02-19 16:53   ` Andrew Lunn
2026-02-20 13:03     ` Neeli, Srinivas
2026-02-20 13:39       ` Andrew Lunn
2026-02-24 11:08         ` Neeli, Srinivas
2026-02-19  5:49 ` [RFC PATCH 2/8] net: xilinx: tsn: Introduce TSN core driver skeleton Srinivas Neeli
2026-02-19  7:32   ` Krzysztof Kozlowski
2026-02-19  5:49 ` [RFC PATCH 3/8] net: xilinx: tsn: Add TSN endpoint and MCDMA support Srinivas Neeli
2026-02-19  5:49 ` [RFC PATCH 4/8] xilinx: tsn: Add Ethernet MAC (EMAC) and MDIO support to the TSN driver Srinivas Neeli
2026-02-19 17:05   ` Andrew Lunn
2026-02-20 13:08     ` Neeli, Srinivas [this message]
2026-02-20 15:03       ` Andrew Lunn
2026-02-24 11:11         ` Neeli, Srinivas
2026-02-20 15:12   ` Andrew Lunn
2026-02-24 11:15     ` Neeli, Srinivas
2026-02-19  5:49 ` [RFC PATCH 5/8] net: xilinx: tsn: Add TSN switch support with port state and frame filter control Srinivas Neeli
2026-02-19  5:49 ` [RFC PATCH 6/8] dt-bindings: net: Add PTP interrupt support Srinivas Neeli
2026-02-20 15:17   ` Andrew Lunn
2026-02-19  5:49 ` [RFC PATCH 7/8] net: xilinx: tsn: Add PTP hardware clock (PHC) and timer support Srinivas Neeli
2026-02-19  5:49 ` [RFC PATCH 8/8] net: xilinx: tsn: Add PTP packet transmission support Srinivas Neeli
2026-02-19  7:34 ` [RFC PATCH 0/8] xilinx: tsn: Add TSN Endpoint Ethernet MAC driver support Krzysztof Kozlowski
2026-02-19 16:42 ` Andrew Lunn
2026-02-20 12:59   ` Neeli, Srinivas
2026-02-20 13:36     ` Andrew Lunn
2026-03-05 11:46       ` Neeli, Srinivas
2026-03-26 10:11         ` Neeli, Srinivas

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=SN7PR12MB8147BA0300639B61306EDC949368A@SN7PR12MB8147.namprd12.prod.outlook.com \
    --to=srinivas.neeli@amd.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=git@amd.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    /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