From: Michael Walle <michael@walle.cc>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Clause 45 and Clause 22 PHYs on one MDIO bus
Date: Mon, 21 Mar 2022 22:41:56 +0100 [thread overview]
Message-ID: <4d728d267e45fe591c933c86cdfff333@walle.cc> (raw)
In-Reply-To: <YjjhxbZgKHykJ+35@lunn.ch>
Am 2022-03-21 21:36, schrieb Andrew Lunn:
>> Actually, it looks like mdiobus_c45_read() is really c45 only and only
>> used for PHYs which just support c45 and not c45-over-c22 (?). I was
>> mistaken by the heavy use of the function in phy_device.c. All the
>> methods in phy-c45.c use phy_*_mmd() functions. Thus it might only be
>> the mxl-gpy doing something fishy in its probe function.
>
> Yes, there is something odd here. You should search back on the
> mailing list.
>
> If i remember correctly, it is something like it responds to both c22
> and c45. If it is found via c22, phylib does not set phydev->is_c45,
> and everything ends up going indirect. So the probe additionally tries
> to find it via c45? Or something like that.
Yeah, found it: https://lore.kernel.org/netdev/YLaG9cdn6ewdffjV@lunn.ch/
But that means that if the controller is not c45 capable, it will always
fail to probe, no?
I've added the "if (regnum & MII_ADDR_C45) return -EOPNOTSUPP" to the
mdio driver and the gpy phy will then fail to probe - as expected.
Should it check for -EOPNOTSUPP and just ignore that error and continue
probing? Or make it a no-op if probe_capabilities say it has no c45
access so it would take advantage of a quirk flag (derived from dt)?
>> Nevertheless, I'd still need the opt-out of any c45 access. Otherwise,
>> if someone will ever implement c45 support for the mdio-mscc-mdio
>> driver, I'll run in the erratic behavior.
>
> Yah, i need to think about that. Are you purely in the DT world, or is
> ACPI also an option?
Just DT world.
> Maybe extend of_mdiobus_register() to look for a DT property to limit
> what values probe_capabilities can take?
I'll have to give it a try. First I was thinking that we wouldn't need
it because a broken PHY driver could just set a quirk
"broken_c45_access"
or similar. But that would mean it has to be probed before any c45 PHY.
Dunno if that will be true for the future. And it sounds rather fragile.
So yes, a dt property might be a better option.
-michael
next prev parent reply other threads:[~2022-03-21 22:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-21 11:21 Clause 45 and Clause 22 PHYs on one MDIO bus Michael Walle
2022-03-21 11:46 ` Michael Walle
2022-03-21 20:36 ` Andrew Lunn
2022-03-21 21:41 ` Michael Walle [this message]
2022-03-21 22:34 ` Andrew Lunn
2022-03-21 20:21 ` Andrew Lunn
2022-03-21 21:51 ` Michael Walle
2022-03-21 22:37 ` 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=4d728d267e45fe591c933c86cdfff333@walle.cc \
--to=michael@walle.cc \
--cc=andrew@lunn.ch \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.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;
as well as URLs for NNTP newsgroup(s).