All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] pinctrl: microchip-sgpio: Fix support for regmap
@ 2022-01-31  8:52 ` Horatiu Vultur
  0 siblings, 0 replies; 6+ messages in thread
From: Horatiu Vultur @ 2022-01-31  8:52 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: lars.povlsen, Steen.Hegelund, UNGLinuxDriver, linus.walleij,
	colin.foster, andy.shevchenko, Horatiu Vultur

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.

Acked-by: Steen Hegelund <Steen.Hegelund@microchip.com>
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>

---
v1->v2:
- use regmap_get_reg_stride() instead of regmap_config.reg_stride
---
 drivers/pinctrl/pinctrl-microchip-sgpio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c
index 8e081c90bdb2..639f1130e989 100644
--- a/drivers/pinctrl/pinctrl-microchip-sgpio.c
+++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c
@@ -137,7 +137,8 @@ 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_get_reg_stride(priv->regs);
 }
 
 static u32 sgpio_readl(struct sgpio_priv *priv, u32 rno, u32 off)
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2] pinctrl: microchip-sgpio: Fix support for regmap
@ 2022-01-31  8:52 ` Horatiu Vultur
  0 siblings, 0 replies; 6+ messages in thread
From: Horatiu Vultur @ 2022-01-31  8:52 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: lars.povlsen, Steen.Hegelund, UNGLinuxDriver, linus.walleij,
	colin.foster, andy.shevchenko, Horatiu Vultur

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.

Acked-by: Steen Hegelund <Steen.Hegelund@microchip.com>
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>

---
v1->v2:
- use regmap_get_reg_stride() instead of regmap_config.reg_stride
---
 drivers/pinctrl/pinctrl-microchip-sgpio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c
index 8e081c90bdb2..639f1130e989 100644
--- a/drivers/pinctrl/pinctrl-microchip-sgpio.c
+++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c
@@ -137,7 +137,8 @@ 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_get_reg_stride(priv->regs);
 }
 
 static u32 sgpio_readl(struct sgpio_priv *priv, u32 rno, u32 off)
-- 
2.33.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] pinctrl: microchip-sgpio: Fix support for regmap
  2022-01-31  8:52 ` Horatiu Vultur
@ 2022-01-31 10:58   ` Andy Shevchenko
  -1 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2022-01-31 10:58 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: linux-arm Mailing List, Linux Kernel Mailing List, Lars Povlsen,
	Steen.Hegelund, Microchip Linux Driver Support, Linus Walleij,
	Colin Foster

On Mon, Jan 31, 2022 at 10:50 AM Horatiu Vultur
<horatiu.vultur@microchip.com> 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.
>
> Acked-by: Steen Hegelund <Steen.Hegelund@microchip.com>
> 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>

LGTM,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> ---
> v1->v2:
> - use regmap_get_reg_stride() instead of regmap_config.reg_stride
> ---
>  drivers/pinctrl/pinctrl-microchip-sgpio.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c
> index 8e081c90bdb2..639f1130e989 100644
> --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c
> +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c
> @@ -137,7 +137,8 @@ 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_get_reg_stride(priv->regs);
>  }
>
>  static u32 sgpio_readl(struct sgpio_priv *priv, u32 rno, u32 off)
> --
> 2.33.0
>


-- 
With Best Regards,
Andy Shevchenko

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] pinctrl: microchip-sgpio: Fix support for regmap
@ 2022-01-31 10:58   ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2022-01-31 10:58 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: linux-arm Mailing List, Linux Kernel Mailing List, Lars Povlsen,
	Steen.Hegelund, Microchip Linux Driver Support, Linus Walleij,
	Colin Foster

On Mon, Jan 31, 2022 at 10:50 AM Horatiu Vultur
<horatiu.vultur@microchip.com> 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.
>
> Acked-by: Steen Hegelund <Steen.Hegelund@microchip.com>
> 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>

LGTM,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> ---
> v1->v2:
> - use regmap_get_reg_stride() instead of regmap_config.reg_stride
> ---
>  drivers/pinctrl/pinctrl-microchip-sgpio.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c
> index 8e081c90bdb2..639f1130e989 100644
> --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c
> +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c
> @@ -137,7 +137,8 @@ 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_get_reg_stride(priv->regs);
>  }
>
>  static u32 sgpio_readl(struct sgpio_priv *priv, u32 rno, u32 off)
> --
> 2.33.0
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] pinctrl: microchip-sgpio: Fix support for regmap
  2022-01-31  8:52 ` Horatiu Vultur
@ 2022-01-31 11:09   ` Linus Walleij
  -1 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2022-01-31 11:09 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: linux-arm-kernel, linux-kernel, lars.povlsen, Steen.Hegelund,
	UNGLinuxDriver, colin.foster, andy.shevchenko

On Mon, Jan 31, 2022 at 9:50 AM Horatiu Vultur
<horatiu.vultur@microchip.com> 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.
>
> Acked-by: Steen Hegelund <Steen.Hegelund@microchip.com>
> 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>

Patch applied for fixes.

I didn't get last weeks fixes to Torvalds this weekend because linux-next
wasn't being compiled, will send the lot with this on top this week.

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] pinctrl: microchip-sgpio: Fix support for regmap
@ 2022-01-31 11:09   ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2022-01-31 11:09 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: linux-arm-kernel, linux-kernel, lars.povlsen, Steen.Hegelund,
	UNGLinuxDriver, colin.foster, andy.shevchenko

On Mon, Jan 31, 2022 at 9:50 AM Horatiu Vultur
<horatiu.vultur@microchip.com> 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.
>
> Acked-by: Steen Hegelund <Steen.Hegelund@microchip.com>
> 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>

Patch applied for fixes.

I didn't get last weeks fixes to Torvalds this weekend because linux-next
wasn't being compiled, will send the lot with this on top this week.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-31 11:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-31  8:52 [PATCH v2] pinctrl: microchip-sgpio: Fix support for regmap Horatiu Vultur
2022-01-31  8:52 ` Horatiu Vultur
2022-01-31 10:58 ` Andy Shevchenko
2022-01-31 10:58   ` Andy Shevchenko
2022-01-31 11:09 ` Linus Walleij
2022-01-31 11:09   ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.