diff mbox series

[RFC,v4,net-next,11/23] pinctrl: ocelot: update pinctrl to automatic base address

Message ID 20211116062328.1949151-12-colin.foster@in-advantage.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series add support for VSC75XX control over SPI | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count fail Series longer than 15 patches (and no cover letter)
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 19 this patch: 19
netdev/cc_maintainers success CCed 2 of 2 maintainers
netdev/build_clang fail Errors and warnings before: 24 this patch: 24
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 19 this patch: 19
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Colin Foster Nov. 16, 2021, 6:23 a.m. UTC
struct gpio_chip recommends passing -1 as base to gpiolib. Doing so avoids
conflicts when the chip is external and gpiochip0 already exists.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
---
 drivers/pinctrl/pinctrl-ocelot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexandre Belloni Nov. 16, 2021, 5:36 p.m. UTC | #1
Hello,

On 15/11/2021 22:23:16-0800, Colin Foster wrote:
> struct gpio_chip recommends passing -1 as base to gpiolib. Doing so avoids
> conflicts when the chip is external and gpiochip0 already exists.
> 
> Signed-off-by: Colin Foster <colin.foster@in-advantage.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 cc7fb0556169..f015404c425c 100644
> --- a/drivers/pinctrl/pinctrl-ocelot.c
> +++ b/drivers/pinctrl/pinctrl-ocelot.c
> @@ -1308,7 +1308,7 @@ static int ocelot_gpiochip_register(struct platform_device *pdev,
>  	gc = &info->gpio_chip;
>  	gc->ngpio = info->desc->npins;
>  	gc->parent = &pdev->dev;
> -	gc->base = 0;
> +	gc->base = -1;

I can't remember why but I'm pretty sure I did that on purpose but this
indeed cause issues when the chip is external. I've asked Clément to
check, let's see what the result is ;)

>  	gc->of_node = info->dev->of_node;
>  	gc->label = "ocelot-gpio";
>  
> -- 
> 2.25.1
>
Clément Léger Nov. 17, 2021, 1:47 p.m. UTC | #2
Le Tue, 16 Nov 2021 18:36:33 +0100,
Alexandre Belloni <alexandre.belloni@bootlin.com> a écrit :

> Hello,
> 
> On 15/11/2021 22:23:16-0800, Colin Foster wrote:
> > struct gpio_chip recommends passing -1 as base to gpiolib. Doing so avoids
> > conflicts when the chip is external and gpiochip0 already exists.
> > 
> > Signed-off-by: Colin Foster <colin.foster@in-advantage.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 cc7fb0556169..f015404c425c 100644
> > --- a/drivers/pinctrl/pinctrl-ocelot.c
> > +++ b/drivers/pinctrl/pinctrl-ocelot.c
> > @@ -1308,7 +1308,7 @@ static int ocelot_gpiochip_register(struct platform_device *pdev,
> >  	gc = &info->gpio_chip;
> >  	gc->ngpio = info->desc->npins;
> >  	gc->parent = &pdev->dev;
> > -	gc->base = 0;
> > +	gc->base = -1;  
> 
> I can't remember why but I'm pretty sure I did that on purpose but this
> indeed cause issues when the chip is external. I've asked Clément to
> check, let's see what the result is ;)

After testing, it works on ocelot pcb123 board.

Tested-by: Clément Léger <clement.leger@bootlin.com>

> 
> >  	gc->of_node = info->dev->of_node;
> >  	gc->label = "ocelot-gpio";
> >  
> > -- 
> > 2.25.1
> >   
>
Colin Foster Nov. 19, 2021, 2:16 a.m. UTC | #3
On Wed, Nov 17, 2021 at 02:47:05PM +0100, Clément Léger wrote:
> Le Tue, 16 Nov 2021 18:36:33 +0100,
> Alexandre Belloni <alexandre.belloni@bootlin.com> a écrit :
> 
> > Hello,
> > 
> > On 15/11/2021 22:23:16-0800, Colin Foster wrote:
> > > struct gpio_chip recommends passing -1 as base to gpiolib. Doing so avoids
> > > conflicts when the chip is external and gpiochip0 already exists.
> > > 
> > > Signed-off-by: Colin Foster <colin.foster@in-advantage.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 cc7fb0556169..f015404c425c 100644
> > > --- a/drivers/pinctrl/pinctrl-ocelot.c
> > > +++ b/drivers/pinctrl/pinctrl-ocelot.c
> > > @@ -1308,7 +1308,7 @@ static int ocelot_gpiochip_register(struct platform_device *pdev,
> > >  	gc = &info->gpio_chip;
> > >  	gc->ngpio = info->desc->npins;
> > >  	gc->parent = &pdev->dev;
> > > -	gc->base = 0;
> > > +	gc->base = -1;  
> > 
> > I can't remember why but I'm pretty sure I did that on purpose but this
> > indeed cause issues when the chip is external. I've asked Clément to
> > check, let's see what the result is ;)
> 
> After testing, it works on ocelot pcb123 board.

Thank you! Glad to hear it didn't break anything.

> 
> Tested-by: Clément Léger <clement.leger@bootlin.com>
> 
> > 
> > >  	gc->of_node = info->dev->of_node;
> > >  	gc->label = "ocelot-gpio";
> > >  
> > > -- 
> > > 2.25.1
> > >   
> > 
> 
> 
> 
> -- 
> Clément Léger,
> Embedded Linux and Kernel engineer at Bootlin
> https://bootlin.com
diff mbox series

Patch

diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c
index cc7fb0556169..f015404c425c 100644
--- a/drivers/pinctrl/pinctrl-ocelot.c
+++ b/drivers/pinctrl/pinctrl-ocelot.c
@@ -1308,7 +1308,7 @@  static int ocelot_gpiochip_register(struct platform_device *pdev,
 	gc = &info->gpio_chip;
 	gc->ngpio = info->desc->npins;
 	gc->parent = &pdev->dev;
-	gc->base = 0;
+	gc->base = -1;
 	gc->of_node = info->dev->of_node;
 	gc->label = "ocelot-gpio";