Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp903647rdb; Tue, 19 Sep 2023 13:53:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFq3NFC7lS2USU+oZffRgvo2LVmRDm8EqXFsJTd8Kr7pbbjEoqqoXFDkujaxy/vFjfYw0an X-Received: by 2002:a17:903:18e:b0:1bb:94ed:20a with SMTP id z14-20020a170903018e00b001bb94ed020amr610383plg.24.1695156834546; Tue, 19 Sep 2023 13:53:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695156834; cv=none; d=google.com; s=arc-20160816; b=hi8EfXL2eS8W3U4Ut3yInb42AfLmKYFH9L7V/ASaP1n2Mwq4jd8cQSzPim+DZ9P/eb tRvhZA5nU+V0n60hx0JTySMT6Ml4szY7/FowJkjYqbAmNCPWv+aw6x+NK3jz1P4rWvkO V0n9F47iCNPu15yOyT7/XHhJ7SLOTNqdAfHM8FoaFFiA9FPf9BgCiryiv9FWuLRdj1k3 WAubVmXkKRwPvKzErC3MCudBetukQ9U6y58HWr4rxjL6k467qq8pigdvGxkOpgoakgot XjByFPQqrBKFV91i2oTHDMm5q2VHZdTXzA8BE14y9cz8zGFNuX1yTydbzNGmhwT/QuOE D5kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=VbupnqNePPSApusEEeMOwHawfGbZVx+B7J1El+BwtS0=; fh=7Jq9qW5KNyA01rDyIGr/2GEapb0mhacJjBa+BBF7cIQ=; b=Tf25rR7TRjXfhj2A/BkxiRRtFOmIAJS5IEL4C1uxA2Pky7OD0UqaEhMigicx6JDW32 tlx0TG2c4Z7lTcpWA9gWk1CtTcGuPwcT07UegUQyfgdrzxmRiuL0W1ctbHcAgN+JVuqL gsVdUmszGl7RErwmuRFqFOtMjTjOCXXSg29iIBya1M9qS6+6jdVvAdSf1ngXgaGtjOmJ vptJ3OgB7v9ZByGfl/PtBspyAsSpmqHrFOkk4QBlJTdjPdWvLiT66agsQkkHPSP2Ijmy 1ARqA+wi8McdjxtVfJVmSOG0//nwgYithjdf6Zr+tEfkT2LxRqKKT/3oerVzOJTb10IQ Z55g== 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:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id l12-20020a170903244c00b001c3991e57dasi10746657pls.396.2023.09.19.13.53.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 13:53:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 92FE980A137C; Tue, 19 Sep 2023 13:51:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233233AbjISUvW (ORCPT + 99 others); Tue, 19 Sep 2023 16:51:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233222AbjISUvU (ORCPT ); Tue, 19 Sep 2023 16:51:20 -0400 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7948BD; Tue, 19 Sep 2023 13:51:11 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1qihgL-00082Y-13; Tue, 19 Sep 2023 20:50:53 +0000 Date: Tue, 19 Sep 2023 21:50:44 +0100 From: Daniel Golle To: Rob Herring Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Krzysztof Kozlowski , Conor Dooley , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH net-next v2 1/2] dt-bindings: net: mediatek,net: add phandles for SerDes on MT7988 Message-ID: References: <35c12a115893d324db16ec6983afb5f1951fd4c9.1695058909.git.daniel@makrotopia.org> <20230919180909.GA4151534-robh@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230919180909.GA4151534-robh@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 morse.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 (morse.vger.email [0.0.0.0]); Tue, 19 Sep 2023 13:51:25 -0700 (PDT) Hi Rob, thank you for the review! On Tue, Sep 19, 2023 at 01:09:09PM -0500, Rob Herring wrote: > On Mon, Sep 18, 2023 at 11:26:34PM +0100, Daniel Golle wrote: > > Add several phandles needed for Ethernet SerDes interfaces on the > > MediaTek MT7988 SoC. > > > > Signed-off-by: Daniel Golle > > --- > > .../devicetree/bindings/net/mediatek,net.yaml | 28 +++++++++++++++++++ > > 1 file changed, 28 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/net/mediatek,net.yaml b/Documentation/devicetree/bindings/net/mediatek,net.yaml > > index e74502a0afe86..78219158b96af 100644 > > --- a/Documentation/devicetree/bindings/net/mediatek,net.yaml > > +++ b/Documentation/devicetree/bindings/net/mediatek,net.yaml > > @@ -385,6 +385,34 @@ allOf: > > minItems: 2 > > maxItems: 2 > > > > + mediatek,toprgu: > > + $ref: /schemas/types.yaml#/definitions/phandle > > + description: > > + Phandle to the syscon representing the reset controller. > > Use the reset binding I got an alternative implementation ready which implements an actual reset controller (by extending drivers/watchdog/mtk_wdt.c to cover also MT7988 and its addition sw-reset-enable bits) and uses single phandles for each reset bit assigned to the corresponding units instead of listing them all for the ethernet controller (maybe that's one step too far though...) However, as mentioned in the cover letter, using the Linux reset controller API (which having to use is a consequence of having to use the reset bindings) doesn't allow to simultanously deassert the resets of pextp, usxgmii pcs and/or sgmii pcs which is how the vendor implementation is doing it as all reset bits are on the same 32-bit register and the Ethernet driver is the only driver needing to access that register. Asserting the resets in sequence and subsequently deasserting in sequence works for me, but it will have to be confirmed to not create any problems because it's clearly a deviation from the behavior of the reference implementation. > > > + > > + mediatek,usxgmiisys: > > + $ref: /schemas/types.yaml#/definitions/phandle-array > > + minItems: 2 > > + maxItems: 2 > > + items: > > + maxItems: 1 > > + description: > > + A list of phandle to the syscon node referencing the USXGMII PCS. > > Use the PCS binding Ack, I will ie. implement standalone PCS driver similar to eg. pcs-rzn1-miic.c. > > > + > > + mediatek,xfi-pextp: > > + $ref: /schemas/types.yaml#/definitions/phandle-array > > + minItems: 2 > > + maxItems: 2 > > + items: > > + maxItems: 1 > > + description: > > + A list of phandle to the syscon node that handles the 10GE SerDes PHY. > > Use the phy binding (phys, not phy-handle for ethernet PHY). Ack, this can be implemented as a standalone PHY driver using PHY bindings. I will do that instead. > > > + > > + mediatek,xfi-pll: > > + $ref: /schemas/types.yaml#/definitions/phandle > > + description: > > + Phandle to the syscon node handling the 10GE SerDes clock setup. > > Use the clock binding Does that imply that I should implement a clock driver whith only a single clock offering only a single operation ('enable') which would then do the magic register writes? While one part is actually identifyable as taking care of enabling a clock, I would not know how to meaningfully abstract the other (first) part, see vendor driver: /* Register to control USXGMII XFI PLL digital */ #define XFI_PLL_DIG_GLB8 0x08 #define RG_XFI_PLL_EN BIT(31) /* Register to control USXGMII XFI PLL analog */ #define XFI_PLL_ANA_GLB8 0x108 #define RG_XFI_PLL_ANA_SWWA 0x02283248 [...] /* Add software workaround for USXGMII PLL TCL issue */ regmap_write(ss->pll, XFI_PLL_ANA_GLB8, RG_XFI_PLL_ANA_SWWA); // How would you represent the line above using the abstractions of the // common clk framework? regmap_read(ss->pll, XFI_PLL_DIG_GLB8, &val); // that looks like it val |= RG_XFI_PLL_EN; // <- could be a abstracted regmap_write(ss->pll, XFI_PLL_DIG_GLB8, val); // in a meaningful way in clock driver. ... which is all we ever do on that regmap. Ever. Thanks in advance to everybody sharing their ideas and advises.