Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp940951iof; Mon, 6 Jun 2022 16:12:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxByEEtxsr4WiIZsM3nVs5j/sBtKVIXz2GHMkHBTogIRnloj2iLqq10h7lE6Km5jT20xivP X-Received: by 2002:a17:907:2da6:b0:711:d86d:ccab with SMTP id gt38-20020a1709072da600b00711d86dccabmr4447112ejc.356.1654557164386; Mon, 06 Jun 2022 16:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654557164; cv=none; d=google.com; s=arc-20160816; b=Ms5Sea3fjgpWzYmuDpxNib4qL0HTwQKCfxxT2vtVPObWdo7VUsx7ha58GTkZPSU8E5 wWqpYF7Ot+AM8i2kMFWCK18bCpEL7viTivDe13nYB8uJ9Z0xGVV2yCuufGnow3fRlvgK 3yHcprCtJmLmfVjSB/V4AMo0RYejrTbr15Wj4N8JaiG5IMsxwmgeSc1rBY6PEY1TcSX9 xPCzf2yfVFCwLridum0eFb/1HiXoHYY8MEj4DxsK8YCQonamYWspgLSzWSVo2VM/Lz4P SA86vzo4hZs7dg9u/8I8pW+FstLCnjcbfsxqc63sIkGUznU3oQQru2kh2MW9FPWXk1O9 w8DQ== 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 :dkim-signature; bh=jeQ0ViwKjg4rIn8dC6mh1AhiPoIbefNYM5vCjdm72pQ=; b=iAAVOACCGnDDOEZtBsxU7elSbl9QItic9RYa/Y4FPg0Qdkm0ddjDR/fJIrsvVLTkE9 4p6f5NL6hyac10N3WCHlRcvSqhPjx6xSkQXpehKQzuYA9VK3vMfPYG/6YNwQW++F8ThD eIbu02viFTcMJuj/PRv9kvlk13mtGxeQIJbrCSWt34ho+2fw6i+VubI0S0c/6rkg1m9A IL8E8r6SnGEHc5Q0VtTgCoEROkFOCi6q08croa7vwUfGHQnWWevRyittjWbQeZmxGvtZ 9+KxBUHmWwi3hMopIrilwugvP+QXPPVrZSEykiqIMYfVuiSXSu3NbbXkJGHgt1KcKWBL omVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@conchuod.ie header.s=google header.b=XDLFX0FC; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=conchuod.ie Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr19-20020a170906d55300b006efdae095adsi11336933ejc.954.2022.06.06.16.12.17; Mon, 06 Jun 2022 16:12:44 -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; dkim=pass header.i=@conchuod.ie header.s=google header.b=XDLFX0FC; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=conchuod.ie Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233243AbiFFUOW (ORCPT + 99 others); Mon, 6 Jun 2022 16:14:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233171AbiFFUOI (ORCPT ); Mon, 6 Jun 2022 16:14:08 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 472C050451 for ; Mon, 6 Jun 2022 13:14:06 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id q7so21288259wrg.5 for ; Mon, 06 Jun 2022 13:14:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=conchuod.ie; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jeQ0ViwKjg4rIn8dC6mh1AhiPoIbefNYM5vCjdm72pQ=; b=XDLFX0FCh6R8nVkiujqyI4B+6dQOabsvXS68MvFtSzExkuJtOCpnza4M3nUEhJDKNY E/GBHB/fJIVsMmtxggc5sLTzmx6F800cNpbVsxJLbTioDUleQdGEYr7fEdlq9hspODw4 OHsau+mt663Gfc6m66ZzdRZFGlAPK50mpMFwdLQzPpUBDpnAOZb9O3JLh/iq4rZSVVhK e4X1uKBD9DQDLePruxUmcmHSLLIj9d+v+HHj6VCNs810/54k6UPwNCe+t/N81vj5XVOc 2CwkLVvFYIbTjnSOl1W5cmPulS6H32+dfMRIH/iBzgQQOZH+WmNCUWAGqoq8escnMgtG iMIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jeQ0ViwKjg4rIn8dC6mh1AhiPoIbefNYM5vCjdm72pQ=; b=643PGGrgriMAZo6nGI16CqqXcRGZi/3IsspUobupQ9A3yAzUuR49a09cpf++PydDZi Lg9RZjc7e3fZKv1EeI8qMkqMU2BjWsglTUo574xNh0mV+cLYmpMOh6svvLXBntLo+bxE Q4AhmfVNWCe9DLOKf+mDUI/p273OFkAkpeiI7xvT25+Mwq6PD0M/fVWl/jVPUxsGBQsc JTHOul/B14HiFpmF/5qS4BV4jan2zx4yKZreuIILOIT0jC6HSqM2b/nHUhfIu96k49HD v+na6ya/GekLKpbZeMbxbo7Ohpbn7/6+GlUFwyzKg3JkCZSuBg/5cpKd5XDViW5BjnNB U8bw== X-Gm-Message-State: AOAM533IXNfYAyqjOTVLdqxvTDz5l6HYOREAAqiiEs1hMVhRypKRoOef s+Ayl6y1e/VIjrtT0QgcCwAjeg== X-Received: by 2002:a05:6000:18ae:b0:211:40df:c00e with SMTP id b14-20020a05600018ae00b0021140dfc00emr24085870wri.304.1654546444685; Mon, 06 Jun 2022 13:14:04 -0700 (PDT) Received: from henark71.. ([51.37.234.167]) by smtp.gmail.com with ESMTPSA id p9-20020a5d4589000000b0020fcf070f61sm16038489wrq.59.2022.06.06.13.14.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 13:14:04 -0700 (PDT) From: Conor Dooley To: Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Support Opensource , Lee Jones , Ulf Hansson , Palmer Dabbelt , Paul Walmsley , Albert Ou , Steve Twiss Cc: Conor Dooley , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-riscv@lists.infradead.org, Atul Khare , Rob Herring Subject: [PATCH v3 2/4] dt-bindings: i2c: convert ocores binding to yaml Date: Mon, 6 Jun 2022 21:13:42 +0100 Message-Id: <20220606201343.514391-3-mail@conchuod.ie> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220606201343.514391-1-mail@conchuod.ie> References: <20220606201343.514391-1-mail@conchuod.ie> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Conor Dooley Convert the open cores i2c controller binding from text to yaml. Reviewed-by: Rob Herring Signed-off-by: Conor Dooley --- .../devicetree/bindings/i2c/i2c-ocores.txt | 78 ------------ .../bindings/i2c/opencores,i2c-ocores.yaml | 113 ++++++++++++++++++ MAINTAINERS | 2 +- 3 files changed, 114 insertions(+), 79 deletions(-) delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-ocores.txt create mode 100644 Documentation/devicetree/bindings/i2c/opencores,i2c-ocores.yaml diff --git a/Documentation/devicetree/bindings/i2c/i2c-ocores.txt b/Documentation/devicetree/bindings/i2c/i2c-ocores.txt deleted file mode 100644 index a37c9455b244..000000000000 --- a/Documentation/devicetree/bindings/i2c/i2c-ocores.txt +++ /dev/null @@ -1,78 +0,0 @@ -Device tree configuration for i2c-ocores - -Required properties: -- compatible : "opencores,i2c-ocores" - "aeroflexgaisler,i2cmst" - "sifive,fu540-c000-i2c", "sifive,i2c0" - For Opencore based I2C IP block reimplemented in - FU540-C000 SoC. - "sifive,fu740-c000-i2c", "sifive,i2c0" - For Opencore based I2C IP block reimplemented in - FU740-C000 SoC. - Please refer to sifive-blocks-ip-versioning.txt for - additional details. -- reg : bus address start and address range size of device -- clocks : handle to the controller clock; see the note below. - Mutually exclusive with opencores,ip-clock-frequency -- opencores,ip-clock-frequency: frequency of the controller clock in Hz; - see the note below. Mutually exclusive with clocks -- #address-cells : should be <1> -- #size-cells : should be <0> - -Optional properties: -- interrupts : interrupt number. -- clock-frequency : frequency of bus clock in Hz; see the note below. - Defaults to 100 KHz when the property is not specified -- reg-shift : device register offsets are shifted by this value -- reg-io-width : io register width in bytes (1, 2 or 4) -- regstep : deprecated, use reg-shift above - -Note -clock-frequency property is meant to control the bus frequency for i2c bus -drivers, but it was incorrectly used to specify i2c controller input clock -frequency. So the following rules are set to fix this situation: -- if clock-frequency is present and neither opencores,ip-clock-frequency nor - clocks are, then clock-frequency specifies i2c controller clock frequency. - This is to keep backwards compatibility with setups using old DTB. i2c bus - frequency is fixed at 100 KHz. -- if clocks is present it specifies i2c controller clock. clock-frequency - property specifies i2c bus frequency. -- if opencores,ip-clock-frequency is present it specifies i2c controller - clock frequency. clock-frequency property specifies i2c bus frequency. - -Examples: - - i2c0: ocores@a0000000 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "opencores,i2c-ocores"; - reg = <0xa0000000 0x8>; - interrupts = <10>; - opencores,ip-clock-frequency = <20000000>; - - reg-shift = <0>; /* 8 bit registers */ - reg-io-width = <1>; /* 8 bit read/write */ - - dummy@60 { - compatible = "dummy"; - reg = <0x60>; - }; - }; -or - i2c0: ocores@a0000000 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "opencores,i2c-ocores"; - reg = <0xa0000000 0x8>; - interrupts = <10>; - clocks = <&osc>; - clock-frequency = <400000>; /* i2c bus frequency 400 KHz */ - - reg-shift = <0>; /* 8 bit registers */ - reg-io-width = <1>; /* 8 bit read/write */ - - dummy@60 { - compatible = "dummy"; - reg = <0x60>; - }; - }; diff --git a/Documentation/devicetree/bindings/i2c/opencores,i2c-ocores.yaml b/Documentation/devicetree/bindings/i2c/opencores,i2c-ocores.yaml new file mode 100644 index 000000000000..85d9efb743ee --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/opencores,i2c-ocores.yaml @@ -0,0 +1,113 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/i2c/opencores,i2c-ocores.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: OpenCores I2C controller + +maintainers: + - Peter Korsgaard + - Andrew Lunn + +allOf: + - $ref: /schemas/i2c/i2c-controller.yaml# + +properties: + compatible: + oneOf: + - items: + - enum: + - sifive,fu740-c000-i2c # Opencore based IP block FU740-C000 SoC + - sifive,fu540-c000-i2c # Opencore based IP block FU540-C000 SoC + - const: sifive,i2c0 + - enum: + - opencores,i2c-ocores + - aeroflexgaisler,i2cmst + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-frequency: + description: | + clock-frequency property is meant to control the bus frequency for i2c bus + drivers, but it was incorrectly used to specify i2c controller input clock + frequency. So the following rules are set to fix this situation: + - if clock-frequency is present and neither opencores,ip-clock-frequency nor + clocks are, then clock-frequency specifies i2c controller clock frequency. + This is to keep backwards compatibility with setups using old DTB. i2c bus + frequency is fixed at 100 KHz. + - if clocks is present it specifies i2c controller clock. clock-frequency + property specifies i2c bus frequency. + - if opencores,ip-clock-frequency is present it specifies i2c controller + clock frequency. clock-frequency property specifies i2c bus frequency. + default: 100000 + + reg-io-width: + description: | + io register width in bytes + enum: [1, 2, 4] + + reg-shift: + description: | + device register offsets are shifted by this value + default: 0 + + regstep: + description: | + deprecated, use reg-shift above + deprecated: true + + opencores,ip-clock-frequency: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Frequency of the controller clock in Hz. Mutually exclusive with clocks. + See the note above. + +required: + - compatible + - reg + - "#address-cells" + - "#size-cells" + +oneOf: + - required: + - opencores,ip-clock-frequency + - required: + - clocks + +unevaluatedProperties: false + +examples: + - | + i2c@a0000000 { + compatible = "opencores,i2c-ocores"; + reg = <0xa0000000 0x8>; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <10>; + opencores,ip-clock-frequency = <20000000>; + + reg-shift = <0>; /* 8 bit registers */ + reg-io-width = <1>; /* 8 bit read/write */ + }; + + i2c@b0000000 { + compatible = "opencores,i2c-ocores"; + reg = <0xa0000000 0x8>; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <10>; + clocks = <&osc>; + clock-frequency = <400000>; /* i2c bus frequency 400 KHz */ + + reg-shift = <0>; /* 8 bit registers */ + reg-io-width = <1>; /* 8 bit read/write */ + }; +... diff --git a/MAINTAINERS b/MAINTAINERS index a6d3bd9d2a8d..cfaf02fc9191 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14869,7 +14869,7 @@ M: Peter Korsgaard M: Andrew Lunn L: linux-i2c@vger.kernel.org S: Maintained -F: Documentation/devicetree/bindings/i2c/i2c-ocores.txt +F: Documentation/devicetree/bindings/i2c/i2c-ocores.yaml F: Documentation/i2c/busses/i2c-ocores.rst F: drivers/i2c/busses/i2c-ocores.c F: include/linux/platform_data/i2c-ocores.h -- 2.36.1