mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marek Vasut <marex@nabladev.com>
To: Jakub Kicinski <kuba@kernel.org>, netdev-bot+sashiko@kernel.org
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	andrew+netdev@lunn.ch, xiaoning.wang@nxp.com,
	claudiu.manoil@nxp.com, edumazet@google.com, pabeni@redhat.com,
	vladimir.oltean@nxp.com, wei.fang@nxp.com, imx@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [net-next,PATCH] enetc: Set eMDIO MDC rate to 2.5 MHz only on i.MX95
Date: Fri, 16 Oct 2026 20:18:04 +0200	[thread overview]
Message-ID: <cea83807-2469-4d9e-b331-aa7e4e31d88b@nabladev.com> (raw)
In-Reply-To: <20261007172230.53347039@kernel.org>

On 10/8/26 2:22 AM, Jakub Kicinski wrote:
> On Mon, 05 Oct 2026 15:30:10 +0000 netdev-bot+sashiko@kernel.org wrote:
>>> -#define ENETC_EMDIO_CFG \
>>> +#define ENETC_EMDIO_CFG(mdc_div) \
>>>   	(MDIO_CFG_HOLD(2) | \
>>> -	 MDIO_CFG_CLKDIV(66) | \
>>> +	 MDIO_CFG_CLKDIV(mdc_div) | \
>>>   	 MDIO_CFG_NEG)
>>
>> [Severity: High]
>> What divider do the other users of these accessors get?
>>
>> The exported enetc_mdio_read_c22(), enetc_mdio_write_c22(),
>> enetc_mdio_read_c45() and enetc_mdio_write_c45() are shared with several
>> bus constructors. Only enetc_pci_mdio_probe() sets mdc_div.
>>
>> These constructors install the same accessors but set only hw and
>> mdio_base:
>>
>>    enetc_mdio_probe() in enetc_pf_common.c (PF external MDIO, LS1028A
>>    and ENETC4)
>>    enetc_imdio_create() in enetc_pf_common.c (internal Lynx PCS MDIO)
>>    netc_port_create_emdio_bus() in drivers/net/dsa/netc/netc_main.c
>>    vsc9959_mdio_bus_alloc() in drivers/net/dsa/ocelot/felix_vsc9959.c
>>
>> For example:
>>
>> enetc_pf_common.c:enetc_mdio_probe() {
>>      ...
>>      bus = devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv));
>>      ...
>>      mdio_priv->hw = &pf->si->hw;
>>      if (is_enetc_rev1(pf->si))
>>          mdio_priv->mdio_base = ENETC_EMDIO_BASE;
>>      else
>>          mdio_priv->mdio_base = ENETC4_EMDIO_BASE;
>>      ...
>> }
>>
>> mdiobus_alloc_size() allocates the priv area with kzalloc(), so mdc_div
>> stays 0. MDIO_CFG_CLKDIV(x) is ((((x) >> 1) & 0xff) << 8).
>>
>> As a result, every C22/C45 transaction on these buses would write a zero
>> clock divider into ENETC_MDIO_CFG. Before 587acb86d646 the value was 258,
>> and after it the value was 66.
> 
> Looks legit.

Let me fill the default into Ocelot and enetc_pf_common.c

  reply	other threads:[~2026-10-16 19:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 22:38 Marek Vasut
2026-10-01 22:43 ` netdev-bot+sinfo
2026-10-05 15:30 ` netdev-bot+sashiko
2026-10-08  0:22   ` Jakub Kicinski
2026-10-16 18:18     ` Marek Vasut [this message]
2026-10-08  3:24 ` Wei Fang
2026-10-16 18:20   ` Marek Vasut

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=cea83807-2469-4d9e-b331-aa7e4e31d88b@nabladev.com \
    --to=marex@nabladev.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=imx@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.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®