From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED598C433B4 for ; Mon, 10 May 2021 17:06:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4BC6613CA for ; Mon, 10 May 2021 17:06:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231308AbhEJRHS (ORCPT ); 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-gpio@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 > > > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 952D3C433ED for ; Mon, 10 May 2021 17:07:55 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F16CC613C8 for ; Mon, 10 May 2021 17:07:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F16CC613C8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xs4all.nl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:Subject:In-Reply-To:Cc:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qdtCRTcbxo719tQ5v5GJtohLZVHX/qB7Di8V8684nKI=; b=jBdJFFHO5/EaMa4j9hJ347n1bj ecBh0E5iZC/gA4b/BOAuFddmziET66YIUSzrR1EGjkituR9m37fUKUM/XPjE2yU4Ely05eIreX+v/ NVDBSOVx0ApacN/Dj/Q3TMoiiFVs6mURpwCpUfb7QE1188BpSfJm70PyfFaTGqieRb/+QjwIMBzWT xal7bUQI6nUBS2jmfpgQd3r9VkijbQ0jxgh0j2AS5nJNrJd2L0y/XYzwZq0a3SVuMPt6JC3KtclB+ 4QkDvwyBlYelMCMr1mw+a0NEACuUk+pa4UN+JPBzouOCk8eiFudn4iTpOtx6ybueWYuddpFzcDYfV P+m6C0cg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lg9MS-00F5vR-4A; Mon, 10 May 2021 17:06:28 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg9MO-00F5uJ-2i for linux-arm-kernel@desiato.infradead.org; Mon, 10 May 2021 17:06:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Message-ID:References:Subject: In-Reply-To:Cc:To:From:Date:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0yJxHpoEqUl+tLyLtaploXUgzDSIri2Q1MzVR2wG2hg=; b=Hltayo4RSVJ16nmp99Hctfl6jE 8+bicrV/fQbfcxVTPzgM+Oi5iwQt1LcCNrFEYf1JsdEBsEE3x4LkalyEOkTWKku3RnZAIh5Ea5JeW 65tex/fFX0ziRsHO2YtWYLc7m/BJl9GTYMQKzJ/TpOKG4VEG/zpARR8FDYCZyvHEG/1xVb0lVLwpJ f4peIDjzQHR9jHfBDOkk3igs16+RKmFUH41gZxOfT+MZuIdN7ATCELj50sDT107wL/sdZjwkpZto+ N9OlB+B1mJk5mjdeZMnE3Z9xnfb/5lMm81M9Vg0LuvUF6JNvKmxzAAqFgLV3ptqxBsIvOIKfSNJaO nUjlvEww==; Received: from sibelius.xs4all.nl ([83.163.83.176]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg9MK-008xTV-3h for linux-arm-kernel@lists.infradead.org; Mon, 10 May 2021 17:06:22 +0000 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_100620_493182_428C3292 X-CRM114-Status: GOOD ( 26.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel