From patchwork Sat Nov 25 00:11:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13468323 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B682C61DF4 for ; Sat, 25 Nov 2023 00:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=eNBo1uyYAHLrR8jsyAUtLrhZ2hlGu1u1rG9crxcJ8f8=; b=s5Q+2/+M2UDtEQ sv0T6IdsAewkPIg6RtWxYX3XMPgGE2xmbRUQV7zOgSVMCs4EoBPjfPxUEeaTbhoyiQ+sV+FaRmbr0 Z0aYmz33fHxx7R7mOYi9rC/MUBfsKjJub7iVPqOLPN4RI8NB9l3lss2yA4TvetsohpzC/QKo5h7NX q9TcXO5E7yfjFxfgqRHmuFAvS5MfyNpzKJuR1iPIpg15bXBv/4cYNPqt4RUQ9uoq90kmaqpwjLJQp DrXs+lq935Yefm0lnRnxQWAiMFL96A1bZCq4ILLfBgJneTAqx12t+vYr2YniT2XJPYKSLtgPBfyLD H7HrF8/vFcktB3wUf2wg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r6gdq-008FBF-1O; Sat, 25 Nov 2023 00:35:26 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r6gdk-008FAF-0f; Sat, 25 Nov 2023 00:35:22 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40b27b498c3so18341445e9.0; Fri, 24 Nov 2023 16:35:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700872517; x=1701477317; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=4gJ4dsCN4jAp0Z6B7bPy+5n1kCmEg5zx74BRyzkdzqY=; b=heUHkgeZeyTJDX3q5p7IhHZOZa1tNIB1CULJRCOc71K6jynpi2D5jW+/ClwDHKOBBU /b6BMhdiOOerjF+ougzEEAmr1ILzvZFFgEoqj9tFySixaObuV0yxC+oIzC9wA8rVsrm8 g65af3xTa8CC4xDzgMbyFRazVzI8Nb0v6tgh3ENSg82c7QoGrDc9UEl4YRd3pC1c4JhR qK7OitbGZDqhuQjijMD5VUa/gPodt1Bv62zgxgvhGaY+Irif6HeRZ6AbQQmuoWKwGXnd +KDntaAZKzYH72+Qdlenw1DtApTzlT2BqyDFlePrd6xTgSjpb0WUAfw1L51L0XG8np0z toLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700872517; x=1701477317; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4gJ4dsCN4jAp0Z6B7bPy+5n1kCmEg5zx74BRyzkdzqY=; b=fFoXWLL33Y+lDv+916THLgcxBJqy4Lt67oyfP78IQ6f867260X0+3IhrKN0HqTzAeZ x52fbDCRrjodTbgJukd2PK03gxIYSY1lmFgCfeaNDCHDsFJfUe56e05HfI9Aj2TTRx/b XmuLHg5IczFh7v7uHxLoCUfcnuficpmlVtfmdL30apQuwT7M/2jQEtqE0NZcDq9VOvUL SzBVlnQB3z8jhadxmPdfW/u5rsycdTb8afH2mVFs5yn/Ue0B96gLR12h7qY0JBWIaUrH veAW/ITf+qIXm51PPGnotpuGpR3xAzemD/EoSkVlZPWb20QyOPCaZAioJ/7orl8krHO7 O4ZQ== X-Gm-Message-State: AOJu0YymmEyN0vf7OUmOH0NObnJSNSdfqNXTd9dXURoh+T8VxUpXkgpA d2UTwaex7LUMezMTNnAY3EE= X-Google-Smtp-Source: AGHT+IEynPKBI7IwnMHpc9o110PkJqJCiDc1zB8vkXfce7EMPEhPFPGlhNEmKHM/SQm8OexRWAI3Ag== X-Received: by 2002:a05:600c:1914:b0:40b:3803:e4c6 with SMTP id j20-20020a05600c191400b0040b3803e4c6mr3641836wmq.8.1700872516754; Fri, 24 Nov 2023 16:35:16 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id u13-20020a05600c00cd00b00405718cbeadsm4268005wmm.1.2023.11.24.16.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 16:35:16 -0800 (PST) From: Christian Marangi To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andy Gross , Bjorn Andersson , Konrad Dybcio , Andrew Lunn , Heiner Kallweit , Russell King , Florian Fainelli , Broadcom internal kernel review list , Daniel Golle , Qingfang Deng , SkyLake Huang , Matthias Brugger , AngeloGioacchino Del Regno , Vladimir Oltean , David Epping , Harini Katakam , Christian Marangi , "Russell King (Oracle)" , Robert Marko , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [net-next RFC PATCH v2 00/11] net: phy: Support DT PHY package Date: Sat, 25 Nov 2023 01:11:16 +0100 Message-Id: <20231125001127.5674-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231124_163520_268375_2EA4233C X-CRM114-Status: GOOD ( 22.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Idea of this big series is to introduce the concept of PHY package in DT and generalize the support of it by PHY driver. The concept of PHY package is nothing new and is already a thing in the kernel with the API phy_package_join/leave/read/write. The main idea of those API is to permit the PHY to have a shared global data and to run probe/config only once for the PHY package. There are various example of this already in the kernel with the mscc, bcm54140 mediatek ge and micrle driver and they all follow the same pattern. What is currently lacking is describing this in DT and better reference the PHY in charge of global configuration of the PHY package. For the already present PHY, the implementation is simple enough with only one PHY having the required regs to apply global configuration. This can be ok for simple PHY package but some Qcom PHY package on ""modern"" SoC have more complex implementation. One example is the PHY for qca807x where some global regs are present in the so-called "combo" port and everything about psgmii calibration is placed in a 5th port in the PHY package. Given these additional thing, the original phy_package API are extended with support for multiple global PHY for configuration. Each PHY driver will have an enum of the ID for the global PHY to reference and is required to pass to the read/write function. On top of this, it's added correct DT support for describing PHY package. One example is this: ethernet-phy-package@0 { #address-cells = <1>; #size-cells = <0>; reg = <0>; ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; }; phy4: ethernet-phy@4 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <4>; }; }; The mdio parse functions are changed to address for this additional special node, the function is changed to simply detect this node and search also in this. If this is detected phy core will join each PHY present in the node and use (if defined) the additional info in the PHY driver to probe/config once the PHY package. I hope this implementation is clean enough as I expect more and more of these configuration to appear in the future. (For Andrew, we are looking intro making this in at803x PHY driver and see what functions can be reused, idea is to move the driver to a dedicated directory and create something like at803x-common.c as the at803x PHY driver is too bloated and splitting it it's a better approach) Changes v2: - Drop compatible "ethernet-phy-package", use node name prefix matching instead - Improve DT example - Add reg for ethernet-phy-package - Drop phy-mode for ethernet-phy-package - Drop patch for generalization of phy-mode - Drop global-phy property (handle internally to the PHY driver) - Rework OF phy package code and PHY driver to handle base address - Fix missing of_node_put - Add some missing docs for added variables in struct - Move some define from dt-bindings include to PHY driver - Handle qsgmii validation in PHY driver - Fix wrong include for gpiolib - Drop reduntant version.h include Christian Marangi (9): net: phy: extend PHY package API to support multiple global address dt-bindings: net: document ethernet PHY package nodes net: phy: add initial support for PHY package in DT net: phy: add support for shared priv data size for PHY package in DT net: phy: add support for driver specific PHY package probe/config net: phy: move mmd_phy_indirect to generic header net: phy: add support for PHY package MMD read/write dt-bindings: net: Document Qcom QCA807x PHY package net: phy: qca807x: Add support for configurable LED Robert Marko (2): dt-bindings: net: add QCA807x PHY defines net: phy: add Qualcom QCA807x driver .../bindings/net/ethernet-phy-package.yaml | 66 + .../devicetree/bindings/net/qcom,qca807x.yaml | 148 ++ drivers/net/mdio/of_mdio.c | 68 +- drivers/net/phy/Kconfig | 7 + drivers/net/phy/Makefile | 1 + drivers/net/phy/bcm54140.c | 23 +- drivers/net/phy/mdio_bus.c | 35 +- drivers/net/phy/mediatek-ge-soc.c | 11 +- drivers/net/phy/micrel.c | 13 +- drivers/net/phy/mscc/mscc.h | 7 + drivers/net/phy/mscc/mscc_main.c | 16 +- drivers/net/phy/phy-core.c | 14 - drivers/net/phy/phy_device.c | 165 +- drivers/net/phy/qca807x.c | 1324 +++++++++++++++++ include/dt-bindings/net/qcom-qca807x.h | 30 + include/linux/phy.h | 170 ++- 16 files changed, 1996 insertions(+), 102 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/ethernet-phy-package.yaml create mode 100644 Documentation/devicetree/bindings/net/qcom,qca807x.yaml create mode 100644 drivers/net/phy/qca807x.c create mode 100644 include/dt-bindings/net/qcom-qca807x.h