Message ID | 20230731091059.17323-2-zhuyinbo@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp1903311vqg; Mon, 31 Jul 2023 02:51:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlE+NXxYOR3vPMGcFpzeFeJVGN0UxY0+B/nazb2I4oDWtAAvN5yd02by5XX5LRYCJad+a2NS X-Received: by 2002:a17:902:f681:b0:1b8:7625:3042 with SMTP id l1-20020a170902f68100b001b876253042mr10932772plg.10.1690797068027; Mon, 31 Jul 2023 02:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690797068; cv=none; d=google.com; s=arc-20160816; b=IH9jJzXINoOZ1UCi3a9PuI4ziWmypCDAbWKJFg6B18kR3Gk3grlF0HttrwDpuipNic bFfZBsjy7jFCpPAtUl+zsx9eCvn/HvIBjo8Pqolg6EVZdDVPtwsKRUELTcJ12CloxRU7 4kkUF69pG/AYzwVVKaDmCsXhvAJ+xkXGp2tLWsR/UNnQNzrTqgQGocqW3+wGp9XuSq8K qNIp7yQAiFcmuHIhbfUImKS6j5IoD9EL87lr5P5nbM7k0EfrR5k9zSFMUOON2W0Dqp3u tBUacE56n5LKIVIzh392HS0JQSLg2A5smUZJaEQBBNwLLm2UYlqtv+pk0TIHH7Ob8sk/ n1AA== 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; bh=if7oEZQ9etOB5gTqlm3jZzW11VASvjyWK0/SiSi6dDk=; fh=teZAvrnU1k4B6t2Z9AwXPKAN+RYsEfJmvb3BgB5uIhw=; b=DHdhoN5NWgwgNjXFmIF4n5vc2DKH/aEzYnZ+H8Sl3xMH0XcMjD6upOp8xicFgD8542 caR0F4xyllJ3C8IHt/Rg4J5eNPaEWoSCRuI8R1zxdHy/mdBroaT4kjtdjN31fir4SQCe /JjtkIctDcPlkhwP1S560g1dvdBF1oakt95UO7D3Vy9z2Z5ygXrd4hP6558tepi1tZER fSfApJSGkovRZliXU09g4xS3/HMLChPZHUIWFAoQMJk13+tkwK4F5M2FlseHfj4HImyL OFDwqHuf9oEDOZbbxazg1kZBnhc2nu2SmnXhGZSnuxQ+cn314Wpm3AfDdhzVA9zalYxi sqUQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a17090311c400b001b7e19195b7si7283933plh.29.2023.07.31.02.50.55; Mon, 31 Jul 2023 02:51:08 -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 S231129AbjGaJLY (ORCPT <rfc822;dengxinlin2429@gmail.com> + 99 others); Mon, 31 Jul 2023 05:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbjGaJLW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 31 Jul 2023 05:11:22 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 369E4102; Mon, 31 Jul 2023 02:11:20 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.201]) by gateway (Coremail) with SMTP id _____8Bx5fC1esdkRCINAA--.31526S3; Mon, 31 Jul 2023 17:11:17 +0800 (CST) Received: from localhost.localdomain (unknown [10.20.42.201]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxriOkesdk1DFCAA--.2097S3; Mon, 31 Jul 2023 17:11:17 +0800 (CST) From: Yinbo Zhu <zhuyinbo@loongson.cn> To: Linus Walleij <linus.walleij@linaro.org>, Bartosz Golaszewski <brgl@bgdev.pl>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jianmin Lv <lvjianmin@loongson.cn>, wanghongliang@loongson.cn, Liu Peibao <liupeibao@loongson.cn>, loongson-kernel@lists.loongnix.cn, Yinbo Zhu <zhuyinbo@loongson.cn> Subject: [PATCH v2 1/2] gpio: dt-bindings: add parsing of loongson gpio offset Date: Mon, 31 Jul 2023 17:10:58 +0800 Message-Id: <20230731091059.17323-2-zhuyinbo@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230731091059.17323-1-zhuyinbo@loongson.cn> References: <20230731091059.17323-1-zhuyinbo@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8CxriOkesdk1DFCAA--.2097S3 X-CM-SenderInfo: 52kx5xhqerqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772929226512859320 X-GMAIL-MSGID: 1772929226512859320 |
Series |
gpio: loongson: add firmware offset parse support
|
|
Commit Message
Yinbo Zhu
July 31, 2023, 9:10 a.m. UTC
Add parsing GPIO configure, input, output, interrupt register offset
address and GPIO control mode support.
Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
---
.../bindings/gpio/loongson,ls-gpio.yaml | 37 +++++++++++++++++++
1 file changed, 37 insertions(+)
Comments
On Mon, Jul 31, 2023 at 05:10:58PM +0800, Yinbo Zhu wrote: > Add parsing GPIO configure, input, output, interrupt register offset > address and GPIO control mode support. This reeks of insufficient use of SoC specific compatibles. Do GPIO controllers on the same SoC have different register offsets? Where are the users for this? Cheers, Conor. > > Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn> > --- > .../bindings/gpio/loongson,ls-gpio.yaml | 37 +++++++++++++++++++ > 1 file changed, 37 insertions(+) > > diff --git a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml > index fb86e8ce6349..cad67f8bfe6e 100644 > --- a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml > +++ b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml > @@ -29,6 +29,33 @@ properties: > > gpio-ranges: true > > + loongson,gpio-conf-offset: > + $ref: /schemas/types.yaml#/definitions/uint32 > + description: > + This option indicate this GPIO configuration register offset address. > + > + loongson,gpio-out-offset: > + $ref: /schemas/types.yaml#/definitions/uint32 > + description: > + This option indicate this GPIO output register offset address. > + > + loongson,gpio-in-offset: > + $ref: /schemas/types.yaml#/definitions/uint32 > + description: > + This option indicate this GPIO input register offset address. > + > + loongson,gpio-ctrl-mode: > + $ref: /schemas/types.yaml#/definitions/uint32 > + description: > + This option indicate this GPIO control mode, where '0' represents > + bit control mode and '1' represents byte control mode. > + > + loongson,gpio-inten-offset: > + $ref: /schemas/types.yaml#/definitions/uint32 > + description: > + This option indicate this GPIO interrupt enable register offset > + address. > + > interrupts: > minItems: 1 > maxItems: 64 > @@ -39,6 +66,11 @@ required: > - ngpios > - "#gpio-cells" > - gpio-controller > + - loongson,gpio-conf-offset > + - loongson,gpio-in-offset > + - loongson,gpio-out-offset > + - loongson,gpio-ctrl-mode > + - loongson,gpio-inten-offset > - gpio-ranges > - interrupts > > @@ -54,6 +86,11 @@ examples: > ngpios = <64>; > #gpio-cells = <2>; > gpio-controller; > + loongson,gpio-conf-offset = <0>; > + loongson,gpio-in-offset = <0x20>; > + loongson,gpio-out-offset = <0x10>; > + loongson,gpio-ctrl-mode = <0>; > + loongson,gpio-inten-offset = <0x30>; > gpio-ranges = <&pctrl 0 0 15>, > <&pctrl 16 16 15>, > <&pctrl 32 32 10>, > -- > 2.20.1 >
在 2023/7/31 下午11:55, Conor Dooley 写道: > On Mon, Jul 31, 2023 at 05:10:58PM +0800, Yinbo Zhu wrote: >> Add parsing GPIO configure, input, output, interrupt register offset >> address and GPIO control mode support. > > This reeks of insufficient use of SoC specific compatibles. Do GPIO > controllers on the same SoC have different register offsets? Yes, > Where are the users for this? For example, ls2k500 contains multiple GPIO chips with different (configure, input, output, interrupt) offset addresses, but all others are the same. > > Cheers, > Conor. > >> >> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn> >> --- >> .../bindings/gpio/loongson,ls-gpio.yaml | 37 +++++++++++++++++++ >> 1 file changed, 37 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml >> index fb86e8ce6349..cad67f8bfe6e 100644 >> --- a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml >> +++ b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml >> @@ -29,6 +29,33 @@ properties: >> >> gpio-ranges: true >> >> + loongson,gpio-conf-offset: >> + $ref: /schemas/types.yaml#/definitions/uint32 >> + description: >> + This option indicate this GPIO configuration register offset address. >> + >> + loongson,gpio-out-offset: >> + $ref: /schemas/types.yaml#/definitions/uint32 >> + description: >> + This option indicate this GPIO output register offset address. >> + >> + loongson,gpio-in-offset: >> + $ref: /schemas/types.yaml#/definitions/uint32 >> + description: >> + This option indicate this GPIO input register offset address. >> + >> + loongson,gpio-ctrl-mode: >> + $ref: /schemas/types.yaml#/definitions/uint32 >> + description: >> + This option indicate this GPIO control mode, where '0' represents >> + bit control mode and '1' represents byte control mode. >> + >> + loongson,gpio-inten-offset: >> + $ref: /schemas/types.yaml#/definitions/uint32 >> + description: >> + This option indicate this GPIO interrupt enable register offset >> + address. >> + >> interrupts: >> minItems: 1 >> maxItems: 64 >> @@ -39,6 +66,11 @@ required: >> - ngpios >> - "#gpio-cells" >> - gpio-controller >> + - loongson,gpio-conf-offset >> + - loongson,gpio-in-offset >> + - loongson,gpio-out-offset >> + - loongson,gpio-ctrl-mode >> + - loongson,gpio-inten-offset >> - gpio-ranges >> - interrupts >> >> @@ -54,6 +86,11 @@ examples: >> ngpios = <64>; >> #gpio-cells = <2>; >> gpio-controller; >> + loongson,gpio-conf-offset = <0>; >> + loongson,gpio-in-offset = <0x20>; >> + loongson,gpio-out-offset = <0x10>; >> + loongson,gpio-ctrl-mode = <0>; >> + loongson,gpio-inten-offset = <0x30>; >> gpio-ranges = <&pctrl 0 0 15>, >> <&pctrl 16 16 15>, >> <&pctrl 32 32 10>, >> -- >> 2.20.1 >>
On Tue, Aug 01, 2023 at 02:39:49PM +0800, Yinbo Zhu wrote: > > > 在 2023/7/31 下午11:55, Conor Dooley 写道: > > On Mon, Jul 31, 2023 at 05:10:58PM +0800, Yinbo Zhu wrote: > > > Add parsing GPIO configure, input, output, interrupt register offset > > > address and GPIO control mode support. > > > > This reeks of insufficient use of SoC specific compatibles. Do GPIO > > controllers on the same SoC have different register offsets? > > > Yes, > > > Where are the users for this? > > > For example, ls2k500 contains multiple GPIO chips with different > (configure, input, output, interrupt) offset addresses, but all others > are the same. Right. That's admittedly not what I expected to hear! Can you firstly explain this in the commit message, and secondly add a soc-specific compatible for the ls2k500 and only allow these properties on that SoC? Thanks, Conor.
在 2023/8/1 下午3:23, Conor Dooley 写道: > On Tue, Aug 01, 2023 at 02:39:49PM +0800, Yinbo Zhu wrote: >> >> >> 在 2023/7/31 下午11:55, Conor Dooley 写道: >>> On Mon, Jul 31, 2023 at 05:10:58PM +0800, Yinbo Zhu wrote: >>>> Add parsing GPIO configure, input, output, interrupt register offset >>>> address and GPIO control mode support. >>> >>> This reeks of insufficient use of SoC specific compatibles. Do GPIO >>> controllers on the same SoC have different register offsets? >> >> >> Yes, >> >>> Where are the users for this? >> >> >> For example, ls2k500 contains multiple GPIO chips with different >> (configure, input, output, interrupt) offset addresses, but all others >> are the same. > > Right. That's admittedly not what I expected to hear! Can you firstly > explain this in the commit message, I will add following explain in the commit message. Do you think it's suitable? Loongson GPIO controllers come in multiple variants that are compatible except for certain register offset values. Add support in yaml file for device properties allowing to specify them in DT. > and secondly add a soc-specific > compatible for the ls2k500 and only allow these properties on that SoC? > Sorry, I may not have described it clearly before, the ls2k500 was only as a example, actually, Loongson GPIO controllers (2k500,2k1000,eg)come in multiple variants that are compatible except for certain register offset values. So above all offset device property was used to in all loongson gpio controller. Thanks, Yinbo
On Tue, Aug 01, 2023 at 04:34:30PM +0800, Yinbo Zhu wrote: > > > 在 2023/8/1 下午3:23, Conor Dooley 写道: > > On Tue, Aug 01, 2023 at 02:39:49PM +0800, Yinbo Zhu wrote: > > > > > > > > > 在 2023/7/31 下午11:55, Conor Dooley 写道: > > > > On Mon, Jul 31, 2023 at 05:10:58PM +0800, Yinbo Zhu wrote: > > > > > Add parsing GPIO configure, input, output, interrupt register offset > > > > > address and GPIO control mode support. > > > > > > > > This reeks of insufficient use of SoC specific compatibles. Do GPIO > > > > controllers on the same SoC have different register offsets? > > > > > > > > > Yes, > > > > > > > Where are the users for this? > > > > > > > > > For example, ls2k500 contains multiple GPIO chips with different > > > (configure, input, output, interrupt) offset addresses, but all others > > > are the same. > > > > Right. That's admittedly not what I expected to hear! Can you firstly > > explain this in the commit message, > > > I will add following explain in the commit message. Do you think it's > suitable? > > Loongson GPIO controllers come in multiple variants that are compatible > except for certain register offset values. Add support in yaml file for > device properties allowing to specify them in DT. Sure, that would be helpful. > > and secondly add a soc-specific > > compatible for the ls2k500 and only allow these properties on that SoC? > Sorry, I may not have described it clearly before, the ls2k500 was only > as a example, actually, Loongson GPIO controllers (2k500,2k1000,eg)come > in multiple variants that are compatible except for certain register > offset values. So above all offset device property was used to in all > loongson gpio controller. But it would be good to know why they are different. Do they each support some different features, or was there some other reason for making controllers like this? Thanks, Conor.
在 2023/8/1 下午11:54, Conor Dooley 写道: > On Tue, Aug 01, 2023 at 04:34:30PM +0800, Yinbo Zhu wrote: >> >> >> 在 2023/8/1 下午3:23, Conor Dooley 写道: >>> On Tue, Aug 01, 2023 at 02:39:49PM +0800, Yinbo Zhu wrote: >>>> >>>> >>>> 在 2023/7/31 下午11:55, Conor Dooley 写道: >>>>> On Mon, Jul 31, 2023 at 05:10:58PM +0800, Yinbo Zhu wrote: >>>>>> Add parsing GPIO configure, input, output, interrupt register offset >>>>>> address and GPIO control mode support. >>>>> >>>>> This reeks of insufficient use of SoC specific compatibles. Do GPIO >>>>> controllers on the same SoC have different register offsets? >>>> >>>> >>>> Yes, >>>> >>>>> Where are the users for this? >>>> >>>> >>>> For example, ls2k500 contains multiple GPIO chips with different >>>> (configure, input, output, interrupt) offset addresses, but all others >>>> are the same. >>> >>> Right. That's admittedly not what I expected to hear! Can you firstly >>> explain this in the commit message, >> >> >> I will add following explain in the commit message. Do you think it's >> suitable? >> >> Loongson GPIO controllers come in multiple variants that are compatible >> except for certain register offset values. Add support in yaml file for >> device properties allowing to specify them in DT. > > Sure, that would be helpful. > >>> and secondly add a soc-specific >>> compatible for the ls2k500 and only allow these properties on that SoC? > >> Sorry, I may not have described it clearly before, the ls2k500 was only >> as a example, actually, Loongson GPIO controllers (2k500,2k1000,eg)come >> in multiple variants that are compatible except for certain register >> offset values. So above all offset device property was used to in all >> loongson gpio controller. > > But it would be good to know why they are different. Do they each > support some different features, or was there some other reason for > making controllers like this? There are no other reasons, just differences in these offset addresses. Thanks, Yinbo.
On Wed, Aug 02, 2023 at 09:38:34AM +0800, Yinbo Zhu wrote: > > > 在 2023/8/1 下午11:54, Conor Dooley 写道: > > On Tue, Aug 01, 2023 at 04:34:30PM +0800, Yinbo Zhu wrote: > > > > > > > > > 在 2023/8/1 下午3:23, Conor Dooley 写道: > > > > On Tue, Aug 01, 2023 at 02:39:49PM +0800, Yinbo Zhu wrote: > > > > > > > > > > > > > > > 在 2023/7/31 下午11:55, Conor Dooley 写道: > > > > > > On Mon, Jul 31, 2023 at 05:10:58PM +0800, Yinbo Zhu wrote: > > > > > > > Add parsing GPIO configure, input, output, interrupt register offset > > > > > > > address and GPIO control mode support. > > > > > > > > > > > > This reeks of insufficient use of SoC specific compatibles. Do GPIO > > > > > > controllers on the same SoC have different register offsets? > > > > > > > > > > > > > > > Yes, > > > > > > > > > > > Where are the users for this? > > > > > > > > > > > > > > > For example, ls2k500 contains multiple GPIO chips with different > > > > > (configure, input, output, interrupt) offset addresses, but all others > > > > > are the same. > > > > > > > > Right. That's admittedly not what I expected to hear! Can you firstly > > > > explain this in the commit message, > > > > > > > > > I will add following explain in the commit message. Do you think it's > > > suitable? > > > > > > Loongson GPIO controllers come in multiple variants that are compatible > > > except for certain register offset values. Add support in yaml file for > > > device properties allowing to specify them in DT. > > > > Sure, that would be helpful. > > > > > > and secondly add a soc-specific > > > > compatible for the ls2k500 and only allow these properties on that SoC? > > > > > Sorry, I may not have described it clearly before, the ls2k500 was only > > > as a example, actually, Loongson GPIO controllers (2k500,2k1000,eg)come > > > in multiple variants that are compatible except for certain register > > > offset values. So above all offset device property was used to in all > > > loongson gpio controller. > > > > But it would be good to know why they are different. Do they each > > support some different features, or was there some other reason for > > making controllers like this? > > > There are no other reasons, just differences in these offset addresses. Huh. Do you have a link to a devicetree for the ls2k500?
在 2023/8/2 下午3:22, Conor Dooley 写道: > On Wed, Aug 02, 2023 at 09:38:34AM +0800, Yinbo Zhu wrote: >> >> >> 在 2023/8/1 下午11:54, Conor Dooley 写道: >>> On Tue, Aug 01, 2023 at 04:34:30PM +0800, Yinbo Zhu wrote: >>>> >>>> >>>> 在 2023/8/1 下午3:23, Conor Dooley 写道: >>>>> On Tue, Aug 01, 2023 at 02:39:49PM +0800, Yinbo Zhu wrote: >>>>>> >>>>>> >>>>>> 在 2023/7/31 下午11:55, Conor Dooley 写道: >>>>>>> On Mon, Jul 31, 2023 at 05:10:58PM +0800, Yinbo Zhu wrote: >>>>>>>> Add parsing GPIO configure, input, output, interrupt register offset >>>>>>>> address and GPIO control mode support. >>>>>>> >>>>>>> This reeks of insufficient use of SoC specific compatibles. Do GPIO >>>>>>> controllers on the same SoC have different register offsets? >>>>>> >>>>>> >>>>>> Yes, >>>>>> >>>>>>> Where are the users for this? >>>>>> >>>>>> >>>>>> For example, ls2k500 contains multiple GPIO chips with different >>>>>> (configure, input, output, interrupt) offset addresses, but all others >>>>>> are the same. >>>>> >>>>> Right. That's admittedly not what I expected to hear! Can you firstly >>>>> explain this in the commit message, >>>> >>>> >>>> I will add following explain in the commit message. Do you think it's >>>> suitable? >>>> >>>> Loongson GPIO controllers come in multiple variants that are compatible >>>> except for certain register offset values. Add support in yaml file for >>>> device properties allowing to specify them in DT. >>> >>> Sure, that would be helpful. >>> >>>>> and secondly add a soc-specific >>>>> compatible for the ls2k500 and only allow these properties on that SoC? >>> >>>> Sorry, I may not have described it clearly before, the ls2k500 was only >>>> as a example, actually, Loongson GPIO controllers (2k500,2k1000,eg)come >>>> in multiple variants that are compatible except for certain register >>>> offset values. So above all offset device property was used to in all >>>> loongson gpio controller. >>> >>> But it would be good to know why they are different. Do they each >>> support some different features, or was there some other reason for >>> making controllers like this? >> >> >> There are no other reasons, just differences in these offset addresses. > > Huh. Do you have a link to a devicetree for the ls2k500? Yes, there was a link about ls2k500 dts, but that ls2k500 dts has not yet added a gpio node. this gpio node will be added later. Thanks, Yinbo
On Wed, Aug 02, 2023 at 03:44:17PM +0800, Yinbo Zhu wrote: > 在 2023/8/2 下午3:22, Conor Dooley 写道: > > On Wed, Aug 02, 2023 at 09:38:34AM +0800, Yinbo Zhu wrote: > > > 在 2023/8/1 下午11:54, Conor Dooley 写道: > > > > On Tue, Aug 01, 2023 at 04:34:30PM +0800, Yinbo Zhu wrote: > > > > > Sorry, I may not have described it clearly before, the ls2k500 was only > > > > > as a example, actually, Loongson GPIO controllers (2k500,2k1000,eg)come > > > > > in multiple variants that are compatible except for certain register > > > > > offset values. So above all offset device property was used to in all > > > > > loongson gpio controller. > > > > > > > > But it would be good to know why they are different. Do they each > > > > support some different features, or was there some other reason for > > > > making controllers like this? > > > > > > > > > There are no other reasons, just differences in these offset addresses. > > > > Huh. Do you have a link to a devicetree for the ls2k500? > > > Yes, there was a link about ls2k500 dts, but that ls2k500 dts has not > yet added a gpio node. this gpio node will be added later. You must have something that you used to test with, no? I don't mind if it is not a patch, but rather is some WIP - I'd just like to see user of the binding :)
在 2023/8/2 下午3:50, Conor Dooley 写道: > On Wed, Aug 02, 2023 at 03:44:17PM +0800, Yinbo Zhu wrote: >> 在 2023/8/2 下午3:22, Conor Dooley 写道: >>> On Wed, Aug 02, 2023 at 09:38:34AM +0800, Yinbo Zhu wrote: >>>> 在 2023/8/1 下午11:54, Conor Dooley 写道: >>>>> On Tue, Aug 01, 2023 at 04:34:30PM +0800, Yinbo Zhu wrote: > >>>>>> Sorry, I may not have described it clearly before, the ls2k500 was only >>>>>> as a example, actually, Loongson GPIO controllers (2k500,2k1000,eg)come >>>>>> in multiple variants that are compatible except for certain register >>>>>> offset values. So above all offset device property was used to in all >>>>>> loongson gpio controller. >>>>> >>>>> But it would be good to know why they are different. Do they each >>>>> support some different features, or was there some other reason for >>>>> making controllers like this? >>>> >>>> >>>> There are no other reasons, just differences in these offset addresses. >>> >>> Huh. Do you have a link to a devicetree for the ls2k500? >> >> >> Yes, there was a link about ls2k500 dts, but that ls2k500 dts has not >> yet added a gpio node. this gpio node will be added later. > > You must have something that you used to test with, no? I don't mind if > it is not a patch, but rather is some WIP - I'd just like to see user of > the binding :) yes, I have a test, for 2k0500, that gpio dts as follows: 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>; loongson,gpio-inten-offset = <0x98>; loongson,gpio-ctrl-mode = <0x0>; ... } Thanks, Yinbo. >
On Wed, Aug 02, 2023 at 04:37:50PM +0800, Yinbo Zhu wrote: > > > 在 2023/8/2 下午3:50, Conor Dooley 写道: > > On Wed, Aug 02, 2023 at 03:44:17PM +0800, Yinbo Zhu wrote: > > > 在 2023/8/2 下午3:22, Conor Dooley 写道: > > > > On Wed, Aug 02, 2023 at 09:38:34AM +0800, Yinbo Zhu wrote: > > > > > 在 2023/8/1 下午11:54, Conor Dooley 写道: > > > > > > On Tue, Aug 01, 2023 at 04:34:30PM +0800, Yinbo Zhu wrote: > > > > > > > > > Sorry, I may not have described it clearly before, the ls2k500 was only > > > > > > > as a example, actually, Loongson GPIO controllers (2k500,2k1000,eg)come > > > > > > > in multiple variants that are compatible except for certain register > > > > > > > offset values. So above all offset device property was used to in all > > > > > > > loongson gpio controller. > > > > > > > > > > > > But it would be good to know why they are different. Do they each > > > > > > support some different features, or was there some other reason for > > > > > > making controllers like this? > > > > > > > > > > > > > > > There are no other reasons, just differences in these offset addresses. > > > > > > > > Huh. Do you have a link to a devicetree for the ls2k500? > > > > > > > > > Yes, there was a link about ls2k500 dts, but that ls2k500 dts has not > > > yet added a gpio node. this gpio node will be added later. > > > > You must have something that you used to test with, no? I don't mind if > > it is not a patch, but rather is some WIP - I'd just like to see user of > > the binding :) > > > yes, I have a test, for 2k0500, that gpio dts as follows: > > 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?
在 2023/8/2 下午11:36, Conor Dooley 写道: > On Wed, Aug 02, 2023 at 04:37:50PM +0800, Yinbo Zhu wrote: >> >> >> 在 2023/8/2 下午3:50, Conor Dooley 写道: >>> On Wed, Aug 02, 2023 at 03:44:17PM +0800, Yinbo Zhu wrote: >>>> 在 2023/8/2 下午3:22, Conor Dooley 写道: >>>>> On Wed, Aug 02, 2023 at 09:38:34AM +0800, Yinbo Zhu wrote: >>>>>> 在 2023/8/1 下午11:54, Conor Dooley 写道: >>>>>>> On Tue, Aug 01, 2023 at 04:34:30PM +0800, Yinbo Zhu wrote: >>> >>>>>>>> Sorry, I may not have described it clearly before, the ls2k500 was only >>>>>>>> as a example, actually, Loongson GPIO controllers (2k500,2k1000,eg)come >>>>>>>> in multiple variants that are compatible except for certain register >>>>>>>> offset values. So above all offset device property was used to in all >>>>>>>> loongson gpio controller. >>>>>>> >>>>>>> But it would be good to know why they are different. Do they each >>>>>>> support some different features, or was there some other reason for >>>>>>> making controllers like this? >>>>>> >>>>>> >>>>>> There are no other reasons, just differences in these offset addresses. >>>>> >>>>> Huh. Do you have a link to a devicetree for the ls2k500? >>>> >>>> >>>> Yes, there was a link about ls2k500 dts, but that ls2k500 dts has not >>>> yet added a gpio node. this gpio node will be added later. >>> >>> You must have something that you used to test with, no? I don't mind if >>> it is not a patch, but rather is some WIP - I'd just like to see user of >>> the binding :) >> >> >> yes, I have a test, for 2k0500, that gpio dts as follows: >> >> 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>; ... } Thanks, Yinbo >
On Thu, Aug 03, 2023 at 09:56:02AM +0800, Yinbo Zhu wrote: > > > 在 2023/8/2 下午11:36, Conor Dooley 写道: > > On Wed, Aug 02, 2023 at 04:37:50PM +0800, Yinbo Zhu wrote: > > > > > > > > > 在 2023/8/2 下午3:50, Conor Dooley 写道: > > > > On Wed, Aug 02, 2023 at 03:44:17PM +0800, Yinbo Zhu wrote: > > > > > 在 2023/8/2 下午3:22, Conor Dooley 写道: > > > > > > On Wed, Aug 02, 2023 at 09:38:34AM +0800, Yinbo Zhu wrote: > > > > > > > 在 2023/8/1 下午11:54, Conor Dooley 写道: > > > > > > > > On Tue, Aug 01, 2023 at 04:34:30PM +0800, Yinbo Zhu wrote: > > > > > > > > > > > > > Sorry, I may not have described it clearly before, the ls2k500 was only > > > > > > > > > as a example, actually, Loongson GPIO controllers (2k500,2k1000,eg)come > > > > > > > > > in multiple variants that are compatible except for certain register > > > > > > > > > offset values. So above all offset device property was used to in all > > > > > > > > > loongson gpio controller. > > > > > > > > > > > > > > > > But it would be good to know why they are different. Do they each > > > > > > > > support some different features, or was there some other reason for > > > > > > > > making controllers like this? > > > > > > > > > > > > > > > > > > > > > There are no other reasons, just differences in these offset addresses. > > > > > > > > > > > > Huh. Do you have a link to a devicetree for the ls2k500? > > > > > > > > > > > > > > > Yes, there was a link about ls2k500 dts, but that ls2k500 dts has not > > > > > yet added a gpio node. this gpio node will be added later. > > > > > > > > You must have something that you used to test with, no? I don't mind if > > > > it is not a patch, but rather is some WIP - I'd just like to see user of > > > > the binding :) > > > > > > > > > yes, I have a test, for 2k0500, that gpio dts as follows: > > > > > > 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.
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? Best regards, Krzysztof
在 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
diff --git a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml index fb86e8ce6349..cad67f8bfe6e 100644 --- a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml +++ b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml @@ -29,6 +29,33 @@ properties: gpio-ranges: true + loongson,gpio-conf-offset: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + This option indicate this GPIO configuration register offset address. + + loongson,gpio-out-offset: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + This option indicate this GPIO output register offset address. + + loongson,gpio-in-offset: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + This option indicate this GPIO input register offset address. + + loongson,gpio-ctrl-mode: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + This option indicate this GPIO control mode, where '0' represents + bit control mode and '1' represents byte control mode. + + loongson,gpio-inten-offset: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + This option indicate this GPIO interrupt enable register offset + address. + interrupts: minItems: 1 maxItems: 64 @@ -39,6 +66,11 @@ required: - ngpios - "#gpio-cells" - gpio-controller + - loongson,gpio-conf-offset + - loongson,gpio-in-offset + - loongson,gpio-out-offset + - loongson,gpio-ctrl-mode + - loongson,gpio-inten-offset - gpio-ranges - interrupts @@ -54,6 +86,11 @@ examples: ngpios = <64>; #gpio-cells = <2>; gpio-controller; + loongson,gpio-conf-offset = <0>; + loongson,gpio-in-offset = <0x20>; + loongson,gpio-out-offset = <0x10>; + loongson,gpio-ctrl-mode = <0>; + loongson,gpio-inten-offset = <0x30>; gpio-ranges = <&pctrl 0 0 15>, <&pctrl 16 16 15>, <&pctrl 32 32 10>,