From: Sean Anderson <sean.anderson@linux.dev>
To: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"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
Cc: linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Michal Simek <michal.simek@amd.com>,
linux-arm-kernel@lists.infradead.org,
Leon Romanovsky <leon@kernel.org>,
Sean Anderson <sean.anderson@linux.dev>
Subject: [PATCH net-next v3 3/7] net: axienet: Use MDIO bus device in prints
Date: Mon, 28 Jul 2025 18:18:19 -0400 [thread overview]
Message-ID: <20250728221823.11968-4-sean.anderson@linux.dev> (raw)
In-Reply-To: <20250728221823.11968-1-sean.anderson@linux.dev>
For clarity and to remove the dependency on the parent netdev, use the
MDIO bus device in print statements.
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
---
Changes in v3:
- New
.../net/ethernet/xilinx/xilinx_axienet_mdio.c | 34 +++++++++++--------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
index 16f3581390dd..cacd5590731d 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
@@ -104,7 +104,7 @@ static int axienet_mdio_read(struct mii_bus *bus, int phy_id, int reg)
rc = ioread32(lp->regs + XAE_MDIO_MRD_OFFSET) & 0x0000FFFF;
- dev_dbg(lp->dev, "axienet_mdio_read(phy_id=%i, reg=%x) == %x\n",
+ dev_dbg(&bus->dev, "%s(phy_id=%i, reg=%x) == %x\n", __func__,
phy_id, reg, rc);
axienet_mdio_mdc_disable(lp);
@@ -131,7 +131,7 @@ static int axienet_mdio_write(struct mii_bus *bus, int phy_id, int reg,
int ret;
u32 mcr;
- dev_dbg(lp->dev, "axienet_mdio_write(phy_id=%i, reg=%x, val=%x)\n",
+ dev_dbg(&bus->dev, "%s(phy_id=%i, reg=%x, val=%x)\n", __func__,
phy_id, reg, val);
axienet_mdio_mdc_enable(lp);
@@ -169,8 +169,9 @@ static int axienet_mdio_write(struct mii_bus *bus, int phy_id, int reg,
* Sets up the MDIO interface by initializing the MDIO clock and enabling the
* MDIO interface in hardware.
**/
-static int axienet_mdio_enable(struct axienet_local *lp, struct device_node *np)
+static int axienet_mdio_enable(struct mii_bus *bus, struct device_node *np)
{
+ struct axienet_local *lp = bus->priv;
u32 mdio_freq = DEFAULT_MDIO_FREQ;
u32 host_clock;
u32 clk_div;
@@ -186,28 +187,31 @@ static int axienet_mdio_enable(struct axienet_local *lp, struct device_node *np)
/* Legacy fallback: detect CPU clock frequency and use as AXI
* bus clock frequency. This only works on certain platforms.
*/
- np1 = of_find_node_by_name(NULL, "cpu");
+ np1 = of_find_node_by_name(NULL, "lpu");
if (!np1) {
- netdev_warn(lp->ndev, "Could not find CPU device node.\n");
+ dev_warn(&bus->dev,
+ "Could not find CPU device node.\n");
host_clock = DEFAULT_HOST_CLOCK;
} else {
int ret = of_property_read_u32(np1, "clock-frequency",
&host_clock);
if (ret) {
- netdev_warn(lp->ndev, "CPU clock-frequency property not found.\n");
+ dev_warn(&bus->dev,
+ "CPU clock-frequency property not found.\n");
host_clock = DEFAULT_HOST_CLOCK;
}
of_node_put(np1);
}
- netdev_info(lp->ndev, "Setting assumed host clock to %u\n",
- host_clock);
+ dev_info(&bus->dev,
+ "Setting assumed host clock to %u\n", host_clock);
}
if (np)
of_property_read_u32(np, "clock-frequency", &mdio_freq);
if (mdio_freq != DEFAULT_MDIO_FREQ)
- netdev_info(lp->ndev, "Setting non-standard mdio bus frequency to %u Hz\n",
- mdio_freq);
+ dev_info(&bus->dev,
+ "Setting non-standard mdio bus frequency to %u Hz\n",
+ mdio_freq);
/* clk_div can be calculated by deriving it from the equation:
* fMDIO = fHOST / ((1 + clk_div) * 2)
@@ -245,14 +249,14 @@ static int axienet_mdio_enable(struct axienet_local *lp, struct device_node *np)
/* Check for overflow of mii_clk_div */
if (clk_div & ~XAE_MDIO_MC_CLOCK_DIVIDE_MAX) {
- netdev_warn(lp->ndev, "MDIO clock divisor overflow\n");
+ dev_warn(&bus->dev, "MDIO clock divisor overflow\n");
return -EOVERFLOW;
}
lp->mii_clk_div = (u8)clk_div;
- netdev_dbg(lp->ndev,
- "Setting MDIO clock divisor to %u/%u Hz host clock.\n",
- lp->mii_clk_div, host_clock);
+ dev_dbg(&bus->dev,
+ "Setting MDIO clock divisor to %u/%u Hz host clock.\n",
+ lp->mii_clk_div, host_clock);
axienet_mdio_mdc_enable(lp);
@@ -295,7 +299,7 @@ int axienet_mdio_setup(struct axienet_local *lp)
lp->mii_bus = bus;
mdio_node = of_get_child_by_name(lp->dev->of_node, "mdio");
- ret = axienet_mdio_enable(lp, mdio_node);
+ ret = axienet_mdio_enable(bus, mdio_node);
if (ret < 0)
goto unregister;
ret = of_mdiobus_register(bus, mdio_node);
--
2.35.1.1320.gc452695387.dirty
next prev parent reply other threads:[~2025-07-28 22:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-28 22:18 [PATCH net-next v3 0/7] net: axienet: Fix deferred probe loop Sean Anderson
2025-07-28 22:18 ` [PATCH net-next v3 1/7] net: axienet: Fix resource release ordering Sean Anderson
2025-07-30 9:27 ` Gupta, Suraj
2025-07-28 22:18 ` [PATCH net-next v3 2/7] net: axienet: Use ioread32/iowrite32 directly Sean Anderson
2025-07-29 4:28 ` Subbaraya Sundeep
2025-07-28 22:18 ` Sean Anderson [this message]
2025-07-29 9:07 ` [PATCH net-next v3 3/7] net: axienet: Use MDIO bus device in prints kernel test robot
2025-07-28 22:18 ` [PATCH net-next v3 4/7] net: axienet: Simplify axienet_mdio_setup Sean Anderson
2025-07-28 22:18 ` [PATCH net-next v3 5/7] net: axienet: Use device variable in probe Sean Anderson
2025-07-28 22:18 ` [PATCH net-next v3 6/7] net: axienet: Rearrange lifetime functions Sean Anderson
2025-07-28 22:18 ` [PATCH net-next v3 7/7] net: axienet: Split into MAC and MDIO drivers Sean Anderson
2025-07-29 4:16 ` Subbaraya Sundeep
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=20250728221823.11968-4-sean.anderson@linux.dev \
--to=sean.anderson@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=kuba@kernel.org \
--cc=leon@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=radhey.shyam.pandey@amd.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).