Re: [PATCH v4] usb: uhci: Add clk support to uhci-platform

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

 



On Mon, Jan 15, 2018 at 2:41 AM, Sergei Shtylyov
<sergei.shtylyov@xxxxxxxxxxxxxxxxxx> wrote:
> Hello!
>
>
> On 1/15/2018 1:59 AM, Benjamin Herrenschmidt wrote:
>
>> The Aspeed SoCs use uhci-platform. With the new dynamic clock
>> control framework, the corresponding IP block clock must be
>> properly enabled.
>>
>> This is a simplified variant of what ehci-platform does, it
>> looks for *one* clock attached to the device, and if it's
>> there, enables it.
>>
>> Signed-off-by: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
>> Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

>> +
>> +       /* Get and enable clock if any specified */
>> +       uhci->clk = devm_clk_get(&pdev->dev, NULL);
>> +       if (IS_ERR(uhci->clk)) {
>> +               ret = PTR_ERR(uhci->clk);
>> +               goto err_rmr;
>> +       }
>> +       ret = clk_prepare_enable(uhci->clk);
>> +       if (ret) {
>> +               dev_err(&pdev->dev, "Error couldn't enable clock (%d)\n",
>> ret);
>> +               goto err_rmr;
>> +       }
>> +
>>         ret = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_SHARED);
>>         if (ret)
>>                 goto err_rmr;
>> @@ -127,6 +140,7 @@ static int uhci_hcd_platform_probe(struct
>> platform_device *pdev)
>>         return 0;
>>     err_rmr:
>> +       clk_disable_unprepare(uhci->clk);
>
>
>     Really? You haven't enabled the clock before either *goto* above, why
> disable it here?

This is fine; clk_disable_unprepare checks to see if struct clk * is
NULL, and if so, silently continues.

Reviewed-by: Joel Stanley <joel@xxxxxxxxx>

I tested the patch on the ASPEED ast2500 platform.

Cheers,

Joel
--
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