netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: "Arınç ÜNAL" <arinc.unal@arinc9.com>,
	"Daniel Golle" <daniel@makrotopia.org>,
	"DENG Qingfang" <dqfext@gmail.com>,
	"Sean Wang" <sean.wang@mediatek.com>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Vladimir Oltean" <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>
Cc: Bartel Eerdekens <bartel.eerdekens@constell8.be>,
	mithat.guner@xeront.com, erkin.bozoglu@xeront.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH net-next v2 1/2] net: dsa: mt7530-mdio: read PHY address of switch from device tree
Date: Tue, 16 Apr 2024 20:09:50 -0700	[thread overview]
Message-ID: <050ef345-9f4c-437c-863b-fdb8e2a47041@gmail.com> (raw)
In-Reply-To: <7d0ded52-14f0-4f6a-b639-72f537603be8@arinc9.com>



On 4/16/2024 1:32 AM, Arınç ÜNAL wrote:
> On 15/04/2024 18:30, Florian Fainelli wrote:
>>
>>
>> On 4/13/2024 11:07 PM, Arınç ÜNAL via B4 Relay wrote:
>>> From: Arınç ÜNAL <arinc.unal@arinc9.com>
>>>
>>> Read the PHY address the switch listens on from the reg property of the
>>> switch node on the device tree. This change brings support for MT7530
>>> switches on boards with such bootstrapping configuration where the 
>>> switch
>>> listens on a different PHY address than the hardcoded PHY address on the
>>> driver, 31.
>>>
>>> As described on the "MT7621 Programming Guide v0.4" document, the MT7530
>>> switch and its PHYs can be configured to listen on the range of 7-12,
>>> 15-20, 23-28, and 31 and 0-4 PHY addresses.
>>>
>>> There are operations where the switch PHY registers are used. For the 
>>> PHY
>>> address of the control PHY, transform the MT753X_CTRL_PHY_ADDR constant
>>> into a macro and use it. The PHY address for the control PHY is 0 
>>> when the
>>> switch listens on 31. In any other case, it is one greater than the PHY
>>> address the switch listens on.
>>>
>>> Reviewed-by: Daniel Golle <daniel@makrotopia.org>
>>> Tested-by: Daniel Golle <daniel@makrotopia.org>
>>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>>
>> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
>>
>> I would go a step further and name phy_addr switch_mdio_addr, or 
>> something along those lines to clearly denote this is not a per-port 
>> PHY address neither a proper PHY device, but we've already had a 
>> similar discussion before about spelling this out clearly as a "pseudo 
>> PHY"....
> 
> I am fine with calling the switch operating on an MDIO bus a psuedo-PHY.
> But I don't believe this grants making up names on our own instead of using
> the name described in IEEE Std 802.3-2022. The switch listens on a PHY
> address on the MDIO bus. 

The switch listens at a particular address on the MDIO bus, that is the 
key thing. Whether the addressable device happens to be an 
Ethernet/SATA/PCIe/USB PHY, an accelerometer, a light switch or an 
Ethernet switch does not matter as long as it is addressable over clause 
22 and/or 45. For all that matters the switch's MDIO interface is not a 
PHY, otherwise its registers 0-15 would be abiding by the IEEE 
802.3-2022 standard, and that is not the case.

> The description for the phy_addr member of the
> mt753x_info structure clearly explains that so I don't see a reason to
> change the variable name.

IMHO it is clearer to use mdiodev->addr through and through, the 
shorthand is not necessary and does not save that many characters to 
type in the first place. Saving a mdiodev pointer into mt7530_priv and 
accessing priv->mdiodev->addr would be 18 characters to type versus 14 
with priv->phy_addr.

Anyway.
-- 
Florian

  reply	other threads:[~2024-04-17  3:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-14  6:07 [PATCH net-next v2 0/2] Read PHY address of switch from device tree on MT7530 DSA subdriver Arınç ÜNAL via B4 Relay
2024-04-14  6:07 ` [PATCH net-next v2 1/2] net: dsa: mt7530-mdio: read PHY address of switch from device tree Arınç ÜNAL via B4 Relay
2024-04-14  8:17   ` Arınç ÜNAL
2024-04-15 15:30   ` Florian Fainelli
2024-04-16  8:32     ` Arınç ÜNAL
2024-04-17  3:09       ` Florian Fainelli [this message]
2024-04-17  7:02         ` Arınç ÜNAL
2024-04-14  6:07 ` [PATCH net-next v2 2/2] net: dsa: mt7530: simplify core operations Arınç ÜNAL via B4 Relay

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=050ef345-9f4c-437c-863b-fdb8e2a47041@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=arinc.unal@arinc9.com \
    --cc=bartel.eerdekens@constell8.be \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=dqfext@gmail.com \
    --cc=edumazet@google.com \
    --cc=erkin.bozoglu@xeront.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mithat.guner@xeront.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=sean.wang@mediatek.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).