Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2761214pxj; Mon, 10 May 2021 10:08:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqrRgI+UwdAiDPNywHV0eebUpL73G91pVo+d0gTBXdQywnalGyMqXXQ969u4tygoHBq8gL X-Received: by 2002:a92:c952:: with SMTP id i18mr22658368ilq.218.1620666492127; Mon, 10 May 2021 10:08:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620666492; cv=none; d=google.com; s=arc-20160816; b=QSw08KRkvPjQ6Cw2FqiAQcfAyh4eI42laos4VEb/HQ8RBPby1tYCjuVlaSd3Smtprk VP1L4rWw/d+U75iL+ZgqM49Sw4z3DIc8FThNz4PCYFZHqG3yDTNTLmH+eSWaeUCrMbH7 gxXeFxtD2kj0mM28BDIQoG+ru1DmJUfpiTo9Rblkg13qrTzEmlllkEvfSVoH8tMEJXd5 Di9cStP7CeZ6LDppKz/f5GlHfIzSNqeGhKZ6sU/94TKRFhiNEJf+y2wrVB9yS7k5Jcqx BR2X/OEzBOpdFb82jBAqSG/gLbz/v9SabT5ZUUqK9e4ufS0z9DTfby19rdTA735YrnSy 3L1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:references:subject:in-reply-to:cc:to :from:date; bh=0yJxHpoEqUl+tLyLtaploXUgzDSIri2Q1MzVR2wG2hg=; b=IP0G8fY61IPPBQJVhrmy1LEYzapcFoyXdrhk22DG3Z7G349DdRlD9661zmDMsBkwAv ZBU20sBTQFGyxiNxkrcFUHdINOirankYZvcT8SKhDI/ZrAxZhg5uujf3vwNN6BycCT1S Q7AtoBVKp+G9LQ6yA3HWxBHsUZtjWqPwTZR+MBparNL2wH9rkn3GiUi7btApPI2iO51Q ckwTukoepKjqDmwmrbuV34WNG0PqNENLKA6+FgWDt5kQIkWGOR9lCykNjkqNj/zoj07a csqju7HFXuBWfhT23TxHnjgmWRYUTgdTac436O8JaV4Dd42/FGxuO0wDY9utRuBGDv+e 21TA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d5si15325003ioq.28.2021.05.10.10.07.59; Mon, 10 May 2021 10:08:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231612AbhEJRHS (ORCPT + 99 others); Mon, 10 May 2021 13:07:18 -0400 Received: from sibelius.xs4all.nl ([83.163.83.176]:63725 "EHLO sibelius.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231230AbhEJRHR (ORCPT ); Mon, 10 May 2021 13:07:17 -0400 Received: from localhost (bloch.sibelius.xs4all.nl [local]) by bloch.sibelius.xs4all.nl (OpenSMTPD) with ESMTPA id 6706a4c6; Mon, 10 May 2021 19:06:10 +0200 (CEST) Date: Mon, 10 May 2021 19:06:10 +0200 (CEST) From: Mark Kettenis To: Rob Herring Cc: kettenis@openbsd.org, devicetree@vger.kernel.org, marcan@marcan.st, linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210510141955.GA58072@robh.at.kernel.org> (message from Rob Herring on Mon, 10 May 2021 09:19:55 -0500) Subject: Re: [PATCH 1/2] dt-bindings: pinctrl: Add DT bindings for apple,pinctrl References: <20210508142000.85116-1-kettenis@openbsd.org> <20210508142000.85116-2-kettenis@openbsd.org> <20210510141955.GA58072@robh.at.kernel.org> Message-ID: <5612be5a12568600@bloch.sibelius.xs4all.nl> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Date: Mon, 10 May 2021 09:19:55 -0500 > From: Rob Herring Hi Rob, > On Sat, May 08, 2021 at 04:19:55PM +0200, Mark Kettenis wrote: > > The Apple GPIO controller is a simple combined pin and GPIO conroller > > present on Apple ARM SoC platforms, including various iPhone and iPad > > devices and the "Apple Silicon" Macs. > > > > Signed-off-by: Mark Kettenis > > --- > > .../bindings/pinctrl/apple,pinctrl.yaml | 103 ++++++++++++++++++ > > MAINTAINERS | 2 + > > include/dt-bindings/pinctrl/apple.h | 13 +++ > > 3 files changed, 118 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml > > create mode 100644 include/dt-bindings/pinctrl/apple.h > > > > diff --git a/Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml > > new file mode 100644 > > index 000000000000..cc7805ca6ba1 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml > > @@ -0,0 +1,103 @@ > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/pinctrl/apple,pinctrl.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: Apple GPIO controller > > + > > +maintainers: > > + - Mark Kettenis > > + > > +description: | > > + The Apple GPIO controller is a simple combined pin and GPIO conroller > > + present on Apple ARM SoC platforms, including various iPhone and iPad > > + devices and the "Apple Silicon" Macs. > > + > > +properties: > > + compatible: > > + items: > > + - const: apple,t8103-pinctrl > > + - const: apple,pinctrl > > A genericish fallback is maybe questionable for pinctrl. That's not > often the same from one SoC to the next. Krzysztof raised a similar point. It seems that Apple isn't in the habit of changing this aspect of their SoCs. Judging from https://github.com/corellium/linux-sandcastle/blob/sandcastle-5.4/drivers/pinctrl/pinctrl-hx-gpio.c Apple has been using a controller with the same register layout and the same known bits in those registers since the T8010 SoC (the A10 used in the iPhone 7). So there is some confidence that a single driver will work for many generations of the SoC. Of course we don't have any authoritative documentaton on these SoCs so I can't be 100% sure that there aren't any subtle differences in the behaviour of the hardware. That's why I also include a more specific compatible for the T8103 SoC (the M1 used in the current Macs). > > + > > + reg: > > + maxItems: 1 > > + > > + clocks: > > + maxItems: 1 > > + > > + gpio-controller: true > > + > > + '#gpio-cells': > > + const: 2 > > + > > + gpio-ranges: > > + maxItems: 1 > > + > > + interrupts: > > + minItems: 1 > > + maxItems: 7 > > + > > + interrupt-controller: true > > + > > +patternProperties: > > + '-pins$': > > + type: object > > + $ref: pinmux-node.yaml# > > + > > + properties: > > + pinmux: > > + description: > > + Values are constructed from pin number and alternate function > > + configuration number using the APPLE_PINMUX() helper macro > > + defined in include/dt-bindings/pinctrl/apple.h. > > + > > + required: > > + - pinmux > > + > > + additionalProperties: false > > + > > +required: > > + - compatible > > + - reg > > + - gpio-controller > > + - '#gpio-cells' > > + - gpio-ranges > > + > > +additionalProperties: false > > + > > +examples: > > + - | > > + #include > > + #include > > + > > + soc { > > + #address-cells = <2>; > > + #size-cells = <2>; > > + > > + pinctrl: pinctrl@23c100000 { > > + compatible = "apple,t8103-pinctrl", "apple,pinctrl"; > > + reg = <0x2 0x3c100000 0x0 0x100000>; > > + clocks = <&gpio_clk>; > > + > > + gpio-controller; > > + #gpio-cells = <2>; > > + gpio-ranges = <&pinctrl 0 0 212>; > > + > > + interrupt-controller; > > + interrupt-parent = <&aic>; > > + interrupts = , > > + , > > + , > > + , > > + , > > + , > > + ; > > + > > + pcie_pins: pcie-pins { > > + pinmux = , > > + , > > + ; > > + }; > > + }; > > + }; > > diff --git a/MAINTAINERS b/MAINTAINERS > > index ad0e9be66885..7327c9b778f1 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -1654,9 +1654,11 @@ C: irc://chat.freenode.net/asahi-dev > > T: git https://github.com/AsahiLinux/linux.git > > F: Documentation/devicetree/bindings/arm/apple.yaml > > F: Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml > > +F: Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml > > F: arch/arm64/boot/dts/apple/ > > F: drivers/irqchip/irq-apple-aic.c > > F: include/dt-bindings/interrupt-controller/apple-aic.h > > +F: include/dt-bindings/pinctrl/apple.h > > > > ARM/ARTPEC MACHINE SUPPORT > > M: Jesper Nilsson > > diff --git a/include/dt-bindings/pinctrl/apple.h b/include/dt-bindings/pinctrl/apple.h > > new file mode 100644 > > index 000000000000..ea0a6f466592 > > --- /dev/null > > +++ b/include/dt-bindings/pinctrl/apple.h > > @@ -0,0 +1,13 @@ > > +/* SPDX-License-Identifier: GPL-2.0+ OR MIT */ > > +/* > > + * This header provides constants for Apple pinctrl bindings. > > + */ > > + > > +#ifndef _DT_BINDINGS_PINCTRL_APPLE_H > > +#define _DT_BINDINGS_PINCTRL_APPLE_H > > + > > +#define APPLE_PINMUX(pin, func) ((pin) | ((func) << 16)) > > +#define APPLE_PIN(pinmux) ((pinmux) & 0xffff) > > +#define APPLE_FUNC(pinmux) ((pinmux) >> 16) > > + > > +#endif /* _DT_BINDINGS_PINCTRL_APPLE_H */ > > -- > > 2.31.1 > > >