* [PATCH 1/4] usb: host: ohci-platform: Add basic runtime PM support
[not found] ` <20170517225922.17723-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
@ 2017-05-17 22:59 ` Tony Lindgren
[not found] ` <20170517225922.17723-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2017-05-17 22:59 ` [PATCH 4/4] ARM: dts: Add remote-wakeup-connected for omap OHCI Tony Lindgren
1 sibling, 1 reply; 9+ messages in thread
From: Tony Lindgren @ 2017-05-17 22:59 UTC (permalink / raw)
To: Alan Stern
Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring,
Roger Quadros, Yoshihiro Shimoda
This is needed in preparation of adding support for omap3 and
later OHCI. The runtime PM will only do something on platforms
that implement it.
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
---
drivers/usb/host/ohci-platform.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -24,6 +24,7 @@
#include <linux/err.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <linux/usb/ohci_pdriver.h>
#include <linux/usb.h>
@@ -51,6 +52,10 @@ static int ohci_platform_power_on(struct platform_device *dev)
struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
int clk, ret, phy_num;
+ ret = pm_runtime_get_sync(&dev->dev);
+ if (ret < 0)
+ return ret;
+
for (clk = 0; clk < OHCI_MAX_CLKS && priv->clks[clk]; clk++) {
ret = clk_prepare_enable(priv->clks[clk]);
if (ret)
@@ -96,6 +101,8 @@ static void ohci_platform_power_off(struct platform_device *dev)
for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--)
if (priv->clks[clk])
clk_disable_unprepare(priv->clks[clk]);
+
+ pm_runtime_put_sync(&dev->dev);
}
static struct hc_driver __read_mostly ohci_platform_hc_driver;
@@ -242,6 +249,7 @@ static int ohci_platform_probe(struct platform_device *dev)
}
#endif
+ pm_runtime_enable(&dev->dev);
if (pdata->power_on) {
err = pdata->power_on(dev);
if (err < 0)
@@ -271,6 +279,7 @@ static int ohci_platform_probe(struct platform_device *dev)
if (pdata->power_off)
pdata->power_off(dev);
err_reset:
+ pm_runtime_disable(&dev->dev);
while (--rst >= 0)
reset_control_assert(priv->resets[rst]);
err_put_clks:
@@ -305,6 +314,8 @@ static int ohci_platform_remove(struct platform_device *dev)
usb_put_hcd(hcd);
+ pm_runtime_disable(&dev->dev);
+
if (pdata == &ohci_platform_defaults)
dev->dev.platform_data = NULL;
--
2.13.0
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/4] ARM: dts: Add remote-wakeup-connected for omap OHCI
[not found] ` <20170517225922.17723-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2017-05-17 22:59 ` [PATCH 1/4] usb: host: ohci-platform: Add basic runtime PM support Tony Lindgren
@ 2017-05-17 22:59 ` Tony Lindgren
[not found] ` <20170517225922.17723-5-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
1 sibling, 1 reply; 9+ messages in thread
From: Tony Lindgren @ 2017-05-17 22:59 UTC (permalink / raw)
To: Alan Stern
Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring,
Roger Quadros, Yoshihiro Shimoda
Add remote-wakeup-connected for omap OHCI as that's needed by
ehci-platform driver.
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
---
arch/arm/boot/dts/omap3.dtsi | 1 +
arch/arm/boot/dts/omap4.dtsi | 1 +
arch/arm/boot/dts/omap5.dtsi | 1 +
3 files changed, 3 insertions(+)
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -715,6 +715,7 @@
reg = <0x48064400 0x400>;
interrupt-parent = <&intc>;
interrupts = <76>;
+ remote-wakeup-connected;
};
usbhsehci: ehci@48064800 {
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -863,6 +863,7 @@
reg = <0x4a064800 0x400>;
interrupt-parent = <&gic>;
interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+ remote-wakeup-connected;
};
usbhsehci: ehci@4a064c00 {
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -939,6 +939,7 @@
compatible = "ti,ohci-omap3";
reg = <0x4a064800 0x400>;
interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+ remote-wakeup-connected;
};
usbhsehci: ehci@4a064c00 {
--
2.13.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] usb: host: ohci-platform: Add basic runtime PM support
[not found] ` <20170517225922.17723-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
@ 2017-05-18 9:28 ` Roger Quadros
2017-05-18 15:25 ` Alan Stern
2017-05-18 17:21 ` Alan Stern
2 siblings, 0 replies; 9+ messages in thread
From: Roger Quadros @ 2017-05-18 9:28 UTC (permalink / raw)
To: Tony Lindgren, Alan Stern
Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring,
Yoshihiro Shimoda
On 18/05/17 01:59, Tony Lindgren wrote:
> This is needed in preparation of adding support for omap3 and
> later OHCI. The runtime PM will only do something on platforms
> that implement it.
>
> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Acked-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
> ---
> drivers/usb/host/ohci-platform.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
> --- a/drivers/usb/host/ohci-platform.c
> +++ b/drivers/usb/host/ohci-platform.c
> @@ -24,6 +24,7 @@
> #include <linux/err.h>
> #include <linux/phy/phy.h>
> #include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
> #include <linux/reset.h>
> #include <linux/usb/ohci_pdriver.h>
> #include <linux/usb.h>
> @@ -51,6 +52,10 @@ static int ohci_platform_power_on(struct platform_device *dev)
> struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
> int clk, ret, phy_num;
>
> + ret = pm_runtime_get_sync(&dev->dev);
> + if (ret < 0)
> + return ret;
> +
> for (clk = 0; clk < OHCI_MAX_CLKS && priv->clks[clk]; clk++) {
> ret = clk_prepare_enable(priv->clks[clk]);
> if (ret)
> @@ -96,6 +101,8 @@ static void ohci_platform_power_off(struct platform_device *dev)
> for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--)
> if (priv->clks[clk])
> clk_disable_unprepare(priv->clks[clk]);
> +
> + pm_runtime_put_sync(&dev->dev);
> }
>
> static struct hc_driver __read_mostly ohci_platform_hc_driver;
> @@ -242,6 +249,7 @@ static int ohci_platform_probe(struct platform_device *dev)
> }
> #endif
>
> + pm_runtime_enable(&dev->dev);
> if (pdata->power_on) {
> err = pdata->power_on(dev);
> if (err < 0)
> @@ -271,6 +279,7 @@ static int ohci_platform_probe(struct platform_device *dev)
> if (pdata->power_off)
> pdata->power_off(dev);
> err_reset:
> + pm_runtime_disable(&dev->dev);
> while (--rst >= 0)
> reset_control_assert(priv->resets[rst]);
> err_put_clks:
> @@ -305,6 +314,8 @@ static int ohci_platform_remove(struct platform_device *dev)
>
> usb_put_hcd(hcd);
>
> + pm_runtime_disable(&dev->dev);
> +
> if (pdata == &ohci_platform_defaults)
> dev->dev.platform_data = NULL;
>
>
--
cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] ARM: dts: Add remote-wakeup-connected for omap OHCI
[not found] ` <20170517225922.17723-5-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
@ 2017-05-18 9:28 ` Roger Quadros
2017-05-18 15:49 ` Alan Stern
1 sibling, 0 replies; 9+ messages in thread
From: Roger Quadros @ 2017-05-18 9:28 UTC (permalink / raw)
To: Tony Lindgren, Alan Stern
Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring,
Yoshihiro Shimoda
On 18/05/17 01:59, Tony Lindgren wrote:
> Add remote-wakeup-connected for omap OHCI as that's needed by
> ehci-platform driver.
>
> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Acked-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
> ---
> arch/arm/boot/dts/omap3.dtsi | 1 +
> arch/arm/boot/dts/omap4.dtsi | 1 +
> arch/arm/boot/dts/omap5.dtsi | 1 +
> 3 files changed, 3 insertions(+)
>
> diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
> --- a/arch/arm/boot/dts/omap3.dtsi
> +++ b/arch/arm/boot/dts/omap3.dtsi
> @@ -715,6 +715,7 @@
> reg = <0x48064400 0x400>;
> interrupt-parent = <&intc>;
> interrupts = <76>;
> + remote-wakeup-connected;
> };
>
> usbhsehci: ehci@48064800 {
> diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
> --- a/arch/arm/boot/dts/omap4.dtsi
> +++ b/arch/arm/boot/dts/omap4.dtsi
> @@ -863,6 +863,7 @@
> reg = <0x4a064800 0x400>;
> interrupt-parent = <&gic>;
> interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
> + remote-wakeup-connected;
> };
>
> usbhsehci: ehci@4a064c00 {
> diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
> --- a/arch/arm/boot/dts/omap5.dtsi
> +++ b/arch/arm/boot/dts/omap5.dtsi
> @@ -939,6 +939,7 @@
> compatible = "ti,ohci-omap3";
> reg = <0x4a064800 0x400>;
> interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
> + remote-wakeup-connected;
> };
>
> usbhsehci: ehci@4a064c00 {
>
--
cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] usb: host: ohci-platform: Add basic runtime PM support
[not found] ` <20170517225922.17723-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2017-05-18 9:28 ` Roger Quadros
@ 2017-05-18 15:25 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1705181114280.1619-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2017-05-18 17:21 ` Alan Stern
2 siblings, 1 reply; 9+ messages in thread
From: Alan Stern @ 2017-05-18 15:25 UTC (permalink / raw)
To: Tony Lindgren
Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring,
Roger Quadros, Yoshihiro Shimoda
On Wed, 17 May 2017, Tony Lindgren wrote:
> This is needed in preparation of adding support for omap3 and
> later OHCI. The runtime PM will only do something on platforms
> that implement it.
This patch isn't correct. See below.
> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
> ---
> drivers/usb/host/ohci-platform.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
> --- a/drivers/usb/host/ohci-platform.c
> +++ b/drivers/usb/host/ohci-platform.c
> @@ -24,6 +24,7 @@
> #include <linux/err.h>
> #include <linux/phy/phy.h>
> #include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
> #include <linux/reset.h>
> #include <linux/usb/ohci_pdriver.h>
> #include <linux/usb.h>
> @@ -51,6 +52,10 @@ static int ohci_platform_power_on(struct platform_device *dev)
> struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
> int clk, ret, phy_num;
>
> + ret = pm_runtime_get_sync(&dev->dev);
> + if (ret < 0)
> + return ret;
> +
> for (clk = 0; clk < OHCI_MAX_CLKS && priv->clks[clk]; clk++) {
> ret = clk_prepare_enable(priv->clks[clk]);
> if (ret)
> @@ -96,6 +101,8 @@ static void ohci_platform_power_off(struct platform_device *dev)
> for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--)
> if (priv->clks[clk])
> clk_disable_unprepare(priv->clks[clk]);
> +
> + pm_runtime_put_sync(&dev->dev);
> }
ohci_platform_power_on() is invoked (by default) by the runtime-resume
callback routine ohci_platform_resume(), through the pdata->power_on
method pointer. Likewise, ohci_platform_power_off() is invoked by the
runtime-suspend callback routine.
This means you shouldn't do pm_runtime_get/put calls from within these
routines.
Is there any particular reason you wanted to add these calls? In
general, USB host controllers are expected to go into runtime suspend
whenever there aren't any children keeping them awake. Hence they
usually don't need to worry about initiating their own suspends and
resumes.
> static struct hc_driver __read_mostly ohci_platform_hc_driver;
> @@ -242,6 +249,7 @@ static int ohci_platform_probe(struct platform_device *dev)
> }
> #endif
>
> + pm_runtime_enable(&dev->dev);
There should be a pm_runtime_set_active() just before this.
> if (pdata->power_on) {
> err = pdata->power_on(dev);
> if (err < 0)
> @@ -271,6 +279,7 @@ static int ohci_platform_probe(struct platform_device *dev)
> if (pdata->power_off)
> pdata->power_off(dev);
> err_reset:
> + pm_runtime_disable(&dev->dev);
> while (--rst >= 0)
> reset_control_assert(priv->resets[rst]);
> err_put_clks:
> @@ -305,6 +314,8 @@ static int ohci_platform_remove(struct platform_device *dev)
>
> usb_put_hcd(hcd);
>
> + pm_runtime_disable(&dev->dev);
> +
> if (pdata == &ohci_platform_defaults)
> dev->dev.platform_data = NULL;
These changes make sense.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] ARM: dts: Add remote-wakeup-connected for omap OHCI
[not found] ` <20170517225922.17723-5-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2017-05-18 9:28 ` Roger Quadros
@ 2017-05-18 15:49 ` Alan Stern
1 sibling, 0 replies; 9+ messages in thread
From: Alan Stern @ 2017-05-18 15:49 UTC (permalink / raw)
To: Tony Lindgren
Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring,
Roger Quadros, Yoshihiro Shimoda
On Wed, 17 May 2017, Tony Lindgren wrote:
> Add remote-wakeup-connected for omap OHCI as that's needed by
> ehci-platform driver.
This should be "ohci", not "ehci". Otherwise,
Acked-by: Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
> ---
> arch/arm/boot/dts/omap3.dtsi | 1 +
> arch/arm/boot/dts/omap4.dtsi | 1 +
> arch/arm/boot/dts/omap5.dtsi | 1 +
> 3 files changed, 3 insertions(+)
>
> diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
> --- a/arch/arm/boot/dts/omap3.dtsi
> +++ b/arch/arm/boot/dts/omap3.dtsi
> @@ -715,6 +715,7 @@
> reg = <0x48064400 0x400>;
> interrupt-parent = <&intc>;
> interrupts = <76>;
> + remote-wakeup-connected;
> };
>
> usbhsehci: ehci@48064800 {
> diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
> --- a/arch/arm/boot/dts/omap4.dtsi
> +++ b/arch/arm/boot/dts/omap4.dtsi
> @@ -863,6 +863,7 @@
> reg = <0x4a064800 0x400>;
> interrupt-parent = <&gic>;
> interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
> + remote-wakeup-connected;
> };
>
> usbhsehci: ehci@4a064c00 {
> diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
> --- a/arch/arm/boot/dts/omap5.dtsi
> +++ b/arch/arm/boot/dts/omap5.dtsi
> @@ -939,6 +939,7 @@
> compatible = "ti,ohci-omap3";
> reg = <0x4a064800 0x400>;
> interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
> + remote-wakeup-connected;
> };
>
> usbhsehci: ehci@4a064c00 {
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] usb: host: ohci-platform: Add basic runtime PM support
[not found] ` <Pine.LNX.4.44L0.1705181114280.1619-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
@ 2017-05-18 15:52 ` Tony Lindgren
0 siblings, 0 replies; 9+ messages in thread
From: Tony Lindgren @ 2017-05-18 15:52 UTC (permalink / raw)
To: Alan Stern
Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring,
Roger Quadros, Yoshihiro Shimoda
* Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org> [170518 08:28]:
> On Wed, 17 May 2017, Tony Lindgren wrote:
>
> > This is needed in preparation of adding support for omap3 and
> > later OHCI. The runtime PM will only do something on platforms
> > that implement it.
>
> This patch isn't correct. See below.
>
> > Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > Cc: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > Cc: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
> > Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> > Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
> > ---
> > drivers/usb/host/ohci-platform.c | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
> > --- a/drivers/usb/host/ohci-platform.c
> > +++ b/drivers/usb/host/ohci-platform.c
> > @@ -24,6 +24,7 @@
> > #include <linux/err.h>
> > #include <linux/phy/phy.h>
> > #include <linux/platform_device.h>
> > +#include <linux/pm_runtime.h>
> > #include <linux/reset.h>
> > #include <linux/usb/ohci_pdriver.h>
> > #include <linux/usb.h>
> > @@ -51,6 +52,10 @@ static int ohci_platform_power_on(struct platform_device *dev)
> > struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
> > int clk, ret, phy_num;
> >
> > + ret = pm_runtime_get_sync(&dev->dev);
> > + if (ret < 0)
> > + return ret;
> > +
> > for (clk = 0; clk < OHCI_MAX_CLKS && priv->clks[clk]; clk++) {
> > ret = clk_prepare_enable(priv->clks[clk]);
> > if (ret)
> > @@ -96,6 +101,8 @@ static void ohci_platform_power_off(struct platform_device *dev)
> > for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--)
> > if (priv->clks[clk])
> > clk_disable_unprepare(priv->clks[clk]);
> > +
> > + pm_runtime_put_sync(&dev->dev);
> > }
>
> ohci_platform_power_on() is invoked (by default) by the runtime-resume
> callback routine ohci_platform_resume(), through the pdata->power_on
> method pointer. Likewise, ohci_platform_power_off() is invoked by the
> runtime-suspend callback routine.
>
> This means you shouldn't do pm_runtime_get/put calls from within these
> routines.
Oh OK great, so the above should not be needed at all.
> Is there any particular reason you wanted to add these calls? In
> general, USB host controllers are expected to go into runtime suspend
> whenever there aren't any children keeping them awake. Hence they
> usually don't need to worry about initiating their own suspends and
> resumes.
No particular reason as it sounds things work without it :) I'll check.
> > static struct hc_driver __read_mostly ohci_platform_hc_driver;
> > @@ -242,6 +249,7 @@ static int ohci_platform_probe(struct platform_device *dev)
> > }
> > #endif
> >
> > + pm_runtime_enable(&dev->dev);
>
> There should be a pm_runtime_set_active() just before this.
OK
> > if (pdata->power_on) {
> > err = pdata->power_on(dev);
> > if (err < 0)
> > @@ -271,6 +279,7 @@ static int ohci_platform_probe(struct platform_device *dev)
> > if (pdata->power_off)
> > pdata->power_off(dev);
> > err_reset:
> > + pm_runtime_disable(&dev->dev);
> > while (--rst >= 0)
> > reset_control_assert(priv->resets[rst]);
> > err_put_clks:
> > @@ -305,6 +314,8 @@ static int ohci_platform_remove(struct platform_device *dev)
> >
> > usb_put_hcd(hcd);
> >
> > + pm_runtime_disable(&dev->dev);
> > +
> > if (pdata == &ohci_platform_defaults)
> > dev->dev.platform_data = NULL;
>
> These changes make sense.
OK thanks for looking.
Regards,
Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] usb: host: ohci-platform: Add basic runtime PM support
[not found] ` <20170517225922.17723-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2017-05-18 9:28 ` Roger Quadros
2017-05-18 15:25 ` Alan Stern
@ 2017-05-18 17:21 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1705181313320.1619-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2 siblings, 1 reply; 9+ messages in thread
From: Alan Stern @ 2017-05-18 17:21 UTC (permalink / raw)
To: Tony Lindgren
Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring,
Roger Quadros, Yoshihiro Shimoda
On Wed, 17 May 2017, Tony Lindgren wrote:
> This is needed in preparation of adding support for omap3 and
> later OHCI. The runtime PM will only do something on platforms
> that implement it.
> @@ -51,6 +52,10 @@ static int ohci_platform_power_on(struct platform_device *dev)
> struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
> int clk, ret, phy_num;
>
> + ret = pm_runtime_get_sync(&dev->dev);
> + if (ret < 0)
> + return ret;
> +
I don't remember how probing for platform device drivers is set up.
So although this is definitely the wrong place for
pm_runtime_get_sync(), it may turn out that you need to do a
pm_runtime_get_noresume() before calling pm_runtime_enable(), and a
pm_runtime_put() at the end of ohci_platform_probe(). Otherwise
runtime PM might kick in during the middle of the probe sequence -- not
what you want.
Similarly, you may need pm_runtime_get_sync() at the start of
ohci_platform_remove() and pm_runtime_put_noidle() at the end.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] usb: host: ohci-platform: Add basic runtime PM support
[not found] ` <Pine.LNX.4.44L0.1705181313320.1619-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
@ 2017-05-19 17:52 ` Tony Lindgren
0 siblings, 0 replies; 9+ messages in thread
From: Tony Lindgren @ 2017-05-19 17:52 UTC (permalink / raw)
To: Alan Stern
Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring,
Roger Quadros, Yoshihiro Shimoda
* Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org> [170518 10:24]:
> On Wed, 17 May 2017, Tony Lindgren wrote:
>
> > This is needed in preparation of adding support for omap3 and
> > later OHCI. The runtime PM will only do something on platforms
> > that implement it.
>
> > @@ -51,6 +52,10 @@ static int ohci_platform_power_on(struct platform_device *dev)
> > struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
> > int clk, ret, phy_num;
> >
> > + ret = pm_runtime_get_sync(&dev->dev);
> > + if (ret < 0)
> > + return ret;
> > +
>
> I don't remember how probing for platform device drivers is set up.
> So although this is definitely the wrong place for
> pm_runtime_get_sync(), it may turn out that you need to do a
> pm_runtime_get_noresume() before calling pm_runtime_enable(), and a
> pm_runtime_put() at the end of ohci_platform_probe(). Otherwise
> runtime PM might kick in during the middle of the probe sequence -- not
> what you want.
Just removing those parts seems to work for probing.
> Similarly, you may need pm_runtime_get_sync() at the start of
> ohci_platform_remove() and pm_runtime_put_noidle() at the end.
Yup that I noticed that too trying to rmmod it with no devices
connected.
While testing I also saw once "external abort on non-linefetch":
(ohci_hub_status_data [ohci_hcd]) from [<bf0298bc>]
(usb_hcd_poll_rh_status+0x3c/0x128 [usbcore])
(usb_hcd_poll_rh_status [usbcore]) from [<c01c790c>]
(call_timer_fn+0xb0/0x3f8)
(call_timer_fn) from [<c01c7d38>] (expire_timers+0xe4/0x220)
(expire_timers) from [<c01c7f08>] (run_timer_softirq+0x94/0x19c)
(run_timer_softirq) from [<c0141cf8>] (__do_softirq+0x140/0x570)
Also I'm still checking if legacy usb_phy vs phy needs handling.
So far it seems that no need to do anything because most devices
need a USB hub anyways unless they have USB serial transceiver
configured with drivers/mfd/omap-usb-host.c for LS/FS.
Regards,
Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-05-19 17:52 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20170517225922.17723-1-tony@atomide.com>
[not found] ` <20170517225922.17723-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2017-05-17 22:59 ` [PATCH 1/4] usb: host: ohci-platform: Add basic runtime PM support Tony Lindgren
[not found] ` <20170517225922.17723-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2017-05-18 9:28 ` Roger Quadros
2017-05-18 15:25 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1705181114280.1619-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2017-05-18 15:52 ` Tony Lindgren
2017-05-18 17:21 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1705181313320.1619-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2017-05-19 17:52 ` Tony Lindgren
2017-05-17 22:59 ` [PATCH 4/4] ARM: dts: Add remote-wakeup-connected for omap OHCI Tony Lindgren
[not found] ` <20170517225922.17723-5-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2017-05-18 9:28 ` Roger Quadros
2017-05-18 15:49 ` Alan Stern
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).