From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: Marc Zyngier <maz@kernel.org>
Cc: linus.walleij@linaro.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
bhelgaas@google.com, robh+dt@kernel.org,
lorenzo.pieralisi@arm.com, kw@linux.com, alyssa@rosenzweig.io,
stan@corellium.com, kettenis@openbsd.org, sven@svenpeter.dev,
marcan@marcan.st, Robin.Murphy@arm.com, joey.gouly@arm.com,
joro@8bytes.org, kernel-team@android.com
Subject: Re: [PATCH v5 10/14] arm64: apple: Add pinctrl nodes
Date: Thu, 30 Sep 2021 11:20:42 +0200 (CEST) [thread overview]
Message-ID: <561497c161587be0@bloch.sibelius.xs4all.nl> (raw)
In-Reply-To: <87fstmtrv2.wl-maz@kernel.org> (message from Marc Zyngier on Thu, 30 Sep 2021 09:00:49 +0100)
> Date: Thu, 30 Sep 2021 09:00:49 +0100
> From: Marc Zyngier <maz@kernel.org>
Hi Linus and Marc,
> On Wed, 29 Sep 2021 20:05:42 +0100,
> Linus Walleij <linus.walleij@linaro.org> wrote:
> >
> > On Wed, Sep 29, 2021 at 6:56 PM Marc Zyngier <maz@kernel.org> wrote:
> >
> > > From: Mark Kettenis <kettenis@openbsd.org>
> > >
> > > Add pinctrl nodes corresponding to the gpio,t8101 nodes in the
> > > Apple device tree for the Mac mini (M1, 2020).
> > >
> > > Clock references are left out at the moment and will be added once
> > > the appropriate bindings have been settled upon.
> > >
> > > Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
> > > Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> > > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > > Link: https://lore.kernel.org/r/20210520171310.772-3-mark.kettenis@xs4all.nl
> > (...)
> > > + pinctrl_ap: pinctrl@23c100000 {
> > > + compatible = "apple,t8103-pinctrl", "apple,pinctrl";
> > > + reg = <0x2 0x3c100000 0x0 0x100000>;
> > > +
> > > + gpio-controller;
> > > + #gpio-cells = <2>;
> > > + gpio-ranges = <&pinctrl_ap 0 0 212>;
> >
> > In other discussions it turns out that the driver is abusing these gpio-ranges
> > to find out how many pins are in each pinctrl instance. This is not the
> > idea with gpio-ranges, these can be multiple and map different sets,
> > so we need something like
> >
> > apple,npins = <212>;
> > (+ bindings)
> >
> > or so...
>
> Is it the driver that needs updating? Or the binding? I don't really
> care about the former, but the latter is more disruptive as it has
> impacts over both u-boot and at least OpenBSD.
I don't have a finished OpenBSD driver yet, and U-Boot support is
still in the process of being upstreamed, so tweaking the binding a
bit is not out of the question at this point. And as long as the
gpio-ranges property continues to be there, things won't break anyway.
> How is that solved on other pinctrl blocks? I can't see anyone having
> a similar a similar property.
I suspect most pinctrl blocks have a well-defined number of pins that
is simply a #define in the driver. Here we don't really know what the
hardware provides but the "Apple device tree" has a property that
describes the number of pins, which varies between the different
blocks.
Since there is a simple 1:1 mapping between pins and gpios it seemed
natural to me to simply use the value from gpio-ranges. My thinking
was that having a separate property to encode the number of pins just
increases the chances of the two getting out of sync. But maybe that
is the whole point Linus is trying to make; not all pins may actually
provide GPIO functionality and gpio-ranges can be used to map only
those pins that actually do. In this particular case I don't think it
makes sense to map multiple ranges though as we will probably never
know full details for all the pins.
FWIW, there are other U-Boot drivers that use gpio-ranges to get the
pin count. But I suppose U-Boot has somewhat different standards than
the Linux kernel, prioritising code size and such.
next prev parent reply other threads:[~2021-09-30 9:20 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-29 16:38 [PATCH v5 00/14] PCI: Add support for Apple M1 Marc Zyngier
2021-09-29 16:38 ` [PATCH v5 01/14] irqdomain: Make of_phandle_args_to_fwspec generally available Marc Zyngier
2021-09-29 16:38 ` [PATCH v5 02/14] of/irq: Allow matching of an interrupt-map local to an interrupt controller Marc Zyngier
2021-09-29 16:38 ` [PATCH v5 03/14] PCI: of: Allow matching of an interrupt-map local to a PCI device Marc Zyngier
2021-09-29 16:38 ` [PATCH v5 04/14] PCI: apple: Add initial hardware bring-up Marc Zyngier
2021-09-29 16:38 ` [PATCH v5 05/14] PCI: apple: Set up reference clocks when probing Marc Zyngier
2021-09-29 16:38 ` [PATCH v5 06/14] PCI: apple: Add INTx and per-port interrupt support Marc Zyngier
2021-09-29 16:38 ` [PATCH v5 07/14] PCI: apple: Implement MSI support Marc Zyngier
2021-09-29 16:38 ` [PATCH v5 08/14] iommu/dart: Exclude MSI doorbell from PCIe device IOVA range Marc Zyngier
2021-09-29 16:38 ` [PATCH v5 09/14] PCI: apple: Configure RID to SID mapper on device addition Marc Zyngier
2021-09-29 16:38 ` [PATCH v5 10/14] arm64: apple: Add pinctrl nodes Marc Zyngier
2021-09-29 19:05 ` Linus Walleij
2021-09-30 8:00 ` Marc Zyngier
2021-09-30 9:20 ` Mark Kettenis [this message]
2021-09-30 15:46 ` Linus Walleij
2021-10-07 16:00 ` Hector Martin
2021-09-29 16:38 ` [PATCH v5 11/14] arm64: apple: Add PCIe node Marc Zyngier
2021-10-07 16:01 ` Hector Martin
2021-09-29 16:38 ` [PATCH v5 12/14] arm64: dts: apple: t8103: Add PCIe DARTs Marc Zyngier
2021-10-07 16:02 ` Hector Martin
2021-09-29 16:38 ` [PATCH v5 13/14] arm64: dts: apple: t8103: Add root port interrupt routing Marc Zyngier
2021-10-07 16:03 ` Hector Martin
2021-09-29 16:38 ` [PATCH v5 14/14] arm64: dts: apple: j274: Expose PCI node for the Ethernet MAC address Marc Zyngier
2021-10-07 16:03 ` Hector Martin
2021-10-04 8:38 ` [PATCH v5 00/14] PCI: Add support for Apple M1 Lorenzo Pieralisi
2021-10-04 9:05 ` Marc Zyngier
2021-10-04 18:30 ` Linus Walleij
2021-10-07 15:43 ` Hector Martin
2021-10-04 19:51 ` Rob Herring
2021-10-04 20:42 ` Linus Walleij
2021-10-05 9:57 ` Marc Zyngier
2021-10-06 5:56 ` Michael Ellerman
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=561497c161587be0@bloch.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=Robin.Murphy@arm.com \
--cc=alyssa@rosenzweig.io \
--cc=bhelgaas@google.com \
--cc=devicetree@vger.kernel.org \
--cc=joey.gouly@arm.com \
--cc=joro@8bytes.org \
--cc=kernel-team@android.com \
--cc=kettenis@openbsd.org \
--cc=kw@linux.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=marcan@marcan.st \
--cc=maz@kernel.org \
--cc=robh+dt@kernel.org \
--cc=stan@corellium.com \
--cc=sven@svenpeter.dev \
/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).