[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231126015346.25208-1-ansuelsmth@gmail.com>
Date: Sun, 26 Nov 2023 02:53:38 +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>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Christian Marangi <ansuelsmth@...il.com>,
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 PATCH RFC v3 0/8] net: phy: Support DT PHY package
This depends on another series for PHY package API change. [1]
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 {
compatible = "ethernet-phy-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.
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)
[1] https://patchwork.kernel.org/project/netdevbpf/patch/20231126003748.9600-1-ansuelsmth@gmail.com/
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 (6):
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
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 | 75 +
.../devicetree/bindings/net/qcom,qca807x.yaml | 136 ++
drivers/net/mdio/of_mdio.c | 68 +-
drivers/net/phy/Kconfig | 7 +
drivers/net/phy/Makefile | 1 +
drivers/net/phy/mdio_bus.c | 35 +-
drivers/net/phy/phy_device.c | 54 +
drivers/net/phy/qca807x.c | 1315 +++++++++++++++++
include/dt-bindings/net/qcom-qca807x.h | 30 +
include/linux/phy.h | 27 +
10 files changed, 1719 insertions(+), 29 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
--
2.40.1
Powered by blists - more mailing lists