Re: [PATCH v2 01/19] phy: mvebu-cp110-comphy: Add clocks support

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

 



Hi Miquel

czw., 27 cze 2019 o 11:51 Miquel Raynal <miquel.raynal@xxxxxxxxxxx> napisał(a):
> +static int mvebu_comphy_init_clks(struct mvebu_comphy_priv *priv)
> +{
> +       int ret;
> +
> +       priv->mg_domain_clk = devm_clk_get(priv->dev, "mg_clk");
> +       if (IS_ERR(priv->mg_domain_clk))
> +               return PTR_ERR(priv->mg_domain_clk);
> +
> +       ret = clk_prepare_enable(priv->mg_domain_clk);
> +       if (ret < 0)
> +               return ret;
> +
> +       priv->mg_core_clk = devm_clk_get(priv->dev, "mg_core_clk");
> +       if (IS_ERR(priv->mg_core_clk)) {
> +               ret = PTR_ERR(priv->mg_core_clk);
> +               goto dis_mg_domain_clk;
> +       }
> +
> +       ret = clk_prepare_enable(priv->mg_core_clk);
> +       if (ret < 0)
> +               goto dis_mg_domain_clk;
> +
> +       priv->axi_clk = devm_clk_get(priv->dev, "axi_clk");
> +       if (IS_ERR(priv->axi_clk)) {
> +               ret = PTR_ERR(priv->axi_clk);
> +               goto dis_mg_core_clk;
> +       }
> +
> +       ret = clk_prepare_enable(priv->axi_clk);
> +       if (ret < 0)
> +               goto dis_mg_core_clk;
> +
> +       return 0;
> +
> +dis_mg_core_clk:
> +       clk_disable_unprepare(priv->mg_core_clk);
> +
> +dis_mg_domain_clk:
> +       clk_disable_unprepare(priv->mg_domain_clk);
> +
> +       priv->mg_domain_clk = NULL;
> +       priv->mg_core_clk = NULL;
> +       priv->axi_clk = NULL;
> +
> +       return ret;
> +};
> +
> +static void mvebu_comphy_disable_unprepare_clks(struct mvebu_comphy_priv *priv)
> +{
> +       if (priv->axi_clk)
> +               clk_disable_unprepare(priv->axi_clk);
> +
> +       if (priv->mg_core_clk)
> +               clk_disable_unprepare(priv->mg_core_clk);
> +
> +       if (priv->mg_domain_clk)
> +               clk_disable_unprepare(priv->mg_domain_clk);
> +}
> +
>  static int mvebu_comphy_probe(struct platform_device *pdev)
>  {
>         struct mvebu_comphy_priv *priv;
>         struct phy_provider *provider;
>         struct device_node *child;
>         struct resource *res;
> +       int ret;
>
>         priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
>         if (!priv)
> @@ -607,10 +671,17 @@ static int mvebu_comphy_probe(struct platform_device *pdev)
>         if (IS_ERR(priv->base))
>                 return PTR_ERR(priv->base);
>
> +       /*
> +        * Ignore error if clocks have not been initialized properly for DT
> +        * compatibility reasons.
> +        */
> +       ret = mvebu_comphy_init_clks(priv);
> +       if (ret)
> +               dev_warn(&pdev->dev, "cannot initialize clocks\n");
> +

Please request probe retry when clocks are not ready, e.g.:
-       if (ret)
+       if (ret) {
+               if (ret == -EPROBE_DEFER)
+                       return ret;
                 dev_warn(&pdev->dev, "cannot initialize clocks\n");
+       }

After that you can put:
Tested-by: Grzegorz Jaszczyk <jaz@xxxxxxxxxxxx>

regards,
Grzegorz




[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