All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Rob Herring <robh@kernel.org>, Thinh Nguyen <thinh.nguyen@synopsys.com>
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
	Mark Rutland <mark.rutland@arm.com>,
	John Youn <john.youn@synopsys.com>
Subject: [v2,3/4] usb: dwc3: Add property snps,enable-refclk-sof
Date: Thu, 20 Dec 2018 08:52:27 +0200	[thread overview]
Message-ID: <87sgysu1uc.fsf@linux.intel.com> (raw)

Hi,

Rob Herring <robh@kernel.org> writes:
> On Fri, Dec 07, 2018 at 06:27:43PM -0800, Thinh Nguyen wrote:
>> This patch adds a property to enable the controller to track the
>> frame number based on the reference clock.
>> 
>> When operating in USB 2.0 mode, the peripheral controller uses the USB2
>> PHY clocks to track the frame number. This prevents the controller from
>> suspending the USB2 PHY when the device goes into low power. Version
>> 1.80a of the DWC_usb31 peripheral controller introduces a way to track
>> frame number based on the reference clock instead. This feature allows
>> the controller to suspend the USB2 PHY when the device goes into low
>> power. This improves power saving for devices that have isochronous
>> endpoints.
>> 
>> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
>> ---
>> Changes in v2:
>> - Revise property description
>> - Rename property from snps,enable-refclk-lpm to snps,enable-refclk-sof
>> 
>>  Documentation/devicetree/bindings/usb/dwc3.txt | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
>> index b7e67edff9b2..01b948fff0eb 100644
>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
>> @@ -101,6 +101,9 @@ Optional properties:
>>  			enable periodic ESS TX threshold.
>>   - snps,refclk-period-ns: if set, this value informs the controller of the
>>  			reference clock period in nanoseconds.
>> + - snps,enable-refclk-sof: set to enable reference clock based frame number
>> +			tracking while in low power, allowing the controller to
>> +			suspend the PHY during low power states.
>
> This should be implied by the compatible string.

Two problems with this:

1) Won't work for PCI-based systems

2) If we start having many users of this we will end up with:

	if (of_device_is_compatible("a") ||
        	of_device_is_compatible("b") ||
        	of_device_is_compatible("c") ||
                of_device_is_compatible("d") ||
                ...)
		foo();

Conversely, if we just pass a flag, this branch will never change. We
won't need changes to the kernel because a new platform needing refclk
based frame number tracking is, now, supported upstream.

WARNING: multiple messages have this Message-ID (diff)
From: Felipe Balbi <balbi@kernel.org>
To: Rob Herring <robh@kernel.org>, Thinh Nguyen <thinh.nguyen@synopsys.com>
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
	Mark Rutland <mark.rutland@arm.com>,
	John Youn <john.youn@synopsys.com>
Subject: Re: [PATCH v2 3/4] usb: dwc3: Add property snps,enable-refclk-sof
Date: Thu, 20 Dec 2018 08:52:27 +0200	[thread overview]
Message-ID: <87sgysu1uc.fsf@linux.intel.com> (raw)
In-Reply-To: <20181218164128.GA14552@bogus>

[-- Attachment #1: Type: text/plain, Size: 2359 bytes --]


Hi,

Rob Herring <robh@kernel.org> writes:
> On Fri, Dec 07, 2018 at 06:27:43PM -0800, Thinh Nguyen wrote:
>> This patch adds a property to enable the controller to track the
>> frame number based on the reference clock.
>> 
>> When operating in USB 2.0 mode, the peripheral controller uses the USB2
>> PHY clocks to track the frame number. This prevents the controller from
>> suspending the USB2 PHY when the device goes into low power. Version
>> 1.80a of the DWC_usb31 peripheral controller introduces a way to track
>> frame number based on the reference clock instead. This feature allows
>> the controller to suspend the USB2 PHY when the device goes into low
>> power. This improves power saving for devices that have isochronous
>> endpoints.
>> 
>> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
>> ---
>> Changes in v2:
>> - Revise property description
>> - Rename property from snps,enable-refclk-lpm to snps,enable-refclk-sof
>> 
>>  Documentation/devicetree/bindings/usb/dwc3.txt | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
>> index b7e67edff9b2..01b948fff0eb 100644
>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
>> @@ -101,6 +101,9 @@ Optional properties:
>>  			enable periodic ESS TX threshold.
>>   - snps,refclk-period-ns: if set, this value informs the controller of the
>>  			reference clock period in nanoseconds.
>> + - snps,enable-refclk-sof: set to enable reference clock based frame number
>> +			tracking while in low power, allowing the controller to
>> +			suspend the PHY during low power states.
>
> This should be implied by the compatible string.

Two problems with this:

1) Won't work for PCI-based systems

