[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230209151632.275883-2-clement.leger@bootlin.com>
Date: Thu, 9 Feb 2023 16:16:27 +0100
From: Clément Léger <clement.leger@...tlin.com>
To: Sergey Shtylyov <s.shtylyov@....ru>,
"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>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>,
Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Russell King <linux@...linux.org.uk>,
Wong Vee Khee <veekhee@...le.com>,
Clément Léger <clement.leger@...tlin.com>,
Kurt Kanzenbach <kurt@...utronix.de>,
Revanth Kumar Uppala <ruppala@...dia.com>,
Tan Tee Min <tee.min.tan@...ux.intel.com>
Cc: Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Herve Codina <herve.codina@...tlin.com>,
Miquèl Raynal <miquel.raynal@...tlin.com>,
Milan Stevanovic <milan.stevanovic@...com>,
Jimmy Lalande <jimmy.lalande@...com>,
Pascal Eberhard <pascal.eberhard@...com>,
Mohammad Athari Bin Ismail <mohammad.athari.ismail@...el.com>,
Jon Hunter <jonathanh@...dia.com>, netdev@...r.kernel.org,
linux-renesas-soc@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org
Subject: [PATCH net-next v3 1/6] net: pcs: rzn1-miic: add pcs_early_setup() function
When using this PCS with the stmmac IP, if the pcs is not configured and
enabled before setting up stmmac hardware, driver setup will fail due to
the lack of input RGMII RX clock. Add pcs_early_setup() function which
allows to configure the MIIC converter based on the "phy-mode" that is
described in the device-tree.
Signed-off-by: Clément Léger <clement.leger@...tlin.com>
---
drivers/net/pcs/pcs-rzn1-miic.c | 12 ++++++++++++
include/linux/pcs-rzn1-miic.h | 3 +++
2 files changed, 15 insertions(+)
diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
index c1424119e821..e2eaf789c4d2 100644
--- a/drivers/net/pcs/pcs-rzn1-miic.c
+++ b/drivers/net/pcs/pcs-rzn1-miic.c
@@ -288,6 +288,18 @@ static const struct phylink_pcs_ops miic_phylink_ops = {
.pcs_link_up = miic_link_up,
};
+int miic_early_setup(struct phylink_pcs *pcs, struct device *dev)
+{
+ int interface;
+
+ interface = device_get_phy_mode(dev);
+ if (interface < 0)
+ return interface;
+
+ return miic_config(pcs, 0, interface, NULL, false);
+}
+EXPORT_SYMBOL(miic_early_setup);
+
struct phylink_pcs *miic_create(struct device *dev, struct device_node *np)
{
struct platform_device *pdev;
diff --git a/include/linux/pcs-rzn1-miic.h b/include/linux/pcs-rzn1-miic.h
index 56d12b21365d..84d7130b4b78 100644
--- a/include/linux/pcs-rzn1-miic.h
+++ b/include/linux/pcs-rzn1-miic.h
@@ -9,8 +9,11 @@
#define __LINUX_PCS_MIIC_H
struct phylink;
+struct phylink_pcs;
struct device_node;
+int miic_early_setup(struct phylink_pcs *pcs, struct device *dev);
+
struct phylink_pcs *miic_create(struct device *dev, struct device_node *np);
void miic_destroy(struct phylink_pcs *pcs);
--
2.39.0
Powered by blists - more mailing lists