* [PATCH v3 1/1] usb:host:xhci support option to disable the xHCI USB2 HW LPM
@ 2017-06-23 3:02 Thang Q. Nguyen
2017-06-26 19:03 ` Rob Herring
2017-07-09 5:38 ` Thang Q. Nguyen
0 siblings, 2 replies; 4+ messages in thread
From: Thang Q. Nguyen @ 2017-06-23 3:02 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rob Herring, Mark Rutland, Mathias Nyman,
linux-usb, devicetree, linux-kernel
Cc: Thang Nguyen, Phong Vo, Loc Ho, Tung Nguyen, patches
XHCI specification 1.1 does not require xHCI-compliant controllers
to always enable hardware USB2 LPM. However, the current xHCI
driver always enable it when seeing HLC=1.
This patch supports an option for users to control disabling
USB2 Hardware LPM via DT/ACPI attribute.
This option is needed in case user would like to disable this
feature. For example, their xHCI controller has its USB2 HW LPM
broken.
Signed-off-by: Tung Nguyen <tunguyen@apm.com>
Signed-off-by: Thang Q. Nguyen <tqnguyen@apm.com>
---
Changes since v2:
- Change code to disable HW LPM as an option for user which
is set via ACPI/DT.
Changes since v1:
- Update DT/ACPI attribute and corresponding codes from HLE to LPM to
be consistent with other attribute names.
---
Documentation/devicetree/bindings/usb/usb-xhci.txt | 1 +
drivers/usb/host/xhci-plat.c | 3 +++
drivers/usb/host/xhci.c | 3 +++
drivers/usb/host/xhci.h | 1 +
4 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt b/Documentation/devicetree/bindings/usb/usb-xhci.txt
index 2d80b60..ae6e484 100644
--- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
@@ -26,6 +26,7 @@ Required properties:
Optional properties:
- clocks: reference to a clock
+ - usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM
- usb3-lpm-capable: determines if platform is USB3 LPM capable
- quirk-broken-port-ped: set if the controller has broken port disable mechanism
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index c04144b..9028fb5 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -267,6 +267,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
goto disable_clk;
}
+ if (device_property_read_bool(sysdev, "usb2-lpm-disable"))
+ xhci->quirks |= XHCI_HW_LPM_DISABLE;
+
if (device_property_read_bool(sysdev, "usb3-lpm-capable"))
xhci->quirks |= XHCI_LPM_SUPPORT;
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 30f47d9..49d05c7 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4061,6 +4061,9 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
!udev->lpm_capable)
return -EPERM;
+ if (xhci->quirks & XHCI_HW_LPM_DISABLE)
+ return -EPERM;
+
if (!udev->parent || udev->parent->parent ||
udev->descriptor.bDeviceClass == USB_CLASS_HUB)
return -EPERM;
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 73a28a9..03d50e8 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1819,6 +1819,7 @@ struct xhci_hcd {
/* For controller with a broken Port Disable implementation */
#define XHCI_BROKEN_PORT_PED (1 << 25)
#define XHCI_LIMIT_ENDPOINT_INTERVAL_7 (1 << 26)
+#define XHCI_HW_LPM_DISABLE (1 << 27)
unsigned int num_active_eps;
unsigned int limit_active_eps;
--
1.7.1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v3 1/1] usb:host:xhci support option to disable the xHCI USB2 HW LPM
2017-06-23 3:02 [PATCH v3 1/1] usb:host:xhci support option to disable the xHCI USB2 HW LPM Thang Q. Nguyen
@ 2017-06-26 19:03 ` Rob Herring
2017-07-09 5:38 ` Thang Q. Nguyen
1 sibling, 0 replies; 4+ messages in thread
From: Rob Herring @ 2017-06-26 19:03 UTC (permalink / raw)
To: Thang Q. Nguyen
Cc: Greg Kroah-Hartman, Mark Rutland, Mathias Nyman, linux-usb,
devicetree, linux-kernel, Phong Vo, Loc Ho, Tung Nguyen, patches
On Fri, Jun 23, 2017 at 10:02:12AM +0700, Thang Q. Nguyen wrote:
> XHCI specification 1.1 does not require xHCI-compliant controllers
> to always enable hardware USB2 LPM. However, the current xHCI
> driver always enable it when seeing HLC=1.
> This patch supports an option for users to control disabling
> USB2 Hardware LPM via DT/ACPI attribute.
> This option is needed in case user would like to disable this
> feature. For example, their xHCI controller has its USB2 HW LPM
> broken.
>
> Signed-off-by: Tung Nguyen <tunguyen@apm.com>
> Signed-off-by: Thang Q. Nguyen <tqnguyen@apm.com>
> ---
> Changes since v2:
> - Change code to disable HW LPM as an option for user which
> is set via ACPI/DT.
> Changes since v1:
> - Update DT/ACPI attribute and corresponding codes from HLE to LPM to
> be consistent with other attribute names.
> ---
> Documentation/devicetree/bindings/usb/usb-xhci.txt | 1 +
> drivers/usb/host/xhci-plat.c | 3 +++
> drivers/usb/host/xhci.c | 3 +++
> drivers/usb/host/xhci.h | 1 +
> 4 files changed, 8 insertions(+), 0 deletions(-)
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 1/1] usb:host:xhci support option to disable the xHCI USB2 HW LPM
2017-06-23 3:02 [PATCH v3 1/1] usb:host:xhci support option to disable the xHCI USB2 HW LPM Thang Q. Nguyen
2017-06-26 19:03 ` Rob Herring
@ 2017-07-09 5:38 ` Thang Q. Nguyen
2017-07-09 6:16 ` Greg Kroah-Hartman
1 sibling, 1 reply; 4+ messages in thread
From: Thang Q. Nguyen @ 2017-07-09 5:38 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rob Herring, Mark Rutland, Mathias Nyman,
linux-usb, devicetree, linux-kernel
Cc: Thang Nguyen, Phong Vo, Loc Ho, Tung Nguyen, patches
On Fri, Jun 23, 2017 at 10:02 AM, Thang Q. Nguyen <tqnguyen@apm.com> wrote:
> XHCI specification 1.1 does not require xHCI-compliant controllers
> to always enable hardware USB2 LPM. However, the current xHCI
> driver always enable it when seeing HLC=1.
> This patch supports an option for users to control disabling
> USB2 Hardware LPM via DT/ACPI attribute.
> This option is needed in case user would like to disable this
> feature. For example, their xHCI controller has its USB2 HW LPM
> broken.
>
> Signed-off-by: Tung Nguyen <tunguyen@apm.com>
> Signed-off-by: Thang Q. Nguyen <tqnguyen@apm.com>
> ---
> Changes since v2:
> - Change code to disable HW LPM as an option for user which
> is set via ACPI/DT.
> Changes since v1:
> - Update DT/ACPI attribute and corresponding codes from HLE to LPM to
> be consistent with other attribute names.
> ---
> Documentation/devicetree/bindings/usb/usb-xhci.txt | 1 +
> drivers/usb/host/xhci-plat.c | 3 +++
> drivers/usb/host/xhci.c | 3 +++
> drivers/usb/host/xhci.h | 1 +
> 4 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt b/Documentation/devicetree/bindings/usb/usb-xhci.txt
> index 2d80b60..ae6e484 100644
> --- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
> +++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
> @@ -26,6 +26,7 @@ Required properties:
>
> Optional properties:
> - clocks: reference to a clock
> + - usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM
> - usb3-lpm-capable: determines if platform is USB3 LPM capable
> - quirk-broken-port-ped: set if the controller has broken port disable mechanism
>
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index c04144b..9028fb5 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -267,6 +267,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
> goto disable_clk;
> }
>
> + if (device_property_read_bool(sysdev, "usb2-lpm-disable"))
> + xhci->quirks |= XHCI_HW_LPM_DISABLE;
> +
> if (device_property_read_bool(sysdev, "usb3-lpm-capable"))
> xhci->quirks |= XHCI_LPM_SUPPORT;
>
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 30f47d9..49d05c7 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -4061,6 +4061,9 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
> !udev->lpm_capable)
> return -EPERM;
>
> + if (xhci->quirks & XHCI_HW_LPM_DISABLE)
> + return -EPERM;
> +
> if (!udev->parent || udev->parent->parent ||
> udev->descriptor.bDeviceClass == USB_CLASS_HUB)
> return -EPERM;
> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> index 73a28a9..03d50e8 100644
> --- a/drivers/usb/host/xhci.h
> +++ b/drivers/usb/host/xhci.h
> @@ -1819,6 +1819,7 @@ struct xhci_hcd {
> /* For controller with a broken Port Disable implementation */
> #define XHCI_BROKEN_PORT_PED (1 << 25)
> #define XHCI_LIMIT_ENDPOINT_INTERVAL_7 (1 << 26)
> +#define XHCI_HW_LPM_DISABLE (1 << 27)
>
> unsigned int num_active_eps;
> unsigned int limit_active_eps;
> --
> 1.7.1
>
Hi,
Is there any other comment on the patch?
Regards,
Thang Q. Nguyen
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v3 1/1] usb:host:xhci support option to disable the xHCI USB2 HW LPM
2017-07-09 5:38 ` Thang Q. Nguyen
@ 2017-07-09 6:16 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2017-07-09 6:16 UTC (permalink / raw)
To: Thang Q. Nguyen
Cc: Rob Herring, Mark Rutland, Mathias Nyman, linux-usb, devicetree,
linux-kernel, Phong Vo, Loc Ho, Tung Nguyen, patches
On Sun, Jul 09, 2017 at 12:38:19PM +0700, Thang Q. Nguyen wrote:
> On Fri, Jun 23, 2017 at 10:02 AM, Thang Q. Nguyen <tqnguyen@apm.com> wrote:
> > XHCI specification 1.1 does not require xHCI-compliant controllers
> > to always enable hardware USB2 LPM. However, the current xHCI
> > driver always enable it when seeing HLC=1.
> > This patch supports an option for users to control disabling
> > USB2 Hardware LPM via DT/ACPI attribute.
> > This option is needed in case user would like to disable this
> > feature. For example, their xHCI controller has its USB2 HW LPM
> > broken.
> >
> > Signed-off-by: Tung Nguyen <tunguyen@apm.com>
> > Signed-off-by: Thang Q. Nguyen <tqnguyen@apm.com>
> > ---
> > Changes since v2:
> > - Change code to disable HW LPM as an option for user which
> > is set via ACPI/DT.
> > Changes since v1:
> > - Update DT/ACPI attribute and corresponding codes from HLE to LPM to
> > be consistent with other attribute names.
> > ---
> > Documentation/devicetree/bindings/usb/usb-xhci.txt | 1 +
> > drivers/usb/host/xhci-plat.c | 3 +++
> > drivers/usb/host/xhci.c | 3 +++
> > drivers/usb/host/xhci.h | 1 +
> > 4 files changed, 8 insertions(+), 0 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt b/Documentation/devicetree/bindings/usb/usb-xhci.txt
> > index 2d80b60..ae6e484 100644
> > --- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
> > +++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
> > @@ -26,6 +26,7 @@ Required properties:
> >
> > Optional properties:
> > - clocks: reference to a clock
> > + - usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM
> > - usb3-lpm-capable: determines if platform is USB3 LPM capable
> > - quirk-broken-port-ped: set if the controller has broken port disable mechanism
> >
> > diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> > index c04144b..9028fb5 100644
> > --- a/drivers/usb/host/xhci-plat.c
> > +++ b/drivers/usb/host/xhci-plat.c
> > @@ -267,6 +267,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
> > goto disable_clk;
> > }
> >
> > + if (device_property_read_bool(sysdev, "usb2-lpm-disable"))
> > + xhci->quirks |= XHCI_HW_LPM_DISABLE;
> > +
> > if (device_property_read_bool(sysdev, "usb3-lpm-capable"))
> > xhci->quirks |= XHCI_LPM_SUPPORT;
> >
> > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> > index 30f47d9..49d05c7 100644
> > --- a/drivers/usb/host/xhci.c
> > +++ b/drivers/usb/host/xhci.c
> > @@ -4061,6 +4061,9 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
> > !udev->lpm_capable)
> > return -EPERM;
> >
> > + if (xhci->quirks & XHCI_HW_LPM_DISABLE)
> > + return -EPERM;
> > +
> > if (!udev->parent || udev->parent->parent ||
> > udev->descriptor.bDeviceClass == USB_CLASS_HUB)
> > return -EPERM;
> > diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> > index 73a28a9..03d50e8 100644
> > --- a/drivers/usb/host/xhci.h
> > +++ b/drivers/usb/host/xhci.h
> > @@ -1819,6 +1819,7 @@ struct xhci_hcd {
> > /* For controller with a broken Port Disable implementation */
> > #define XHCI_BROKEN_PORT_PED (1 << 25)
> > #define XHCI_LIMIT_ENDPOINT_INTERVAL_7 (1 << 26)
> > +#define XHCI_HW_LPM_DISABLE (1 << 27)
> >
> > unsigned int num_active_eps;
> > unsigned int limit_active_eps;
> > --
> > 1.7.1
> >
> Hi,
> Is there any other comment on the patch?
Relax, it's the middle of the merge window, we can't do anything with
patches until after 4.13-rc1 comes out a the earliest...
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-07-09 6:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-23 3:02 [PATCH v3 1/1] usb:host:xhci support option to disable the xHCI USB2 HW LPM Thang Q. Nguyen
2017-06-26 19:03 ` Rob Herring
2017-07-09 5:38 ` Thang Q. Nguyen
2017-07-09 6:16 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®