From patchwork Tue Dec 14 23:34:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 12676929 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D5F9C433F5 for ; Tue, 14 Dec 2021 23:34:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238263AbhLNXeo (ORCPT ); Tue, 14 Dec 2021 18:34:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235236AbhLNXen (ORCPT ); Tue, 14 Dec 2021 18:34:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81070C061574; Tue, 14 Dec 2021 15:34:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4D698B81DC8; Tue, 14 Dec 2021 23:34:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2AF0C34605; Tue, 14 Dec 2021 23:34:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639524881; bh=F9c6TqEtJNBAy48jwMwJKWur2ITtODBYI89zx7MFjgM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YRj/z3iQr74eRpqmQnsNL4rZUrf3Y+SwYbqaHxUtaGPB7OfXQ97mAni/3sa+TRvTE OHdp9JM7nJSRaM1KeoUbYEG1zbnobPSsweHIWDSdOwzCix1v5kOBH68QuA5/hKvsRx DngRiPiRAy2KzQ+6oBaGNyMScLwHLOjG+780tcY2jK+85hEaJaBPun5EGIph1rCvB0 CYSgf2Y+F07OpvhQQtn7CGbtLr0rkWxix2O2x36DMmJasYjVPob1/dbwHgOBijZIFp MFJfGbJ3CSNVFOjA30jcclJP85IbepID6HinXhESIjjvkL630FsQmjDY9G9B8XDTIG XzOvwgq77YM6A== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Rob Herring , devicetree@vger.kernel.org Cc: Vladimir Oltean , Holger Brunck , Andrew Lunn , "netdev@vger.kernel.org" , Russell King , linux-phy@lists.infradead.org, Vinod Koul , Kishon Vijay Abraham I , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH devicetree 1/2] dt-bindings: phy: Convert generic PHY provider binding to YAML Date: Wed, 15 Dec 2021 00:34:31 +0100 Message-Id: <20211214233432.22580-2-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214233432.22580-1-kabel@kernel.org> References: <20211214233432.22580-1-kabel@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Convert phy-bindings.txt to YAML. This creates binding only for PHY provider, since PHY consumer binding is in dtschema. Consumer binding example is provided. Signed-off-by: Marek BehĂșn --- .../devicetree/bindings/phy/phy-bindings.txt | 73 +------------------ .../devicetree/bindings/phy/phy.yaml | 59 +++++++++++++++ 2 files changed, 60 insertions(+), 72 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/phy.yaml diff --git a/Documentation/devicetree/bindings/phy/phy-bindings.txt b/Documentation/devicetree/bindings/phy/phy-bindings.txt index c4eb38902533..ded3cf18352d 100644 --- a/Documentation/devicetree/bindings/phy/phy-bindings.txt +++ b/Documentation/devicetree/bindings/phy/phy-bindings.txt @@ -1,72 +1 @@ -This document explains only the device tree data binding. For general -information about PHY subsystem refer to Documentation/driver-api/phy/phy.rst - -PHY device node -=============== - -Required Properties: -#phy-cells: Number of cells in a PHY specifier; The meaning of all those - cells is defined by the binding for the phy node. The PHY - provider can use the values in cells to find the appropriate - PHY. - -Optional Properties: -phy-supply: Phandle to a regulator that provides power to the PHY. This - regulator will be managed during the PHY power on/off sequence. - -For example: - -phys: phy { - compatible = "xxx"; - reg = <...>; - . - . - #phy-cells = <1>; - . - . -}; - -That node describes an IP block (PHY provider) that implements 2 different PHYs. -In order to differentiate between these 2 PHYs, an additional specifier should be -given while trying to get a reference to it. - -PHY user node -============= - -Required Properties: -phys : the phandle for the PHY device (used by the PHY subsystem; not to be - confused with the Ethernet specific 'phy' and 'phy-handle' properties, - see Documentation/devicetree/bindings/net/ethernet.txt for these) -phy-names : the names of the PHY corresponding to the PHYs present in the - *phys* phandle - -Example 1: -usb1: usb_otg_ss@xxx { - compatible = "xxx"; - reg = ; - . - . - phys = <&usb2_phy>, <&usb3_phy>; - phy-names = "usb2phy", "usb3phy"; - . - . -}; - -This node represents a controller that uses two PHYs, one for usb2 and one for -usb3. - -Example 2: -usb2: usb_otg_ss@xxx { - compatible = "xxx"; - reg = ; - . - . - phys = <&phys 1>; - phy-names = "usbphy"; - . - . -}; - -This node represents a controller that uses one of the PHYs of the PHY provider -device defined previously. Note that the phy handle has an additional specifier -"1" to differentiate between the two PHYs. +This file has moved to ./phy.yaml. diff --git a/Documentation/devicetree/bindings/phy/phy.yaml b/Documentation/devicetree/bindings/phy/phy.yaml new file mode 100644 index 000000000000..a5b6b04cff5b --- /dev/null +++ b/Documentation/devicetree/bindings/phy/phy.yaml @@ -0,0 +1,59 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Common PHY Provider Generic Binding + +description: + This is the generic binding for common PHYs providers. + +maintainers: + - Kishon Vijay Abraham I + - Vinod Koul + +select: + required: + - '#phy-cells' + +properties: + '#phy-cells': + $ref: '/schemas/types.yaml#/definitions/uint32' + description: + Number of cells in a PHY specifier. The meaning of all those cells is + defined by the binding for the PHY node. The PHY provider can use the + values in cells to find the appropriate PHY. + maximum: 16 + + phy-supply: + description: + Phandle to a regulator that provides power to the PHY. This regulator + will be managed during the PHY power on/off sequence. + +required: + - '#phy-cells' + +additionalProperties: true + +examples: + - | + phy_regulator: regulator { + compatible = "regulator-fixed"; + regulator-name = "phy-regulator"; + }; + + phy: phy { + #phy-cells = <1>; + phy-supply = <&phy_regulator>; + }; + + ethernet-controller { + phys = <&phy 0>; + phy-names = "ethphy"; + }; + + usb { + phys = <&phy 1>, <&phy 2>; + phy-names = "usb2phy", "usb3phy"; + }; From patchwork Tue Dec 14 23:34:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 12676931 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD1E2C4332F for ; Tue, 14 Dec 2021 23:34:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238271AbhLNXeq (ORCPT ); Tue, 14 Dec 2021 18:34:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238264AbhLNXep (ORCPT ); Tue, 14 Dec 2021 18:34:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1900C06173E; Tue, 14 Dec 2021 15:34:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3AFE06171C; Tue, 14 Dec 2021 23:34:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E5A3C34600; Tue, 14 Dec 2021 23:34:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639524883; bh=6dXrC0FdP3B7Ezq06gX3Eh2HgFGakgLcBGUR+xmwRJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CDUAediloFuCmcB9BNlhg5n0N1FHNME3+vDj6IfDmNGTx3CXxpawQ5sHfQnc2nA3t 031Dm6ivnTlc9z0ghNmir0dw602lSydMwo3Jj7mT6myPNvQ23mVB9E2yq99wEAUYa3 rq+jj9yTF1FrinGx0NanIEIY2akkclnQqPxPLMEXy/GtsbPAUV/rdNODjhoR4NO4Tm KHBTAeZLapyZ/cvwx1jXJtTUL6ut7HaIlHqe6UuhDE20PBBqFLclm4W0YCtMj3ZiyC qBt8j6QkTND9yE64RZOV0UhZZoDZPK89OiLbUArpOgWuropPGZkL2DzIpxtyrIW8zr q1khD+mYfSluQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Rob Herring , devicetree@vger.kernel.org Cc: Vladimir Oltean , Holger Brunck , Andrew Lunn , "netdev@vger.kernel.org" , Russell King , linux-phy@lists.infradead.org, Vinod Koul , Kishon Vijay Abraham I , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH devicetree 2/2] dt-bindings: phy: Add `tx-amplitude-microvolt` property binding Date: Wed, 15 Dec 2021 00:34:32 +0100 Message-Id: <20211214233432.22580-3-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214233432.22580-1-kabel@kernel.org> References: <20211214233432.22580-1-kabel@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Common PHYs often have the possibility to specify peak-to-peak voltage on the differential pair - the default voltage sometimes needs to be changed for a particular board. Add properties `tx-amplitude-microvolt` and `tx-amplitude-microvolt-names` for this purpose. The second property is needed to specify Example usage with only one voltage (it will be used for all supported PHY modes, the `tx-amplitude-microvolt-names` property is not needed in this case): tx-amplitude-microvolt = <915000>; Example usage with voltages for multiple modes: tx-amplitude-microvolt = <915000>, <1100000>, <1200000>; tx-amplitude-microvolt-names = "2500base-x", "usb", "pcie"; Signed-off-by: Marek BehĂșn --- I wanted to constrain the values allowed in the `tx-amplitude-microvolt-names` property to: - ethernet SerDes modes (sgmii, qsgmii, 10gbase-r, 2500base-x, ...) - PCIe modes (pattern: ^pcie[1-6]?$) - USB modes (pattern: ^usb((-host|-device|-otg)?-(ls|fs|hs|ss|ss\+|4))?$) - DisplayPort modes (pattern: ^dp(-rbr|-hbr[23]?|-uhbr-(10|13.5|20))?$) - Camera modes (mipi-dphy, mipi-dphy-univ, mipi-dphy-v2.5-univ) - Storage modes (sata, ufs-hs, ufs-hs-a, ufs-hs-b) But was unable to. The '-names' suffix implies string-array type, and string-array type does not allow to specify a type for all items in a simple way, i.e.: items: enum: - sgmii - sata - usb ... Such constraint does work when changing ethernet controller's `phy-connection-type` to array, see https://lore.kernel.org/netdev/20211123164027.15618-2-kabel@kernel.org/ But it seems that string-array type prohibits this. --- .../devicetree/bindings/phy/phy.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/phy.yaml b/Documentation/devicetree/bindings/phy/phy.yaml index a5b6b04cff5b..8915065cf6c2 100644 --- a/Documentation/devicetree/bindings/phy/phy.yaml +++ b/Documentation/devicetree/bindings/phy/phy.yaml @@ -31,9 +31,29 @@ properties: Phandle to a regulator that provides power to the PHY. This regulator will be managed during the PHY power on/off sequence. + tx-amplitude-microvolt: + description: + Transmit amplitude voltages in microvolts, peak-to-peak. If this property + contains multiple values for various PHY modes, the + 'tx-amplitude-microvolt-names' property must be provided and contain + corresponding mode names. + + tx-amplitude-microvolt-names: + description: | + Names of the modes corresponding to voltages in the + 'tx-amplitude-microvolt' property. Required only if multiple voltages + are provided. + + If a value of 'default' is provided, the system should use it for any PHY + mode that is otherwise not defined here. If 'default' is not provided, the + system should use manufacturer default value. + required: - '#phy-cells' +dependencies: + tx-amplitude-microvolt-names: [ tx-amplitude-microvolt ] + additionalProperties: true examples: @@ -46,6 +66,8 @@ examples: phy: phy { #phy-cells = <1>; phy-supply = <&phy_regulator>; + tx-amplitude-microvolt = <915000>, <1100000>, <1200000>; + tx-amplitude-microvolt-names = "2500base-x", "usb-hs", "usb-ss"; }; ethernet-controller {