[PATCH net-next v3 1/6] net: pcs: rzn1-miic: add pcs_early_setup() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 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




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux