From: "Markus Stockhausen" <markus.stockhausen@gmx.de>
To: "'Jagielski, Jedrzej'" <jedrzej.jagielski@intel.com>,
<andrew@lunn.ch>, <hkallweit1@gmail.com>, <linux@armlinux.org.uk>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <netdev@vger.kernel.org>,
<chris.packham@alliedtelesis.co.nz>, <daniel@makrotopia.org>,
<mensi@mensi.ch>
Subject: AW: [PATCH net-next 6/8] net: mdio: realtek-rtl9300: relocate topology setup
Date: Tue, 2 Jun 2026 12:50:31 +0200 [thread overview]
Message-ID: <017101dcf27d$a37cc850$ea7658f0$@gmx.de> (raw)
In-Reply-To: <PH0PR11MB590280FD1EBFDE793A92A97FF0122@PH0PR11MB5902.namprd11.prod.outlook.com>
> Von: Jagielski, Jedrzej <jedrzej.jagielski@intel.com>
> Gesendet: Dienstag, 2. Juni 2026 11:51
> Betreff: RE: [PATCH net-next 6/8] net: mdio: realtek-rtl9300: relocate
topology setup
> ...
> >-static int otto_emdio_9300_mdiobus_init(struct otto_emdio_priv *priv)
> >+static int otto_emdio_write_mapping(struct otto_emdio_priv *priv, u32
base, u32 port,
> >+ u32 ports_per_reg, u32 bits_per_val, u32
value)
> > {
> >- u32 glb_ctrl_mask = 0, glb_ctrl_val = 0;
> >- struct regmap *regmap = priv->regmap;
> >- u32 port_addr[5] = { 0 };
> >- u32 poll_sel[2] = { 0 };
> >- int i, err;
> >+ u32 shift = (port % ports_per_reg) * bits_per_val;
>
> are we sure @ports_per_reg cannot be equal to 0 in any scenario?
This helper is only implemented to make the topology
setup code easier to read. So this is never gets a zero input.
I can rename the function to clearer indicate the tight coupling.
> ...
> >- pos = (i % 16) * 2;
> >- poll_sel[i / 16] |= (priv->smi_bus[i] & 0x3) << pos;
> >+ for_each_set_bit(port, priv->valid_ports, info->num_ports) {
> >+ if (info->bus_map_base) {
> >+ /* 16 ports per register, 2 bits per port (bus index
0-3) */
> >+ ret = otto_emdio_write_mapping(priv,
info->bus_map_base, port,
> >+ 16, 2,
priv->smi_bus[port]);
> >+ if (ret)
> >+ return ret;
> >+ }
> >+ if (info->addr_map_base) {
> >+ /* 6 ports per register, 5 bits per port (PHY
address 0-31) */
> >+ ret = otto_emdio_write_mapping(priv,
info->addr_map_base, port,
> >+ 6, 5,
priv->smi_addr[port]);
> >+ if (ret)
> >+ return ret;
> >+ }
> > }
> >+ return 0;
>
> Magic numbers appearing here and there, what is discouraged in netdev i
believe
> Any chance to replace them with corresponding defines?
No problem, will ad that to v2.
Markus
next prev parent reply other threads:[~2026-06-02 10:50 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 5:26 [PATCH net-next 0/8] net: mdio: realtek-rtl9300: Refactor initialization and port lookup Markus Stockhausen
2026-06-02 5:26 ` [PATCH net-next 1/8] net: mdio: realtek-rtl9300: Convert to fwnode API Markus Stockhausen
2026-06-02 12:06 ` Andrew Lunn
2026-06-02 12:29 ` AW: " Markus Stockhausen
2026-06-02 12:50 ` Andrew Lunn
2026-06-02 5:26 ` [PATCH net-next 2/8] net: mdio: realtek-rtl9300: Correctly handle ethernet-phy-package Markus Stockhausen
2026-06-02 9:32 ` Jagielski, Jedrzej
2026-06-02 10:23 ` AW: " Markus Stockhausen
2026-06-02 11:22 ` Jagielski, Jedrzej
2026-06-02 5:26 ` [PATCH net-next 3/8] net: mdio: realtek-rtl9300: harden otto_emdio_map_ports() Markus Stockhausen
2026-06-02 9:38 ` Jagielski, Jedrzej
2026-06-02 10:42 ` AW: " Markus Stockhausen
2026-06-02 11:29 ` Jagielski, Jedrzej
2026-06-02 12:14 ` Andrew Lunn
2026-06-02 5:26 ` [PATCH net-next 4/8] net: mdio: realtek-rtl9300: harden otto_emdio_probe_one() Markus Stockhausen
2026-06-02 5:26 ` [PATCH net-next 5/8] net: mdio: realtek-rtl9300: adapt spaces for defines Markus Stockhausen
2026-06-02 9:42 ` Jagielski, Jedrzej
2026-06-02 10:18 ` AW: " Markus Stockhausen
2026-06-02 11:16 ` Jagielski, Jedrzej
2026-06-02 12:20 ` Andrew Lunn
2026-06-02 5:26 ` [PATCH net-next 6/8] net: mdio: realtek-rtl9300: relocate topology setup Markus Stockhausen
2026-06-02 9:50 ` Jagielski, Jedrzej
2026-06-02 10:50 ` Markus Stockhausen [this message]
2026-06-02 12:24 ` Andrew Lunn
2026-06-02 13:01 ` AW: " Markus Stockhausen
2026-06-02 5:26 ` [PATCH net-next 7/8] net: mdio: realtek-rtl9300: reorder controller setup Markus Stockhausen
2026-06-02 5:26 ` [PATCH net-next 8/8] net: mdio: realtek-rtl9300: Convert port lookup from O(n) to O(1) Markus Stockhausen
2026-06-02 12:30 ` 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='017101dcf27d$a37cc850$ea7658f0$@gmx.de' \
--to=markus.stockhausen@gmx.de \
--cc=andrew@lunn.ch \
--cc=chris.packham@alliedtelesis.co.nz \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=jedrzej.jagielski@intel.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mensi@mensi.ch \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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