@@ -1453,28 +1453,18 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)
base++;
}
- priv->clk = devm_clk_get_optional(&pdev->dev, "sw_switch");
+ priv->clk = devm_clk_get_optional_enabled(&pdev->dev, "sw_switch");
if (IS_ERR(priv->clk))
return PTR_ERR(priv->clk);
- ret = clk_prepare_enable(priv->clk);
- if (ret)
- return ret;
-
- priv->clk_mdiv = devm_clk_get_optional(&pdev->dev, "sw_switch_mdiv");
- if (IS_ERR(priv->clk_mdiv)) {
- ret = PTR_ERR(priv->clk_mdiv);
- goto out_clk;
- }
-
- ret = clk_prepare_enable(priv->clk_mdiv);
- if (ret)
- goto out_clk;
+ priv->clk_mdiv = devm_clk_get_optional_enabled(&pdev->dev, "sw_switch_mdiv");
+ if (IS_ERR(priv->clk_mdiv))
+ return PTR_ERR(priv->clk_mdiv);
ret = bcm_sf2_sw_rst(priv);
if (ret) {
pr_err("unable to software reset switch: %d\n", ret);
- goto out_clk_mdiv;
+ return ret;
}
bcm_sf2_crossbar_setup(priv);
@@ -1484,7 +1474,7 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)
ret = bcm_sf2_mdio_register(ds);
if (ret) {
pr_err("failed to register MDIO bus\n");
- goto out_clk_mdiv;
+ return ret;
}
bcm_sf2_gphy_enable_set(priv->dev->ds, false);
@@ -1551,10 +1541,6 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)
out_mdio:
bcm_sf2_mdio_unregister(priv);
-out_clk_mdiv:
- clk_disable_unprepare(priv->clk_mdiv);
-out_clk:
- clk_disable_unprepare(priv->clk);
return ret;
}
@@ -1571,8 +1557,6 @@ static void bcm_sf2_sw_remove(struct platform_device *pdev)
dsa_unregister_switch(priv->dev->ds);
bcm_sf2_cfp_exit(priv->dev->ds);
bcm_sf2_mdio_unregister(priv);
- clk_disable_unprepare(priv->clk_mdiv);
- clk_disable_unprepare(priv->clk);
if (priv->type == BCM7278_DEVICE_ID)
reset_control_assert(priv->rcdev);
}