Message ID | 20231011090510.114476-3-ychuang570808@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp397887vqb; Wed, 11 Oct 2023 02:07:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEPey6NIpO7GWYwOJsg3kCarlVjrF/TMmMRap/6ahFKSPLWqYxVdZUeFq0GPb8MvXdv08hF X-Received: by 2002:a05:6a20:43a6:b0:16c:b514:a4bc with SMTP id i38-20020a056a2043a600b0016cb514a4bcmr14059805pzl.4.1697015245542; Wed, 11 Oct 2023 02:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697015245; cv=none; d=google.com; s=arc-20160816; b=BVCCGVZwfUopwHDUWOui4jYvY5a2OPZ3bcohHOoh+R1DAoRbD1h/5TqETq50oI5KKp gU7iX5nWt8P2wRwxDUpMLPuuCq8e9VYunxm4K0OXAPSAluTmQcGoNR9Bdn5NAnY4uSfr N1t5X/12kxLo+x+VMjCD0z0kU3IhJhRqNkErKrXgBTYTJVA/4bPTj/JD5ODsyIadkHRU 79m7kpZveX+IQex9pv71eVWx6xyStWd7ePfZ8NeEDtQLb2FgiCXHJJtieO1oVYvVBY2e dKn1niO3La+qOEakw00mRNzbN1Tv/VzLsfhPSD048lkE3+DLg/SdBT1mNdxy2U1IZkkZ Z0Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rP+cC4Mbb/gp/3RvoRNIIeydGHiY8BBAyci0bzJmdbw=; fh=RXcrNhDULZEFnfui821EQfgSlaEVBcyXlNtZpbKsIMI=; b=I3Tq5sSjaOir40qaaUM5AtYYtqvdEdW4eIeYh8A34HzCFZbJGFdPfdZ6APhSbbHOvn 77QmIQCxEUDGUV0Wh0taKdw489CcmIBOQdsO0V/Ga6pRBzez/1K4pSdbERzx9FXjxf4n nWST81/aql6HFB/a1Dtg6+khKhmPXfZreocuUwgRMv1kS6lK0V1RgjBB6lfsyDaPW51D LogMTwpFwEuTQxLMsrBv5ss0LM0xCUrnjgS8JopFMduuMdoxpaJTtW8Lz8otGhHAO1Vp CUAf0Np/8Yptj4BTJXaufB7jq4eQpLEiTqa0X/v1J5GCgaXm7fTqGoehaI0uoAbf4y5b qVbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="iwxwZK/V"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id p4-20020a17090ab90400b002744e9b7a22si15613196pjr.9.2023.10.11.02.07.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 02:07:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="iwxwZK/V"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 791438076D1B; Wed, 11 Oct 2023 02:06:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231183AbjJKJFc (ORCPT <rfc822;rua109.linux@gmail.com> + 19 others); Wed, 11 Oct 2023 05:05:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345794AbjJKJFZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 11 Oct 2023 05:05:25 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5495B7; Wed, 11 Oct 2023 02:05:20 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1c5ff5f858dso46057405ad.2; Wed, 11 Oct 2023 02:05:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697015120; x=1697619920; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rP+cC4Mbb/gp/3RvoRNIIeydGHiY8BBAyci0bzJmdbw=; b=iwxwZK/V/r1KUW2ZAO04Czvue263rZdIqJqdwd4i69xUvUvsdZialtkXDi3rkbRrPA i/2VOATiOMaM5Zpw4In+sliZIzg9cMAao+7YHNV/yJJHE415aMr64LCCdHW0f2vXF8jz bzfPpUXW1o0WYIr3uJhLYmYvhxoaJovaAgHISK8HJThg2de2R5ipeQ+VhTCS8O/KeWna RdFh6HNIEsDx48GTZaPPWxPp2jdQmkDB0khIH0JUeSJt3Rm5rd22USiSp6NIdODhCZtg BK6XU1kWFhnGIa96L/tjXoNfSuNJRKPYhL1C9a1wW5qdLGpKAwnv/wz05dgVpV4EsWFv PiKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697015120; x=1697619920; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rP+cC4Mbb/gp/3RvoRNIIeydGHiY8BBAyci0bzJmdbw=; b=RxAk0E94p+wkFb0kY5Tk/+nRlv5agjk0J9Of+1Ua6+KcGGsXCVstBr4s2d1aBWu7Fq xrEra42KdGGnSyHewqlWIMO2Ci+Vva/IYel2o2iPRhEefVUOaovTkUlb8zlN2w/WZ5pR itajppYq9w4sJXqjupvrPwCWu34UIxT31sO642p7XO6P4nf9rCOo+XadgPzX54FsTRwH klkOPYkeHsOmmry6jR3nlrJpdwsIYOqJE1N0RhJLgBAdBCEyRk/h1PNosfXr+RZh3ge0 YKpbmhynJhL4zUybRVgiswDVyIHeOnochvXHLC5uWAsz6gf1OGpUx2H24O9PLMVg+VeJ O8vA== X-Gm-Message-State: AOJu0Yys9rOjWi3ymvNxrQuokid6tRoa5BsR4GzgVPoiI3PzwBsmFm5h TInXRj7tIaEp+4lvE2T8KyU= X-Received: by 2002:a17:902:aa05:b0:1c5:8a0e:b01e with SMTP id be5-20020a170902aa0500b001c58a0eb01emr16204646plb.63.1697015120106; Wed, 11 Oct 2023 02:05:20 -0700 (PDT) Received: from a28aa0606c51.. (60-250-192-107.hinet-ip.hinet.net. [60.250.192.107]) by smtp.gmail.com with ESMTPSA id z18-20020a170903019200b001c61df93afdsm13346699plg.59.2023.10.11.02.05.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 02:05:19 -0700 (PDT) From: Jacky Huang <ychuang570808@gmail.com> To: linus.walleij@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, p.zabel@pengutronix.de, j.neuschaefer@gmx.net Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, schung@nuvoton.com, Jacky Huang <ychuang3@nuvoton.com> Subject: [PATCH 2/4] dt-bindings: pinctrl: Document nuvoton ma35d1 pin control Date: Wed, 11 Oct 2023 09:05:08 +0000 Message-Id: <20231011090510.114476-3-ychuang570808@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231011090510.114476-1-ychuang570808@gmail.com> References: <20231011090510.114476-1-ychuang570808@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 11 Oct 2023 02:06:16 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779449457875189505 X-GMAIL-MSGID: 1779449457875189505 |
Series |
Add support for nuvoton ma35d1 pin control
|
|
Commit Message
Jacky Huang
Oct. 11, 2023, 9:05 a.m. UTC
From: Jacky Huang <ychuang3@nuvoton.com> Add the dt-bindings header for nuvoton ma35d1 pinctrl, that gets shared between the pin control driver and pin configuration in the dts. Add documentation to describe nuvoton ma35d1 pin control and GPIO. Signed-off-by: Jacky Huang <ychuang3@nuvoton.com> --- .../pinctrl/nuvoton,ma35d1-pinctrl.yaml | 180 ++++++++++++++++++ include/dt-bindings/pinctrl/ma35d1-pinfunc.h | 38 ++++ 2 files changed, 218 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/nuvoton,ma35d1-pinctrl.yaml create mode 100644 include/dt-bindings/pinctrl/ma35d1-pinfunc.h
Comments
On 11/10/2023 11:05, Jacky Huang wrote: > From: Jacky Huang <ychuang3@nuvoton.com> > > Add the dt-bindings header for nuvoton ma35d1 pinctrl, that gets shared > between the pin control driver and pin configuration in the dts. > > Add documentation to describe nuvoton ma35d1 pin control and GPIO. > > Signed-off-by: Jacky Huang <ychuang3@nuvoton.com> > --- > .../pinctrl/nuvoton,ma35d1-pinctrl.yaml | 180 ++++++++++++++++++ > include/dt-bindings/pinctrl/ma35d1-pinfunc.h | 38 ++++ > 2 files changed, 218 insertions(+) > create mode 100644 Documentation/devicetree/bindings/pinctrl/nuvoton,ma35d1-pinctrl.yaml > create mode 100644 include/dt-bindings/pinctrl/ma35d1-pinfunc.h > > diff --git a/Documentation/devicetree/bindings/pinctrl/nuvoton,ma35d1-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/nuvoton,ma35d1-pinctrl.yaml > new file mode 100644 > index 000000000000..0ddedbad4b78 > --- /dev/null > +++ b/Documentation/devicetree/bindings/pinctrl/nuvoton,ma35d1-pinctrl.yaml > @@ -0,0 +1,180 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/pinctrl/nuvoton,ma35d1-pinctrl.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Nuvoton MA35D1 pin control and GPIO > + > +maintainers: > + - Shan-Chun Hung <schung@nuvoton.com> > + > +properties: > + compatible: > + enum: > + - nuvoton,ma35d1-pinctrl > + > + '#address-cells': > + const: 1 > + > + '#size-cells': > + const: 1 > + > + nuvoton,sys: > + description: > + phandle to the syscon node sys is quite generic. Description explains nothing except duplicating known information. Drop duplicated info and instead explain to what this phandle points and how it is going to be used. > + $ref: /schemas/types.yaml#/definitions/phandle-array > + items: > + maxItems: 1 So just phandle, not phandle-array, unless it is defined like this in some other binding. > + > + ranges: true > + > +allOf: > + - $ref: pinctrl.yaml# allOf: goes after required: block. > + > +patternProperties: > + "gpio[a-n]@[0-9a-f]+$": ^gpio@[0-9a-f]+$": > + type: object > + additionalProperties: false > + properties: > + Drop blank line > + gpio-controller: true > + > + '#gpio-cells': > + const: 2 > + > + reg: > + maxItems: 1 > + > + clocks: > + maxItems: 1 > + > + interrupt-controller: true > + > + '#interrupt-cells': > + const: 2 > + > + interrupts: > + description: > + The interrupt outputs to sysirq. > + maxItems: 1 > + > + required: > + - reg > + - interrupts > + - interrupt-controller > + - '#interrupt-cells' > + - gpio-controller > + - '#gpio-cells' Keep the same order as in list of properties. > + > + "pcfg-[a-z0-9-.]+$": Why using different naming than other Nuvoton SoCs? You also accept "foobarpcfg-1", which does not look intentional. > + type: object > + description: > + A pinctrl node should contain at least one subnodes representing the > + pinctrl groups available on the machine. Each subnode will list the > + pins it needs, and how they should be configured, with regard to muxer > + configuration, pullups, drive strength, input enable/disable and input > + schmitt. > + > + allOf: > + - $ref: pincfg-node.yaml# missing additional/unevaluatedProperties: false. > + > + properties: > + bias-disable: true Why do you need this and other ones? > + > + bias-pull-down: true > + > + bias-pull-up: true > + > + drive-strength: > + minimum: 0 0 mA? Is it really valid? Are you sure you used correct property? > + maximum: 7 > + > + input-enable: true > + > + input-schmitt-enable: true > + > + power-source: > + description: > + I/O voltage in millivolt. > + enum: [ 1800, 3300 ] Missing units in property name. power-source also does not really describe the property. > + > +additionalProperties: > + type: object > + additionalProperties: > + type: object Wait, what? What are you describing here? > + properties: > + nuvoton,pin: > + description: > + Each entry consists of 4 parameters and represents the mux and config > + setting for one pin. > + $ref: /schemas/types.yaml#/definitions/uint32-matrix > + minItems: 1 > + items: > + items: > + - minimum: 0x80 > + maximum: 0xec > + description: > + The pinctrl register offset in syscon registers. > + - minimum: 0 > + maximum: 30 > + description: > + The bit offset in the pinctrl register. > + - minimum: 0 > + maximum: 15 > + description: > + The multi-function pin value. > + - description: > + The phandle of a node contains the generic pinconfig options > + to use as described in pinctrl-bindings.txt. > + > +examples: > + - | > + #include <dt-bindings/interrupt-controller/arm-gic.h> > + #include <dt-bindings/gpio/gpio.h> > + #include <dt-bindings/clock/nuvoton,ma35d1-clk.h> > + #include <dt-bindings/pinctrl/ma35d1-pinfunc.h> > + > + pinctrl@40040000 { > + compatible = "nuvoton,ma35d1-pinctrl"; > + #address-cells = <1>; > + #size-cells = <1>; > + nuvoton,sys = <&sys>; > + ranges = <0 0x40040000 0xc00>; > + > + gpioa@40040000 { > + reg = <0x0 0x40>; > + interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; > + clocks = <&clk GPA_GATE>; > + gpio-controller; > + #gpio-cells = <2>; > + interrupt-controller; > + #interrupt-cells = <2>; > + }; > + > + pcfg_default: pcfg-default { > + slew-rate = <0>; > + input-schmitt-disable; > + bias-disable; > + power-source = <3300>; > + drive-strength = <0>; Really 0 mA? Why this is so incomplete? > + }; > + }; > + > + pinctrl {> + uart13 { > + pinctrl_uart13: uart13grp { According to your bindings this does not belong here. > + nuvoton,pins = > + <MA35_SYS_REG_GPH_H 24 2 &pcfg_default>, > + <MA35_SYS_REG_GPH_H 28 2 &pcfg_default>; > + }; > + }; > + }; > + > + serial@407d0000 { Drop node, not related at all. > + compatible = "nuvoton,ma35d1-uart"; > + reg = <0x407d0000 0x100>; > + interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>; > + clocks = <&clk UART13_GATE>; > + pinctrl-0 = <&pinctrl_uart13>; > + }; > diff --git a/include/dt-bindings/pinctrl/ma35d1-pinfunc.h b/include/dt-bindings/pinctrl/ma35d1-pinfunc.h > new file mode 100644 > index 000000000000..a2609d466dc9 > --- /dev/null > +++ b/include/dt-bindings/pinctrl/ma35d1-pinfunc.h Filename matching bindings. The same name. > @@ -0,0 +1,38 @@ > +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */ > +/* > + * Copyright (C) 2023 Nuvoton Technologies. > + */ > + > +#ifndef __DT_BINDINGS_PINCTRL_NUVOTON_MA35D1_H > +#define __DT_BINDINGS_PINCTRL_NUVOTON_MA35D1_H > + > +#define MA35_SYS_REG_GPA_L 0x80 Registry addresses are not suitable for bindings. There is also no need to have REG address in the binding. Drop entire file. Best regards, Krzysztof
Dear Krzysztof, Thank you for the review. On 2023/10/13 上午 03:41, Krzysztof Kozlowski wrote: > On 11/10/2023 11:05, Jacky Huang wrote: >> From: Jacky Huang<ychuang3@nuvoton.com> >> >> Add the dt-bindings header for nuvoton ma35d1 pinctrl, that gets shared >> between the pin control driver and pin configuration in the dts. >> >> Add documentation to describe nuvoton ma35d1 pin control and GPIO. >> >> Signed-off-by: Jacky Huang<ychuang3@nuvoton.com> >> --- >> .../pinctrl/nuvoton,ma35d1-pinctrl.yaml | 180 ++++++++++++++++++ >> include/dt-bindings/pinctrl/ma35d1-pinfunc.h | 38 ++++ >> 2 files changed, 218 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/pinctrl/nuvoton,ma35d1-pinctrl.yaml >> create mode 100644 include/dt-bindings/pinctrl/ma35d1-pinfunc.h >> >> diff --git a/Documentation/devicetree/bindings/pinctrl/nuvoton,ma35d1-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/nuvoton,ma35d1-pinctrl.yaml >> new file mode 100644 >> index 000000000000..0ddedbad4b78 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/pinctrl/nuvoton,ma35d1-pinctrl.yaml >> @@ -0,0 +1,180 @@ >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >> +%YAML 1.2 >> +--- >> +$id:http://devicetree.org/schemas/pinctrl/nuvoton,ma35d1-pinctrl.yaml# >> +$schema:http://devicetree.org/meta-schemas/core.yaml# >> + >> +title: Nuvoton MA35D1 pin control and GPIO >> + >> +maintainers: >> + - Shan-Chun Hung<schung@nuvoton.com> >> + >> +properties: >> + compatible: >> + enum: >> + - nuvoton,ma35d1-pinctrl >> + >> + '#address-cells': >> + const: 1 >> + >> + '#size-cells': >> + const: 1 >> + >> + nuvoton,sys: >> + description: >> + phandle to the syscon node > sys is quite generic. Description explains nothing except duplicating > known information. Drop duplicated info and instead explain to what this > phandle points and how it is going to be used. > > >> + $ref: /schemas/types.yaml#/definitions/phandle-array >> + items: >> + maxItems: 1 > So just phandle, not phandle-array, unless it is defined like this in > some other binding. I would like to update this as: nuvoton,sys: $ref: /schemas/types.yaml#/definitions/phandle description: Help pinctrl driver to access system registers by means of regmap. >> + >> + ranges: true >> + >> +allOf: >> + - $ref: pinctrl.yaml# > allOf: goes after required: block. I will fix it. >> + >> +patternProperties: >> + "gpio[a-n]@[0-9a-f]+$": > ^gpio@[0-9a-f]+$": I will fix this, and also fix the dtsi. >> + type: object >> + additionalProperties: false >> + properties: >> + > Drop blank line I will fix it. >> + gpio-controller: true >> + >> + '#gpio-cells': >> + const: 2 >> + >> + reg: >> + maxItems: 1 >> + >> + clocks: >> + maxItems: 1 >> + >> + interrupt-controller: true >> + >> + '#interrupt-cells': >> + const: 2 >> + >> + interrupts: >> + description: >> + The interrupt outputs to sysirq. >> + maxItems: 1 >> + >> + required: >> + - reg >> + - interrupts >> + - interrupt-controller >> + - '#interrupt-cells' >> + - gpio-controller >> + - '#gpio-cells' > Keep the same order as in list of properties. I will fix the order. >> + >> + "pcfg-[a-z0-9-.]+$": > Why using different naming than other Nuvoton SoCs? You also accept > "foobarpcfg-1", which does not look intentional. > I will use '"^pin-[a-z0-9-.]+$" instead. >> + type: object >> + description: >> + A pinctrl node should contain at least one subnodes representing the >> + pinctrl groups available on the machine. Each subnode will list the >> + pins it needs, and how they should be configured, with regard to muxer >> + configuration, pullups, drive strength, input enable/disable and input >> + schmitt. >> + >> + allOf: >> + - $ref: pincfg-node.yaml# > missing additional/unevaluatedProperties: false. I will add unevaluatedProperties: false. >> + >> + properties: >> + bias-disable: true > Why do you need this and other ones? We expect the pin configuration to select one of ==> bias-disable; bias-pull-down; bias-pull-up; This is the same as rockchip,pinctrl.yaml and renesas,rzv2m-pinctrl.yaml. >> + >> + bias-pull-down: true >> + >> + bias-pull-up: true >> + >> + drive-strength: >> + minimum: 0 > 0 mA? Is it really valid? Are you sure you used correct property? We treat this value as the value to be written to the control register, not as a current value in mA. I will correct this mistake. >> + maximum: 7 >> + >> + input-enable: true >> + >> + input-schmitt-enable: true >> + >> + power-source: >> + description: >> + I/O voltage in millivolt. >> + enum: [ 1800, 3300 ] > Missing units in property name. power-source also does not really > describe the property. The output voltage level of GPIO can be configured as 1.8V or 3.3V, but I cannot find any suitable output properties in 'pincfg-node.yaml.' I noticed that 'xlnx,zynq-pinctrl.yaml' and 'xlnx,zynq-pinctrl.yaml' use 'power source' to specify the output voltage. Should I follow their approach or define a vendor-specific one? >> + >> +additionalProperties: >> + type: object >> + additionalProperties: >> + type: object > Wait, what? What are you describing here? I will fix it as: "-grp[0-9]$": type: object description: Pinctrl node's client devices use subnodes for desired pin configuration. Client device subnodes use below standard properties. properties: nuvoton,pins: .... and fix the example dts also. >> + properties: >> + nuvoton,pin: >> + description: >> + Each entry consists of 4 parameters and represents the mux and config >> + setting for one pin. >> + $ref: /schemas/types.yaml#/definitions/uint32-matrix >> + minItems: 1 >> + items: >> + items: >> + - minimum: 0x80 >> + maximum: 0xec >> + description: >> + The pinctrl register offset in syscon registers. >> + - minimum: 0 >> + maximum: 30 >> + description: >> + The bit offset in the pinctrl register. >> + - minimum: 0 >> + maximum: 15 >> + description: >> + The multi-function pin value. >> + - description: >> + The phandle of a node contains the generic pinconfig options >> + to use as described in pinctrl-bindings.txt. >> + >> +examples: >> + - | >> + #include <dt-bindings/interrupt-controller/arm-gic.h> >> + #include <dt-bindings/gpio/gpio.h> >> + #include <dt-bindings/clock/nuvoton,ma35d1-clk.h> >> + #include <dt-bindings/pinctrl/ma35d1-pinfunc.h> >> + >> + pinctrl@40040000 { >> + compatible = "nuvoton,ma35d1-pinctrl"; >> + #address-cells = <1>; >> + #size-cells = <1>; >> + nuvoton,sys = <&sys>; >> + ranges = <0 0x40040000 0xc00>; >> + >> + gpioa@40040000 { >> + reg = <0x0 0x40>; >> + interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; >> + clocks = <&clk GPA_GATE>; >> + gpio-controller; >> + #gpio-cells = <2>; >> + interrupt-controller; >> + #interrupt-cells = <2>; >> + }; >> + >> + pcfg_default: pcfg-default { >> + slew-rate = <0>; >> + input-schmitt-disable; >> + bias-disable; >> + power-source = <3300>; >> + drive-strength = <0>; > Really 0 mA? > > Why this is so incomplete? We treat this value as the value to be written to the control register, not as a current value in mA. I will correct this mistake. >> + }; >> + }; >> + >> + pinctrl {> + uart13 { >> + pinctrl_uart13: uart13grp { > According to your bindings this does not belong here. I will fix. >> + nuvoton,pins = >> + <MA35_SYS_REG_GPH_H 24 2 &pcfg_default>, >> + <MA35_SYS_REG_GPH_H 28 2 &pcfg_default>; >> + }; >> + }; >> + }; >> + >> + serial@407d0000 { > Drop node, not related at all. Okay, I will drop this node. >> + compatible = "nuvoton,ma35d1-uart"; >> + reg = <0x407d0000 0x100>; >> + interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>; >> + clocks = <&clk UART13_GATE>; >> + pinctrl-0 = <&pinctrl_uart13>; >> + }; >> diff --git a/include/dt-bindings/pinctrl/ma35d1-pinfunc.h b/include/dt-bindings/pinctrl/ma35d1-pinfunc.h >> new file mode 100644 >> index 000000000000..a2609d466dc9 >> --- /dev/null >> +++ b/include/dt-bindings/pinctrl/ma35d1-pinfunc.h > Filename matching bindings. The same name. > >> @@ -0,0 +1,38 @@ >> +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */ >> +/* >> + * Copyright (C) 2023 Nuvoton Technologies. >> + */ >> + >> +#ifndef __DT_BINDINGS_PINCTRL_NUVOTON_MA35D1_H >> +#define __DT_BINDINGS_PINCTRL_NUVOTON_MA35D1_H >> + >> +#define MA35_SYS_REG_GPA_L 0x80 > Registry addresses are not suitable for bindings. There is also no need > to have REG address in the binding. Drop entire file. > > Best regards, > Krzysztof > I will remove 'ma35d1-pinfunc.h' as it will be useless after the 'nuvoton,pin' definition changed. Best Regards, Jacky Huang
On 16/10/2023 06:32, Jacky Huang wrote: >>> + '#size-cells': >>> + const: 1 >>> + >>> + nuvoton,sys: >>> + description: >>> + phandle to the syscon node >> sys is quite generic. Description explains nothing except duplicating >> known information. Drop duplicated info and instead explain to what this >> phandle points and how it is going to be used. Read comments carefully. >> >> >>> + $ref: /schemas/types.yaml#/definitions/phandle-array >>> + items: >>> + maxItems: 1 >> So just phandle, not phandle-array, unless it is defined like this in >> some other binding. > > I would like to update this as: > > nuvoton,sys: Nothing improved. > $ref: /schemas/types.yaml#/definitions/phandle > description: > Help pinctrl driver to access system registers by means of regmap. Driver is not relevant here. Say which part of syscon are necessary for pinctrl operation. > > > >>> + >>> + ranges: true >>> + >>> +allOf: >>> + - $ref: pinctrl.yaml# >> allOf: goes after required: block. > > I will fix it. > >>> + >>> +patternProperties: >>> + "gpio[a-n]@[0-9a-f]+$": >> ^gpio@[0-9a-f]+$": > > I will fix this, and also fix the dtsi. > >>> + type: object >>> + additionalProperties: false >>> + properties: >>> + >> Drop blank line > > I will fix it. > >>> + gpio-controller: true >>> + >>> + '#gpio-cells': >>> + const: 2 >>> + >>> + reg: >>> + maxItems: 1 >>> + >>> + clocks: >>> + maxItems: 1 >>> + >>> + interrupt-controller: true >>> + >>> + '#interrupt-cells': >>> + const: 2 >>> + >>> + interrupts: >>> + description: >>> + The interrupt outputs to sysirq. >>> + maxItems: 1 >>> + >>> + required: >>> + - reg >>> + - interrupts >>> + - interrupt-controller >>> + - '#interrupt-cells' >>> + - gpio-controller >>> + - '#gpio-cells' >> Keep the same order as in list of properties. > > I will fix the order. > >>> + >>> + "pcfg-[a-z0-9-.]+$": >> Why using different naming than other Nuvoton SoCs? You also accept >> "foobarpcfg-1", which does not look intentional. >> > > I will use '"^pin-[a-z0-9-.]+$" instead. [.] is redundant... What exactly do you want to match? > > >>> + type: object >>> + description: >>> + A pinctrl node should contain at least one subnodes representing the >>> + pinctrl groups available on the machine. Each subnode will list the >>> + pins it needs, and how they should be configured, with regard to muxer >>> + configuration, pullups, drive strength, input enable/disable and input >>> + schmitt. >>> + >>> + allOf: >>> + - $ref: pincfg-node.yaml# >> missing additional/unevaluatedProperties: false. > > I will add unevaluatedProperties: false. > >>> + >>> + properties: >>> + bias-disable: true >> Why do you need this and other ones? > > We expect the pin configuration to select one of ==> > bias-disable; > bias-pull-down; > bias-pull-up; > > This is the same as rockchip,pinctrl.yaml and renesas,rzv2m-pinctrl.yaml. OK, then go with nuvoton approach. List the properties (:true) and use additionalProperties: false. > >>> + >>> + bias-pull-down: true >>> + >>> + bias-pull-up: true >>> + >>> + drive-strength: >>> + minimum: 0 >> 0 mA? Is it really valid? Are you sure you used correct property? > > We treat this value as the value to be written to the control register, > not as > a current value in mA. I will correct this mistake. Instead treat it as mA. Is this possible? > >>> + maximum: 7 >>> + >>> + input-enable: true >>> + >>> + input-schmitt-enable: true >>> + >>> + power-source: >>> + description: >>> + I/O voltage in millivolt. >>> + enum: [ 1800, 3300 ] >> Missing units in property name. power-source also does not really >> describe the property. > > > The output voltage level of GPIO can be configured as 1.8V or 3.3V, > but I cannot find any suitable output properties in 'pincfg-node.yaml.' There is actually power-source, but treated as actual choice of power supplies. > I noticed that 'xlnx,zynq-pinctrl.yaml' and 'xlnx,zynq-pinctrl.yaml' use > 'power source' to specify the output voltage. Should I follow their > approach or define a vendor-specific one? Maybe Rob or Linus have here some recommendation, but I would suggest to go either with rtd1319d-pinctrl.yaml approach or add a generic property to pincfg-node expressed in real units like "io-microvolt". Rob, Linus, any ideas for generic property replacing register-specific power-source? Best regards, Krzysztof
Dear Krzysztof, Thank you for the review. On 2023/10/17 上午 03:52, Krzysztof Kozlowski wrote: > On 16/10/2023 06:32, Jacky Huang wrote: >>>> + '#size-cells': >>>> + const: 1 >>>> + >>>> + nuvoton,sys: >>>> + description: >>>> + phandle to the syscon node >>> sys is quite generic. Description explains nothing except duplicating >>> known information. Drop duplicated info and instead explain to what this >>> phandle points and how it is going to be used. > Read comments carefully. I will update the description of 'nuvoton,sys'. > >>> >>>> + $ref: /schemas/types.yaml#/definitions/phandle-array >>>> + items: >>>> + maxItems: 1 >>> So just phandle, not phandle-array, unless it is defined like this in >>> some other binding. >> I would like to update this as: >> >> nuvoton,sys: > Nothing improved. Here just fix the 'phandle-array' to 'phandle' and remove 'maxItems'. >> $ref: /schemas/types.yaml#/definitions/phandle >> description: >> Help pinctrl driver to access system registers by means of regmap. > Driver is not relevant here. Say which part of syscon are necessary for > pinctrl operation. > I will update description as: nuvoton,sys: $ref: /schemas/types.yaml#/definitions/phandle description: The pin function control registers are located in the system control register space. This phandle provides pinctrl the ability to access the pin function control registers through the use of regmap. >> >> >>>> + >>>> + ranges: true >>>> + >>>> +allOf: >>>> + - $ref: pinctrl.yaml# >>> allOf: goes after required: block. >> I will fix it. >> >>>> + >>>> +patternProperties: >>>> + "gpio[a-n]@[0-9a-f]+$": >>> ^gpio@[0-9a-f]+$": >> I will fix this, and also fix the dtsi. >> >>>> + type: object >>>> + additionalProperties: false >>>> + properties: >>>> + >>> Drop blank line >> I will fix it. >> >>>> + gpio-controller: true >>>> + >>>> + '#gpio-cells': >>>> + const: 2 >>>> + >>>> + reg: >>>> + maxItems: 1 >>>> + >>>> + clocks: >>>> + maxItems: 1 >>>> + >>>> + interrupt-controller: true >>>> + >>>> + '#interrupt-cells': >>>> + const: 2 >>>> + >>>> + interrupts: >>>> + description: >>>> + The interrupt outputs to sysirq. >>>> + maxItems: 1 >>>> + >>>> + required: >>>> + - reg >>>> + - interrupts >>>> + - interrupt-controller >>>> + - '#interrupt-cells' >>>> + - gpio-controller >>>> + - '#gpio-cells' >>> Keep the same order as in list of properties. >> I will fix the order. >> >>>> + >>>> + "pcfg-[a-z0-9-.]+$": >>> Why using different naming than other Nuvoton SoCs? You also accept >>> "foobarpcfg-1", which does not look intentional. >>> >> I will use '"^pin-[a-z0-9-.]+$" instead. > [.] is redundant... What exactly do you want to match? I want to match the name like "-1.8v" or "-3.3v". However, this should be specified in the property, so I will drop the "-.". >> >>>> + type: object >>>> + description: >>>> + A pinctrl node should contain at least one subnodes representing the >>>> + pinctrl groups available on the machine. Each subnode will list the >>>> + pins it needs, and how they should be configured, with regard to muxer >>>> + configuration, pullups, drive strength, input enable/disable and input >>>> + schmitt. >>>> + >>>> + allOf: >>>> + - $ref: pincfg-node.yaml# >>> missing additional/unevaluatedProperties: false. >> I will add unevaluatedProperties: false. >> >>>> + >>>> + properties: >>>> + bias-disable: true >>> Why do you need this and other ones? >> We expect the pin configuration to select one of ==> >> bias-disable; >> bias-pull-down; >> bias-pull-up; >> >> This is the same as rockchip,pinctrl.yaml and renesas,rzv2m-pinctrl.yaml. > OK, then go with nuvoton approach. List the properties (:true) and use > additionalProperties: false. I got it. >>>> + >>>> + bias-pull-down: true >>>> + >>>> + bias-pull-up: true >>>> + >>>> + drive-strength: >>>> + minimum: 0 >>> 0 mA? Is it really valid? Are you sure you used correct property? >> We treat this value as the value to be written to the control register, >> not as >> a current value in mA. I will correct this mistake. > Instead treat it as mA. Is this possible? I will update it as: drive-strength-microamp: oneOf: - enum: [ 2900, 4400, 5800, 7300, 8600, 10100, 11500, 13000 ] description: 1.8V I/O driving strength - enum: [ 17100, 25600, 34100, 42800, 48000, 56000, 77000, 82000 ] description: 3.3V I/O driving strength And use a lookup table in the pinctrl driver to translate it into register value. >>>> + maximum: 7 >>>> + >>>> + input-enable: true >>>> + >>>> + input-schmitt-enable: true >>>> + >>>> + power-source: >>>> + description: >>>> + I/O voltage in millivolt. >>>> + enum: [ 1800, 3300 ] >>> Missing units in property name. power-source also does not really >>> describe the property. >> >> The output voltage level of GPIO can be configured as 1.8V or 3.3V, >> but I cannot find any suitable output properties in 'pincfg-node.yaml.' > There is actually power-source, but treated as actual choice of power > supplies. > >> I noticed that 'xlnx,zynq-pinctrl.yaml' and 'xlnx,zynq-pinctrl.yaml' use >> 'power source' to specify the output voltage. Should I follow their >> approach or define a vendor-specific one? > Maybe Rob or Linus have here some recommendation, but I would suggest to > go either with rtd1319d-pinctrl.yaml approach or add a generic property > to pincfg-node expressed in real units like "io-microvolt". OK, I will update it as: power-source: description: | Valid arguments are described as below: 0: power supply of 1.8V 1: power supply of 3.3V enum: [0, 1] > Rob, Linus, any ideas for generic property replacing register-specific > power-source? > > > Best regards, > Krzysztof > Best Regards, Jacky Huang
On 18/10/2023 05:26, Jacky Huang wrote: > Dear Krzysztof, > > Thank you for the review. > > > On 2023/10/17 上午 03:52, Krzysztof Kozlowski wrote: >> On 16/10/2023 06:32, Jacky Huang wrote: >>>>> + '#size-cells': >>>>> + const: 1 >>>>> + >>>>> + nuvoton,sys: >>>>> + description: >>>>> + phandle to the syscon node >>>> sys is quite generic. Description explains nothing except duplicating >>>> known information. Drop duplicated info and instead explain to what this >>>> phandle points and how it is going to be used. >> Read comments carefully. > > > I will update the description of 'nuvoton,sys'. What is the full name of destination block? > >> >>>> >>>>> + $ref: /schemas/types.yaml#/definitions/phandle-array >>>>> + items: >>>>> + maxItems: 1 >>>> So just phandle, not phandle-array, unless it is defined like this in >>>> some other binding. >>> I would like to update this as: >>> >>> nuvoton,sys: >> Nothing improved. > > Here just fix the 'phandle-array' to 'phandle' and remove 'maxItems'. > >>> $ref: /schemas/types.yaml#/definitions/phandle >>> description: >>> Help pinctrl driver to access system registers by means of regmap. >> Driver is not relevant here. Say which part of syscon are necessary for >> pinctrl operation. >> > > I will update description as: > > nuvoton,sys: > $ref: /schemas/types.yaml#/definitions/phandle > description: > The pin function control registers are located in the system > control register space. This phandle provides pinctrl the > ability to access the pin function control registers through > the use of regmap. regmap is unrelated to the bindings. > >>>>> + maximum: 7 >>>>> + >>>>> + input-enable: true >>>>> + >>>>> + input-schmitt-enable: true >>>>> + >>>>> + power-source: >>>>> + description: >>>>> + I/O voltage in millivolt. >>>>> + enum: [ 1800, 3300 ] >>>> Missing units in property name. power-source also does not really >>>> describe the property. >>> >>> The output voltage level of GPIO can be configured as 1.8V or 3.3V, >>> but I cannot find any suitable output properties in 'pincfg-node.yaml.' >> There is actually power-source, but treated as actual choice of power >> supplies. >> >>> I noticed that 'xlnx,zynq-pinctrl.yaml' and 'xlnx,zynq-pinctrl.yaml' use >>> 'power source' to specify the output voltage. Should I follow their >>> approach or define a vendor-specific one? >> Maybe Rob or Linus have here some recommendation, but I would suggest to >> go either with rtd1319d-pinctrl.yaml approach or add a generic property >> to pincfg-node expressed in real units like "io-microvolt". > > OK, I will update it as: > > power-source: > description: | > Valid arguments are described as below: > 0: power supply of 1.8V > 1: power supply of 3.3V > enum: [0, 1] > > >> Rob, Linus, any ideas for generic property replacing register-specific >> power-source? I proposed io-microvolt Best regards, Krzysztof
Dear Krzysztof, Thank you for the review. On 2023/10/18 下午 01:58, Krzysztof Kozlowski wrote: > On 18/10/2023 05:26, Jacky Huang wrote: >> Dear Krzysztof, >> >> Thank you for the review. >> >> >> On 2023/10/17 上午 03:52, Krzysztof Kozlowski wrote: >>> On 16/10/2023 06:32, Jacky Huang wrote: >>>>>> + '#size-cells': >>>>>> + const: 1 >>>>>> + >>>>>> + nuvoton,sys: >>>>>> + description: >>>>>> + phandle to the syscon node >>>>> sys is quite generic. Description explains nothing except duplicating >>>>> known information. Drop duplicated info and instead explain to what this >>>>> phandle points and how it is going to be used. >>> Read comments carefully. >> >> I will update the description of 'nuvoton,sys'. > What is the full name of destination block? The full name is 'system-management'. From: sys: system-management@40460000 { compatible = "nuvoton,ma35d1-reset", "syscon"; reg = <0x0 0x40460000 0x0 0x200>; #reset-cells = <1>; }; >>>>>> + $ref: /schemas/types.yaml#/definitions/phandle-array >>>>>> + items: >>>>>> + maxItems: 1 >>>>> So just phandle, not phandle-array, unless it is defined like this in >>>>> some other binding. >>>> I would like to update this as: >>>> >>>> nuvoton,sys: >>> Nothing improved. >> Here just fix the 'phandle-array' to 'phandle' and remove 'maxItems'. >> >>>> $ref: /schemas/types.yaml#/definitions/phandle >>>> description: >>>> Help pinctrl driver to access system registers by means of regmap. >>> Driver is not relevant here. Say which part of syscon are necessary for >>> pinctrl operation. >>> >> I will update description as: >> >> nuvoton,sys: >> $ref: /schemas/types.yaml#/definitions/phandle >> description: >> The pin function control registers are located in the system >> control register space. This phandle provides pinctrl the >> ability to access the pin function control registers through >> the use of regmap. > regmap is unrelated to the bindings. So, I will just update the description as: phandle of the system-management node. >>>>>> + maximum: 7 >>>>>> + >>>>>> + input-enable: true >>>>>> + >>>>>> + input-schmitt-enable: true >>>>>> + >>>>>> + power-source: >>>>>> + description: >>>>>> + I/O voltage in millivolt. >>>>>> + enum: [ 1800, 3300 ] >>>>> Missing units in property name. power-source also does not really >>>>> describe the property. >>>> The output voltage level of GPIO can be configured as 1.8V or 3.3V, >>>> but I cannot find any suitable output properties in 'pincfg-node.yaml.' >>> There is actually power-source, but treated as actual choice of power >>> supplies. >>> >>>> I noticed that 'xlnx,zynq-pinctrl.yaml' and 'xlnx,zynq-pinctrl.yaml' use >>>> 'power source' to specify the output voltage. Should I follow their >>>> approach or define a vendor-specific one? >>> Maybe Rob or Linus have here some recommendation, but I would suggest to >>> go either with rtd1319d-pinctrl.yaml approach or add a generic property >>> to pincfg-node expressed in real units like "io-microvolt". >> OK, I will update it as: >> >> power-source: >> description: | >> Valid arguments are described as below: >> 0: power supply of 1.8V >> 1: power supply of 3.3V >> enum: [0, 1] >> >> >>> Rob, Linus, any ideas for generic property replacing register-specific >>> power-source? > I proposed io-microvolt > > Best regards, > Krzysztof > I will use 'io-microvolt' once it is available. Best Regards, Jacky Huang
On Mon, Oct 16, 2023 at 9:52 PM Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > > I noticed that 'xlnx,zynq-pinctrl.yaml' and 'xlnx,zynq-pinctrl.yaml' use > > 'power source' to specify the output voltage. Should I follow their > > approach or define a vendor-specific one? > > Maybe Rob or Linus have here some recommendation, but I would suggest to > go either with rtd1319d-pinctrl.yaml approach or add a generic property > to pincfg-node expressed in real units like "io-microvolt". > > Rob, Linus, any ideas for generic property replacing register-specific > power-source? The existing power-source is generally used to select between (usually two) different chip-internal power rails, such as 1.8V and 3.3V. The format is a driver-specific enumerator. We *could* just patch the documentation for power-source to say that microvolts is the preferred format but legacy users may be using a custom enumerator. io-microvolt seems like a more long-term viable option if a wider range of voltages are to be supported so I'm happy with that if the DT folks think it's nicer. However notice that the power-source property is already being hard-coded into things such as SCMI and ACPI so it's not like it will ever be replaced by io-microvolt and phased out as far as Linux is concerned. Not the next 50 years at least. Yours, Linus Walleij
On 18/10/2023 10:18, Linus Walleij wrote: > On Mon, Oct 16, 2023 at 9:52 PM Krzysztof Kozlowski > <krzysztof.kozlowski@linaro.org> wrote: > >>> I noticed that 'xlnx,zynq-pinctrl.yaml' and 'xlnx,zynq-pinctrl.yaml' use >>> 'power source' to specify the output voltage. Should I follow their >>> approach or define a vendor-specific one? >> >> Maybe Rob or Linus have here some recommendation, but I would suggest to >> go either with rtd1319d-pinctrl.yaml approach or add a generic property >> to pincfg-node expressed in real units like "io-microvolt". >> >> Rob, Linus, any ideas for generic property replacing register-specific >> power-source? > > The existing power-source is generally used to select between (usually > two) different chip-internal power rails, such as 1.8V and 3.3V. > The format is a driver-specific enumerator. > > We *could* just patch the documentation for power-source to > say that microvolts is the preferred format but legacy users may > be using a custom enumerator. > > io-microvolt seems like a more long-term viable option if a wider > range of voltages are to be supported so I'm happy with that if the > DT folks think it's nicer. However notice that the power-source > property is already being hard-coded into things such as SCMI > and ACPI so it's not like it will ever be replaced by io-microvolt > and phased out as far as Linux is concerned. Not the next 50 > years at least. This I understand. I think It is better in general if generic properties use units (e.g. drive-strength-microamp, output-impedance-ohms), so it could be here "io-microvolt". At least for the new bindings. Best regards, Krzysztof
On Wed, Oct 18, 2023 at 11:53 AM Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > On 18/10/2023 10:18, Linus Walleij wrote: > > On Mon, Oct 16, 2023 at 9:52 PM Krzysztof Kozlowski > > <krzysztof.kozlowski@linaro.org> wrote: > > > >>> I noticed that 'xlnx,zynq-pinctrl.yaml' and 'xlnx,zynq-pinctrl.yaml' use > >>> 'power source' to specify the output voltage. Should I follow their > >>> approach or define a vendor-specific one? > >> > >> Maybe Rob or Linus have here some recommendation, but I would suggest to > >> go either with rtd1319d-pinctrl.yaml approach or add a generic property > >> to pincfg-node expressed in real units like "io-microvolt". > >> > >> Rob, Linus, any ideas for generic property replacing register-specific > >> power-source? > > > > The existing power-source is generally used to select between (usually > > two) different chip-internal power rails, such as 1.8V and 3.3V. > > The format is a driver-specific enumerator. > > > > We *could* just patch the documentation for power-source to > > say that microvolts is the preferred format but legacy users may > > be using a custom enumerator. > > > > io-microvolt seems like a more long-term viable option if a wider > > range of voltages are to be supported so I'm happy with that if the > > DT folks think it's nicer. However notice that the power-source > > property is already being hard-coded into things such as SCMI > > and ACPI so it's not like it will ever be replaced by io-microvolt > > and phased out as far as Linux is concerned. Not the next 50 > > years at least. > > This I understand. > > I think It is better in general if generic properties use units (e.g. > drive-strength-microamp, output-impedance-ohms), so it could be here > "io-microvolt". At least for the new bindings. I agree. Even io-voltage-microvolt perhaps. Yours, Linus Walleij
diff --git a/Documentation/devicetree/bindings/pinctrl/nuvoton,ma35d1-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/nuvoton,ma35d1-pinctrl.yaml new file mode 100644 index 000000000000..0ddedbad4b78 --- /dev/null +++ b/Documentation/devicetree/bindings/pinctrl/nuvoton,ma35d1-pinctrl.yaml @@ -0,0 +1,180 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pinctrl/nuvoton,ma35d1-pinctrl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nuvoton MA35D1 pin control and GPIO + +maintainers: + - Shan-Chun Hung <schung@nuvoton.com> + +properties: + compatible: + enum: + - nuvoton,ma35d1-pinctrl + + '#address-cells': + const: 1 + + '#size-cells': + const: 1 + + nuvoton,sys: + description: + phandle to the syscon node + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + maxItems: 1 + + ranges: true + +allOf: + - $ref: pinctrl.yaml# + +patternProperties: + "gpio[a-n]@[0-9a-f]+$": + type: object + additionalProperties: false + properties: + + gpio-controller: true + + '#gpio-cells': + const: 2 + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + interrupt-controller: true + + '#interrupt-cells': + const: 2 + + interrupts: + description: + The interrupt outputs to sysirq. + maxItems: 1 + + required: + - reg + - interrupts + - interrupt-controller + - '#interrupt-cells' + - gpio-controller + - '#gpio-cells' + + "pcfg-[a-z0-9-.]+$": + type: object + description: + A pinctrl node should contain at least one subnodes representing the + pinctrl groups available on the machine. Each subnode will list the + pins it needs, and how they should be configured, with regard to muxer + configuration, pullups, drive strength, input enable/disable and input + schmitt. + + allOf: + - $ref: pincfg-node.yaml# + + properties: + bias-disable: true + + bias-pull-down: true + + bias-pull-up: true + + drive-strength: + minimum: 0 + maximum: 7 + + input-enable: true + + input-schmitt-enable: true + + power-source: + description: + I/O voltage in millivolt. + enum: [ 1800, 3300 ] + +additionalProperties: + type: object + additionalProperties: + type: object + properties: + nuvoton,pin: + description: + Each entry consists of 4 parameters and represents the mux and config + setting for one pin. + $ref: /schemas/types.yaml#/definitions/uint32-matrix + minItems: 1 + items: + items: + - minimum: 0x80 + maximum: 0xec + description: + The pinctrl register offset in syscon registers. + - minimum: 0 + maximum: 30 + description: + The bit offset in the pinctrl register. + - minimum: 0 + maximum: 15 + description: + The multi-function pin value. + - description: + The phandle of a node contains the generic pinconfig options + to use as described in pinctrl-bindings.txt. + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/gpio/gpio.h> + #include <dt-bindings/clock/nuvoton,ma35d1-clk.h> + #include <dt-bindings/pinctrl/ma35d1-pinfunc.h> + + pinctrl@40040000 { + compatible = "nuvoton,ma35d1-pinctrl"; + #address-cells = <1>; + #size-cells = <1>; + nuvoton,sys = <&sys>; + ranges = <0 0x40040000 0xc00>; + + gpioa@40040000 { + reg = <0x0 0x40>; + interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk GPA_GATE>; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + pcfg_default: pcfg-default { + slew-rate = <0>; + input-schmitt-disable; + bias-disable; + power-source = <3300>; + drive-strength = <0>; + }; + }; + + pinctrl { + uart13 { + pinctrl_uart13: uart13grp { + nuvoton,pins = + <MA35_SYS_REG_GPH_H 24 2 &pcfg_default>, + <MA35_SYS_REG_GPH_H 28 2 &pcfg_default>; + }; + }; + }; + + serial@407d0000 { + compatible = "nuvoton,ma35d1-uart"; + reg = <0x407d0000 0x100>; + interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk UART13_GATE>; + pinctrl-0 = <&pinctrl_uart13>; + }; diff --git a/include/dt-bindings/pinctrl/ma35d1-pinfunc.h b/include/dt-bindings/pinctrl/ma35d1-pinfunc.h new file mode 100644 index 000000000000..a2609d466dc9 --- /dev/null +++ b/include/dt-bindings/pinctrl/ma35d1-pinfunc.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */ +/* + * Copyright (C) 2023 Nuvoton Technologies. + */ + +#ifndef __DT_BINDINGS_PINCTRL_NUVOTON_MA35D1_H +#define __DT_BINDINGS_PINCTRL_NUVOTON_MA35D1_H + +#define MA35_SYS_REG_GPA_L 0x80 +#define MA35_SYS_REG_GPA_H 0x84 +#define MA35_SYS_REG_GPB_L 0x88 +#define MA35_SYS_REG_GPB_H 0x8c +#define MA35_SYS_REG_GPC_L 0x90 +#define MA35_SYS_REG_GPC_H 0x94 +#define MA35_SYS_REG_GPD_L 0x98 +#define MA35_SYS_REG_GPD_H 0x9c +#define MA35_SYS_REG_GPE_L 0xa0 +#define MA35_SYS_REG_GPE_H 0xa4 +#define MA35_SYS_REG_GPF_L 0xa8 +#define MA35_SYS_REG_GPF_H 0xac +#define MA35_SYS_REG_GPG_L 0xb0 +#define MA35_SYS_REG_GPG_H 0xb4 +#define MA35_SYS_REG_GPH_L 0xb8 +#define MA35_SYS_REG_GPH_H 0xbc +#define MA35_SYS_REG_GPI_L 0xc0 +#define MA35_SYS_REG_GPI_H 0xc4 +#define MA35_SYS_REG_GPJ_L 0xc8 +#define MA35_SYS_REG_GPJ_H 0xcc +#define MA35_SYS_REG_GPK_L 0xd0 +#define MA35_SYS_REG_GPK_H 0xd4 +#define MA35_SYS_REG_GPL_L 0xd8 +#define MA35_SYS_REG_GPL_H 0xdc +#define MA35_SYS_REG_GPM_L 0xe0 +#define MA35_SYS_REG_GPM_H 0xe4 +#define MA35_SYS_REG_GPN_L 0xe8 +#define MA35_SYS_REG_GPN_H 0xec + +#endif /* __DT_BINDINGS_PINCTRL_NUVOTON_MA35D1_H */