linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] pinctrl: ocelot: Add fixes for ocelot driver
@ 2022-03-03 20:37 Horatiu Vultur
  2022-03-03 20:37 ` [PATCH 1/2] pinctrl: ocelot: Fix the pincfg resource Horatiu Vultur
  2022-03-03 20:37 ` [PATCH 2/2] pinctrl: ocelot: Fix interrupt parsing Horatiu Vultur
  0 siblings, 2 replies; 7+ messages in thread
From: Horatiu Vultur @ 2022-03-03 20:37 UTC (permalink / raw)
  To: linux-gpio, linux-kernel
  Cc: linus.walleij, colin.foster, andriy.shevchenko, Horatiu Vultur

This contains two fixes for the ocelot pinctrl:
- first fixes the memory resource index for pincfg
- second fixes the interrupt parsing

Horatiu Vultur (2):
  pinctrl: ocelot: Fix the pincfg resource.
  pinctrl: ocelot: Fix interrupt parsing

 drivers/pinctrl/pinctrl-ocelot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.33.0


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

* [PATCH 1/2] pinctrl: ocelot: Fix the pincfg resource.
  2022-03-03 20:37 [PATCH 0/2] pinctrl: ocelot: Add fixes for ocelot driver Horatiu Vultur
@ 2022-03-03 20:37 ` Horatiu Vultur
  2022-03-03 21:28   ` Colin Foster
  2022-03-03 20:37 ` [PATCH 2/2] pinctrl: ocelot: Fix interrupt parsing Horatiu Vultur
  1 sibling, 1 reply; 7+ messages in thread
From: Horatiu Vultur @ 2022-03-03 20:37 UTC (permalink / raw)
  To: linux-gpio, linux-kernel
  Cc: linus.walleij, colin.foster, andriy.shevchenko, Horatiu Vultur

The pincfg resources are in the second memory resource. But the driver
still tries to access the first memory resource to get the pincfg. This
is wrong therefore fix to access the second memory resource.

Fixes: ad96111e658a95 ("pinctrl: ocelot: combine get resource and ioremap into single call")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/pinctrl/pinctrl-ocelot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c
index 685c79e08d40..a859fbcb09af 100644
--- a/drivers/pinctrl/pinctrl-ocelot.c
+++ b/drivers/pinctrl/pinctrl-ocelot.c
@@ -1892,7 +1892,7 @@ static struct regmap *ocelot_pinctrl_create_pincfg(struct platform_device *pdev)
 		.max_register = 32,
 	};
 
-	base = devm_platform_ioremap_resource(pdev, 0);
+	base = devm_platform_ioremap_resource(pdev, 1);
 	if (IS_ERR(base)) {
 		dev_dbg(&pdev->dev, "Failed to ioremap config registers (no extended pinconf)\n");
 		return NULL;
-- 
2.33.0


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

* [PATCH 2/2] pinctrl: ocelot: Fix interrupt parsing
  2022-03-03 20:37 [PATCH 0/2] pinctrl: ocelot: Add fixes for ocelot driver Horatiu Vultur
  2022-03-03 20:37 ` [PATCH 1/2] pinctrl: ocelot: Fix the pincfg resource Horatiu Vultur
@ 2022-03-03 20:37 ` Horatiu Vultur
  2022-03-04 12:40   ` Andy Shevchenko
  1 sibling, 1 reply; 7+ messages in thread
From: Horatiu Vultur @ 2022-03-03 20:37 UTC (permalink / raw)
  To: linux-gpio, linux-kernel
  Cc: linus.walleij, colin.foster, andriy.shevchenko, Horatiu Vultur

In the blamed commit, it removes the duplicate of_node assignment in the
driver. But the driver uses this before calling into of_gpio_dev_init to
determine if it needs to assign an IRQ chip to the GPIO. The fixes
consists in using of_node from dev.

Fixes: 8a8d6bbe1d3bc7 ("pinctrl: Get rid of duplicate of_node assignment in the drivers")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/pinctrl/pinctrl-ocelot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c
index a859fbcb09af..a0f00380e700 100644
--- a/drivers/pinctrl/pinctrl-ocelot.c
+++ b/drivers/pinctrl/pinctrl-ocelot.c
@@ -1851,7 +1851,7 @@ static int ocelot_gpiochip_register(struct platform_device *pdev,
 	gc->base = -1;
 	gc->label = "ocelot-gpio";
 
-	irq = irq_of_parse_and_map(gc->of_node, 0);
+	irq = irq_of_parse_and_map(info->dev->of_node, 0);
 	if (irq) {
 		girq = &gc->irq;
 		girq->chip = &ocelot_irqchip;
-- 
2.33.0


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

* Re: [PATCH 1/2] pinctrl: ocelot: Fix the pincfg resource.
  2022-03-03 20:37 ` [PATCH 1/2] pinctrl: ocelot: Fix the pincfg resource Horatiu Vultur
@ 2022-03-03 21:28   ` Colin Foster
  0 siblings, 0 replies; 7+ messages in thread
From: Colin Foster @ 2022-03-03 21:28 UTC (permalink / raw)
  To: Horatiu Vultur; +Cc: linux-gpio, linux-kernel, linus.walleij, andriy.shevchenko

Hi Horatiu,

On Thu, Mar 03, 2022 at 09:37:15PM +0100, Horatiu Vultur wrote:
> The pincfg resources are in the second memory resource. But the driver
> still tries to access the first memory resource to get the pincfg. This
> is wrong therefore fix to access the second memory resource.
> 
> Fixes: ad96111e658a95 ("pinctrl: ocelot: combine get resource and ioremap into single call")

Sorry for this bug, but thanks for finding / fixing it. Digging through
my commit log to make sure I didn't make the same mistake a _third_ time
:(

For what it's worth:

Reviewed-by: Colin Foster <colin.foster@in-advantage.com>

> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> ---
>  drivers/pinctrl/pinctrl-ocelot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c
> index 685c79e08d40..a859fbcb09af 100644
> --- a/drivers/pinctrl/pinctrl-ocelot.c
> +++ b/drivers/pinctrl/pinctrl-ocelot.c
> @@ -1892,7 +1892,7 @@ static struct regmap *ocelot_pinctrl_create_pincfg(struct platform_device *pdev)
>  		.max_register = 32,
>  	};
>  
> -	base = devm_platform_ioremap_resource(pdev, 0);
> +	base = devm_platform_ioremap_resource(pdev, 1);
>  	if (IS_ERR(base)) {
>  		dev_dbg(&pdev->dev, "Failed to ioremap config registers (no extended pinconf)\n");
>  		return NULL;
> -- 
> 2.33.0
> 

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

* Re: [PATCH 2/2] pinctrl: ocelot: Fix interrupt parsing
  2022-03-03 20:37 ` [PATCH 2/2] pinctrl: ocelot: Fix interrupt parsing Horatiu Vultur
@ 2022-03-04 12:40   ` Andy Shevchenko
  2022-03-04 12:41     ` Andy Shevchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2022-03-04 12:40 UTC (permalink / raw)
  To: Horatiu Vultur; +Cc: linux-gpio, linux-kernel, linus.walleij, colin.foster

On Thu, Mar 03, 2022 at 09:37:16PM +0100, Horatiu Vultur wrote:
> In the blamed commit, it removes the duplicate of_node assignment in the
> driver. But the driver uses this before calling into of_gpio_dev_init to
> determine if it needs to assign an IRQ chip to the GPIO. The fixes
> consists in using of_node from dev.

...

> -	irq = irq_of_parse_and_map(gc->of_node, 0);
> +	irq = irq_of_parse_and_map(info->dev->of_node, 0);

Why platform_get_irq() can't be used?

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 2/2] pinctrl: ocelot: Fix interrupt parsing
  2022-03-04 12:40   ` Andy Shevchenko
@ 2022-03-04 12:41     ` Andy Shevchenko
  2022-03-04 14:26       ` Horatiu Vultur
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2022-03-04 12:41 UTC (permalink / raw)
  To: Horatiu Vultur; +Cc: linux-gpio, linux-kernel, linus.walleij, colin.foster

On Fri, Mar 04, 2022 at 02:40:38PM +0200, Andy Shevchenko wrote:
> On Thu, Mar 03, 2022 at 09:37:16PM +0100, Horatiu Vultur wrote:
> > In the blamed commit, it removes the duplicate of_node assignment in the
> > driver. But the driver uses this before calling into of_gpio_dev_init to
> > determine if it needs to assign an IRQ chip to the GPIO. The fixes
> > consists in using of_node from dev.
> 
> ...
> 
> > -	irq = irq_of_parse_and_map(gc->of_node, 0);
> > +	irq = irq_of_parse_and_map(info->dev->of_node, 0);
> 
> Why platform_get_irq() can't be used?

Or actually _optional() variant of it?

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 2/2] pinctrl: ocelot: Fix interrupt parsing
  2022-03-04 12:41     ` Andy Shevchenko
@ 2022-03-04 14:26       ` Horatiu Vultur
  0 siblings, 0 replies; 7+ messages in thread
From: Horatiu Vultur @ 2022-03-04 14:26 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-gpio, linux-kernel, linus.walleij, colin.foster

The 03/04/2022 14:41, Andy Shevchenko wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On Fri, Mar 04, 2022 at 02:40:38PM +0200, Andy Shevchenko wrote:
> > On Thu, Mar 03, 2022 at 09:37:16PM +0100, Horatiu Vultur wrote:
> > > In the blamed commit, it removes the duplicate of_node assignment in the
> > > driver. But the driver uses this before calling into of_gpio_dev_init to
> > > determine if it needs to assign an IRQ chip to the GPIO. The fixes
> > > consists in using of_node from dev.
> >
> > ...
> >
> > > -   irq = irq_of_parse_and_map(gc->of_node, 0);
> > > +   irq = irq_of_parse_and_map(info->dev->of_node, 0);
> >
> > Why platform_get_irq() can't be used?
> 
> Or actually _optional() variant of it?

It can be used. I will update this in the next series.

> 
> --
> With Best Regards,
> Andy Shevchenko
> 
> 

-- 
/Horatiu

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

end of thread, other threads:[~2022-03-04 14:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 20:37 [PATCH 0/2] pinctrl: ocelot: Add fixes for ocelot driver Horatiu Vultur
2022-03-03 20:37 ` [PATCH 1/2] pinctrl: ocelot: Fix the pincfg resource Horatiu Vultur
2022-03-03 21:28   ` Colin Foster
2022-03-03 20:37 ` [PATCH 2/2] pinctrl: ocelot: Fix interrupt parsing Horatiu Vultur
2022-03-04 12:40   ` Andy Shevchenko
2022-03-04 12:41     ` Andy Shevchenko
2022-03-04 14:26       ` Horatiu Vultur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).