Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1999101rwo; Thu, 3 Aug 2023 03:15:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlHESIBNapwjbAYM+fZ0O/jj2/7876yqnCngbzZlb0j+d10T4WDI0rdQ8hXKZUMe5ZLLNfXB X-Received: by 2002:a05:6a00:22c7:b0:67b:8602:aa1b with SMTP id f7-20020a056a0022c700b0067b8602aa1bmr20165617pfj.27.1691057749273; Thu, 03 Aug 2023 03:15:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691057749; cv=none; d=google.com; s=arc-20160816; b=IqcW4fS36yuoDaUEssiB+2qtwKXPFWAzn3bbYlj4i0PTqUUwUEoA2XHs5tjKugHLeC gwAEsJq9CQQcDJqV0AT4y6vmaZC9XRroOzyAtMxb24yO51zU7MXuuf99uWlfyxdDFoVp 0zshMmjpT7enIDVw9m8LXmld7n54ZDwRT/I2zjnJ9wtTsgxwoWTH+yvoxncKwg3lpvKM v927ynYNCajlHoW8qcdkUvcFKth2yVCLX/FFLPQ+GXM1Y6eMubLhIf0Me+qBWDEY711u j7UIVFYV93wEwj9CwKbWDV/LHrfS4aOYSptHoffM2UdDIvcSND+7j0sX2fEu5rsjHxFH +lIA== 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 :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=d7R/UeZBac835mA1GtrR+w0jrkpcELQvomUVYO8mHJQ=; fh=iGGkY2gT3UDpZOEjIcftxTVJXe+M9SdyOxKo00mLKr4=; b=dwShHF5jsXBQYf6v56zmsHyzedzXkZR7ecnONp3y9qzAmSTZX80r8V9CJp6WH0j+6K o/OGndktGnVIjuvhR9ww6Npt2F8Tfr42QttMbcZ85h/BzdY3QxqkNgrY0esxiOFhvf0B R3iIvpyT6oj1XQMLI+hK+JUXPgGCfFgCziru8KuVLKv3c6P8hI2Za4SxesxHtc5iWmn/ mvd9ONJjfjuIXluvrSu3Jkx6QkI0/cdN54EF76Fpf1OQLtnQUrLC62skKv45tHh+9CSR exkI2D83gctcWVsDzgF9X9EU+KeKfBIWjhxa1jNb+tdm9KVgPxDPp9gCnSpVHIIdZqEw tUeg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x7-20020a056a00270700b00665e0165510si12157340pfv.252.2023.08.03.03.15.36; Thu, 03 Aug 2023 03:15:49 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234196AbjHCJnn (ORCPT + 99 others); Thu, 3 Aug 2023 05:43:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232664AbjHCJnZ (ORCPT ); Thu, 3 Aug 2023 05:43:25 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E5F8B3595; Thu, 3 Aug 2023 02:42:41 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.201]) by gateway (Coremail) with SMTP id _____8CxruuAdstkxJ4PAA--.33645S3; Thu, 03 Aug 2023 17:42:24 +0800 (CST) Received: from [10.20.42.201] (unknown [10.20.42.201]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxPCOAdstknQFHAA--.33675S3; Thu, 03 Aug 2023 17:42:24 +0800 (CST) Subject: Re: [PATCH v2 1/2] gpio: dt-bindings: add parsing of loongson gpio offset To: Krzysztof Kozlowski , Conor Dooley Cc: Conor Dooley , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Jianmin Lv , wanghongliang@loongson.cn, Liu Peibao , loongson-kernel@lists.loongnix.cn, zhuyinbo@loongson.cn References: <20230801-whenever-imitation-b2759b212f6b@spud> <20230801-varsity-chemo-09cc5e250ded@spud> <26adb487-f8c5-9cf4-5b31-070e9161e761@loongson.cn> <20230802-jailer-pavilion-84fb17bb3710@wendy> <3534f7b9-0e02-28c1-238a-5a6fdbb95e94@loongson.cn> <20230802-bunkbed-siamese-57ee53bdf273@wendy> <20230802-empathy-wound-70df4990a976@spud> <20230803-tartar-tainted-968687047460@wendy> From: Yinbo Zhu Message-ID: <7db5af37-47d5-9bcd-2798-7124438316c1@loongson.cn> Date: Thu, 3 Aug 2023 17:42:24 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8DxPCOAdstknQFHAA--.33675S3 X-CM-SenderInfo: 52kx5xhqerqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org 在 2023/8/3 下午2:41, Krzysztof Kozlowski 写道: > On 03/08/2023 08:30, Conor Dooley wrote: >>>>> gpio0:gpio@0x1fe10430 { >>>>> compatible = "loongson,ls2k-gpio"; >>>>> reg = <0 0x1fe10430 0 0x20>; >>>>> gpio-controller; >>>>> #gpio-cells = <2>; >>>>> interrupt-parent = <&liointc1>; >>>>> ngpios = <64>; >>>>> loongson,gpio-conf-offset = <0>; >>>>> loongson,gpio-out-offset = <0x10>; >>>>> loongson,gpio-in-offset = <0x8>; >>>>> loongson,gpio-inten-offset = <0xb0>; >>>>> loongson,gpio-ctrl-mode = <0x0>; >>>>> ... >>>>> } >>>>> >>>>> gpio1:gpio@0x1fe10450 { >>>>> compatible = "loongson,ls2k-gpio"; >>>>> reg = <0 0x1fe10450 0 0x20>; >>>>> gpio-controller; >>>>> #gpio-cells = <2>; >>>>> interrupt-parent = <&liointc1>; >>>>> ngpios = <64>; >>>>> loongson,gpio-conf-offset = <0>; >>>>> loongson,gpio-out-offset = <0x10>; >>>>> loongson,gpio-in-offset = <0x8>; >>>> >>>> These 3 are the same for both controllers, no? >>>> Is only the inten-offset a variable? >>>> >>>>> loongson,gpio-inten-offset = <0x98>; >>>> >>>> These offsets exceed the region that you've got in the reg property for >>>> this controller, do they not? >>>> >>>> Is there some sort of "miscellaneous register area" at 0x1FE104E0, or >>>> just those two interrupt registers and nothing else? >>> >>> >>> 2k500 gpio dts is just an example, like 3a5000, or more other platform, >>> above offset was different but the gpio controller was compatible. >>> >>> gpio: gpio@1fe00500 { >>> compatible = "loongson,ls2k-gpio"; >>> reg = <0 0x1fe00500 0xc00>; >>> gpio-controller; >>> #gpio-cells = <2>; >>> ngpios = <16>; >>> loongson,gpio-conf-offset = <0x0>; >>> loongson,gpio-out-offset = <0x8>; >>> loongson,gpio-in-offset = <0xc>; >>> ... >>> } >> >> That is a different SoC and needs to have a different compatible string. >> "loongson,ls2k-foo" compatible strings were a mistake that only got past >> us because we were not aware it was a family, rather than a specific >> SoC. They certainly should not be used in isolation on a 3a5000! >> >> Are there more than one GPIO controllers on the 3a5000? If so, what do >> those nodes look like. > > Eh, even for the same SoC having different offsets suggest that > programming model is a bit different. Anyway, who designed such > hardware? Really? Hi Krzysztof & Conor, I'm sorry for the confusion caused to you, such as 2k2000, which has two gpio controllers with different register offsets. The gpio node is following: pioA: gpio0@0x1fe00500 { compatible = "loongson,ls2k-gpio"; reg = <0 0x1fe00500 0 0x20>; gpio-controller; #gpio-cells = <2>; ngpios = <32>; loongson,gpio-ctrl-mode = <0>; loongson,gpio-conf-offset = <0>; loongson,gpio-in-offset = <0xc>; loongson,gpio-out-offset = <0x8>; }; pioB: gpio1@0x100e0000 { compatible = "loongson,ls2k-gpio"; reg = <0 0x100e0000 0 0x20>; gpio-controller; #gpio-cells = <2>; ngpios = <64>; loongson,gpio-ctrl-mode = <0>; loongson,gpio-conf-offset = <0>; loongson,gpio-in-offset = <0x20>; loongson,gpio-out-offset = <0x10>; }; In addition, the GPIO controllers between different SoCs are compatible except for offset, previously, the examples of 3a5000 and 2k0500 gpio were listed, Of course, it also includes 2k1000, which gpio chip was compatible but offset was different. About the "loongson,ls2k-foo" compatible strings were a mistake that I got it and I will add a specific SoC "loongson,ls2k1000-foo" compatible , but from previous community communication, it seems that if different SoC peripherals are compatible, they can use the same compatible string. Thanks, Yinbo