@@ -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;
@@ -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);
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@bootlin.com> --- drivers/net/pcs/pcs-rzn1-miic.c | 12 ++++++++++++ include/linux/pcs-rzn1-miic.h | 3 +++ 2 files changed, 15 insertions(+)