[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231125001127.5674-5-ansuelsmth@gmail.com>
Date: Sat, 25 Nov 2023 01:11:20 +0100
From: Christian Marangi <ansuelsmth@...il.com>
To: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
Florian Fainelli <florian.fainelli@...adcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@...adcom.com>,
Daniel Golle <daniel@...rotopia.org>,
Qingfang Deng <dqfext@...il.com>,
SkyLake Huang <SkyLake.Huang@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Vladimir Oltean <olteanv@...il.com>,
David Epping <david.epping@...singlinkelectronics.com>,
Harini Katakam <harini.katakam@....com>,
Christian Marangi <ansuelsmth@...il.com>,
"Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
Robert Marko <robert.marko@...tura.hr>, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Subject: [net-next RFC PATCH v2 04/11] net: phy: add support for shared priv data size for PHY package in DT
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 <ansuelsmth@...il.com>
---
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 f25bedb69b90..454dc8256e94 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -3198,6 +3198,7 @@ static int of_phy_package(struct phy_device *phydev)
struct device_node *node = phydev->mdio.dev.of_node;
struct device_node *package_node;
const u8 *global_phys_offset;
+ int shared_priv_data_size;
int *global_phys_addr;
u8 global_phys_num;
u32 base_addr;
@@ -3236,8 +3237,12 @@ static int of_phy_package(struct phy_device *phydev)
global_phys_addr[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_phys_addr,
- 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 3f75ae85b740..4ddf08e89624 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -895,6 +895,8 @@ struct phy_led {
* global PHYs for PHY package global configuration.
* @phy_package_global_phys_num: Num of the required global PHYs
* for PHY package global configuration.
+ * @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.
@@ -914,6 +916,7 @@ struct phy_driver {
const void *driver_data;
const u8 *phy_package_global_phys_offset;
const u8 phy_package_global_phys_num;
+ unsigned int phy_package_priv_data_size;
/**
* @soft_reset: Called to issue a PHY software reset
--
2.40.1
Powered by blists - more mailing lists