Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5919648rwl; Mon, 9 Jan 2023 01:28:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXu1T1n38leMtPxIS83V93X04+p38LA0g+7roOHw8pxUFdJ3INOHm7VLF9SMCIJz9Pw+Ozkn X-Received: by 2002:a17:907:c24e:b0:7c0:1db5:ea10 with SMTP id tj14-20020a170907c24e00b007c01db5ea10mr71202023ejc.53.1673256517872; Mon, 09 Jan 2023 01:28:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673256517; cv=none; d=google.com; s=arc-20160816; b=kX/fqrSjwU2ro0jhuBQxczrktp5+dnRVV3WoZ3H72Ila9UO2Qvo2vbJFpdTgk1wSdh c4uttc4o1MgcbVh0LP4UDthQHalt9afrKw/iwWNun97a5AOp/KGN29oU14ptT905Sx6J jH/wLmfKu3jSsFPfM08Vl910tC3uegPyUw7Z4rtKJJFCEwyPAKwqrSFF+OusQxv5S80n 11XAUbDE9P8MrZpcqz5JecFPCKiG8h1p/ZswuBjh4qNuvTx4c3sunMdMv34yD4WtNZTV IxofUVk7lnkqhMSGsD1uXNPid+EnVBRLPJIB+rk8Vp1PxxdgRPs7g0oakpO5AVFbXsN6 r13g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=BeamC+5HCrCEB+x0OBOSbvY/5eyBn0AnwZPYF9JEd3U=; b=QYytlnJgX+hl6fOzpYscwBhAktFIm7nTq6lXKv3iHzbabqT9AE1yv+cshiZlZS+cBV U1FqNqMrDPzWDM3x+SYvlPMTpTiu+3kdoJe2TBLS2dctc9fvvdjqOA15RNJY5iwoLsZS kjq8ZO2DgiVM9+Nb4AzVRW2ZFSrPf2Ys8BiGZHKJPRdl03hd1qrmHhaYGEFPjpQ0aAlr f2kcnVPRmKGIHMuLO22Cljtsxox4A3ZjVvcK2YUYJWhwZgnMMlEBodAnuarAlf65kVhW Vx5cUDsAcDLuXcWeTSWDHjtTTJG0u2tulV4r0e2Cn2q32/Ym/YXIstc2FOsNB2N+5WSY Fw2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EZDB9m7K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a17090658c600b007abafd4d7d0si10248021ejs.702.2023.01.09.01.28.24; Mon, 09 Jan 2023 01:28:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EZDB9m7K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236987AbjAIJMW (ORCPT + 54 others); Mon, 9 Jan 2023 04:12:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236949AbjAIJLq (ORCPT ); Mon, 9 Jan 2023 04:11:46 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB30D178B7 for ; Mon, 9 Jan 2023 01:08:03 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id o15so5738462wmr.4 for ; Mon, 09 Jan 2023 01:08:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=BeamC+5HCrCEB+x0OBOSbvY/5eyBn0AnwZPYF9JEd3U=; b=EZDB9m7KfPX6hQI067hHiDmD14mANKUfROLBf4JAbzvFo/R5gP9heZZXHaP3G3IDqT ZZ97cGEM5qB4R4Lrhre5ZmvTBBT5dNHfsu3b2EUEdl/f9uRqoE7jmKFDL36gDFX7f+gj y3nZSPpBimWZgy4+y8l/dZGGqA25RR80FQgzr91+bt14Dic9CnmSB9s1FrmSdVHtErSL EeMIaZsMktewJ9j6JrjaqR0lPPMbpo8b1Gk3SLKPrsUeYMFTaSf2JI0wEa2QZiZSGS79 KsiVHYOYR6bknah+a3kkxCkQchaMsc5GcUUlDmEpOXE9hicCiBt5XrOleKh5CzJCvZYC mgUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BeamC+5HCrCEB+x0OBOSbvY/5eyBn0AnwZPYF9JEd3U=; b=y+XqocGgslKH62bzH6W0uu3FFf2A7AU3ZR6jARDFAubNM84vlbr7xD0jfeu43SUmHS ULgqItrlD1+ouWYy3uwEM/653ZhGwVszhjH3YQfcgP6W0CyNuhVuh+ZoaM/hrUDVzJva AhKvGUs8cXFziGcBhEiAQMCzBo0vzYVbFGbzS00wH29J8F+7jNDfKCjKS7hmRkZ7uuh8 GZhyukd+5VzrLqAVgo26PlAa2V+5SuQ6yLkBoV+g/eFqf3HXE2uTztgoYyzMxj8ouCBh wMozW5NJlADFJUVPzTlJeZQd/RhaGo5eodK0s55lh0ckkXjJzf/altKict8slliXlBlc QDpQ== X-Gm-Message-State: AFqh2kpBZ2B9MUIHOfiJTSMbW+ojqNj9+WWNkWNhl1zhzjzyn+yAaT3W 8qA5IcJgQxrt0xzJRXos+0sVSYrUIJH7VTha X-Received: by 2002:a05:600c:4f48:b0:3d6:8570:1239 with SMTP id m8-20020a05600c4f4800b003d685701239mr56297915wmq.16.1673255282438; Mon, 09 Jan 2023 01:08:02 -0800 (PST) Received: from [192.168.1.109] ([178.197.216.144]) by smtp.gmail.com with ESMTPSA id u13-20020a05600c19cd00b003c6f1732f65sm16469505wmq.38.2023.01.09.01.08.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Jan 2023 01:08:01 -0800 (PST) Message-ID: Date: Mon, 9 Jan 2023 10:08:00 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v3 1/2] dt-bindings: pinctrl: add schema for NXP S32 SoCs Content-Language: en-US To: Chester Lin Cc: Rob Herring , Linus Walleij , Krzysztof Kozlowski , =?UTF-8?Q?Andreas_F=c3=a4rber?= , s32@nxp.com, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Larisa Grigore , Ghennadi Procopciuc , Andrei Stefanescu , Matthias Brugger References: <20221221073232.21888-1-clin@suse.com> <20221221073232.21888-2-clin@suse.com> <17dc933d-e46c-ddfa-b185-5c24fa7dddb6@linaro.org> From: Krzysztof Kozlowski In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/01/2023 08:04, Chester Lin wrote: > Hi Krzysztof, > > On Thu, Dec 22, 2022 at 12:28:31PM +0100, Krzysztof Kozlowski wrote: >> On 21/12/2022 08:32, Chester Lin wrote: >>> Add DT schema for the pinctrl driver of NXP S32 SoC family. >>> >>> Signed-off-by: Larisa Grigore >>> Signed-off-by: Ghennadi Procopciuc >>> Signed-off-by: Chester Lin >>> --- >>> >>> Changes in v3: >>> - Remove the minItems from reg because there's no optional item for s32g2. >>> - List supported properties of pinmux-node and pincfg-node and add more >>> descriptions. >>> - Adjust the location of "required:". >>> - Fix descriptions and wordings. >>> - Rename the yaml file to nxp,s32g2-siul2-pinctrl.yaml. >>> >>> Changes in v2: >>> - Remove the "nxp,pins" property since it has been moved into the driver. >>> - Add descriptions for reg entries. >>> - Refine the compatible name from "nxp,s32g-..." to "nxp,s32g2-...". >>> - Fix schema issues and revise the example. >>> - Fix the copyright format suggested by NXP. >>> >>> .../pinctrl/nxp,s32g2-siul2-pinctrl.yaml | 129 ++++++++++++++++++ >>> 1 file changed, 129 insertions(+) >>> create mode 100644 Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml >>> >>> diff --git a/Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml >>> new file mode 100644 >>> index 000000000000..1554ce14214a >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml >>> @@ -0,0 +1,129 @@ >>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >>> +# Copyright 2022 NXP >>> +%YAML 1.2 >>> +--- >>> +$id: http://devicetree.org/schemas/pinctrl/nxp,s32g2-siul2-pinctrl.yaml# >>> +$schema: http://devicetree.org/meta-schemas/core.yaml# >>> + >>> +title: NXP S32G2 pin controller >>> + >>> +maintainers: >>> + - Ghennadi Procopciuc >>> + - Chester Lin >>> + >>> +description: | >>> + S32G2 pinmux is implemented in SIUL2 (System Integration Unit Lite2), >>> + whose memory map is split into two regions: >>> + SIUL2_0 @ 0x4009c000 >>> + SIUL2_1 @ 0x44010000 >>> + >>> + Every SIUL2 region has multiple register types, and here only MSCR and >>> + IMCR registers need to be revealed for kernel to configure pinmux. >>> + >>> + Please note that some register indexes are reserved in S32G2, such as >>> + MSCR102-MSCR111, MSCR123-MSCR143, IMCR84-IMCR118 and IMCR398-IMCR429. >>> + >>> +properties: >>> + compatible: >>> + enum: >>> + - nxp,s32g2-siul2-pinctrl >>> + >>> + reg: >>> + description: | >>> + A list of MSCR/IMCR register regions to be reserved. >>> + - MSCR (Multiplexed Signal Configuration Register) >>> + An MSCR register can configure the associated pin as either a GPIO pin >>> + or a function output pin depends on the selected signal source. >>> + - IMCR (Input Multiplexed Signal Configuration Register) >>> + An IMCR register can configure the associated pin as function input >>> + pin depends on the selected signal source. >>> + items: >>> + - description: MSCR registers group 0 in SIUL2_0 >>> + - description: MSCR registers group 1 in SIUL2_1 >>> + - description: MSCR registers group 2 in SIUL2_1 >>> + - description: IMCR registers group 0 in SIUL2_0 >>> + - description: IMCR registers group 1 in SIUL2_1 >>> + - description: IMCR registers group 2 in SIUL2_1 >>> + >>> +patternProperties: >>> + '-pins$': >>> + type: object >>> + additionalProperties: false >>> + >>> + patternProperties: >>> + '-grp[0-9]$': >>> + type: object >>> + allOf: >>> + - $ref: pinmux-node.yaml# >>> + - $ref: pincfg-node.yaml# >>> + description: | >>> + Pinctrl node's client devices specify pin muxes using subnodes, >>> + which in turn use the standard properties below. >>> + >>> + properties: >>> + bias-disable: true >>> + bias-high-impedance: true >>> + bias-pull-up: true >>> + bias-pull-down: true >>> + drive-open-drain: true >>> + input-enable: true >>> + output-enable: true >>> + >>> + pinmux: >>> + description: | >>> + An integer array for representing pinmux configurations of >>> + a device. Each integer consists of a PIN_ID and a 4-bit >>> + selected signal source(SSS) as IOMUX setting, which is >>> + calculated as: pinmux = (PIN_ID << 4 | SSS) >>> + >>> + slew-rate: >>> + description: | >>> + 0: 208MHz >>> + 1-3: Reserved >>> + 4: 166MHz >>> + 5: 150MHz >>> + 6: 133MHz >>> + 7: 83MHz >>> + enum: [0, 4, 5, 6, 7] >> >> You have known values, then use them. This is much more readable in DTS. > > The main reason of mapping with register values [0-7] is to simplify the > driver implementation while handling register r/w. Define bindings for the DTS, not for the drivers. > To improve readability > as you suggested, I am thinking of having a DT header "s32g2-pinfunc.h" with > a few binding macros/helper as below, the only difference compared to v3 is > using S32G2_PINMUX and S32G2_SLEW_XXXMHZ macros rather than pure integers > to represent pinmux and slew-rate property values. Binding headers is not a place for register values. By definition - these are bindings, not hardware description. Hardware description is DTS. Feel free to store them in DTS headers, but anyway this does not solve the issue here. The issue is: you store register values in DTS, which is limited, not extendable description. Each of your devices would need entirely different binding for this because register values can change between every SoC version. Several other pinctrl bindings use similar approach, but they have not got a clear mapping to values (e.g. they have fast and slow). For the case with real values, use the same solution as drive-strength - real values. > > Regards, > Chester > > > From 3a29d905ae104e694230ffc02dc9f9de4191c5d1 Mon Sep 17 00:00:00 2001 > From: Chester Lin > Date: Fri, 28 Oct 2022 16:44:29 +0800 > Subject: [PATCH] dt-bindings: pinctrl: add support for NXP S32 SoCs > > Add DT schema and hedaer file for the pinctrl driver of NXP S32 SoC family. > > Signed-off-by: Larisa Grigore > Signed-off-by: Ghennadi Procopciuc > Signed-off-by: Chester Lin > --- > .../pinctrl/nxp,s32g2-siul2-pinctrl.yaml | 136 ++++++++++++++++++ > include/dt-bindings/pinctrl/s32g2-pinfunc.h | 17 +++ NAK for bindings. Best regards, Krzysztof