2) If we start having many users of this we will end up with:

	if (of_device_is_compatible("a") ||
        	of_device_is_compatible("b") ||
        	of_device_is_compatible("c") ||
                of_device_is_compatible("d") ||
                ...)
		foo();

Conversely, if we just pass a flag, this branch will never change. We
won't need changes to the kernel because a new platform needing refclk
based frame number tracking is, now, supported upstream.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

             reply	other threads:[~2018-12-20  6:52 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-20  6:52 Felipe Balbi [this message]
2018-12-20  6:52 ` [PATCH v2 3/4] usb: dwc3: Add property snps,enable-refclk-sof Felipe Balbi
  -- strict thread matches above, loose matches on Subject: below --
2018-12-21 19:30 [v2,1/4] usb: dwc3: Add property snps,refclk-period-ns Thinh Nguyen
2018-12-21 19:30 ` [PATCH v2 1/4] " Thinh Nguyen
2018-12-21 17:11 [v2,1/4] " Rob Herring
2018-12-21 17:11 ` [PATCH v2 1/4] " Rob Herring
2018-12-21  0:21 [v2,1/4] " Thinh Nguyen
2018-12-21  0:21 ` [PATCH v2 1/4] " Thinh Nguyen
2018-12-20 15:19 [v2,3/4] usb: dwc3: Add property snps,enable-refclk-sof Rob Herring
2018-12-20 15:19 ` [PATCH v2 3/4] " Rob Herring
2018-12-20  6:48 [v2,1/4] usb: dwc3: Add property snps,refclk-period-ns Felipe Balbi
2018-12-20  6:48 ` [PATCH v2 1/4] " Felipe Balbi
2018-12-19 21:31 [v2,1/4] " Thinh Nguyen
2018-12-19 21:31 ` [PATCH v2 1/4] " Thinh Nguyen
2018-12-19 13:18 [v2,1/4] " Rob Herring
2018-12-19 13:18 ` [PATCH v2 1/4] " Rob Herring
2018-12-19  0:22 [v2,1/4] " Thinh Nguyen
2018-12-19  0:22 ` [PATCH v2 1/4] " Thinh Nguyen
2018-12-19  0:19 [v2,3/4] usb: dwc3: Add property snps,enable-refclk-sof Thinh Nguyen
2018-12-19  0:19 ` [PATCH v2 3/4] " Thinh Nguyen
2018-12-18 16:41 [v2,3/4] " Rob Herring
2018-12-18 16:41 ` [PATCH v2 3/4] " Rob Herring
2018-12-18 16:38 [v2,1/4] usb: dwc3: Add property snps,refclk-period-ns Rob Herring
2018-12-18 16:38 ` [PATCH v2 1/4] " Rob Herring
2018-12-08  2:27 [v2,3/4] usb: dwc3: Add property snps,enable-refclk-sof Thinh Nguyen
2018-12-08  2:27 ` [PATCH v2 3/4] " Thinh Nguyen
2018-12-08  2:27 [v2,1/4] usb: dwc3: Add property snps,refclk-period-ns Thinh Nguyen
2018-12-08  2:27 ` [PATCH v2 1/4] " Thinh Nguyen
2018-12-08  2:27 [PATCH v2 0/4] usb: dwc3: Introduce refclk lpm 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=87sgysu1uc.fsf@linux.intel.com \
    --to=balbi@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=john.youn@synopsys.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.