All of lore.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: linux-gpio@vger.kernel.org,
	Conor Dooley <conor.dooley@microchip.com>,
	Daire McNamara <daire.mcnamara@microchip.com>,
	valentina.fernandezalanis@microchip.com,
	Linus Walleij <linus.walleij@linaro.org>,
	Lewis Hanly <lewis.hanly@microchip.com>
Subject: Re: [PATCH v9 1/1] gpio: mpfs: add polarfire soc gpio support
Date: Fri, 1 Nov 2024 15:16:53 +0000	[thread overview]
Message-ID: <20241101-impeding-outpour-e68b980c14b8@spud> (raw)
In-Reply-To: <CAMRc=MfhwPij=t+PBicHCE6xsfBxYeKK1+r5UKMZ5vqHAbuZ2w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2946 bytes --]

On Fri, Nov 01, 2024 at 03:32:16PM +0100, Bartosz Golaszewski wrote:
> On Fri, Nov 1, 2024 at 3:28 PM Conor Dooley <conor@kernel.org> wrote:
> >
> > On Fri, Nov 01, 2024 at 02:47:51PM +0100, Bartosz Golaszewski wrote:
> > > On Fri, Nov 1, 2024 at 2:37 PM Conor Dooley <conor@kernel.org> wrote:
> > > >
> > > > On Fri, Nov 01, 2024 at 02:09:06PM +0100, Bartosz Golaszewski wrote:
> > > > > On Fri, Nov 1, 2024 at 1:17 PM Conor Dooley <conor@kernel.org> wrote:
> > > > > >
> > > > > > On Thu, Oct 31, 2024 at 02:00:22PM +0100, Bartosz Golaszewski wrote:
> > > > > > > On Thu, Oct 31, 2024 at 1:04 PM Conor Dooley <conor@kernel.org> wrote:
> > > > > >
> > > > > > > > +       mpfs_gpio->gc.direction_input = mpfs_gpio_direction_input;
> > > > > > > > +       mpfs_gpio->gc.direction_output = mpfs_gpio_direction_output;
> > > > > > > > +       mpfs_gpio->gc.get_direction = mpfs_gpio_get_direction;
> > > > > > > > +       mpfs_gpio->gc.get = mpfs_gpio_get;
> > > > > > > > +       mpfs_gpio->gc.set = mpfs_gpio_set;
> > > > > > > > +       mpfs_gpio->gc.base = -1;
> > > > > > > > +       mpfs_gpio->gc.ngpio = ngpios;
> > > > > > >
> > > > > > > The "ngpios" property will be parsed by GPIO core so no need to set it.
> > > > > >
> > > > > > Are you sure it'll work here? I tried dropping the ngpios parsing, but I
> > > > > > get:
> > > > > > gpiochip_add_data_with_key: GPIOs 0..-1 (20122000.gpio) failed to register, -22
> > > > > >
> > > > > > That's coming from the device_property_read_u32(dev, "ngpios", &ngpios);
> > > > > > in gpiochip_get_ngpios(). Checking against the bluefield driver and the
> > > > > > code in gpiochip_add_data_with_key(), it's not immediately obvious what
> > > > > > I am missing.
> > > > >
> > > > > Does dev have an fwnode correctly assigned? What does dev_fwnode(dev) return?
> > > >
> > > > It's not a null pointer or something obviously wrong by virtue of being
> > > > null-adjacent, it is a virtual address but not one that %ps can identify.
> > >
> > > This is an OF system right? If you do dev_of_node(dev), does the
> > > returned node->name show the OF node you expect?
> >
> > Yes.
> 
> I mean inside gpiochip_get_ngpios(), sorry for confusion.

That is what I checked actually, didn't think you'd ask me to check the
one in probe that works.

> > > Does it have the
> > > "ngpios" property? Can you read it with of_property_read_u32()?
> >
> > No, EINVAL there too.
> 
> I assume the node is not assigned correctly. What if in your probe you
> do: gc->fwnode = dev_fwnode(dev)?

Makes no difference, same probe failure as before...


...but I just realised something: ngpios isn't a required property for
this device as it has a default of 32 and 32 is how many gpios this
controller has. Simple oversight, hours wasted. That's always the way of
it I suppose. The core code can't be used here I suppose, since ngpios
is optional.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2024-11-01 15:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31 12:04 [PATCH v9 0/1] Polarfire SoC GPIO support Conor Dooley
2024-10-31 12:04 ` [PATCH v9 1/1] gpio: mpfs: add polarfire soc gpio support Conor Dooley
2024-10-31 13:00   ` Bartosz Golaszewski
2024-11-01 12:17     ` Conor Dooley
2024-11-01 13:09       ` Bartosz Golaszewski
2024-11-01 13:37         ` Conor Dooley
2024-11-01 13:47           ` Bartosz Golaszewski
2024-11-01 14:28             ` Conor Dooley
2024-11-01 14:32               ` Bartosz Golaszewski
2024-11-01 15:16                 ` Conor Dooley [this message]
2024-11-01 20:50                   ` Bartosz Golaszewski

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=20241101-impeding-outpour-e68b980c14b8@spud \
    --to=conor@kernel.org \
    --cc=brgl@bgdev.pl \
    --cc=conor.dooley@microchip.com \
    --cc=daire.mcnamara@microchip.com \
    --cc=lewis.hanly@microchip.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=valentina.fernandezalanis@microchip.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 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.