Message ID | 08de3f4b-e33f-95c8-3297-814ea107272a@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2318401wrn; Wed, 18 Jan 2023 04:52:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXu9AByKs9q8Oy0ux4JcVefXiFDnNwrPEJV5ee2gJUcsgYB/O34Rwfj9AR3A6NaH5p5fJoXx X-Received: by 2002:a05:6a20:9b99:b0:b7:4f67:c2de with SMTP id mr25-20020a056a209b9900b000b74f67c2demr6667357pzb.40.1674046361574; Wed, 18 Jan 2023 04:52:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674046361; cv=none; d=google.com; s=arc-20160816; b=0ZV+h7/R4uCMOeLe356h+Nrt09dw8yx+s84c1MSfgHcGq9P+ML3Su1dpb0Dm7yqmn0 /mmiW9+cT2aCfSQyVxkU4yrpfduAqnuWdt0nosT5ZRSuK+402ozyPQagFqLq/6fT4/Mq zFTzsPpB6E+oTn+6BMtWuhwQpXYGED14LYG5y7qIqUgIZZHRtrRW4tW4UQECi3e6F4zY eHJh80TBtnpme9at8Ebg0doxmggvIRdPy8y43lNXW6LmrkfIasGsKLeGQWduc8l0mjKR RQ6SBEsQZdH3eY0XVPgXaIDviRKpsgzoIcQ6RDHL5DNiTUH3NxpifByVCE6er5hIaica rEaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language:cc:to :subject:from:user-agent:mime-version:date:message-id:dkim-signature; bh=zSiUjqeIhXTuZdT6eBiGLcbiQdlWY4D946T8IZEq1tM=; b=yfipNuEjpG0EgNarnPnlgFAN01HCfLtEUiEYbOXQA7kRS2kOGay6P/OU+DlDWgGj9p cvCnktV6mDzX8LOZc03Nl6XEaiDwYRT+jqg9m53EYTxcQssCdaEtcZqh3oK9nEp9eJ7p MoH6jXs78MBBzNm6lO3Z/6wxvrGgrICS57cXjd3gvbuIPhlH13MsT6Lkm19XGlT7JpOm 0+fvdpKYLRHE8SpNnMTMVoKTuyBRSynF0Jpk8+PBxsMT4FOcbNAAvnVECIVmDexkWvLs 1AJ7ruxUrOUBfuUaBj+ccbzXRkJQX5n8xjpYtoG48ojbXCdovc6I5nHZcNDNqblNJIir 0vUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dKanFbSa; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020aa782c5000000b0058dada4acbasi7921304pfn.67.2023.01.18.04.52.28; Wed, 18 Jan 2023 04:52:41 -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=@gmail.com header.s=20210112 header.b=dKanFbSa; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231167AbjARMwL (ORCPT <rfc822;pfffrao@gmail.com> + 99 others); Wed, 18 Jan 2023 07:52:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230367AbjARMvu (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 18 Jan 2023 07:51:50 -0500 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77CC64E50C; Wed, 18 Jan 2023 04:13:27 -0800 (PST) Received: by mail-ej1-x62a.google.com with SMTP id mp20so36146978ejc.7; Wed, 18 Jan 2023 04:13:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:content-language:cc:to:subject:from :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=zSiUjqeIhXTuZdT6eBiGLcbiQdlWY4D946T8IZEq1tM=; b=dKanFbSavWhQ2T04eS+23uXizOzrzix2u0Cn/8NyzbdwfmUOqEwbG0Mvvs/5qQAZYw E9SMCML7RNO6mwGoYvIku1ZYootIDWCeVdQy4IOV9nnp5z9QMjUlEcQnoSIKsIEx4BuJ ANNkfnb3q0U5o5qoR2AxxjfX55b1fjCrbA/clrv/NzXcYQ1K6icZHfFK3HCaDyb2Mzbl W4iwTVmvr1HjtdQwfFXUlIwRHQJI+A58LMkUrbvyzCXpWKppAklGEwHAp0xqR1jcZ+pZ OJGYYZxgSkoRYiN5wwame4F5h8Vyoad7PzXPCsFNSiUysNL3v82BgUkf8PgkyPZ+MqE8 5OpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:content-language:cc:to:subject:from :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=zSiUjqeIhXTuZdT6eBiGLcbiQdlWY4D946T8IZEq1tM=; b=Wt82lhEoccIh4J4Tam9mIeJrwnBuhWghOLr1xb/8Asu7wJc00yveUtjis8WM1jY6AJ hOUOuewTZc0/sE5RBH0+1d2ZnR7UYFWcctwPK5/IRbFKkm3Tj/AuQj/HWKdlJjwyaaj5 grZYOR6CMZbetteq+C49kizbpmlXFsXhwrhXgeUgNweA1BHALU3msdpRLo/sj1AROsj5 emS70NVUOppdgc+m3k9MwyN/jXkFp93ysQYd/bOk950uyQ5zy116KrfEcANi4OAO/JFh uCClHZi3wBJVPV82bb/35UV8UJMKjkws1c2dnF432ABt1gjyy3NW7W7n950OOAwB4d40 4tew== X-Gm-Message-State: AFqh2kqAPmtd1AhQS2uVhVM2xX5dSELTAdQed2BXvoXJhyu6frJQ3d4A gVP6kdSwwNJF+PJe4aFp3os= X-Received: by 2002:a17:907:86a5:b0:870:d4f3:61b3 with SMTP id qa37-20020a17090786a500b00870d4f361b3mr8604731ejc.12.1674044005883; Wed, 18 Jan 2023 04:13:25 -0800 (PST) Received: from [192.168.2.1] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id r24-20020aa7da18000000b004704658abebsm14187212eds.54.2023.01.18.04.13.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Jan 2023 04:13:25 -0800 (PST) Message-ID: <08de3f4b-e33f-95c8-3297-814ea107272a@gmail.com> Date: Wed, 18 Jan 2023 13:13:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 From: Johan Jonker <jbx6244@gmail.com> Subject: [PATCH v1 1/4] dt-bindings: gpio: rockchip,gpio-bank: add compatible string per SoC To: linus.walleij@linaro.org, brgl@bgdev.pl Cc: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, heiko@sntech.de, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kever.yang@rock-chips.com, sjg@chromium.org, philipp.tomsich@vrull.eu Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755364837409138743?= X-GMAIL-MSGID: =?utf-8?q?1755364837409138743?= |
Series |
[v1,1/4] dt-bindings: gpio: rockchip,gpio-bank: add compatible string per SoC
|
|
Commit Message
Johan Jonker
Jan. 18, 2023, 12:13 p.m. UTC
Currently all Rockchip gpio nodes have the same compatible.
Replace all the compatibles in gpio nodes to be able to
give them a consistent ID independent from probe order or alias.
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---
.../bindings/gpio/rockchip,gpio-bank.yaml | 15 +++++++++++++++
1 file changed, 15 insertions(+)
--
2.20.1
Comments
On Wed, Jan 18, 2023 at 01:13:23PM +0100, Johan Jonker wrote: > Currently all Rockchip gpio nodes have the same compatible. > Replace all the compatibles in gpio nodes to be able to > give them a consistent ID independent from probe order or alias. I fail to see how the compatible change affects probe order or aliases. It is also an ABI break if there is not the existing compatible as a fallback. State the problem you are trying to solve with this change, not just what your solution is. GPIO shouldn't really have an alias either IMO. Rob
On 1/18/23 16:32, Rob Herring wrote: > On Wed, Jan 18, 2023 at 01:13:23PM +0100, Johan Jonker wrote: >> Currently all Rockchip gpio nodes have the same compatible. >> Replace all the compatibles in gpio nodes to be able to >> give them a consistent ID independent from probe order or alias. > > I fail to see how the compatible change affects probe order or aliases. > It is also an ABI break if there is not the existing compatible as a > fallback. State the problem you are trying to solve with this change, > not just what your solution is. Hi Rob, Since the yaml conversion of rockchip,gpio-bank.yaml we have generic "gpio" names instead of "gpio-1". For both Linux and U-boot there's a need for a consisted ID order between the nodes. The kernel has no logic to decide between the first compatible and the fallback. A fallback doesn't have ability to add/select "data" with probe, but have to use of_device_is_compatible(np, "rockchip,rk3188-gpio-bank") for "15" SoCs instead. I can produce a serie with fall back. Let us know how to move forward here. Kind regards, Johan Jonker === Linux driver behavior: id = of_alias_get_id(np, "gpio"); if (id < 0) id = gpio++; Problems: Alias not always available in existing DT files(not part of the binding) Probe order is not guarantied and possible number gap for rk3066a between gpio4 and gpio6. (id counter gives not consistent result) === U-boot rk_gpio.c current behavior: end = strrchr(dev->name, '@'); priv->bank = trailing_strtoln(dev->name, end); priv->name[0] = 'A' + priv->bank; uc_priv->bank_name = priv->name; Problems: Crash when node name has no "gpio-1" format U-boot rk-gpio proposed: priv->name[0] = 'A' + dev_seq(dev); uc_priv->bank_name = priv->name; Problems: Reduced FDT's and rk3066a gives number gaps. === My proposal: struct lookup_table rk_gpio_rk3188_data[] = { {0x2000a000, "A"}, {0x2003c000, "B"}, {0x2003e000, "C"}, {0x20080000, "D"}, }; { .compatible = "rockchip,rk3188-gpio-bank", .data = &rk_gpio_rk3188_data }, === See links for previous discussions: [PATCH v1] arm: dts: rockchip: sync rk3066/rk3188 DT files from linux-next v6.2-rc4 Johan Jonker https://lore.kernel.org/linux-rockchip/6ec4427e-f56f-7545-2296-bc75d74f4364@theobroma-systems.com/T/#t [PATCH 1/3] arm64: dts: rk3399: sync rk3399.dtsi from 6.1-rc1 Peter Robinson https://lore.kernel.org/u-boot/0ab9a600-b517-0ce5-d189-99fc8eddfa60@theobroma-systems.com/ [PATCH/RFC] rockchip: derive GPIO bank from alias if available John Keeping https://lore.kernel.org/u-boot/CAPnjgZ3j7YVJt+B-uEKS_rsSRBSR-kmyLujV3RozL7kbFNrqFw@mail.gmail.com/ [PATCH] rockchip: derive GPIO bank from alias if available John Keeping https://lore.kernel.org/u-boot/Y8gaqasu9ho0vl8X@donbot/T/#m00e3823cf74d35a7c8536a1193ed1a77c7698135 Broken U-boot gpio driver: https://source.denx.de/u-boot/u-boot/-/blob/master/drivers/gpio/rk_gpio.c#L154-L157 > > GPIO shouldn't really have an alias either IMO. > > Rob
On 18/01/2023 18:12, Johan Jonker wrote: > > > On 1/18/23 16:32, Rob Herring wrote: >> On Wed, Jan 18, 2023 at 01:13:23PM +0100, Johan Jonker wrote: >>> Currently all Rockchip gpio nodes have the same compatible. >>> Replace all the compatibles in gpio nodes to be able to >>> give them a consistent ID independent from probe order or alias. >> >> I fail to see how the compatible change affects probe order or aliases. >> It is also an ABI break if there is not the existing compatible as a >> fallback. State the problem you are trying to solve with this change, >> not just what your solution is. > > Hi Rob, > > Since the yaml conversion of rockchip,gpio-bank.yaml we have generic "gpio" names instead of "gpio-1". > For both Linux and U-boot there's a need for a consisted ID order between the nodes. Still do not see how compatible is related to this. > > The kernel has no logic to decide between the first compatible and the fallback. > A fallback doesn't have ability to add/select "data" with probe, but have to use > of_device_is_compatible(np, "rockchip,rk3188-gpio-bank") for "15" SoCs instead. > > I can produce a serie with fall back. > Let us know how to move forward here. > > Kind regards, > > Johan Jonker > > > === > Linux driver behavior: > > id = of_alias_get_id(np, "gpio"); > if (id < 0) > id = gpio++; > > Problems: > Alias not always available in existing DT files(not part of the binding) > Probe order is not guarantied and possible number gap for rk3066a between gpio4 and gpio6. > (id counter gives not consistent result) Again, how compatible is related to this? > > === > U-boot rk_gpio.c current behavior: > > end = strrchr(dev->name, '@'); > priv->bank = trailing_strtoln(dev->name, end); > priv->name[0] = 'A' + priv->bank; > uc_priv->bank_name = priv->name; > > Problems: > Crash when node name has no "gpio-1" format > > U-boot rk-gpio proposed: > > priv->name[0] = 'A' + dev_seq(dev); > uc_priv->bank_name = priv->name; > > Problems: > Reduced FDT's and rk3066a gives number gaps. > > === > > My proposal: > > struct lookup_table rk_gpio_rk3188_data[] = { > {0x2000a000, "A"}, > {0x2003c000, "B"}, > {0x2003e000, "C"}, > {0x20080000, "D"}, > }; > > { .compatible = "rockchip,rk3188-gpio-bank", .data = &rk_gpio_rk3188_data }, Which you did not do... Your patch is doing something entirely else. Best regards, Krzysztof
diff --git a/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml b/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml index affd823c8..72fdfcc65 100644 --- a/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml +++ b/Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml @@ -13,7 +13,22 @@ properties: compatible: enum: - rockchip,gpio-bank + - rockchip,px30-gpio-bank + - rockchip,rk3036-gpio-bank + - rockchip,rk3066a-gpio-bank + - rockchip,rk3128-gpio-bank + - rockchip,rk3188-gpio-bank - rockchip,rk3188-gpio-bank0 + - rockchip,rk3228-gpio-bank + - rockchip,rk3288-gpio-bank + - rockchip,rk3328-gpio-bank + - rockchip,rk3308-gpio-bank + - rockchip,rk3368-gpio-bank + - rockchip,rk3399-gpio-bank + - rockchip,rk3568-gpio-bank + - rockchip,rk3588-gpio-bank + - rockchip,rv1108-gpio-bank + - rockchip,rv1126-gpio-bank reg: maxItems: 1