From: "Sverdlin, Alexander" <alexander.sverdlin@siemens.com>
To: "hauke@hauke-m.de" <hauke@hauke-m.de>,
"olteanv@gmail.com" <olteanv@gmail.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"andrew@lunn.ch" <andrew@lunn.ch>,
"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"arkadis@mellanox.com" <arkadis@mellanox.com>,
"daniel@makrotopia.org" <daniel@makrotopia.org>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"edumazet@google.com" <edumazet@google.com>,
"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
"horms@kernel.org" <horms@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "john@phrozen.org" <john@phrozen.org>,
"Stockmann, Lukas" <lukas.stockmann@siemens.com>,
"yweng@maxlinear.com" <yweng@maxlinear.com>,
"fchan@maxlinear.com" <fchan@maxlinear.com>,
"lxu@maxlinear.com" <lxu@maxlinear.com>,
"jpovazanec@maxlinear.com" <jpovazanec@maxlinear.com>,
"Schirm, Andreas" <andreas.schirm@siemens.com>,
"Christen, Peter" <peter.christen@siemens.com>,
"ajayaraman@maxlinear.com" <ajayaraman@maxlinear.com>,
"bxu@maxlinear.com" <bxu@maxlinear.com>,
"lrosu@maxlinear.com" <lrosu@maxlinear.com>
Subject: Re: [PATCH RFC net-next 18/23] net: dsa: lantiq_gswip: convert to use regmap
Date: Thu, 21 Aug 2025 17:59:23 +0000 [thread overview]
Message-ID: <80e49f31a311787ebdd24992e3822727a708a0b9.camel@siemens.com> (raw)
In-Reply-To: <aKDiUb084FhsmsTv@pidgin.makrotopia.org>
Hi Daniel,
On Sat, 2025-08-16 at 20:56 +0100, Daniel Golle wrote:
> Use regmap for register access in preparation for supporting the MaxLinear
> GSW1xx family of switches connected via MDIO or SPI.
>
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
...
> --- a/drivers/net/dsa/lantiq_gswip.c
> +++ b/drivers/net/dsa/lantiq_gswip.c
...
> static void gswip_switch_mask(struct gswip_priv *priv, u32 clear, u32 set,
> u32 offset)
> {
> - u32 val = gswip_switch_r(priv, offset);
> + int ret;
>
> - val &= ~(clear);
> - val |= set;
> - gswip_switch_w(priv, val, offset);
> + ret = regmap_update_bits_base(priv->gswip, offset, clear | set, set,
> + NULL, false, true);
The above looks like regmap_write_bits()?
...
> static void gswip_mdio_mask(struct gswip_priv *priv, u32 clear, u32 set,
> u32 offset)
> {
> - u32 val = gswip_mdio_r(priv, offset);
> -
> - val &= ~(clear);
> - val |= set;
> - gswip_mdio_w(priv, val, offset);
> -}
> -
> -static u32 gswip_mii_r(struct gswip_priv *priv, u32 offset)
> -{
> - return __raw_readl(priv->mii + (offset * 4));
> -}
> + int ret;
>
> -static void gswip_mii_w(struct gswip_priv *priv, u32 val, u32 offset)
> -{
> - __raw_writel(val, priv->mii + (offset * 4));
> + ret = regmap_update_bits_base(priv->mdio, offset, clear | set, set,
> + NULL, false, true);
regmap_write_bits()?
> + if (ret) {
> + WARN_ON_ONCE(1);
> + dev_err(priv->dev, "failed to update mdio register\n");
> + }
> }
>
> static void gswip_mii_mask(struct gswip_priv *priv, u32 clear, u32 set,
> u32 offset)
> {
> - u32 val = gswip_mii_r(priv, offset);
> + int ret;
>
> - val &= ~(clear);
> - val |= set;
> - gswip_mii_w(priv, val, offset);
> + ret = regmap_update_bits_base(priv->mii, offset, clear | set, set, NULL,
> + false, true);
ditto
--
Alexander Sverdlin
Siemens AG
www.siemens.com
prev parent reply other threads:[~2025-08-21 17:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-16 19:56 Daniel Golle
2025-08-21 17:59 ` Sverdlin, Alexander [this message]
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=80e49f31a311787ebdd24992e3822727a708a0b9.camel@siemens.com \
--to=alexander.sverdlin@siemens.com \
--cc=ajayaraman@maxlinear.com \
--cc=andreas.schirm@siemens.com \
--cc=andrew@lunn.ch \
--cc=arkadis@mellanox.com \
--cc=bxu@maxlinear.com \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=fchan@maxlinear.com \
--cc=hauke@hauke-m.de \
--cc=horms@kernel.org \
--cc=john@phrozen.org \
--cc=jpovazanec@maxlinear.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lrosu@maxlinear.com \
--cc=lukas.stockmann@siemens.com \
--cc=lxu@maxlinear.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=peter.christen@siemens.com \
--cc=yweng@maxlinear.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
all inboxes | Powered by JetHome®