}
#endif
+static int fecmxc_set_ref_clk(struct clk *clk_ref, phy_interface_t interface)
+{
+ unsigned int freq;
+ int ret;
+
+ if (!CONFIG_IS_ENABLED(CLK_CCF))
+ return 0;
+
+ if (interface == PHY_INTERFACE_MODE_MII)
+ freq = 25000000;
+ else if (interface == PHY_INTERFACE_MODE_RMII)
+ freq = 50000000;
+ else if (interface == PHY_INTERFACE_MODE_RGMII ||
+ interface == PHY_INTERFACE_MODE_RGMII_ID ||
+ interface == PHY_INTERFACE_MODE_RGMII_RXID ||
+ interface == PHY_INTERFACE_MODE_RGMII_TXID)
+ freq = 125000000;
+ else
+ return -EINVAL;
+
+ ret = clk_set_rate(clk_ref, freq);
+ if (ret < 0)
+ return ret;
+
+ return 0;
+}
+
static int fecmxc_probe(struct udevice *dev)
{
bool dm_mii_bus = true;
ret = clk_get_by_name(dev, "enet_clk_ref", &priv->clk_ref);
if (!ret) {
+ ret = fecmxc_set_ref_clk(&priv->clk_ref,
+ pdata->phy_interface);
+ if (ret)
+ return ret;
+
ret = clk_enable(&priv->clk_ref);
if (ret)
return ret;