Re: [PATCH] Revert "usb: chipidea: usbmisc_imx: delete clock information"

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

 



On Thu, Jul 2, 2015 at 5:40 AM, Peter Chen <peter.chen@xxxxxxxxxxxxx> wrote:

> Sorry, I can't accept it, and it will remain the clock on, and break
> runtime pm feature.
>
> In fact, the core and non-core use the same clocks, and at imx27, it
> may need two or three clocks to let the controller work for imx27.
> I can accept handle three clocks like below at ci_hdrc_imx.c to fix
> this issue.
>
> arch/arm/boot/dts/imx25.dtsi
>                 clocks = <&clks 9>, <&clks 70>, <&clks 8>;
>                 clock-names = "ipg", "ahb", "per";

Do you mean something like this? (I know I should not break existing
dtb's, but just want to make sure I got your idea):

diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index feb9d34..e74aa3c 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -515,7 +515,10 @@
                                #index-cells = <1>;
                                compatible = "fsl,imx27-usbmisc";
                                reg = <0x10024600 0x200>;
-                               clocks = <&clks IMX27_CLK_USB_AHB_GATE>;
+                               clocks = <&clks IMX27_CLK_IPG>,
+                                        <&clks IMX27_CLK_USB_AHB_GATE>,
+                                        <&clks IMX27_CLK_USB_DIV>;
+                               clock-names = "ipg", "ahb", "per";
                        };

                        sahara2: sahara@10025000 {
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c
b/drivers/usb/chipidea/ci_hdrc_imx.c
index 389f0e0..a2b8cd0 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -65,6 +65,8 @@ struct ci_hdrc_imx_data {
        struct usb_phy *phy;
        struct platform_device *ci_pdev;
        struct clk *clk;
+       struct clk *per;
+       struct clk *ahb;
        struct imx_usbmisc_data *usbmisc_data;
        bool supports_runtime_pm;
        bool in_lpm;
@@ -141,13 +143,27 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
        if (IS_ERR(data->usbmisc_data))
                return PTR_ERR(data->usbmisc_data);

-       data->clk = devm_clk_get(&pdev->dev, NULL);
+       data->clk = devm_clk_get(&pdev->dev, "ipg");
        if (IS_ERR(data->clk)) {
                dev_err(&pdev->dev,
-                       "Failed to get clock, err=%ld\n", PTR_ERR(data->clk));
+                       "Failed to get ipg clock, err=%ld\n",
PTR_ERR(data->clk));
                return PTR_ERR(data->clk);
        }

+       data->per = devm_clk_get(&pdev->dev, "per");
+       if (IS_ERR(data->per)) {
+               dev_err(&pdev->dev,
+                       "Failed to get per clock, err=%ld\n",
PTR_ERR(data->per));
+               return PTR_ERR(data->per);
+       }
+
+       data->ahb = devm_clk_get(&pdev->dev, "ahb");
+       if (IS_ERR(data->ahb)) {
+               dev_err(&pdev->dev,
+                       "Failed to get ahb clock, err=%ld\n",
PTR_ERR(data->ahb));
+               return PTR_ERR(data->ahb);
+       }
+
        ret = clk_prepare_enable(data->clk);
        if (ret) {
                dev_err(&pdev->dev,
@@ -155,6 +171,9 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
                return ret;
        }

+       clk_prepare_enable(data->per);
+       clk_prepare_enable(data->ahb);
+
        data->phy = devm_usb_get_phy_by_phandle(&pdev->dev, "fsl,usbphy", 0);
        if (IS_ERR(data->phy)) {
                ret = PTR_ERR(data->phy);

This fails as:

imx_usb 10024000.usb: Failed to get ipg clock, err=-2
imx_usb: probe of 10024000.usb failed with error -2
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux