From patchwork Mon Aug 7 07:40:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinbo Zhu X-Patchwork-Id: 131722 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1284409vqr; Mon, 7 Aug 2023 00:42:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG+2wb1YywDZAUVTxOmFGHB85mycame+Webq94HjWHuKl/mkp+uayk6tUXQLClVi5Jv2CtF X-Received: by 2002:aa7:dc12:0:b0:522:cb97:f198 with SMTP id b18-20020aa7dc12000000b00522cb97f198mr6679600edu.38.1691394138912; Mon, 07 Aug 2023 00:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691394138; cv=none; d=google.com; s=arc-20160816; b=xeJMf015jSR78jsIne1QHxZAKXHDSSId3XJYh6Uzn8ZPv319r1nsxj3nIBWyywXSnj uweiEzebjkpjsPnpJ6wDxuzgmx2DtId37e//PJg9jcX3wRHPRWulurk7uWHBkqxh5MwY FkymT5Tfbyxo93pwoKgiKoj2Xezz5lWUmkMf0KJWgAv0CQ1Z2GAZfs4ly1JirDumCmA7 NiFI+1qX3dO+Kr8y6Kt7dhmw7hefYjkzW4g3EgAD7KhIC39KujPA/dp9cThOOeqLMv63 LFq+zxcn/h0hZchCJsnSm9dFsIS4eaK4iyM3XhGqHFDrpbHvtFnXSzGL3bnhVEjz2MKD hgwg== 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=C/Pd1K/SGMoK17JfA7aNkIGeNsDYE5rPa0yXkdDEJWg=; fh=03M9NuUp7mf+kiarWzGb9RQmG0WNybTkFW4IRsSZJPI=; b=zPfNJwg8e+EEOd4ay0cyyYWogbIWhvb2gvR/Mka1wJtXT20KvlL+S2t0lIRd5JkRBH czAnx362zBYVi8lriwe6ckxFpJIqnegcHComEnoW0SiHaODJgFpBbRt0z3Oolb9J+DpL b8BdD9ZzY0EhSaKl7/XrHfnkKN5Fnyf54tF2RfBmZTpnveR23kBxTZuCBsAkTk/XrtLc ACDre+3oL8BKwySzBmE9rQpmC3t0IZfbb6n1xJTebTRDtmKZtAWWk2ABpdZ/GT+CvCvS ZpKZBkfHMbF1IoIY0u9KqWEPPPF2Ln2/GkWY1j/WPhhfiNLpFn600R1sfruDEV3T+A7I mJLA== 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 d8-20020a50ea88000000b00522d742bc4dsi5367269edo.334.2023.08.07.00.41.55; Mon, 07 Aug 2023 00:42:18 -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 S230294AbjHGHlJ (ORCPT + 99 others); Mon, 7 Aug 2023 03:41:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229989AbjHGHlE (ORCPT ); Mon, 7 Aug 2023 03:41:04 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 22EA010FE; Mon, 7 Aug 2023 00:41:01 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.201]) by gateway (Coremail) with SMTP id _____8AxFvEJoNBkCOARAA--.40060S3; Mon, 07 Aug 2023 15:40:57 +0800 (CST) Received: from localhost.localdomain (unknown [10.20.42.201]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxB838n9Bk+dBMAA--.56868S3; Mon, 07 Aug 2023 15:40:56 +0800 (CST) From: Yinbo Zhu To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jianmin Lv , wanghongliang@loongson.cn, loongson-kernel@lists.loongnix.cn, Yinbo Zhu Subject: [PATCH v3 1/2] gpio: dt-bindings: add parsing of loongson gpio offset Date: Mon, 7 Aug 2023 15:40:42 +0800 Message-Id: <20230807074043.31288-2-zhuyinbo@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230807074043.31288-1-zhuyinbo@loongson.cn> References: <20230807074043.31288-1-zhuyinbo@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8BxB838n9Bk+dBMAA--.56868S3 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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773555300471141061 X-GMAIL-MSGID: 1773555300471141061 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. Signed-off-by: Yinbo Zhu --- .../bindings/gpio/loongson,ls-gpio.yaml | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml index fb86e8ce6349..fc51cf40fccd 100644 --- a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml +++ b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml @@ -14,6 +14,7 @@ properties: enum: - loongson,ls2k-gpio - loongson,ls7a-gpio + - loongson,ls2k1000-gpio reg: maxItems: 1 @@ -29,6 +30,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 +67,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 @@ -49,11 +82,16 @@ examples: #include gpio0: gpio@1fe00500 { - compatible = "loongson,ls2k-gpio"; + compatible = "loongson,ls2k1000-gpio"; reg = <0x1fe00500 0x38>; 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>,