From: Colin Foster <colin.foster@in-advantage.com>
To: Horatiu Vultur <horatiu.vultur@microchip.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org, lars.povlsen@microchip.com,
Steen.Hegelund@microchip.com, UNGLinuxDriver@microchip.com,
linus.walleij@linaro.org
Subject: Re: [PATCH] pinctrl: microchip-sgpio: Fix support for regmap
Date: Tue, 25 Jan 2022 08:46:59 -0800 [thread overview]
Message-ID: <20220125164659.GA31440@COLIN-DESKTOP1.localdomain> (raw)
In-Reply-To: <20220125161245.418882-1-horatiu.vultur@microchip.com>
Hi Horatiu,
On Tue, Jan 25, 2022 at 05:12:45PM +0100, Horatiu Vultur wrote:
> Initially the driver accessed the registers using u32 __iomem but then
> in the blamed commit it changed it to use regmap. The problem is that now
> the offset of the registers is not calculated anymore at word offset but
> at byte offset. Therefore make sure to multiply the offset with word size.
>
Sorry about this one. I see it must have slipped through the cracks
because I had made the same change in my tree. The only difference is I
had copied reg_stride into sgpio_priv instead of making regmap_config
file-scope. For what its worth, with apologies:
Reviewed-by: Colin Foster <colin.foster@in-advantage.com>
> Fixes: 2afbbab45c261a ("pinctrl: microchip-sgpio: update to support regmap")
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> ---
> drivers/pinctrl/pinctrl-microchip-sgpio.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c
> index 8e081c90bdb2..2999c98bbdee 100644
> --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c
> +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c
> @@ -98,6 +98,12 @@ static const struct sgpio_properties properties_sparx5 = {
> .regoff = { 0x00, 0x06, 0x26, 0x04, 0x05, 0x2a, 0x32, 0x3a, 0x3e, 0x42 },
> };
>
> +static const struct regmap_config regmap_config = {
> + .reg_bits = 32,
> + .val_bits = 32,
> + .reg_stride = 4,
> +};
> +
> static const char * const functions[] = { "gpio" };
>
> struct sgpio_bank {
> @@ -137,7 +143,7 @@ static inline int sgpio_addr_to_pin(struct sgpio_priv *priv, int port, int bit)
>
> static inline u32 sgpio_get_addr(struct sgpio_priv *priv, u32 rno, u32 off)
> {
> - return priv->properties->regoff[rno] + off;
> + return (priv->properties->regoff[rno] + off) * regmap_config.reg_stride;
> }
>
> static u32 sgpio_readl(struct sgpio_priv *priv, u32 rno, u32 off)
> @@ -821,11 +827,6 @@ static int microchip_sgpio_probe(struct platform_device *pdev)
> struct clk *clk;
> u32 __iomem *regs;
> u32 val;
> - struct regmap_config regmap_config = {
> - .reg_bits = 32,
> - .val_bits = 32,
> - .reg_stride = 4,
> - };
>
> priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> if (!priv)
> --
> 2.33.0
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-01-25 16:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-25 16:12 [PATCH] pinctrl: microchip-sgpio: Fix support for regmap Horatiu Vultur
2022-01-25 16:46 ` Colin Foster [this message]
2022-01-27 10:40 ` Horatiu Vultur
2022-01-28 14:19 ` Andy Shevchenko
2022-01-28 21:32 ` Colin Foster
2022-01-27 12:42 ` Steen.Hegelund
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=20220125164659.GA31440@COLIN-DESKTOP1.localdomain \
--to=colin.foster@in-advantage.com \
--cc=Steen.Hegelund@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=horatiu.vultur@microchip.com \
--cc=lars.povlsen@microchip.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.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