Message ID | 20240201151747.7524-1-ansuelsmth@gmail.com |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-48374-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp225578dyb; Thu, 1 Feb 2024 07:19:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJ//1PTqVQKZc5lpwHma5lP/Q8wDGPLz965BB2JRvTRMH7U8t8w0RBil6N5hESZkMjNn7y X-Received: by 2002:a05:6402:1803:b0:55f:7b91:cbcf with SMTP id g3-20020a056402180300b0055f7b91cbcfmr3622436edy.6.1706800743162; Thu, 01 Feb 2024 07:19:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706800743; cv=pass; d=google.com; s=arc-20160816; b=UnPYNQSkPx1o338dxDtFP0OpnQsR31jyPqjrQwHH3CKEgRhv7EoHMpkGweSI7DM5tc 4gVm42Mv3BgKFTz9dIkjAe28Qwn/ev71JnmDv14EsOwnng6USFvP+YhZyS6PQwXC8qOL hD6Jr/w1nPgETWlIYwvkCfoIjxjyV5Kw5bZnDJy+3y6ccqRgqA6ty99q8k46RITAvm8X aQ7UMpzVUaT8K/B44gESauKTvdHanYIjfnaWJBQSrB//AnZpSiv5h8Sa4Wjw9c5SCJ2Y v/Nh81WN22m8+AU5XaT9k2kWDK0X/jNtK/dbiVzNnMQWY5PpSrqUjPapOWvFWH1gTlHM eMWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=FgF7oqxYUKcEdySx4Ly0ihobldR/JZonk5s5GnUnAk8=; fh=qRv2CcfdfZaNGciUm0QBcMoQf9aKOeBm7z/Xo0QJqYU=; b=sccn4yMOfgzbWjY0v6vrMqFgNaPaIKe5/Xz8Tlkaa1zZXBjt11Afpyb90YMtNyRiW7 bweLOyrkhth7c35OKEyfNouE3l+PbJ7kOM+7GmRY8S1wM+Kityg7Wltx7T3ugSkSMwzC sB4/J6RLpv4oDTJ6OF8OJF1tXY6ZI9UE3iRCHyj2OyV9JYHNrtHavEPjDIdvbzqZdggX U+ZwPg5o4mwiaE6vqbktQivjQPIjKAggzAoUhkbt9Hvf7DR2wEyPuETdO82aCym9rvtW 4levJ0Z0yO6BK78gYUgOgEKCjlBBuX+8g7ck/miWyUA6h1oiyGFhpM6CuQrxrVfbL42Y ujSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XcqiC5DE; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-48374-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48374-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=1; AJvYcCUYblVdqzxAB/XAk7iuhJb0zO20Pe8tXBn6bcQpDvfpl7FtRsYFTvW6rgH8ZXUnYajMa3tPRYY2gKIKQ+l9c3LK4ruxJg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z73-20020a509e4f000000b0055f1b68c8e7si3733808ede.674.2024.02.01.07.19.02 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 07:19:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48374-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XcqiC5DE; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-48374-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48374-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 99A001F22372 for <ouuuleilei@gmail.com>; Thu, 1 Feb 2024 15:19:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F984626D2; Thu, 1 Feb 2024 15:18:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XcqiC5DE" Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6745B5F48C; Thu, 1 Feb 2024 15:18:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706800696; cv=none; b=LNbWeVonHRQz9baQob6DbYHvs3eDtyr1DZMCtOX3munDpPhJoSOnhmV0TPdfchVTbrLXVpqbYTI2U9QjvmT7z0uUoEzRHCirAsyYW6w9idO8bfg3bTPp7+QFNF3tGU3h2sHtbLeLz6KEi5Pthhnx/YiM6QttVgrohzW7mjrBlwY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706800696; c=relaxed/simple; bh=p2zjvsecwqsbWVxX3y98V4aEVEIewA84Nqu+biKQYbQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=O5L7mY0gsZkkDHYEDoG+7M9fd7Ls1QSEr8en0cFoLs+plf19JZXqONaumIkAMfh2m96fzgkBBjkZH4vE5cu/wm9AO5PVgvz0zQquY47Ub1gKI4Y1yLmCD1rPAaMQh6bsxO+vpEdjl4TWKfvpbrdkFYYDuWLYsu0cFvPuLU1pttE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XcqiC5DE; arc=none smtp.client-ip=209.85.208.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2cf588c4dbcso13768371fa.1; Thu, 01 Feb 2024 07:18:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706800692; x=1707405492; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=FgF7oqxYUKcEdySx4Ly0ihobldR/JZonk5s5GnUnAk8=; b=XcqiC5DEWtWD86+McEu4fimnsuqqKqhDizsw4Y5bEtZNhURMK2fKyUPJwytpah89EE PkEC+aNlsRlA3RJBTxNODPhTYYoEe0ZlH7PXWlnXRiCnusCXswPZdl2FGliMjWGj0PZ1 z3z+QPHPN06J8I0uZXgxCKaeyUqhfoiFdITf5nYhNGPJZVPwvLdOi3a8fy5IJy30Y+9V JWZ5FPBSOf+04U47KvE3rayn3q5JY6h3uoQEVQKbnWNx1Xlzdew3L3oV+djv3MqohtDN F7TW0Ga4sU7WodKsF3RjYfiCNZIzAYlYnKpZFnWw+F716uPOGg2yNZIZAVg4z0vDGsnJ /SDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706800692; x=1707405492; 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=FgF7oqxYUKcEdySx4Ly0ihobldR/JZonk5s5GnUnAk8=; b=UFAsbWUZbc9idDakVjtE3/1Qs4Qdvw74IPY5Jl+7VVWf2xFc/gkZ6D2TKVhp8dmAVy qjTdawxc+aT39f6qZisC+ePSgZ7C7qFp9JKm85i5bi4qnDbhF34Gdph3lvwIbSNgrJG/ +pBLkEn2SHBEjuERNX2xFpQo9ifFh0D7LLjYPoHARRiXawgPYShuAVTXRt9Gy5f/TlE/ xJbsikVHJJZKoFd3zRTVP/6VsaERa3nLtfNw+w1pf/bDZ00nB8f3SUODdmM4gYz2DwTb WEpsKLJ76IqWKt+8VO+cIup7I17yNXM7l/WXgflw5F0YxQeuygtGeHfy5cdvvhh8RLgl fSpA== X-Gm-Message-State: AOJu0Yx86ahwwcrJaOUEN9oTgOIRpanejVhcvk8Jn2t4ccPMLuE4tBf9 6t1os94RCQBl3xPYuOiU+6vFkFAgFkLuV0hIKICc4D2BkWAHpihN X-Received: by 2002:a05:651c:b1e:b0:2d0:6c48:8777 with SMTP id b30-20020a05651c0b1e00b002d06c488777mr3912995ljr.27.1706800691924; Thu, 01 Feb 2024 07:18:11 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXzHo/BMpbXlwq2Bb7Cq+XwG1cIAz96p6MJ56TRJ5l2LjvHtzPfIaCA7tT8fifrSavCHK6bOlKnwPnbrP7SXuOe1FtMAxEcTbQbNoq88YOMiDQODa3fSTnMxfEpmhpYRnYHEm0oShZxcSPqGKsjclh4E64Vow3kHQzTmrlNCljJMOHGWoCV3ZHcUcqEGQ2asyqUqgAV3ZVkELRNVlYlKvU6M65psnvm3FyFsO6FdKJEu59pbjMUJu/6XrYkgDym53tUdACQBmjBlAmCfYac8eF0O5GCcBwGLsKeFJsYIeBxryBeADJfJSC3Yyr3wP8OShbN/BNFmzFNBb81LdbqsHdD4T+Bo3ZdvZvcgvh+fzTSHIZWvg0tloVKz0ClBTv+682coao6Nbf2vwUyPrMe7Nh4krQcIRc0PBEU8sbdY63jpZY3l0iCIoKM/oxZY4384VWAdBZ/TwugAjouULZZ0SZUu6DOuYD9T+E+TXVGaxuzt2n0asEw/XmKR5WYRAPAPhKVkHH3cVTJNTHrtMFcneq84ySf8dPrurkahyNHVva8udsz+YbOCEHVZ4C4GUH5NcjUyFjOnCUgALMpyeVXB4lXTRmvtmbv/aywtnJ3N37sb2PabspxhpXb Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id z9-20020a2e3509000000b002cdf37ee19dsm2437978ljz.7.2024.02.01.07.18.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 07:18:11 -0800 (PST) From: Christian Marangi <ansuelsmth@gmail.com> 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>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, Frank Rowand <frowand.list@gmail.com>, Christian Marangi <ansuelsmth@gmail.com>, Robert Marko <robert.marko@sartura.hr>, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [net-next PATCH v5 0/9] net: phy: Introduce PHY Package concept Date: Thu, 1 Feb 2024 16:17:26 +0100 Message-ID: <20240201151747.7524-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789710295824046236 X-GMAIL-MSGID: 1789710295824046236 |
Series |
net: phy: Introduce PHY Package concept
|
|
Message
Christian Marangi
Feb. 1, 2024, 3:17 p.m. UTC
Idea of this big series is to introduce the concept of PHY package in DT and give PHY drivers a way to derive the base address from DT. 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. What is currently lacking is describing this in DT and better reference a base address to calculate offset from. In the scenario of a PHY package where multiple address are used and there isn't a way to get the base address of the PHY package from some regs, getting the information from DT is the only way. A possible example to this problem is this: ethernet-phy-package@0 { compatible = "qcom,qca807x-package"; #address-cells = <1>; #size-cells = <0>; reg = <0>; qcom,package-mode = "qsgmii"; ethernet-phy@1 { reg = <1>; }; phy4: ethernet-phy@4 { 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. (we match the node name to be "ethernet-phy-package") PHY driver can then use introduced helper of_phy_package_join to join the PHY to the PHY package and derive the base address from DT. The base addr + offset implementation adds additional complexity to the code but I think will make DT reviwers happier since the absolute reg implementation might make things confusing with having double reg in the DTS. I'm open to any alternative implementation and also to revert this to the absolute implementation. Changes v5: - Rebase on top of net-next - Change implementation to base addr + offset in subnode - Adapt to all the changes and cleanup done to at803x Changes v4: - Rework DT implementation - Drop of autojoin support and rework to simple helper - Rework PHY driver to the new implementation - Add compatible for qca807x package - Further cleanup patches Changes v3: - Add back compatible implementation - Detach patch that can be handled separately (phy_package_mmd, phy_package extended) - Rework code to new simplified implementation with base addr + offset - Improve documentation with additional info and description 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 (7): dt-bindings: net: document ethernet PHY package nodes net: phy: add support for scanning PHY in PHY packages nodes net: phy: add devm/of_phy_package_join helper net: phy: qcom: move more function to shared library dt-bindings: net: Document Qcom QCA807x PHY package net: phy: qcom: generalize some qca808x LED functions net: phy: qca807x: add support for configurable LED Robert Marko (2): dt-bindings: net: add QCA807x PHY defines net: phy: qcom: add support for QCA807x PHY Family .../bindings/net/ethernet-phy-package.yaml | 55 ++ .../devicetree/bindings/net/qcom,qca807x.yaml | 142 +++ drivers/net/mdio/of_mdio.c | 75 +- drivers/net/phy/mdio_bus.c | 44 +- drivers/net/phy/phy_device.c | 84 ++ drivers/net/phy/qcom/Kconfig | 8 + drivers/net/phy/qcom/Makefile | 1 + drivers/net/phy/qcom/at803x.c | 35 - drivers/net/phy/qcom/qca807x.c | 832 ++++++++++++++++++ drivers/net/phy/qcom/qca808x.c | 311 +------ drivers/net/phy/qcom/qcom-phy-lib.c | 247 ++++++ drivers/net/phy/qcom/qcom.h | 123 +++ include/dt-bindings/net/qcom-qca807x.h | 30 + include/linux/of_mdio.h | 26 + include/linux/phy.h | 6 + 15 files changed, 1648 insertions(+), 371 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/qcom/qca807x.c create mode 100644 include/dt-bindings/net/qcom-qca807x.h
Comments
Quoting Christian Marangi (2024-02-01 16:17:28) > > +static int __of_mdiobus_parse_phys(struct mii_bus *mdio, struct device_node *np, > + int base_addr, bool *scanphys) > +{ > + struct device_node *child; > + int addr, rc = 0; > + > + /* Loop over the child nodes and register a phy_device for each phy */ > + for_each_available_child_of_node(np, child) { > + if (of_node_name_eq(child, "ethernet-phy-package")) { > + rc = of_property_read_u32(child, "reg", &addr); > + if (rc) > + goto exit; This means a PHY package node w/o a reg property will prevent all other PHYs in the same parent node to be found? > + > + rc = __of_mdiobus_parse_phys(mdio, child, addr, scanphys); You might want to save passing scanphys down, PHYs w/o a reg property in a PHY package won't be "auto scanned" later. > diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c > index afbad1ad8683..7737d0101d7b 100644 > --- a/drivers/net/phy/mdio_bus.c > +++ b/drivers/net/phy/mdio_bus.c > @@ -459,20 +459,33 @@ EXPORT_SYMBOL(of_mdio_find_bus); > * found, set the of_node pointer for the mdio device. This allows > * auto-probed phy devices to be supplied with information passed in > * via DT. > + * If a PHY package is found, PHY is searched also there. > */ > -static void of_mdiobus_link_mdiodev(struct mii_bus *bus, > - struct mdio_device *mdiodev) > +static int of_mdiobus_find_phy(struct device *dev, struct mdio_device *mdiodev, > + struct device_node *np, int base_addr) > { > - struct device *dev = &mdiodev->dev; > struct device_node *child; > > - if (dev->of_node || !bus->dev.of_node) > - return; > + for_each_available_child_of_node(np, child) { > + int addr, ret; > > - for_each_available_child_of_node(bus->dev.of_node, child) { > - int addr; > + if (of_node_name_eq(child, "ethernet-phy-package")) { > + ret = of_property_read_u32(child, "reg", &addr); > + if (ret) > + return ret; of_node_put
Quoting Christian Marangi (2024-02-01 16:17:29) > +/** > + * of_phy_package_join - join a common PHY group in PHY package > + * @phydev: target phy_device struct > + * @priv_size: if non-zero allocate this amount of bytes for private data > + * > + * This is a variant of phy_package_join for PHY package defined in DT. > + * > + * The parent node of the @phydev is checked as a valid PHY package node > + * structure (by matching the node name "ethernet-phy-package") and the > + * base_addr for the PHY package is passed to phy_package_join. > + * > + * With this configuration the shared struct will also have the np value > + * filled to use additional DT defined properties in PHY specific > + * probe_once and config_init_once PHY package OPs. > + * > + * Returns < 1 on error, 0 on success. Esp. calling phy_package_join() So, < 0 on error ? > +int of_phy_package_join(struct phy_device *phydev, size_t priv_size) > +{ > + struct device_node *node = phydev->mdio.dev.of_node; > + struct device_node *package_node; > + u32 base_addr; > + int ret; > + > + if (!node) > + return -EINVAL; > + > + package_node = of_get_parent(node); Is the node put on package leave? > + if (!package_node) > + return -EINVAL; > + > + if (!of_node_name_eq(package_node, "ethernet-phy-package") of_put_node? + below. > + return -EINVAL; > + > + if (of_property_read_u32(package_node, "reg", &base_addr)) > + return -EINVAL; > + > + ret = phy_package_join(phydev, base_addr, priv_size); > + if (ret) > + return ret; > + > + phydev->shared->np = package_node; Just looked quickly, looks like ->np is uninitialized in the !of join case. > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(of_phy_package_join);
On 01/02/2024 16:17, Christian Marangi wrote: > From: Robert Marko <robert.marko@sartura.hr> > > Add DT bindings defined for Qualcomm QCA807x PHY series related to > calibration and DAC settings. Nothing from this file is used and your commit msg does not provide rationale "why", thus it does not look like something for bindings. Otherwise please point me which patch with *driver* uses these bindings. > > Signed-off-by: Robert Marko <robert.marko@sartura.hr> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> > --- > include/dt-bindings/net/qcom-qca807x.h | 30 ++++++++++++++++++++++++++ Use filename matching compatible, so vendor,device. No wildcards, unless your compatible also has them. > 1 file changed, 30 insertions(+) > create mode 100644 include/dt-bindings/net/qcom-qca807x.h > Best regards, Krzysztof
On 01/02/2024 16:17, Christian Marangi wrote: > Document Qcom QCA807x PHY package. > > Qualcomm QCA807X Ethernet PHY is PHY package of 2 or 5 > IEEE 802.3 clause 22 compliant 10BASE-Te, 100BASE-TX and > 1000BASE-T PHY-s. > > Document the required property to make the PHY package correctly > configure and work. > > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> > --- > .../devicetree/bindings/net/qcom,qca807x.yaml | 142 ++++++++++++++++++ Your bindings header must be squashed here. Headers are not separate thing from the bindings. > 1 file changed, 142 insertions(+) > create mode 100644 Documentation/devicetree/bindings/net/qcom,qca807x.yaml > > diff --git a/Documentation/devicetree/bindings/net/qcom,qca807x.yaml b/Documentation/devicetree/bindings/net/qcom,qca807x.yaml > new file mode 100644 > index 000000000000..1c3692897b02 > --- /dev/null > +++ b/Documentation/devicetree/bindings/net/qcom,qca807x.yaml > @@ -0,0 +1,142 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/net/qcom,qca807x.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Qualcomm QCA807X Ethernet PHY What is "X"? Wildcards are usually not expected. > + > +maintainers: > + - Christian Marangi <ansuelsmth@gmail.com> > + - Robert Marko <robert.marko@sartura.hr> > + > +description: | > + Qualcomm QCA807X Ethernet PHY is PHY package of 2 or 5 > + IEEE 802.3 clause 22 compliant 10BASE-Te, 100BASE-TX and > + 1000BASE-T PHY-s. > + > + They feature 2 SerDes, one for PSGMII or QSGMII connection with > + MAC, while second one is SGMII for connection to MAC or fiber. > + > + Both models have a combo port that supports 1000BASE-X and > + 100BASE-FX fiber. > + > + Each PHY inside of QCA807x series has 4 digitally controlled > + output only pins that natively drive LED-s for up to 2 attached > + LEDs. Some vendor also use these 4 output for GPIO usage without > + attaching LEDs. > + > + Note that output pins can be set to drive LEDs OR GPIO, mixed > + definition are not accepted. > + > + PHY package can be configured in 3 mode following this table: > + > + First Serdes mode Second Serdes mode > + Option 1 PSGMII for copper Disabled > + ports 0-4 > + Option 2 PSGMII for copper 1000BASE-X / 100BASE-FX > + ports 0-4 > + Option 3 QSGMII for copper SGMII for > + ports 0-3 copper port 4 > + > +$ref: ethernet-phy-package.yaml# > + > +properties: > + compatible: > + const: qcom,qca807x-package > + > + qcom,package-mode: Where is definition of this property with type and description? > + enum: > + - qsgmii > + - psgmii > + > + qcom,tx-driver-strength: Use proper unit suffix. https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/property-units.yaml > + description: set the TX Amplifier value in mv. > + If not defined, 600mw is set by default. > + $ref: /schemas/types.yaml#/definitions/uint32 > + enum: [140, 160, 180, 200, 220, > + 240, 260, 280, 300, 320, > + 400, 500, 600] > + > +patternProperties: > + ^ethernet-phy(@[a-f0-9]+)?$: > + $ref: ethernet-phy.yaml# > + > + properties: > + gpio-controller: > + description: set the output lines as GPIO instead of LEDs > + type: boolean > + > + '#gpio-cells': > + description: number of GPIO cells for the PHY > + const: 2 > + > + dependencies: > + gpio-controller: ['#gpio-cells'] Why do you need it? None of gpio-controllers do it, I think. > + > + if: > + required: > + - gpio-controller > + then: > + properties: > + leds: false > + > + unevaluatedProperties: false > + > +required: > + - compatible > + > +unevaluatedProperties: false Best regards, Krzysztof
Quoting Christian Marangi (2024-02-01 18:20:10) > On Thu, Feb 01, 2024 at 05:25:36PM +0100, Antoine Tenart wrote: > > Quoting Christian Marangi (2024-02-01 16:17:28) > > > + > > > + rc = __of_mdiobus_parse_phys(mdio, child, addr, scanphys); > > > > You might want to save passing scanphys down, PHYs w/o a reg property in > > a PHY package won't be "auto scanned" later. > > I might be confused by this, but isn't this already done? (passing > scanphys in each recursive call so we can set it to true if needed?) > > Also I think the scanphys should be skipped for the PHY package > (assuming we make reg mandatory, it would be an error condition and > should not be handled?) Sorry if that wasn't clear, this is what I meant. scanphys doesn't need to be set to true in a PHY package (both if we want reg to be mandatory there and because my understanding of the auto-scan code is PHYs in a PHY package won't be auto scanned anyway). Thanks, Antoine
On Fri, Feb 02, 2024 at 08:45:52AM +0100, Krzysztof Kozlowski wrote: > On 01/02/2024 16:17, Christian Marangi wrote: > > Document Qcom QCA807x PHY package. > > > > Qualcomm QCA807X Ethernet PHY is PHY package of 2 or 5 > > IEEE 802.3 clause 22 compliant 10BASE-Te, 100BASE-TX and > > 1000BASE-T PHY-s. > > > > Document the required property to make the PHY package correctly > > configure and work. > > > > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> > > --- > > .../devicetree/bindings/net/qcom,qca807x.yaml | 142 ++++++++++++++++++ > > Your bindings header must be squashed here. Headers are not separate > thing from the bindings. > > > 1 file changed, 142 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/net/qcom,qca807x.yaml > > > > diff --git a/Documentation/devicetree/bindings/net/qcom,qca807x.yaml b/Documentation/devicetree/bindings/net/qcom,qca807x.yaml > > new file mode 100644 > > index 000000000000..1c3692897b02 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/net/qcom,qca807x.yaml > > @@ -0,0 +1,142 @@ > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/net/qcom,qca807x.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: Qualcomm QCA807X Ethernet PHY > > What is "X"? Wildcards are usually not expected. > It's to identify the Ethrnet PHY family. Looks wrong to declare qca8072 or qca8074 since they would refer to a more generic Family of devices. What would be the correct way? We have many other case on net with schema called qca8k that refer to the family of Ethernet Switch but in it refer to qca8327 qca8337 qca8334... > > + > > +maintainers: > > + - Christian Marangi <ansuelsmth@gmail.com> > > + - Robert Marko <robert.marko@sartura.hr> > > + > > +description: | > > + Qualcomm QCA807X Ethernet PHY is PHY package of 2 or 5 > > + IEEE 802.3 clause 22 compliant 10BASE-Te, 100BASE-TX and > > + 1000BASE-T PHY-s. > > + > > + They feature 2 SerDes, one for PSGMII or QSGMII connection with > > + MAC, while second one is SGMII for connection to MAC or fiber. > > + > > + Both models have a combo port that supports 1000BASE-X and > > + 100BASE-FX fiber. > > + > > + Each PHY inside of QCA807x series has 4 digitally controlled > > + output only pins that natively drive LED-s for up to 2 attached > > + LEDs. Some vendor also use these 4 output for GPIO usage without > > + attaching LEDs. > > + > > + Note that output pins can be set to drive LEDs OR GPIO, mixed > > + definition are not accepted. > > + > > + PHY package can be configured in 3 mode following this table: > > + > > + First Serdes mode Second Serdes mode > > + Option 1 PSGMII for copper Disabled > > + ports 0-4 > > + Option 2 PSGMII for copper 1000BASE-X / 100BASE-FX > > + ports 0-4 > > + Option 3 QSGMII for copper SGMII for > > + ports 0-3 copper port 4 > > + > > +$ref: ethernet-phy-package.yaml# > > + > > +properties: > > + compatible: > > + const: qcom,qca807x-package > > + > > + qcom,package-mode: > > Where is definition of this property with type and description? > > > + enum: > > + - qsgmii > > + - psgmii > > + > > + qcom,tx-driver-strength: > > Use proper unit suffix. > > https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/property-units.yaml > > > + description: set the TX Amplifier value in mv. > > + If not defined, 600mw is set by default. > > + $ref: /schemas/types.yaml#/definitions/uint32 > > + enum: [140, 160, 180, 200, 220, > > + 240, 260, 280, 300, 320, > > + 400, 500, 600] > > + > > +patternProperties: > > + ^ethernet-phy(@[a-f0-9]+)?$: > > + $ref: ethernet-phy.yaml# > > + > > + properties: > > + gpio-controller: > > + description: set the output lines as GPIO instead of LEDs > > + type: boolean > > + > > + '#gpio-cells': > > + description: number of GPIO cells for the PHY > > + const: 2 > > + > > + dependencies: > > + gpio-controller: ['#gpio-cells'] > > Why do you need it? None of gpio-controllers do it, I think. > Well gpio-controller property is optional and having that declared and #gpio-cells skipped will result in an error on probe. I think it should be the opposite with other schema having to declare this. In usual way for gpio-controller both property are defined as required but you can see some (to-be-converted) txt files whith comments where they say: /mux/adi,adgs1408.txt:10:- gpio-controller : if present, #gpio-cells is required. Should I instead add this condition in the if right below? > > + > > + if: > > + required: > > + - gpio-controller > > + then: > > + properties: > > + leds: false > > + > > + unevaluatedProperties: false > > + > > +required: > > + - compatible > > + > > +unevaluatedProperties: false > > > Best regards, > Krzysztof >
On Fri, Feb 02, 2024 at 04:19:15PM +0100, Christian Marangi wrote: > On Fri, Feb 02, 2024 at 08:41:56AM +0100, Krzysztof Kozlowski wrote: > > On 01/02/2024 16:17, Christian Marangi wrote: > > > From: Robert Marko <robert.marko@sartura.hr> > > > > > > Add DT bindings defined for Qualcomm QCA807x PHY series related to > > > calibration and DAC settings. > > > > Nothing from this file is used and your commit msg does not provide > > rationale "why", thus it does not look like something for bindings. > > Otherwise please point me which patch with *driver* uses these bindings. > > > > Hi, since I have to squash this, I will include the reason in the schema > patch. > > Anyway these are raw values used to configure the qcom,control-dac > property. Maybe I am missing something, but a quick scan of the patchset and a grep of the tree doesn't show this property being documented anywhere. > In the driver it's used by qca807x_config_init. We read what is set in > DT and we configure the reg accordingly. > > If this is wrong should we use a more schema friendly approach with > declaring an enum of string and document that there? Without any idea of what that property is used for it is hard to say, but personally I much prefer enums of strings for what looks like a property that holds register values. That you felt it necessary to add defines for the values makes it more like that that is the case. Cheers, Conor. > > > > > > > Signed-off-by: Robert Marko <robert.marko@sartura.hr> > > > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> > > > --- > > > include/dt-bindings/net/qcom-qca807x.h | 30 ++++++++++++++++++++++++++ > > > > Use filename matching compatible, so vendor,device. No wildcards, unless > > your compatible also has them. > > > > > 1 file changed, 30 insertions(+) > > > create mode 100644 include/dt-bindings/net/qcom-qca807x.h > > > > > > > > > > > Best regards, > > Krzysztof > > > > -- > Ansuel
On Fri, Feb 02, 2024 at 04:12:53PM +0100, Christian Marangi wrote: > On Fri, Feb 02, 2024 at 08:45:52AM +0100, Krzysztof Kozlowski wrote: > > On 01/02/2024 16:17, Christian Marangi wrote: > > > Document Qcom QCA807x PHY package. > > > > > > Qualcomm QCA807X Ethernet PHY is PHY package of 2 or 5 > > > IEEE 802.3 clause 22 compliant 10BASE-Te, 100BASE-TX and > > > 1000BASE-T PHY-s. > > > > > > Document the required property to make the PHY package correctly > > > configure and work. > > > > > > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> > > > --- > > > .../devicetree/bindings/net/qcom,qca807x.yaml | 142 ++++++++++++++++++ > > > > Your bindings header must be squashed here. Headers are not separate > > thing from the bindings. > > > > > 1 file changed, 142 insertions(+) > > > create mode 100644 Documentation/devicetree/bindings/net/qcom,qca807x.yaml > > > > > > diff --git a/Documentation/devicetree/bindings/net/qcom,qca807x.yaml b/Documentation/devicetree/bindings/net/qcom,qca807x.yaml > > > new file mode 100644 > > > index 000000000000..1c3692897b02 > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/net/qcom,qca807x.yaml > > > @@ -0,0 +1,142 @@ > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > > +%YAML 1.2 > > > +--- > > > +$id: http://devicetree.org/schemas/net/qcom,qca807x.yaml# > > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > > + > > > +title: Qualcomm QCA807X Ethernet PHY > > > > What is "X"? Wildcards are usually not expected. > > > > It's to identify the Ethrnet PHY family. Looks wrong to declare qca8072 > or qca8074 since they would refer to a more generic Family of devices. Declare them all or provide some justification such as the exact model is discoverable (and better be sure power on is the same in order to do discovery). > What would be the correct way? We have many other case on net with > schema called qca8k that refer to the family of Ethernet Switch but in > it refer to qca8327 qca8337 qca8334... > > > > + > > > +maintainers: > > > + - Christian Marangi <ansuelsmth@gmail.com> > > > + - Robert Marko <robert.marko@sartura.hr> > > > + > > > +description: | > > > + Qualcomm QCA807X Ethernet PHY is PHY package of 2 or 5 > > > + IEEE 802.3 clause 22 compliant 10BASE-Te, 100BASE-TX and > > > + 1000BASE-T PHY-s. > > > + > > > + They feature 2 SerDes, one for PSGMII or QSGMII connection with > > > + MAC, while second one is SGMII for connection to MAC or fiber. > > > + > > > + Both models have a combo port that supports 1000BASE-X and > > > + 100BASE-FX fiber. > > > + > > > + Each PHY inside of QCA807x series has 4 digitally controlled > > > + output only pins that natively drive LED-s for up to 2 attached > > > + LEDs. Some vendor also use these 4 output for GPIO usage without > > > + attaching LEDs. > > > + > > > + Note that output pins can be set to drive LEDs OR GPIO, mixed > > > + definition are not accepted. > > > + > > > + PHY package can be configured in 3 mode following this table: > > > + > > > + First Serdes mode Second Serdes mode > > > + Option 1 PSGMII for copper Disabled > > > + ports 0-4 > > > + Option 2 PSGMII for copper 1000BASE-X / 100BASE-FX > > > + ports 0-4 > > > + Option 3 QSGMII for copper SGMII for > > > + ports 0-3 copper port 4 > > > + > > > +$ref: ethernet-phy-package.yaml# > > > + > > > +properties: > > > + compatible: > > > + const: qcom,qca807x-package > > > + > > > + qcom,package-mode: > > > > Where is definition of this property with type and description? > > > > > + enum: > > > + - qsgmii > > > + - psgmii > > > + > > > + qcom,tx-driver-strength: > > > > Use proper unit suffix. > > > > https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/property-units.yaml > > > > > + description: set the TX Amplifier value in mv. > > > + If not defined, 600mw is set by default. > > > + $ref: /schemas/types.yaml#/definitions/uint32 > > > + enum: [140, 160, 180, 200, 220, > > > + 240, 260, 280, 300, 320, > > > + 400, 500, 600] > > > + > > > +patternProperties: > > > + ^ethernet-phy(@[a-f0-9]+)?$: > > > + $ref: ethernet-phy.yaml# > > > + > > > + properties: > > > + gpio-controller: > > > + description: set the output lines as GPIO instead of LEDs > > > + type: boolean You only need 'gpio-controller: true'. The core already defines the type. > > > + > > > + '#gpio-cells': > > > + description: number of GPIO cells for the PHY Not a useful description. Normally, you'd describe what's in the cells, but GPIO is standardized so no need (unless you are deviating from the norm). > > > + const: 2 > > > + > > > + dependencies: > > > + gpio-controller: ['#gpio-cells'] > > > > Why do you need it? None of gpio-controllers do it, I think. > > > > Well gpio-controller property is optional and having that declared and > #gpio-cells skipped will result in an error on probe. I think it should > be the opposite with other schema having to declare this. If you think everything else is wrong, then please fix them. :) > > In usual way for gpio-controller both property are defined as required > but you can see some (to-be-converted) txt files whith comments where > they say: > > ./mux/adi,adgs1408.txt:10:- gpio-controller : if present, #gpio-cells is required. > > Should I instead add this condition in the if right below? The core schema enforces this dependency, so you don't need to. Rob
On Thu, Feb 01, 2024 at 04:17:32PM +0100, Christian Marangi wrote: > Document Qcom QCA807x PHY package. > > Qualcomm QCA807X Ethernet PHY is PHY package of 2 or 5 > IEEE 802.3 clause 22 compliant 10BASE-Te, 100BASE-TX and > 1000BASE-T PHY-s. > > Document the required property to make the PHY package correctly > configure and work. > > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> > --- > .../devicetree/bindings/net/qcom,qca807x.yaml | 142 ++++++++++++++++++ > 1 file changed, 142 insertions(+) > create mode 100644 Documentation/devicetree/bindings/net/qcom,qca807x.yaml > > diff --git a/Documentation/devicetree/bindings/net/qcom,qca807x.yaml b/Documentation/devicetree/bindings/net/qcom,qca807x.yaml > new file mode 100644 > index 000000000000..1c3692897b02 > --- /dev/null > +++ b/Documentation/devicetree/bindings/net/qcom,qca807x.yaml > @@ -0,0 +1,142 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/net/qcom,qca807x.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Qualcomm QCA807X Ethernet PHY > + > +maintainers: > + - Christian Marangi <ansuelsmth@gmail.com> > + - Robert Marko <robert.marko@sartura.hr> > + > +description: | > + Qualcomm QCA807X Ethernet PHY is PHY package of 2 or 5 > + IEEE 802.3 clause 22 compliant 10BASE-Te, 100BASE-TX and > + 1000BASE-T PHY-s. > + > + They feature 2 SerDes, one for PSGMII or QSGMII connection with > + MAC, while second one is SGMII for connection to MAC or fiber. > + > + Both models have a combo port that supports 1000BASE-X and > + 100BASE-FX fiber. > + > + Each PHY inside of QCA807x series has 4 digitally controlled > + output only pins that natively drive LED-s for up to 2 attached > + LEDs. Some vendor also use these 4 output for GPIO usage without > + attaching LEDs. > + > + Note that output pins can be set to drive LEDs OR GPIO, mixed > + definition are not accepted. > + > + PHY package can be configured in 3 mode following this table: > + > + First Serdes mode Second Serdes mode > + Option 1 PSGMII for copper Disabled > + ports 0-4 > + Option 2 PSGMII for copper 1000BASE-X / 100BASE-FX > + ports 0-4 > + Option 3 QSGMII for copper SGMII for > + ports 0-3 copper port 4 > + > +$ref: ethernet-phy-package.yaml# > + > +properties: > + compatible: > + const: qcom,qca807x-package > + > + qcom,package-mode: > + enum: > + - qsgmii > + - psgmii > + > + qcom,tx-driver-strength: > + description: set the TX Amplifier value in mv. > + If not defined, 600mw is set by default. > + $ref: /schemas/types.yaml#/definitions/uint32 > + enum: [140, 160, 180, 200, 220, > + 240, 260, 280, 300, 320, > + 400, 500, 600] > + > +patternProperties: > + ^ethernet-phy(@[a-f0-9]+)?$: I don't get how an address is optional. Rob
On Thu, Feb 01, 2024 at 04:17:27PM +0100, Christian Marangi wrote: > Document ethernet PHY package nodes used to describe PHY shipped in > bundle of 2-5 PHY. The special node describe a container of PHY that > share common properties. This is a generic schema and PHY package > should create specialized version with the required additional shared > properties. > > Example are PHY packages that have some regs only in one PHY of the > package and will affect every other PHY in the package, for example > related to PHY interface mode calibration or global PHY mode selection. > > The PHY package node MUST declare the base address used by the PHY driver > for global configuration by calculating the offsets of the global PHY > based on the base address of the PHY package. > > Each reg of the PHYs defined in the PHY Package node is an offset of the > PHY Package reg. > > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> > --- > .../bindings/net/ethernet-phy-package.yaml | 55 +++++++++++++++++++ > 1 file changed, 55 insertions(+) > create mode 100644 Documentation/devicetree/bindings/net/ethernet-phy-package.yaml > > diff --git a/Documentation/devicetree/bindings/net/ethernet-phy-package.yaml b/Documentation/devicetree/bindings/net/ethernet-phy-package.yaml > new file mode 100644 > index 000000000000..d7cdbb1a4b3e > --- /dev/null > +++ b/Documentation/devicetree/bindings/net/ethernet-phy-package.yaml > @@ -0,0 +1,55 @@ > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/net/ethernet-phy-package.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Ethernet PHY Package Common Properties > + > +maintainers: > + - Christian Marangi <ansuelsmth@gmail.com> > + > +description: > + PHY packages are multi-port Ethernet PHY of the same family > + and each Ethernet PHY is affected by the global configuration > + of the PHY package. > + > + Each reg of the PHYs defined in the PHY Package node is > + an offset of the PHY Package reg. > + > + Each Ethernet PHYs defined in the PHY package node is > + reachable in the MDIO bus at the address of the PHY > + Package offset of the Ethernet PHY reg. If the phys are addressed with an MDIO address, then just use those. > + > +properties: > + $nodename: > + pattern: "^ethernet-phy-package(@[a-f0-9]+)?$" Can't be optional if 'reg' is required (which it should be). > + > + reg: > + minimum: 0 > + maximum: 31 > + description: > + The base ID number for the PHY package. > + Commonly the ID of the first PHY in the PHY package. > + > + Some PHY in the PHY package might be not defined but > + still occupy ID on the device (just not attached to > + anything) hence the PHY package reg might correspond > + to a not attached PHY (offset 0). > + > + '#address-cells': > + const: 1 > + > + '#size-cells': > + const: 0 > + > +patternProperties: > + ^ethernet-phy(@[a-f0-9]+)?$: Same issue here. > + $ref: ethernet-phy.yaml# > + > +required: > + - reg > + - '#address-cells' > + - '#size-cells' > + > +additionalProperties: true > -- > 2.43.0 >