From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Daniel Golle <daniel@makrotopia.org>, arinc.unal@arinc9.com
Cc: DENG Qingfang <dqfext@gmail.com>,
Sean Wang <sean.wang@mediatek.com>, Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
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>,
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 1/2] net: dsa: mt7530-mdio: read PHY address of switch from device tree
Date: Sun, 14 Apr 2024 10:06:42 +0200 [thread overview]
Message-ID: <6faf8008-3a64-4ed9-8d7e-52ff32862df9@wanadoo.fr> (raw)
In-Reply-To: <ZhtJGEdjeS3LfMWF@makrotopia.org>
Le 14/04/2024 à 05:10, Daniel Golle a écrit :
> On Sun, Apr 14, 2024 at 01:08:19AM +0300, 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.
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>
> See minor nit inline below.
>
...
>>
>> -#define MT753X_CTRL_PHY_ADDR 0
>> +#define MT753X_CTRL_PHY_ADDR(phy_addr) (phy_addr == 0x1f ? 0 : phy_addr + 1)
>
> #define MT753X_CTRL_PHY_ADDR(phy_addr) (phy_addr + 1 & 0x1f)
Nit: maybe (even if certainly useless in this case):
#define MT753X_CTRL_PHY_ADDR(phy_addr) ((phy_addr) + 1 & 0x1f)
?
>
> It's shorter, and works without conditional operator which is expensive.
>
Cj
next prev parent reply other threads:[~2024-04-14 8:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-13 22:08 [PATCH net-next 0/2] Read PHY address of switch from device tree on MT7530 DSA subdriver Arınç ÜNAL via B4 Relay
2024-04-13 22:08 ` [PATCH net-next 1/2] net: dsa: mt7530-mdio: read PHY address of switch from device tree Arınç ÜNAL via B4 Relay
2024-04-14 3:10 ` Daniel Golle
2024-04-14 5:59 ` Arınç ÜNAL
2024-04-14 8:06 ` Christophe JAILLET [this message]
2024-04-13 22:08 ` [PATCH net-next 2/2] net: dsa: mt7530: simplify core operations Arınç ÜNAL via B4 Relay
2024-04-14 3:22 ` Daniel Golle
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=6faf8008-3a64-4ed9-8d7e-52ff32862df9@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--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=f.fainelli@gmail.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 read-only IMAP folder(s) and NNTP newsgroup(s).