From patchwork Wed Oct 18 09:24:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ante Knezic X-Patchwork-Id: 735314 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB4BA1773B for ; Wed, 18 Oct 2023 09:25:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=helmholz.de header.i=@helmholz.de header.b="GzmcBdc/" Received: from mail.helmholz.de (mail.helmholz.de [217.6.86.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9640FF7 for ; Wed, 18 Oct 2023 02:25:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=helmholz.de ; s=dkim1; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=zWH27i+cvXvmcutNDHehRu32MxOdvX+prdLpdMQ5kwI=; b=GzmcBdc/wdNPtgF2a7gfmCgBkW c25aHlTPdUm7cKBvb8fjFhijWuxoSYqifoJu86fk8nYIumA0bZmhalLuxP298CkhW1WDQxOyuFM8s knKsKqmLNkQ9GiTAli3rKj1gq8ZOozoAR3QtNxrsQQjRI2jC38ZfnloSp+Mh3PxlEseijZvfy/4OS MtSc+l8ZmNbL5ccuqlsbX9V2x3GJ7CUIWXKYVLSZTeWtCdVg3+NRFtRu/pOMeKJ3EfTIwXqQroduj pYt49rA9tsX4Li9MzCXU6HezbjNKa5DW7zEnQ4cUmG7g+GN4YpX7dlEacNK/DeNdaXwcMRfAdRPoy O69vYQfw==; Received: from [192.168.1.4] (port=59014 helo=SH-EX2013.helmholz.local) by mail.helmholz.de with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (Exim 4.96) (envelope-from ) id 1qt2mp-0003EC-0m; Wed, 18 Oct 2023 11:24:19 +0200 Received: from linuxdev.helmholz.local (192.168.6.7) by SH-EX2013.helmholz.local (192.168.1.4) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 18 Oct 2023 11:24:18 +0200 From: Ante Knezic To: CC: , , , , , , , , , , , , , , , Ante Knezic Subject: [PATCH net-next v3 1/2] dt-bindings: net: microchip,ksz: document microchip,rmii-clk-internal Date: Wed, 18 Oct 2023 11:24:13 +0200 Message-ID: <351f7993397a496bf7d6d79b9096079a41157919.1697620929.git.ante.knezic@helmholz.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [192.168.6.7] X-ClientProxiedBy: SH-EX2013.helmholz.local (192.168.1.4) To SH-EX2013.helmholz.local (192.168.1.4) X-EXCLAIMER-MD-CONFIG: 2ae5875c-d7e5-4d7e-baa3-654d37918933 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_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Add documentation for selecting reference rmii clock on KSZ88X3 devices Signed-off-by: Ante Knezic --- .../devicetree/bindings/net/dsa/microchip,ksz.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml index 41014f5c01c4..624feb1bb9be 100644 --- a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml +++ b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml @@ -72,6 +72,23 @@ properties: interrupts: maxItems: 1 + microchip,rmii-clk-internal: + $ref: /schemas/types.yaml#/definitions/flag + description: + Set if the RMII reference clock is provided internally. Otherwise + reference clock should be provided externally. + +if: + not: + properties: + compatible: + enum: + - microchip,ksz8863 + - microchip,ksz8873 +then: + properties: + microchip,rmii-clk-internal: false + required: - compatible - reg From patchwork Wed Oct 18 09:24:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ante Knezic X-Patchwork-Id: 735949 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C326217989 for ; Wed, 18 Oct 2023 09:24:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=helmholz.de header.i=@helmholz.de header.b="DbizTzTH" Received: from mail.helmholz.de (mail.helmholz.de [217.6.86.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D08FD101 for ; Wed, 18 Oct 2023 02:24:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=helmholz.de ; s=dkim1; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=P208vLuzeC8YOSU91aWKUZeFeNNRc/LChYsdSyHcihw=; b=DbizTzTHxEq6QnjO3POZXaRAUG JzpvbT2+A8b/BahSr1jUiSnMmX/nfcRa48e5HhWwJOMDjR9KW2WP6CsIlu9pyLQBskrhkaL+hlN1v gX4XqkdTxru1XwHVOhMbRY0ejXDICWzzxOyYO9bl/1WXoj93mYj5+ZiU+YAQKQr+xu0eZYrQ7VHIl UVJfbcts5dagonxzaD2IXGgn+IBgdpzOgZ7Ijgp3N39igos1BfvNPEt5Ni3nUWAhknnOm6i228+wr qCpqXxVCWWxj8Pd107RR7tSqvWytT/q/IHBhoNe+pS5axATprxbPufU+wp8uTzdnlaHSDpFWc6H4r qfUUPzsA==; Received: from [192.168.1.4] (port=59019 helo=SH-EX2013.helmholz.local) by mail.helmholz.de with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (Exim 4.96) (envelope-from ) id 1qt2mq-0003Ed-2S; Wed, 18 Oct 2023 11:24:20 +0200 Received: from linuxdev.helmholz.local (192.168.6.7) by SH-EX2013.helmholz.local (192.168.1.4) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 18 Oct 2023 11:24:20 +0200 From: Ante Knezic To: CC: , , , , , , , , , , , , , , , Ante Knezic Subject: [PATCH net-next v3 2/2] net:dsa:microchip: add property to select internal RMII reference clock Date: Wed, 18 Oct 2023 11:24:14 +0200 Message-ID: <893a3ad19b28c6bb1bf5ea18dee2fa5855f0c207.1697620929.git.ante.knezic@helmholz.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <351f7993397a496bf7d6d79b9096079a41157919.1697620929.git.ante.knezic@helmholz.de> References: <351f7993397a496bf7d6d79b9096079a41157919.1697620929.git.ante.knezic@helmholz.de> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [192.168.6.7] X-ClientProxiedBy: SH-EX2013.helmholz.local (192.168.1.4) To SH-EX2013.helmholz.local (192.168.1.4) X-EXCLAIMER-MD-CONFIG: 2ae5875c-d7e5-4d7e-baa3-654d37918933 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_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 Microchip KSZ8863/KSZ8873 have the ability to select between internal and external RMII reference clock. By default, reference clock needs to be provided via REFCLKI_3 pin. If required, device can be setup to provide RMII clock internally so that REFCLKI_3 pin can be left unconnected. Add a new "microchip,rmii-clk-internal" property which will set RMII clock reference to internal. If property is not set, reference clock needs to be provided externally. Signed-off-by: Ante Knezic --- drivers/net/dsa/microchip/ksz8795.c | 10 +++++++++- drivers/net/dsa/microchip/ksz8795_reg.h | 3 +++ drivers/net/dsa/microchip/ksz_common.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c index 91aba470fb2f..b50ad9552c65 100644 --- a/drivers/net/dsa/microchip/ksz8795.c +++ b/drivers/net/dsa/microchip/ksz8795.c @@ -1312,8 +1312,16 @@ void ksz8_port_setup(struct ksz_device *dev, int port, bool cpu_port) ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_802_1P_ENABLE, true); if (cpu_port) { - if (!ksz_is_ksz88x3(dev)) + if (!ksz_is_ksz88x3(dev)) { ksz8795_cpu_interface_select(dev, port); + } else { + dev->rmii_clk_internal = of_property_read_bool(dev->dev->of_node, + "microchip,rmii-clk-internal"); + + ksz_cfg(dev, KSZ88X3_REG_FVID_AND_HOST_MODE, + KSZ88X3_PORT3_RMII_CLK_INTERNAL, + dev->rmii_clk_internal); + } member = dsa_user_ports(ds); } else { diff --git a/drivers/net/dsa/microchip/ksz8795_reg.h b/drivers/net/dsa/microchip/ksz8795_reg.h index 3c9dae53e4d8..beca974e0171 100644 --- a/drivers/net/dsa/microchip/ksz8795_reg.h +++ b/drivers/net/dsa/microchip/ksz8795_reg.h @@ -22,6 +22,9 @@ #define KSZ8863_GLOBAL_SOFTWARE_RESET BIT(4) #define KSZ8863_PCS_RESET BIT(0) +#define KSZ88X3_REG_FVID_AND_HOST_MODE 0xC6 +#define KSZ88X3_PORT3_RMII_CLK_INTERNAL BIT(3) + #define REG_SW_CTRL_0 0x02 #define SW_NEW_BACKOFF BIT(7) diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h index 8842efca0871..e5b0445fe2ca 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -163,6 +163,7 @@ struct ksz_device { phy_interface_t compat_interface; bool synclko_125; bool synclko_disable; + bool rmii_clk_internal; struct vlan_table *vlan_cache;