linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Thinh Nguyen <thinh.nguyen@synopsys.com>Thinh Nguyen
	<thinh.nguyen@synopsys.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>
Cc: John Youn <john.youn@synopsys.com>
Subject: [1/3] usb: dwc3: Add reference clock properties
Date: Fri, 09 Nov 2018 10:54:45 +0200	[thread overview]
Message-ID: <87k1lmska2.fsf@linux.intel.com> (raw)

Hi,

Thinh Nguyen <thinh.nguyen@synopsys.com> writes:
>> Thinh Nguyen <thinh.nguyen@synopsys.com> writes:
>>>> Thinh Nguyen <thinh.nguyen@synopsys.com> writes:
>>>>>>>>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
>>>>>>>>> index 636630fb92d7..712b344c3a31 100644
>>>>>>>>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
>>>>>>>>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
>>>>>>>>> @@ -95,6 +95,24 @@ Optional properties:
>>>>>>>>>  			this and tx-thr-num-pkt-prd to a valid, non-zero value
>>>>>>>>>  			1-16 (DWC_usb31 programming guide section 1.2.3) to
>>>>>>>>>  			enable periodic ESS TX threshold.
>>>>>>>>> + - snps,refclk-period-ns: set to program the reference clock period. The valid
>>>>>>>>> +   			input periods are as follow:
>>>>>>>>> +			+-------------+-----------------+
>>>>>>>>> +			| Period (ns) | Freq (MHz)      |
>>>>>>>>> +			+-------------+-----------------+
>>>>>>>>> +			| 25          | 39.7/40         |
>>>>>>>>> +			| 41          | 24.4            |
>>>>>>>>> +			| 50          | 20              |
>>>>>>>>> +			| 52          | 19.2            |
>>>>>>>>> +			| 58          | 17.2            |
>>>>>>>>> +			| 62          | 16.1            |
>>>>>>>>> +			+-------------+-----------------+
>>>>>>>>> + - snps,enable-refclk-lpm: set to enable low power scheduling of isochronous
>>>>>>>>> +			transfers by running SOF/ITP counters using the
>>>>>>>>> +			reference clock. Only valid for DWC_usb31 peripheral
>>>>>>>>> +			controller v1.80a and higher. Both
>>>>>>>>> +			"snps,dis_u2_susphy_quirk" and
>>>>>>>>> +			"snps,dis_enblslpm_quirk" must not be set.
>>>>>>>> sounds like you should rely on clk API here. Then on driver call
>>>>>>>> clk_get_rate() to computer whatever you need to compute.
>>>>>>>>
>>>>>>> There's nothing to compute here. We can simply enable this feature with
>>>>>>> "snps, enable-refclk-lpm" and the controller will use the default refclk
>>>>>>> settings.
>>>>>> Right, right. What I'm saying, though, is that we have a clock API for
>>>>>> describing a clock. So why wouldn't we rely on that API for this? I
>>>>>> think both of these new properties can be replaced with standard clock
>>>>>> API properties:
>>>>>>
>>>>>> 	clocks = <&clk1>, ..., <&lpm_clk>
>>>>>>         clock-names = "clock1", ...., "lpm";
>>>>>>
>>>>>> Then dwc3 core could, simply, check if we have a clock named "lpm" and
>>>>>> if there is, use NSECS_PER_SEC / clk_get_rate() to get its period and
>>>>>> write it to the register that needs the information.
>>>>> There's no new clock here. We are using the ref_clk for SOF and ITP
>>>>> counter for this feature. Also, clocks are optional on non-DT platforms.
>>>>> To use the clock API, then we need to update the driver to allow some
>>>>> optional clock such as "ref" clock for non-DT platforms. Do you want to
>>>>> do it like this?
>>>> I can't think of a problem that would arise from that. Can you? Mark,
>>>> Rob, what do you think?
>>>>
>>> No problem. That can be done. This will remove the
>>> "snps,refclk-period-ns" property. But we should have
>>> "snps,enable-refclk-lpm" to enable this feature.
>> not really. Just check if you have a clock named lpm. If you do, then
>> you enable the feature.
>>
> But this clock name should be "ref".  The new name "lpm" would make it
> seem like it's a different clock.

now I understand. There's no special LPM clock, this is just the regular
old reference clock being used for LPM. I agree with you, only
refclk-period-ns will be replaced.

             reply	other threads:[~2018-11-09  8:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09  8:54 Felipe Balbi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-12-08  2:25 [1/3] usb: dwc3: Add reference clock properties Thinh Nguyen
2018-11-09  7:45 Thinh Nguyen
2018-11-09  7:14 Felipe Balbi
2018-11-08 19:51 Thinh Nguyen
2018-11-08  7:17 Felipe Balbi
2018-11-07 22:49 Thinh Nguyen
2018-11-07  6:37 Felipe Balbi
2018-11-07  4:11 Thinh Nguyen
2018-11-06 11:26 Felipe Balbi
2018-11-03  1:35 Thinh Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k1lmska2.fsf@linux.intel.com \
    --to=balbi@kernel.org \
    --cc=john.youn@synopsys.com \
    --cc=thinh.nguyen@synopsys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).