Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2229259rdb; Mon, 20 Nov 2023 05:52:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IGA9Tr+pChnK2XyTIVqqNDcE1qOYVW/i9ItIQD/kX7nVKLn1/pMZ4+ltZ/b6OqCj1f7ojHR X-Received: by 2002:a17:90b:3a8e:b0:27d:433e:e69c with SMTP id om14-20020a17090b3a8e00b0027d433ee69cmr1086643pjb.18.1700488348924; Mon, 20 Nov 2023 05:52:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700488348; cv=none; d=google.com; s=arc-20160816; b=v3lfVm9Q5g7StPFJs9Id4kL66VrX19s5MCvWNP3J3t67ewGxwt6213p3Y5Rqd45Ofe 6FNH5qmXm7PxRvHIZF0gWH35gXD6CBWULsECqljqwxJK3TSdrWzYc2msecZGgklWgZCE a0S0kZroTUHgF+atrMXi9QmJS5zdK3QxFe67y2kgpF1R3Q/7wYXeCzRoqPxG7A9p+Ge4 V0hqDHxCmdLrzMexPaNgckaxTSATpADQct7nDBSWIiFdDSpDOZFL81QI9lorCdEz3jK5 XSYCfwrhQU6xEs7DoZPlCZGSWkHp1OkN+8O5z/1JUcPJ6jOJm5zQpNQ0D/HOBrQtDR5r 4gmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=qB4fi/eCMZ5pGZWSsqUWAAl8tjVSzuSGp4YLf0Eq9M0=; fh=zPyAtQBIWE/l9hby8g4KTASOZz1Q4ly6b7sYfyUlIrs=; b=LYZ9LvoMGW4Fi43/VES3lBHUmaBV4DEV40fW78yFhP9YscZd92MWGn6g2EgzJlqgTV sW/+mo9rgnl0IdVhZ2bWTBDFgseTQpN8hMGLnWn8ycoiAzzuGFkihAoHzC80Sd5Gi1ct SyXLyDr0BGQjqDJJmSmZYlbnMS7FBAl4Ge+4ERM/xv7SDBnpyPCkvAoYR6C7Hn0nU1tM LAeqVwDil9NDmVIp212yyR6YqHPWr67Re6jlHDxbtbfQcNSkh6vZ2sP3itQen5qPD0bD CtVRw3vzRsfsE1+jGonk0PB3BYz3jmtDz9PO0Hjnp4BmoYAQksPVoJwtVT+7LkNCVIQw R3zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mAzqogHA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id x4-20020a17090a9dc400b00285176db799si4076830pjv.164.2023.11.20.05.52.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 05:52:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mAzqogHA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id DE5C88039EC9; Mon, 20 Nov 2023 05:52:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233464AbjKTNvp (ORCPT + 99 others); Mon, 20 Nov 2023 08:51:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233393AbjKTNvh (ORCPT ); Mon, 20 Nov 2023 08:51:37 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 217CED5D; Mon, 20 Nov 2023 05:51:23 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40842752c6eso16250665e9.1; Mon, 20 Nov 2023 05:51:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700488281; x=1701093081; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=qB4fi/eCMZ5pGZWSsqUWAAl8tjVSzuSGp4YLf0Eq9M0=; b=mAzqogHAf1D7ONAHYaBcvRLY8y8kp/v0Pmr+NA15XISsQ68WKVxe+MPI62RYMcTuqX T/wDomRuB61Ycq5TaUsjptkKJ0ngs0NU3Co6kMI7zZKfrOVhYYptixAyRo39SJwuKtE4 S9YNa+UmbAg0+mq+EW8GXRqq+ZfMOagqG+ADHss4ZYr2DIrEJb8y/Uvhns/7wKIbNwjI EteutBXF/bTkPeADtYfyvPZAlXUe7RRGYVyCd7qallSSewVHbwPtzu72daTsrCL3U95z iYDjRvK2naegCoteX4a7w+pweSOj6ZL+FiB1XvvXNxrcUU5F4GJPFhQ5LTCiqzE7qa/D U46g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700488281; x=1701093081; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qB4fi/eCMZ5pGZWSsqUWAAl8tjVSzuSGp4YLf0Eq9M0=; b=nEkkqFiShc7tRFlYqoR40AlK0l9CgzgbKoevTdb6hbYHTD4r1ObpwwRpM4WPFmDAqX cSK2U3sX86uKUlG85uxhq0s9BcnAutttimY3jL2jelN+VS4H8gxWaUJVgH05OhPVe1O+ +vT/DAWPbvMhSrCYFMGrk3SIpJvhVys6LbEYwRmUFWd/bMWSeQRnnY0DG92lqq4dC1FV WzL/uU4W7YToEvFicHtRtwQ/i0a8/twt0+WO2QyhMWEac2xQKdN2OcUzEqVkDwEQqiPQ grv7yxHv7qfqaqFKELPR0XNuR75PL6tClYUJdoHGqJr5tF0wwZVu2zyWCG7GteFmn6A3 4XzQ== X-Gm-Message-State: AOJu0YyLvP+ZNK4htVM3VkBq9ld5Mqix24jp4BQRUq0f3+PYM3ssSoRf ytGnyl2S/VLMfygibhmzvmw= X-Received: by 2002:a05:600c:1914:b0:409:7d0:d20b with SMTP id j20-20020a05600c191400b0040907d0d20bmr5623787wmq.24.1700488281411; Mon, 20 Nov 2023 05:51:21 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id j33-20020a05600c1c2100b0040772934b12sm18205846wms.7.2023.11.20.05.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 05:51:21 -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 , David Epping , Vladimir Oltean , Christian Marangi , "Russell King (Oracle)" , Harini Katakam , Simon Horman , 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 06/14] net: phy: add support for shared priv data size for PHY package in DT Date: Mon, 20 Nov 2023 14:50:33 +0100 Message-Id: <20231120135041.15259-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231120135041.15259-1-ansuelsmth@gmail.com> References: <20231120135041.15259-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 20 Nov 2023 05:52:20 -0800 (PST) Add support for defining shared data size for PHY package defined in DT. A PHY driver has to define the value .phy_package_priv_data_size to make the generic OF PHY package function alloc priv data in the shared struct for the PHY package. Signed-off-by: Christian Marangi --- drivers/net/phy/phy_device.c | 7 ++++++- include/linux/phy.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 452fd69e8924..91d17129b774 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3200,6 +3200,7 @@ static int of_phy_package(struct phy_device *phydev) struct device_node *package_node; const char *global_phy_name; int i, global_phys_num, ret; + int shared_priv_data_size; int *global_phy_addrs; if (!node) @@ -3252,8 +3253,12 @@ static int of_phy_package(struct phy_device *phydev) global_phy_addrs[i] = addr; } + shared_priv_data_size = 0; + if (phydev->drv->phy_package_priv_data_size) + shared_priv_data_size = phydev->drv->phy_package_priv_data_size; + ret = devm_phy_package_join(&phydev->mdio.dev, phydev, global_phy_addrs, - global_phys_num, 0); + global_phys_num, shared_priv_data_size); if (ret) goto exit; diff --git a/include/linux/phy.h b/include/linux/phy.h index 5e595a0a43b6..7c47c12cffa0 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -896,6 +896,8 @@ struct phy_led { * for PHY package global init. If defined, list is compared * with DT values to match correct PHY phandle order. List * last element MUST BE an empty string. + * @phy_package_priv_data_size: Size of the priv data to alloc + * for shared struct of PHY package. * * All functions are optional. If config_aneg or read_status * are not implemented, the phy core uses the genphy versions. @@ -915,6 +917,7 @@ struct phy_driver { const void *driver_data; unsigned int phy_package_global_phy_num; const char * const *phy_package_global_phy_names; + unsigned int phy_package_priv_data_size; /** * @soft_reset: Called to issue a PHY software reset -- 2.40.1