From: Andrew Lunn <andrew@lunn.ch>
To: Joris Vaisvila <joey@tinyisr.com>
Cc: netdev@vger.kernel.org, horms@kernel.org, pabeni@redhat.com,
kuba@kernel.org, edumazet@google.com, davem@davemloft.net,
olteanv@gmail.com, devicetree@vger.kernel.org,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Subject: Re: [PATCH net-next v3 4/4] net: dsa: initial support for MT7628 embedded switch
Date: Thu, 30 Apr 2026 21:19:59 +0200 [thread overview]
Message-ID: <eccbc14b-fec1-4023-b95a-b0c45eb6df22@lunn.ch> (raw)
In-Reply-To: <20260428185510.261521-5-joey@tinyisr.com>
> source "drivers/net/dsa/lantiq/Kconfig"
>
> +config NET_DSA_MT7628
> + tristate "MediaTek MT7628 Embedded Ethernet switch support"
> + select NET_DSA_TAG_MT7628
> + select MEDIATEK_FE_SOC_PHY
> + help
> + This enables support for the built-in Ethernet switch found
> + in the MT7628 SoC.
> +
> config NET_DSA_MT7530
> tristate "MediaTek MT7530 and MT7531 Ethernet switch support"
NET_DSA_MT7628 is > NET_DSA_MT7530 so should come second.
> +static int mt7628_mii_read(struct mii_bus *bus, int port, int regnum)
> +{
> + struct mt7628_esw *esw = bus->priv;
> + int ret;
> + u32 val;
> +
> + ret = regmap_read_poll_timeout(esw->regmap, MT7628_ESW_REG_PCR1, val,
> + !(val & MT7628_ESW_PCR1_RD_DONE), 10,
> + 5000);
> + if (ret)
> + goto out;
> +
> + ret = regmap_write(esw->regmap, MT7628_ESW_REG_PCR0,
> + FIELD_PREP(MT7628_ESW_PCR0_CPU_PHY_REG,
> + regnum) |
> + FIELD_PREP(MT7628_ESW_PCR0_CPU_PHY_ADDR,
> + port) | MT7628_ESW_PCR0_RD_PHY_CMD);
> + if (ret)
> + goto out;
> +
> + ret = regmap_read_poll_timeout(esw->regmap, MT7628_ESW_REG_PCR1, val,
> + (val & MT7628_ESW_PCR1_RD_DONE), 10,
> + 5000);
> +out:
> + if (ret) {
> + dev_err(&bus->dev, "read failed. MDIO timeout?\n");
> + return ret;
> + }
> + return FIELD_GET(MT7628_ESW_PCR1_RD_DATA, val);
This works, but it is an unusual structure. Normally the label is
after the normal exist path, and only deals with errors.
> +}
> +
> +static int mt7628_mii_write(struct mii_bus *bus, int port, int regnum, u16 dat)
> +{
> + ret = regmap_read_poll_timeout(esw->regmap, MT7628_ESW_REG_PCR1, val,
> + (val & MT7628_ESW_PCR1_WT_DONE), 10,
> + 5000);
> +out:
> + if (ret) {
> + dev_err(&bus->dev, "write failed. MDIO timeout?\n");
> + return ret;
> + }
> + return 0;
> +}
Same here.
Otherwise this looks O.K.
Andrew
next prev parent reply other threads:[~2026-04-30 19:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 18:55 [PATCH net-next v3 0/4] net: dsa: mt7628 embedded switch initial support Joris Vaisvila
2026-04-28 18:55 ` [PATCH net-next v3 1/4] dt-bindings: net: dsa: add MT7628 ESW Joris Vaisvila
2026-04-30 23:56 ` Jakub Kicinski
2026-04-28 18:55 ` [PATCH net-next v3 2/4] net: phy: mediatek: add phy driver for MT7628 built-in Fast Ethernet PHYs Joris Vaisvila
2026-04-28 18:55 ` [PATCH net-next v3 3/4] net: dsa: initial MT7628 tagging driver Joris Vaisvila
2026-04-28 18:55 ` [PATCH net-next v3 4/4] net: dsa: initial support for MT7628 embedded switch Joris Vaisvila
2026-04-30 19:19 ` Andrew Lunn [this message]
2026-04-30 23:56 ` Jakub Kicinski
2026-04-29 7:09 ` [PATCH net-next v3 0/4] net: dsa: mt7628 embedded switch initial support Krzysztof Kozlowski
2026-04-29 8:21 ` Joris Vaisvila
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=eccbc14b-fec1-4023-b95a-b0c45eb6df22@lunn.ch \
--to=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=joey@tinyisr.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=robh@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