Message ID | f2d447d8b836cf9584762465a784185e8fcf651f.1683813687.git.daniel@makrotopia.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4432399vqo; Thu, 11 May 2023 07:49:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5w+ygsckhnYqplDUBg/JetJDzqDQRQC6bj8jl1Kl6AOn2BHv1PqiWtnPqPi8iV+rTz2jlJ X-Received: by 2002:a05:6a20:a125:b0:103:be8d:d512 with SMTP id q37-20020a056a20a12500b00103be8dd512mr3910926pzk.23.1683816542260; Thu, 11 May 2023 07:49:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683816542; cv=none; d=google.com; s=arc-20160816; b=cCOqz16vWvCECNl1iuyDqHqNUSn/RjP8czAl7txlov3zhcGN0a2ANZD4E0wg1iYhB4 n7FBd32YB4nPG2bCzZKloXBn52/OVHqQWgUyz+m4eRndPjODmY/XvF4VAHAeJkpqQVPd nskDHzOGEbJiQ4ahAvPky9TbAUEiMETl9MgzeUDSGsZO0QOhOImUlFUciZbgjxsqdcsw 2O1e+Esgb04BvGbieEYPGwV8TWZsGupBPwPA7DDqDGLwGoSSsMgqxDJaAx2spvV0p/np B2i48A+ejSbFpsyye29R2glwGtcwZm8weiQ6LywESdDUKlVK8QyKWNqyl0L6Pq8rzl8x NDSw== 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=tSedURZCH4O9rUDcwf0+7htNhZ8IPJW3gu96SwEEe38=; b=bhWmMQ6rNjqO2CoYKHuld/sW1UZgdCrDm6AgUSglXDA5/cAAQoRGA1K+jtVzSAryso 4RUTmGxnaG29VD7fKlwwy0JA/8mxLUN8MC1XD/C4ae/j/1NYFpc9/xg+yTIbyK95vKOq xDLjvpvSGQypu0Epwwbdkhj6SMniQF9Z7R7aGn7TqNZ88pfcXqwVA7ZZ3XH9YO0Rv3lh +xGvwuWS+pL6Obl4YBsE55hEoN4uPLmc0IFJqqOTAztooehPocbCToLMngKujIIc5QkM UYo6QUL90a1HbwBIC+23KGANbrqDPN07op4/mboOKRXGZjDFSbeWyUqeaPT4GE+R4Vtz +MTg== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g67-20020a636b46000000b005030006a2desi6414965pgc.182.2023.05.11.07.48.49; Thu, 11 May 2023 07:49:02 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238606AbjEKOod (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Thu, 11 May 2023 10:44:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238268AbjEKOoD (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 11 May 2023 10:44:03 -0400 X-Greylist: delayed 1641 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 11 May 2023 07:39:49 PDT Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEDD91156A; Thu, 11 May 2023 07:39:49 -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 1px71g-0000mM-2M; Thu, 11 May 2023 14:12:12 +0000 Date: Thu, 11 May 2023 16:10:20 +0200 From: Daniel Golle <daniel@makrotopia.org> To: devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Qingfang Deng <dqfext@gmail.com>, SkyLake Huang <SkyLake.Huang@mediatek.com>, Simon Horman <simon.horman@corigine.com> Subject: [PATCH net-next v4 1/2] dt-bindings: arm: mediatek: add mediatek,boottrap binding Message-ID: <f2d447d8b836cf9584762465a784185e8fcf651f.1683813687.git.daniel@makrotopia.org> References: <cover.1683813687.git.daniel@makrotopia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <cover.1683813687.git.daniel@makrotopia.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765609614884231577?= X-GMAIL-MSGID: =?utf-8?q?1765609614884231577?= |
Series |
net: phy: add driver for MediaTek SoC built-in GE PHYs
|
|
Commit Message
Daniel Golle
May 11, 2023, 2:10 p.m. UTC
The boottrap is used to read implementation details from the SoC, such
as the polarity of LED pins. Add bindings for it as we are going to use
it for the LEDs connected to MediaTek built-in 1GE PHYs.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
.../arm/mediatek/mediatek,boottrap.yaml | 37 +++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,boottrap.yaml
Comments
On Thu, May 11, 2023 at 04:10:20PM +0200, Daniel Golle wrote: > The boottrap is used to read implementation details from the SoC, such > as the polarity of LED pins. Add bindings for it as we are going to use > it for the LEDs connected to MediaTek built-in 1GE PHYs. What exactly is it? Fuses? Is it memory mapped, or does it need a driver to access it? How is it shared between its different users? Thank Andrew
On Thu, 11 May 2023 16:10:20 +0200, Daniel Golle wrote: > The boottrap is used to read implementation details from the SoC, such > as the polarity of LED pins. Add bindings for it as we are going to use > it for the LEDs connected to MediaTek built-in 1GE PHYs. > > Signed-off-by: Daniel Golle <daniel@makrotopia.org> > --- > .../arm/mediatek/mediatek,boottrap.yaml | 37 +++++++++++++++++++ > 1 file changed, 37 insertions(+) > create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,boottrap.yaml > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13): yamllint warnings/errors: dtschema/dtc warnings/errors: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/mediatek/mediatek,boottrap.example.dtb: boottrap@1001f6f0: $nodename:0: 'boottrap' was expected From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/mediatek/mediatek,boottrap.yaml /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/mediatek/mediatek,boottrap.example.dtb: boottrap@1001f6f0: reg: [[0, 268564208], [0, 32]] is too long From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/mediatek/mediatek,boottrap.yaml See https://patchwork.ozlabs.org/patch/1780124 This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1. If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date: pip3 install dtschema --upgrade Please check and re-submit.
On 11/05/2023 17:53, Andrew Lunn wrote: > On Thu, May 11, 2023 at 04:10:20PM +0200, Daniel Golle wrote: >> The boottrap is used to read implementation details from the SoC, such >> as the polarity of LED pins. Add bindings for it as we are going to use >> it for the LEDs connected to MediaTek built-in 1GE PHYs. > > What exactly is it? Fuses? Is it memory mapped, or does it need a > driver to access it? How is it shared between its different users? Yes, looks like some efuse/OTP/nvmem, so it should probably use nvmem bindings and do not look different than other in such class. Best regards, Krzysztof
On Fri, May 12, 2023 at 08:54:36AM +0200, Krzysztof Kozlowski wrote: > On 11/05/2023 17:53, Andrew Lunn wrote: > > On Thu, May 11, 2023 at 04:10:20PM +0200, Daniel Golle wrote: > >> The boottrap is used to read implementation details from the SoC, such > >> as the polarity of LED pins. Add bindings for it as we are going to use > >> it for the LEDs connected to MediaTek built-in 1GE PHYs. > > > > What exactly is it? Fuses? Is it memory mapped, or does it need a > > driver to access it? How is it shared between its different users? > > Yes, looks like some efuse/OTP/nvmem, so it should probably use nvmem > bindings and do not look different than other in such class. I've asked MediaTek and they have replied with an elaborate definition. Summary: The boottrap is a single 32-bit wide register at 0x1001f6f0 which can be used to read back the bias of bootstrap pins from the SoC as follows: * bit[8]: Reference CLK source && gphy port0's LED If bit[8] == 0: - Reference clock source is XTRL && gphy port0's LED is pulled low on board side If bit[8] == 1: - Reference clock source is Oscillator && gphy port0's LED is pulled high on board side * bit[9]: DDR type && gphy port1's LED If bit[9] == 0: - DDR type is DDRx16b x2 && gphy port1's LED is pulled low on board side If bit[9] == 1: - DDR type is DDRx16b x1 && gphy port1's LED is pulled high on board side * bit[10]: gphy port2's LED If bit[10] == 0: - phy port2's LED is pulled low on board side If bit[10] == 1: - gphy port2's LED is pulled high on board side * bit[11]: gphy port3's LED If bit[11] == 0: - phy port3's LED is pulled low on board side If bit[11] == 1: - gphy port3's LED is pulled high on board side If bit[10] == 0 && bit[11] == 0: - BROM will boot from SPIM-NOR If bit[10] == 1 && bit[11] == 0: - BROM will boot from SPIM-NAND If bit[10] == 0 && bit[11] == 1: - BROM will boot from eMMC If bit[10] == 1 && bit[11] == 1: - BROM will boot from SNFI-NAND The boottrap is present in many MediaTek SoCs, however, support for reading it is only really needed on MT7988 due to the dual-use of some bootstrap pins as PHY LEDs. We could say this is some kind of read-only 'syscon' node (and hence use regmap driver to access it), that would make it easy but it's not very accurate. Also efuse/OTP/nvmem doesn't seem accurate, though in terms of software it could work just as well. I will update DT bindings to contain the gained insights. Please advise if any existing driver (syscon/regmap or efuse/OTP/nvmem) should be used or if it's ok to just use plain mmio in the PHY driver. Best regards Daniel
On 18/05/2023 04:44, Daniel Golle wrote: > On Fri, May 12, 2023 at 08:54:36AM +0200, Krzysztof Kozlowski wrote: >> On 11/05/2023 17:53, Andrew Lunn wrote: >>> On Thu, May 11, 2023 at 04:10:20PM +0200, Daniel Golle wrote: >>>> The boottrap is used to read implementation details from the SoC, such >>>> as the polarity of LED pins. Add bindings for it as we are going to use >>>> it for the LEDs connected to MediaTek built-in 1GE PHYs. >>> >>> What exactly is it? Fuses? Is it memory mapped, or does it need a >>> driver to access it? How is it shared between its different users? >> >> Yes, looks like some efuse/OTP/nvmem, so it should probably use nvmem >> bindings and do not look different than other in such class. > > I've asked MediaTek and they have replied with an elaborate definition. > Summary: > The boottrap is a single 32-bit wide register at 0x1001f6f0 which can > be used to read back the bias of bootstrap pins from the SoC as follows: Is it within some other address space? Register address suggests that. In such case you should not create a device in the middle of other device's address space. You punched a hole in uniform address space which prevents creating that other device for entire space. > > * bit[8]: Reference CLK source && gphy port0's LED > If bit[8] == 0: > - Reference clock source is XTRL && gphy port0's LED is pulled low on board side > If bit[8] == 1: > - Reference clock source is Oscillator && gphy port0's LED is pulled high on board side > > * bit[9]: DDR type && gphy port1's LED > If bit[9] == 0: > - DDR type is DDRx16b x2 && gphy port1's LED is pulled low on board side > If bit[9] == 1: > - DDR type is DDRx16b x1 && gphy port1's LED is pulled high on board side > > * bit[10]: gphy port2's LED > If bit[10] == 0: > - phy port2's LED is pulled low on board side > If bit[10] == 1: > - gphy port2's LED is pulled high on board side > > * bit[11]: gphy port3's LED > If bit[11] == 0: > - phy port3's LED is pulled low on board side > If bit[11] == 1: > - gphy port3's LED is pulled high on board side > > If bit[10] == 0 && bit[11] == 0: > - BROM will boot from SPIM-NOR > If bit[10] == 1 && bit[11] == 0: > - BROM will boot from SPIM-NAND > If bit[10] == 0 && bit[11] == 1: > - BROM will boot from eMMC > If bit[10] == 1 && bit[11] == 1: > - BROM will boot from SNFI-NAND > > The boottrap is present in many MediaTek SoCs, however, support for > reading it is only really needed on MT7988 due to the dual-use of some > bootstrap pins as PHY LEDs. > > We could say this is some kind of read-only 'syscon' node (and hence > use regmap driver to access it), that would make it easy but it's not > very accurate. Also efuse/OTP/nvmem doesn't seem accurate, though in > terms of software it could work just as well. > > I will update DT bindings to contain the gained insights. If this is separate address space with one register, then boottrap sounds ok. If you have multiple read only registers with fused values, then this is efuse region, so something like nvidia,tegra20-efuse. Best regards, Krzysztof
On 18/05/2023 09:50, Krzysztof Kozlowski wrote: > On 18/05/2023 04:44, Daniel Golle wrote: >> On Fri, May 12, 2023 at 08:54:36AM +0200, Krzysztof Kozlowski wrote: >>> On 11/05/2023 17:53, Andrew Lunn wrote: >>>> On Thu, May 11, 2023 at 04:10:20PM +0200, Daniel Golle wrote: >>>>> The boottrap is used to read implementation details from the SoC, such >>>>> as the polarity of LED pins. Add bindings for it as we are going to use >>>>> it for the LEDs connected to MediaTek built-in 1GE PHYs. >>>> >>>> What exactly is it? Fuses? Is it memory mapped, or does it need a >>>> driver to access it? How is it shared between its different users? >>> >>> Yes, looks like some efuse/OTP/nvmem, so it should probably use nvmem >>> bindings and do not look different than other in such class. >> >> I've asked MediaTek and they have replied with an elaborate definition. >> Summary: >> The boottrap is a single 32-bit wide register at 0x1001f6f0 which can >> be used to read back the bias of bootstrap pins from the SoC as follows: > > Is it within some other address space? Register address suggests that. > > In such case you should not create a device in the middle of other > device's address space. You punched a hole in uniform address space > which prevents creating that other device for entire space. > >> >> * bit[8]: Reference CLK source && gphy port0's LED >> If bit[8] == 0: >> - Reference clock source is XTRL && gphy port0's LED is pulled low on board side >> If bit[8] == 1: >> - Reference clock source is Oscillator && gphy port0's LED is pulled high on board side >> >> * bit[9]: DDR type && gphy port1's LED >> If bit[9] == 0: >> - DDR type is DDRx16b x2 && gphy port1's LED is pulled low on board side >> If bit[9] == 1: >> - DDR type is DDRx16b x1 && gphy port1's LED is pulled high on board side >> >> * bit[10]: gphy port2's LED >> If bit[10] == 0: >> - phy port2's LED is pulled low on board side >> If bit[10] == 1: >> - gphy port2's LED is pulled high on board side >> >> * bit[11]: gphy port3's LED >> If bit[11] == 0: >> - phy port3's LED is pulled low on board side >> If bit[11] == 1: >> - gphy port3's LED is pulled high on board side >> >> If bit[10] == 0 && bit[11] == 0: >> - BROM will boot from SPIM-NOR >> If bit[10] == 1 && bit[11] == 0: >> - BROM will boot from SPIM-NAND >> If bit[10] == 0 && bit[11] == 1: >> - BROM will boot from eMMC >> If bit[10] == 1 && bit[11] == 1: >> - BROM will boot from SNFI-NAND >> >> The boottrap is present in many MediaTek SoCs, however, support for >> reading it is only really needed on MT7988 due to the dual-use of some >> bootstrap pins as PHY LEDs. >> >> We could say this is some kind of read-only 'syscon' node (and hence >> use regmap driver to access it), that would make it easy but it's not >> very accurate. Also efuse/OTP/nvmem doesn't seem accurate, though in >> terms of software it could work just as well. >> >> I will update DT bindings to contain the gained insights. > > If this is separate address space with one register, then boottrap > sounds ok. If you have multiple read only registers with fused values, > then this is efuse region, so something like nvidia,tegra20-efuse. Please align together on some common solution. It looks like you are solving the same problem: https://lore.kernel.org/all/?q=%22nvmem%3A+syscon%3A+Add+syscon+backed+nvmem+driver%22 Best regards, Krzysztof
diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,boottrap.yaml b/Documentation/devicetree/bindings/arm/mediatek/mediatek,boottrap.yaml new file mode 100644 index 000000000000..460e375320a4 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,boottrap.yaml @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/arm/mediatek/mediatek,boottrap.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MediaTek boottrap + +maintainers: + - Daniel Golle <daniel@makrotopia.org> + +description: + The boottrap found in some MediaTek SoCs is used to read SoC implementation + details such as LED polarities. + +properties: + $nodename: + const: boottrap + + compatible: + const: mediatek,boottrap + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + boottrap: boottrap@1001f6f0 { + compatible = "mediatek,boottrap"; + reg = <0 0x1001f6f0 0 0x20>; + };