Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1163003rda; Mon, 23 Oct 2023 04:49:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGs0qMhriiLQb3s2Qcur8mpOSeBFsfy3lQ7P/JoKgs3Gb4ivaIhEm4prqaaZw+zhNrcdNkt X-Received: by 2002:a05:6a20:7fa0:b0:16b:9b5d:155d with SMTP id d32-20020a056a207fa000b0016b9b5d155dmr9073095pzj.30.1698061780667; Mon, 23 Oct 2023 04:49:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698061780; cv=none; d=google.com; s=arc-20160816; b=VDF0JwSwFfcixGIK+AlkChIJXi4+YHBOWQyvaTbCk0P+DVFCq+RxjHe25uPOSRE+A0 XAbmCXz0cStRj2jy7u1tSZFkys3RPrMDtuLxr+Emh7XL61/e/ImnRolay4krzPJry5WU 0ing0QHWY2ZAsmaCoj8RqIaCWO6n3nb/O6I+gxXHJOgLw33Qw9JZRq4ILtA36rGlOrnl 2NNzLhaDIf5DK5l4Ky0/DOckMOmCNivNrjCQPsPEED1+uj0So1FRSB5JlPpLE291p5+3 Or4KWCrodSTK15d+XRdSvSxYCmv8j+PQbCCTllWhEEvIwpXk9B/mob1uHzEBCZ549iXz lZNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=BNp3c1enindMHQXLkVvvZFmpMbc1UgC/Lva6kV5e8jE=; fh=5AIWmXkHBaXxawlALdEGTqK1aqyFumvfjW806/vJVWE=; b=Ajgi+pP3jJXiXp7LmtsojYsl7kLCamJu4Iofp7+ld52MiP0TaXCn6YGAqeVJ8QZCY0 EWUjiMZqh7rvt0iT3kLmGWVrknxiSo0lICGChAvYyIWRfKK2Mx4aTmB9cZTzkynekAcq jufily19kIuktlFEF7IMG0BaV96WoiQpY02/0ebjJKRhbGxm/HA8mD9JK3laWJ1KDj3D fcnLhpNvDhT6hjaRlIf5g9X3QTSnyxcH7kNTn+gIY4StpYF8/QmfK8gw9peJ6oR5xVrV se+YuHAR9LJXMIuArImhyX3bIq7ngZfSepQVP6z8fQMdDgNmeMp1mTsEcnPds4nBvkzz 2eBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id q21-20020a638c55000000b005aab3984970si6545341pgn.19.2023.10.23.04.49.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 04:49:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E376F8055AD1; Mon, 23 Oct 2023 04:49:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234293AbjJWLt1 (ORCPT + 99 others); Mon, 23 Oct 2023 07:49:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234560AbjJWLt0 (ORCPT ); Mon, 23 Oct 2023 07:49:26 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4683DE8 for ; Mon, 23 Oct 2023 04:49:24 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qutQt-0007fH-7U; Mon, 23 Oct 2023 13:49:19 +0200 Received: from [2a0a:edc0:2:b01:1d::c0] (helo=ptx.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qutQq-003hJw-Mt; Mon, 23 Oct 2023 13:49:16 +0200 Received: from ore by ptx.whiteo.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1qutQq-00FvNG-Jo; Mon, 23 Oct 2023 13:49:16 +0200 Date: Mon, 23 Oct 2023 13:49:16 +0200 From: Oleksij Rempel To: Ante Knezic Cc: UNGLinuxDriver@microchip.com, andrew@lunn.ch, conor+dt@kernel.org, davem@davemloft.net, devicetree@vger.kernel.org, edumazet@google.com, f.fainelli@gmail.com, krzysztof.kozlowski+dt@linaro.org, kuba@kernel.org, linux-kernel@vger.kernel.org, marex@denx.de, netdev@vger.kernel.org, olteanv@gmail.com, pabeni@redhat.com, robh+dt@kernel.org, woojung.huh@microchip.com Subject: Re: [PATCH net-next v4 2/2] net:dsa:microchip: add property to select Message-ID: <20231023114916.GC3787187@pengutronix.de> References: <20231023084150.GB3787187@pengutronix.de> <20231023085750.8537-1-ante.knezic@helmholz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231023085750.8537-1-ante.knezic@helmholz.de> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 23 Oct 2023 04:49:37 -0700 (PDT) On Mon, Oct 23, 2023 at 10:57:50AM +0200, Ante Knezic wrote: > On Mon, 23 Oct 2023 10:41:50 +0200, Oleksij Rempel wrote: > > > Here is KSZ8873 as initial reference: > > https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/00002348A.pdf > > 3.3.9 RMII INTERFACE OPERATION: > > "When EN_REFCLKO_3 is high, KSZ8873RLL will output a 50 MHz in REFCLKO_3. > > Register 198 bit[3] is used to select internal or external reference > > clock. Internal reference clock means that the clock for the RMII of > > KSZ8873RLL will be provided by the KSZ8873RLL internally and the > > REFCLKI_3 pin is unconnected. For the external reference clock, the > > clock will provide to KSZ8873RLL via REFCLKI_3." > > > > KSZ9897: > > http://ww1.microchip.com/downloads/en/DeviceDoc/00002330B.pdf > > 4.11.2 REDUCED MEDIA INDEPENDENT INTERFACE (RMII) > > The upper paragraph refers to the case when switch is acting as a clock > provider (regardless whether its set as internal or external reference > clock). You can see this if you look at the next paragraph: > "If KSZ8863RLL does not provide the reference clock, this 50 MHz reference > clock with divide-by-2 (25 MHz) has to be used in X1 pin instead of the > 25 MHz crystal, since the ..." > So rmii-clk-internal property does not select whether switch is acting > as a clock provider or clock consumer which is what you are refering to > I believe? The clock provider/consumer is set via strapping pins. > > Real case scenario: I have a board where switch is acting as a clock > provider, generating output to REFCLKO pin and feeding it to uC. > This board does not have externally routed copper track from REFCLKO > to REFCLKI, thus making the RMII interface not operable, unless the > rmii-clk-internal bit is set. > If this bit is not set, only way to make it running is to solder a > jumper wire from REFCLKO to REFCLKI. In case of KSZ8873 we seems to have something like: Switch MAC<-. | PLL -> clk sel -> REFCLKO \-----< REFCLKI Clock select in this case is controlled by Register 198 (0xC6). In case of KSZ9897 we probably have something like: Switch MAC<-. | PLL -> clk sel -> REFCLKO \--x--< REFCLKI | Gate REFCLKI if REFCLKO is used. In both cases: - KSZ8873, Setting bit3 in Register 198 (0xC6) will control use of clk select - KSZ9897, setting bit2 in Register 0xN301, will controll use of clk select and probably gate REFCLKI. So far, it looks very similar to me and it is usually handled by phy-mode rmii vs revrmii. Correct? So, the main question is still, do we need this kind of configuration per port or it is enough to have it per switch? For some reasons KSZ8863MLL datasheet provides RMII clock select configuration for two ports (port 1 and 3) https://ww1.microchip.com/downloads/aemDocuments/documents/UNG/ProductDocuments/DataSheets/KSZ8863MLL-FLL-RLL-Data-Sheet-00002335C.pdf May be there are variants with two RMIIs? Something similar but with multiple RMII interfaces seems to be supported by KSZ8864CNX: https://eu.mouser.com/datasheet/2/268/00002229A-1082534.pdf And all KSZ9xxx series seems to handle it per port as well. -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |