linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: James Hilliard <james.hilliard1@gmail.com>, Andrew Lunn <andrew@lunn.ch>
Cc: netdev@vger.kernel.org, linux-sunxi@lists.linux.dev,
	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>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Russell King <linux@armlinux.org.uk>,
	"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
	Furong Xu <0x1207@gmail.com>,
	Kunihiko Hayashi <hayashi.kunihiko@socionext.com>,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] net: stmmac: allow drivers to explicitly select PHY device
Date: Fri, 30 May 2025 16:56:22 -0700	[thread overview]
Message-ID: <e1f4e2b7-edf9-444c-ad72-afae6e271e36@gmail.com> (raw)
In-Reply-To: <CADvTj4posNXP4FCXPqABtP0cMD1dPUH+hXcRQnetZ65ReKjOKQ@mail.gmail.com>

On 5/30/25 16:46, James Hilliard wrote:
> On Tue, May 27, 2025 at 2:02 PM Andrew Lunn <andrew@lunn.ch> wrote:
>>
>> On Tue, May 27, 2025 at 01:21:21PM -0600, James Hilliard wrote:
>>> On Tue, May 27, 2025 at 1:14 PM Andrew Lunn <andrew@lunn.ch> wrote:
>>>>
>>>> On Tue, May 27, 2025 at 11:55:54AM -0600, James Hilliard wrote:
>>>>> Some devices like the Allwinner H616 need the ability to select a phy
>>>>> in cases where multiple PHY's may be present in a device tree due to
>>>>> needing the ability to support multiple SoC variants with runtime
>>>>> PHY selection.
>>>>
>>>> I'm not convinced about this yet. As far as i see, it is different
>>>> variants of the H616. They should have different compatibles, since
>>>> they are not actually compatible, and you should have different DT
>>>> descriptions. So you don't need runtime PHY selection.
>>>
>>> Different compatibles for what specifically? I mean the PHY compatibles
>>> are just the generic "ethernet-phy-ieee802.3-c22" compatibles.
>>
>> You at least have a different MTD devices, exporting different
>> clocks/PWM/Reset controllers. That should have different compatibles,
>> since they are not compatible. You then need phandles to these
>> different clocks/PWM/Reset controllers, and for one of the PHYs you
>> need a phandle to the I2C bus, so the PHY driver can do the
>> initialisation. So i think in the end you know what PHY you have on
>> the board, so there is no need to do runtime detection.
> 
> Hmm, thinking about this again, maybe it makes sense to just
> do the runtime detection in the MFD driver entirely, as it turns
> out the AC300 initialization sequence is largely a subset of the
> AC200 initialization sequence(AC300 would just not need any
> i2c part of the initialization sequence). So if we use the same
> MFD driver which internally does autodetection then we can
> avoid the need for selecting separate PHY's entirely. This at
> least is largely how the vendor BSP driver works at the moment.
> 
> Would this approach make sense?

This has likely been discussed, but cannot you move the guts of patch #2 
into u-boot or the boot loader being used and have it patch the PHY 
Device Tree node's "reg" property accordingly before handing out the DTB 
to the kernel?

Another way to address what you want to do is to remove the "reg" 
property from the Ethernet PHY node and just let of_mdiobus_register() 
automatically scan, you have the advantage of having the addresses 
consecutive so this won't dramatically increase the boot time... I do 
that on the boards I suppose that have a removable mezzanine card that 
includes a PHY address whose address is dictated by straps so we don't 
want to guess, we let the kernel auto detect instead.
-- 
Florian


  reply	other threads:[~2025-05-31  0:15 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-27 17:55 [PATCH v2 1/3] net: stmmac: allow drivers to explicitly select PHY device James Hilliard
2025-05-27 17:55 ` [PATCH v2 2/3] net: stmmac: dwmac-sun8i: Allow runtime AC200/AC300 phy selection James Hilliard
2025-05-27 17:55 ` [PATCH v2 3/3] dt-bindings: net: sun8i-emac: Add AC300 EMAC1 nvmem " James Hilliard
2025-05-27 19:14 ` [PATCH v2 1/3] net: stmmac: allow drivers to explicitly select PHY device Andrew Lunn
2025-05-27 19:21   ` James Hilliard
2025-05-27 20:01     ` Andrew Lunn
2025-05-27 20:16       ` James Hilliard
2025-05-27 20:30         ` Andrew Lunn
2025-05-27 20:37           ` James Hilliard
2025-05-27 21:48             ` Andrew Lunn
2025-05-27 22:47               ` James Hilliard
2025-05-28  7:53             ` Russell King (Oracle)
2025-05-28 11:57               ` James Hilliard
2025-05-28 13:24                 ` Andrew Lunn
2025-05-28 14:11                   ` Chen-Yu Tsai
2025-05-28 17:25                     ` James Hilliard
2025-05-28 18:34                       ` Russell King (Oracle)
2025-05-28 19:10                         ` James Hilliard
2025-05-28 19:26                           ` Andrew Lunn
2025-05-28 19:45                             ` James Hilliard
2025-05-28 21:05                               ` Andrew Lunn
2025-05-28 21:14                                 ` James Hilliard
2025-05-28 21:29                                   ` Andrew Lunn
2025-05-28 21:45                                     ` James Hilliard
2025-05-28 23:47                                       ` Andrew Lunn
2025-05-29  0:31                                         ` James Hilliard
2025-05-30 23:46       ` James Hilliard
2025-05-30 23:56         ` Florian Fainelli [this message]
2025-05-31  0:02           ` James Hilliard
2025-05-31  0:24             ` Florian Fainelli
2025-05-31  0:49               ` James Hilliard

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=e1f4e2b7-edf9-444c-ad72-afae6e271e36@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=0x1207@gmail.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hayashi.kunihiko@socionext.com \
    --cc=james.hilliard1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=linux@armlinux.org.uk \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rmk+kernel@armlinux.org.uk \
    /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).