[net-next,v2,1/2] dt-bindings: net: mediatek,net: add phandles for SerDes on MT7988
Message ID | 35c12a115893d324db16ec6983afb5f1951fd4c9.1695058909.git.daniel@makrotopia.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2995635vqi; Mon, 18 Sep 2023 15:36:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFbUr1W1b3fgkLkzyPPZQ3RMC5caqwTnaVmQdx4VxvkfIBLruvepX8LKfItMxh3oSD6+36a X-Received: by 2002:a92:c247:0:b0:34f:cd3c:e029 with SMTP id k7-20020a92c247000000b0034fcd3ce029mr12612528ilo.13.1695076592897; Mon, 18 Sep 2023 15:36:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695076592; cv=none; d=google.com; s=arc-20160816; b=c4y1yhGqvgZaMliY9vEL3jDR9j7k7E8QedQZTx3nh7pd0WO36khDY8GiAn0XWb4Df5 RM0qmlPFhxJrMnJw7Zvbgy+kLFit6g9UDh5fFvLN+shYKRofJS/0aKwEeoIBWpT/FQId VU/OoH33+5OU1SX+Lhr1k7qC01g4MqFA35WzGBtggoxENmiNtsw6UJ1pGtoQIRzRNf8P +qkVBvGfoZvQ/Ssifn7FOGzyTgzD85NI62LH1uo2k/YakHF5u7wvwcbWvL6qnPdMxIop Lzghi/wftA0/IHdBUVXyjm+6kVGP5vd6+nq/lnPN9ZQpKIeI+Y1ZUxw1AgUuP0BOXVcW gbTA== 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:to:from:date; bh=yIqg8NfF8dEjK6PuGmtFIyuJOGRZ9y2mMzqcfzBkbRs=; fh=z6SMc47/fbKHWC0EF4m++RWwRv0itRNRAk3FMus4c04=; b=WNzUGwEoYcFuAKpIPPO/OQXPv9+Pae11yI/yZZCM0NqVUKpuqQNrUPx9/4ZQTtr7JO cwjODkY56WXRnkZH3EvqOsyPw1JJ3+fZQi/3b5tq65qOK8xoibsw/BEO8LCqtNdaFEPq PM1l39lEVRdEaAeSMFIR1aB4GDWrTEMIywRDMkc/1khFo/lthVSeWe/x/y18dBjFXztz J0yCEb528V1ZJTy9MoMLOlVODeE/md3VU4vlLWkzKDttjgep1s1QKDFLCbkb1TMXMw4O cZZupYG01fAm8XukTj+C6W0JMCVZ4xPwH0OTUmYylIQ7ndNvAfX/99RSm2yuHQ0XwGfv 35Zw== 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 Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id v3-20020a655c43000000b0053074c54c3fsi8459748pgr.868.2023.09.18.15.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 15:36:32 -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 96C8F821FD16; Mon, 18 Sep 2023 15:27:03 -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 S229473AbjIRW1A (ORCPT <rfc822;kernel.ruili@gmail.com> + 25 others); Mon, 18 Sep 2023 18:27:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbjIRW05 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 18 Sep 2023 18:26:57 -0400 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E842AC; Mon, 18 Sep 2023 15:26:51 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from <daniel@makrotopia.org>) id 1qiMhX-0002wi-01; Mon, 18 Sep 2023 22:26:43 +0000 Date: Mon, 18 Sep 2023 23:26:34 +0100 From: Daniel Golle <daniel@makrotopia.org> To: "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Felix Fietkau <nbd@nbd.name>, John Crispin <john@phrozen.org>, Sean Wang <sean.wang@mediatek.com>, Mark Lee <Mark-MC.Lee@mediatek.com>, Lorenzo Bianconi <lorenzo@kernel.org>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Russell King <linux@armlinux.org.uk>, 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: [PATCH net-next v2 1/2] dt-bindings: net: mediatek,net: add phandles for SerDes on MT7988 Message-ID: <35c12a115893d324db16ec6983afb5f1951fd4c9.1695058909.git.daniel@makrotopia.org> References: <cover.1695058909.git.daniel@makrotopia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <cover.1695058909.git.daniel@makrotopia.org> 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: <linux-kernel.vger.kernel.org> 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, 18 Sep 2023 15:27:03 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777416633345559892 X-GMAIL-MSGID: 1777416633345559892 |
Series |
net: ethernet: mtk_eth_soc: add paths and SerDes modes
|
|
Commit Message
Daniel Golle
Sept. 18, 2023, 10:26 p.m. UTC
Add several phandles needed for Ethernet SerDes interfaces on the
MediaTek MT7988 SoC.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
.../devicetree/bindings/net/mediatek,net.yaml | 28 +++++++++++++++++++
1 file changed, 28 insertions(+)
Comments
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 <daniel@makrotopia.org> > --- > .../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 > + > + 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 > + > + 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). > + > + 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 > + > patternProperties: > "^mac@[0-1]$": > type: object > -- > 2.42.0
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 <daniel@makrotopia.org> > > --- > > .../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.
On 19/09/2023 22:50, Daniel Golle wrote: > 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 <daniel@makrotopia.org> >>> --- >>> .../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. You can have reset for entire register, why not? And even if current Linux implementation had some troubles with this, you could fix it. > >> >>> + >>> + 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? Yes > > 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? What is above line? Please do not ask us to decode your vendor code. You know, we also have nothing to do with it. And anyway, why do you need to abstract it? Why not writing unconditionally? > > 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. Not only. You will also get all Linux infrastructure associated with this clock, so proper devlinks, sysfs/debug entries, automatic gating of unused clocks etc. Best regards, Krzysztof
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. + + 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. + + 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. + + mediatek,xfi-pll: + $ref: /schemas/types.yaml#/definitions/phandle + description: + Phandle to the syscon node handling the 10GE SerDes clock setup. + patternProperties: "^mac@[0-1]$": type: object