From: Linus Walleij <linus.walleij@linaro.org>
To: Bartosz Golaszewski <brgl@bgdev.pl>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 2/2] gpio: mmio: Parse ngpios property
Date: Wed, 16 Oct 2024 09:21:53 +0200 [thread overview]
Message-ID: <20241016-gpio-ngpios-v1-2-f16cf154f715@linaro.org> (raw)
In-Reply-To: <20241016-gpio-ngpios-v1-0-f16cf154f715@linaro.org>
This makes the MMIO GPIO driver parse the ngpios property from
devices instatiated directly from the device tree so we can
further restrict the number of GPIOs down from the number of
bits on the target register.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpio/gpio-mmio.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c
index d89e78f0ead3..9e944c191551 100644
--- a/drivers/gpio/gpio-mmio.c
+++ b/drivers/gpio/gpio-mmio.c
@@ -694,6 +694,7 @@ MODULE_DEVICE_TABLE(of, bgpio_of_match);
static struct bgpio_pdata *bgpio_parse_fw(struct device *dev, unsigned long *flags)
{
struct bgpio_pdata *pdata;
+ u32 ngpios;
if (!dev_fwnode(dev))
return NULL;
@@ -704,6 +705,9 @@ static struct bgpio_pdata *bgpio_parse_fw(struct device *dev, unsigned long *fla
pdata->base = -1;
+ if (!device_property_read_u32(dev, "ngpios", &ngpios))
+ pdata->ngpios = ngpios;
+
if (device_is_big_endian(dev))
*flags |= BGPIOF_BIG_ENDIAN_BYTE_ORDER;
--
2.46.2
next prev parent reply other threads:[~2024-10-16 7:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 7:21 [PATCH 0/2] gpio: mmio: Support ngpios property Linus Walleij
2024-10-16 7:21 ` [PATCH 1/2] dt-bindings: gpio-mmio: Add " Linus Walleij
2024-10-16 15:47 ` Rob Herring
2024-10-16 18:31 ` Linus Walleij
2024-10-16 18:58 ` Rob Herring
2024-10-16 19:12 ` Linus Walleij
2024-10-16 7:21 ` Linus Walleij [this message]
2024-10-17 2:05 ` [PATCH 2/2] gpio: mmio: Parse " kernel test robot
2024-10-17 2:05 ` kernel test robot
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=20241016-gpio-ngpios-v1-2-f16cf154f715@linaro.org \
--to=linus.walleij@linaro.org \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=robh@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;
as well as URLs for NNTP newsgroup(s).