Skip to contentSkip to conversation

USB: OHCI:Properly handle ohci_suspend()routine in bus glue

PATCH Superseded Majunath Goudar 7 participants 59 messages Oct 2, 2013 – Nov 13, 2013 4 messages not in the archive

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover USB: OHCI:Properly handle ohci_suspend()routine in bus glue

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci bus glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci suspend scenario.

Calling explicitly the ohci_suspend()routine will ensure proper handling of suspend scenario.

*** BLURB HERE ***

Manjunath Goudar (11):
USB: OHCI: Properly handle OHCI controller suspend
USB: OHCI: Properly handle ohci-at91 suspend
USB: OHCI: Properly handle ohci-s3c2410 suspend
USB: OHCI: Properly handle ohci-da8xx suspend
USB: OHCI: Properly handle ohci-ep93xx suspend
USB: OHCI: Properly handle ohci-exynos suspend
USB: OHCI: Properly handle ohci-omap suspend
USB: OHCI: Properly handle ohci-platform suspend
USB: OHCI: Properly handle ohci-pxa27x suspend
USB: OHCI: Properly handle ohci-sm501 suspend
USB: OHCI: Properly handle ohci-spear suspend

 drivers/usb/host/ohci-at91.c     |   10 ++++++++--
 drivers/usb/host/ohci-da8xx.c    |   15 +++++++++++----
 drivers/usb/host/ohci-ep93xx.c   |   11 +++++++++--
 drivers/usb/host/ohci-exynos.c   |   20 +++++---------------
 drivers/usb/host/ohci-hcd.c      |    9 ++++++++-
 drivers/usb/host/ohci-omap.c     |   13 ++++++++++---
 drivers/usb/host/ohci-platform.c |   11 +++++++++--
 drivers/usb/host/ohci-pxa27x.c   |    9 ++++++++-
 drivers/usb/host/ohci-s3c2410.c  |   21 ++++-----------------
 drivers/usb/host/ohci-sm501.c    |   11 +++++++++--
 drivers/usb/host/ohci-spear.c    |   12 +++++++++---
 11 files changed, 90 insertions(+), 52 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/11 USB: OHCI: Properly handle OHCI controller suspend

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of OHCI was not properly
handled in ochi_suspend()routine. Alan Stern
suggested, properly handle OHCI suspend scenario.

This does generic proper handling of suspend
scenario to all OHCI SOC.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-hcd.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-hcd.c +8 -1
index 8ada13f..310bcfe 100644
@@ -1036,6 +1036,7 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 {
 	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);
 	unsigned long	flags;
+	int		rc = 0;
 
 	/* Disable irq emission and mark HW unaccessible. Use
 	 * the spinlock to properly synchronize with possible pending
@@ -1048,7 +1049,13 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
 	spin_unlock_irqrestore (&ohci->lock, flags);
 
-	return 0;
+	synchronize_irq(hcd->irq);
+
+	if (do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
+		ohci_resume(hcd, false);
+		rc = -EBUSY;
+	}
+	return rc;
 }
 EXPORT_SYMBOL_GPL(ohci_suspend);
 
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/11 USB: OHCI: Properly handle ohci-at91 suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-at91 glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-at91 suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_at91_drv_suspend() will ensure proper handling of suspend scenario. This task is sugested by Alan Stern.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-at91.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-at91.c +8 -2
index 476b5a5..f2d8403 100644
@@ -636,8 +636,14 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
 {
 	struct usb_hcd	*hcd = platform_get_drvdata(pdev);
 	struct ohci_hcd	*ohci = hcd_to_ohci(hcd);
+	bool		do_wakeup = device_may_wakeup(&pdev->dev);
+	int		ret;
 
-	if (device_may_wakeup(&pdev->dev))
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
+	if (do_wakeup)
 		enable_irq_wake(hcd->irq);
 
 	/*
@@ -658,7 +664,7 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
 		at91_stop_clock();
 	}
 
-	return 0;
+	return ret;
 }
 
 static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/11 USB: OHCI: Properly handle ohci-s3c2410 suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-s3c2410 glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-s3c2410 suspend scenario.

Calling explicitly the ohci_suspend()
routine in ohci_hcd_s3c2410_drv_suspend() will ensure proper handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-s3c2410.c |   21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
drivers/usb/host/ohci-s3c2410.c +4 -17
index be3429e..b5bf9b7 100644
@@ -426,28 +426,15 @@ static int ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev)
 static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
 {
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
-	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 	struct platform_device *pdev = to_platform_device(dev);
-	unsigned long flags;
+	bool do_wakeup = device_may_wakeup(dev);
 	int rc = 0;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED) {
-		rc = -EINVAL;
-		goto bail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
 	s3c2410_stop_hc(pdev);
-bail:
-	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
 }
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/11 USB: OHCI: Properly handle ohci-da8xx suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-da8xx glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-da8xx suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_da8xx_suspend() will ensure proper handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-da8xx.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/usb/host/ohci-da8xx.c +11 -4
index 9be59f1..f8238a4 100644
@@ -406,19 +406,26 @@ static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev)
 }
 
 #ifdef CONFIG_PM
-static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message)
+static int ohci_da8xx_suspend(struct platform_device *pdev,
+				pm_message_t message)
 {
-	struct usb_hcd	*hcd	= platform_get_drvdata(dev);
+	struct usb_hcd	*hcd	= platform_get_drvdata(pdev);
 	struct ohci_hcd	*ohci	= hcd_to_ohci(hcd);
+	bool		do_wakeup	= device_may_wakeup(&pdev->dev);
+	int		ret;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
 	ohci_da8xx_clock(0);
 	hcd->state = HC_STATE_SUSPENDED;
-	dev->dev.power.power_state = PMSG_SUSPEND;
-	return 0;
+
+	return ret;
 }
 
 static int ohci_da8xx_resume(struct platform_device *dev)
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-ep93xx glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-ep93xx suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_ep93xx_drv_suspend() will ensure proper handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-ep93xx.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-ep93xx.c +9 -2
index 492f681..08409bf 100644
@@ -112,13 +112,20 @@ static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_
 {
 	struct usb_hcd *hcd = platform_get_drvdata(pdev);
 	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+	bool do_wakeup = device_may_wakeup(&pdev->dev);
+	int ret;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
-	clk_disable(usb_host_clock);
-	return 0;
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
+	ep93xx_stop_hc(&pdev->dev);
+
+	return ret;
 }
 
 static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

Hi, Greg,

[Adding ep93xx maintainers as well]

Quoted 36 lines · Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-ep93xx glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-ep93xx suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_ep93xx_drv_suspend() will ensure proper handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-ep93xx.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-ep93xx.c +2 -0
index 492f681..08409bf 100644
@@ -112,13 +112,20 @@ static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_
 {
        struct usb_hcd *hcd = platform_get_drvdata(pdev);
        struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+       bool do_wakeup = device_may_wakeup(&pdev->dev);
+       int ret;
 
        if (time_before(jiffies, ohci->next_statechange))
                msleep(5);
        ohci->next_statechange = jiffies;
 

drivers/usb/host/ohci-ep93xx.c static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_ · line 129

Quoted 10 lines
drivers/usb/host/ohci-ep93xx.c +7 -2
-       clk_disable(usb_host_clock);
-       return 0;
+       ret = ohci_suspend(hcd, do_wakeup);
+       if (ret)
+               return ret;
+
+       ep93xx_stop_hc(&pdev->dev);
+
+       return ret;
 }

This patch showed up in -next today (or maybe a while ago and I didn't notice). It's causing a build failure on ep93xx:

Quoted 1 line

From http://arm-soc.lixom.net/buildlogs/next-thierry/v3.12-rc5-5366-gba2e8c2/buildall.arm.ep93xx_defconfig.log.failed:

drivers/usb/host/ohci-ep93xx.c: In function 'ohci_hcd_ep93xx_drv_suspend':
drivers/usb/host/ohci-ep93xx.c:126:2: error: implicit declaration of function 'ep93xx_stop_hc'

It's really confusing though, because Majunath has posted this patch three times. The first time it had the ep93xx_stop_hc() call in there, the second patch (labelled V2) did not, and the third(?) version, without version label, also lacked it. No revision log in the patch, and no comments on it.

But it does seem like the wrong version was merged based on build results.

-Olof

maintainer
#7 lore raw

PATCH 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

Quoted 50 lines · Olof Johansson

Hi, Greg,

[Adding ep93xx maintainers as well]

Quoted 24 lines · Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-ep93xx glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-ep93xx suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_ep93xx_drv_suspend() will ensure proper handling of suspend scenario.

drivers/usb/host/ohci-ep93xx.c +2 -0
@@ -112,13 +112,20 @@ static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_
 {
        struct usb_hcd *hcd = platform_get_drvdata(pdev);
        struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+       bool do_wakeup = device_may_wakeup(&pdev->dev);
+       int ret;
 
        if (time_before(jiffies, ohci->next_statechange))
                msleep(5);
        ohci->next_statechange = jiffies;
 

drivers/usb/host/ohci-ep93xx.c static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_ · line 129

Quoted 10 lines
drivers/usb/host/ohci-ep93xx.c +7 -2
-       clk_disable(usb_host_clock);
-       return 0;
+       ret = ohci_suspend(hcd, do_wakeup);
+       if (ret)
+               return ret;
+
+       ep93xx_stop_hc(&pdev->dev);
+
+       return ret;
 }

This patch showed up in -next today (or maybe a while ago and I didn't notice). It's causing a build failure on ep93xx:

From http://arm-soc.lixom.net/buildlogs/next-thierry/v3.12-rc5-5366-gba2e8c2/buildall.arm.ep93xx_defconfig.log.failed:

drivers/usb/host/ohci-ep93xx.c: In function 'ohci_hcd_ep93xx_drv_suspend':
drivers/usb/host/ohci-ep93xx.c:126:2: error: implicit declaration of function 'ep93xx_stop_hc'

Quoted 5 lines

It's really confusing though, because Majunath has posted this patch three times. The first time it had the ep93xx_stop_hc() call in there, the second patch (labelled V2) did not, and the third(?) version, without version label, also lacked it. No revision log in the patch, and no comments on it.

In fact he has posted it a lot more than 3 times, and the version numbers (or lack thereof) are definitely confusing.

The reason for the build failure is that Manjanuth started work on this patch many months ago -- back in the spring. At that time the ep93xx_stop_hc() routine did exist.

But commit af3f233fd27b (usb: ohci-ep93xx: tidy up driver (*probe) and (*remove)), dated July 1, removed it. Manjunath never updated his patch in response.

Quoted 1 line

But it does seem like the wrong version was merged based on build results.

No, it's a rebasing failure, not a wrong version.

Alan Stern

#8 lore raw

PATCH 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

Quoted 65 lines · Alan Stern
Quoted 50 lines · Olof Johansson

Hi, Greg,

[Adding ep93xx maintainers as well]

Quoted 24 lines · Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-ep93xx glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-ep93xx suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_ep93xx_drv_suspend() will ensure proper handling of suspend scenario.

drivers/usb/host/ohci-ep93xx.c +2 -0
@@ -112,13 +112,20 @@ static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_
 {
        struct usb_hcd *hcd = platform_get_drvdata(pdev);
        struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+       bool do_wakeup = device_may_wakeup(&pdev->dev);
+       int ret;
 
        if (time_before(jiffies, ohci->next_statechange))
                msleep(5);
        ohci->next_statechange = jiffies;
 

drivers/usb/host/ohci-ep93xx.c static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_ · line 129

Quoted 10 lines
drivers/usb/host/ohci-ep93xx.c +7 -2
-       clk_disable(usb_host_clock);
-       return 0;
+       ret = ohci_suspend(hcd, do_wakeup);
+       if (ret)
+               return ret;
+
+       ep93xx_stop_hc(&pdev->dev);
+
+       return ret;
 }

This patch showed up in -next today (or maybe a while ago and I didn't notice). It's causing a build failure on ep93xx:

From http://arm-soc.lixom.net/buildlogs/next-thierry/v3.12-rc5-5366-gba2e8c2/buildall.arm.ep93xx_defconfig.log.failed:

drivers/usb/host/ohci-ep93xx.c: In function 'ohci_hcd_ep93xx_drv_suspend':
drivers/usb/host/ohci-ep93xx.c:126:2: error: implicit declaration of function 'ep93xx_stop_hc'

Quoted 5 lines

It's really confusing though, because Majunath has posted this patch three times. The first time it had the ep93xx_stop_hc() call in there, the second patch (labelled V2) did not, and the third(?) version, without version label, also lacked it. No revision log in the patch, and no comments on it.

In fact he has posted it a lot more than 3 times, and the version numbers (or lack thereof) are definitely confusing.

The reason for the build failure is that Manjanuth started work on this patch many months ago -- back in the spring. At that time the ep93xx_stop_hc() routine did exist.

Quoted 7 lines

But commit af3f233fd27b (usb: ohci-ep93xx: tidy up driver (*probe) and (*remove)), dated July 1, removed it. Manjunath never updated his patch in response.

Quoted 1 line

But it does seem like the wrong version was merged based on build results.

No, it's a rebasing failure, not a wrong version.

I've reverted all of these patches now, hopefully from Linaro will step up and fix them and resend them.

thanks,

greg k-h

#9 lore raw

PATCH 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

In reply to Alan Stern
Quoted 65 lines · Alan Stern
Quoted 50 lines · Olof Johansson

Hi, Greg,

[Adding ep93xx maintainers as well]

Quoted 24 lines · Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-ep93xx glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-ep93xx suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_ep93xx_drv_suspend() will ensure proper handling of suspend scenario.

drivers/usb/host/ohci-ep93xx.c +2 -0
@@ -112,13 +112,20 @@ static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_
 {
        struct usb_hcd *hcd = platform_get_drvdata(pdev);
        struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+       bool do_wakeup = device_may_wakeup(&pdev->dev);
+       int ret;
 
        if (time_before(jiffies, ohci->next_statechange))
                msleep(5);
        ohci->next_statechange = jiffies;
 

drivers/usb/host/ohci-ep93xx.c static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_ · line 129

Quoted 10 lines
drivers/usb/host/ohci-ep93xx.c +7 -2
-       clk_disable(usb_host_clock);
-       return 0;
+       ret = ohci_suspend(hcd, do_wakeup);
+       if (ret)
+               return ret;
+
+       ep93xx_stop_hc(&pdev->dev);
+
+       return ret;
 }

This patch showed up in -next today (or maybe a while ago and I didn't notice). It's causing a build failure on ep93xx:

From http://arm-soc.lixom.net/buildlogs/next-thierry/v3.12-rc5-5366-gba2e8c2/buildall.arm.ep93xx_defconfig.log.failed:

drivers/usb/host/ohci-ep93xx.c: In function 'ohci_hcd_ep93xx_drv_suspend':
drivers/usb/host/ohci-ep93xx.c:126:2: error: implicit declaration of function 'ep93xx_stop_hc'

Quoted 5 lines

It's really confusing though, because Majunath has posted this patch three times. The first time it had the ep93xx_stop_hc() call in there, the second patch (labelled V2) did not, and the third(?) version, without version label, also lacked it. No revision log in the patch, and no comments on it.

In fact he has posted it a lot more than 3 times, and the version numbers (or lack thereof) are definitely confusing.

The reason for the build failure is that Manjanuth started work on this patch many months ago -- back in the spring. At that time the ep93xx_stop_hc() routine did exist.

Quoted 7 lines

But commit af3f233fd27b (usb: ohci-ep93xx: tidy up driver (*probe) and
(*remove)), dated July 1, removed it. Manjunath never updated his
patch in response.

Quoted 1 line

But it does seem like the wrong version was merged based on build results.

No, it's a rebasing failure, not a wrong version.

Alan,

As an alternative to this patch, I have successfully used the ohci-platform driver on the ep93xx. This does move a bit of glue code into the ep93xx core (arch/arm/mach-ep93xx/core.c) but it removes the ohci-ep93xx glue driver completely.

I can post a patch for this shortly if you would like.

Regards,
Hartley

maintainer
#10 lore raw

PATCH 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

Quoted 8 lines · Hartley Sweeten

Alan,

As an alternative to this patch, I have successfully used the ohci-platform driver on the ep93xx. This does move a bit of glue code into the ep93xx core (arch/arm/mach-ep93xx/core.c) but it removes the ohci-ep93xx glue driver completely.

I can post a patch for this shortly if you would like.

That would be great! It would save me the trouble of fixing Manjanuth's patch and it would remove a source file too!

Alan Stern

#11 lore raw

PATCH 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

Quoted 10 lines · Alan Stern
Quoted 6 lines · Hartley Sweeten

As an alternative to this patch, I have successfully used the ohci-platform driver on the ep93xx. This does move a bit of glue code into the ep93xx core (arch/arm/mach-ep93xx/core.c) but it removes the ohci-ep93xx glue driver completely.

I can post a patch for this shortly if you would like.

That would be great! It would save me the trouble of fixing Manjanuth's patch and it would remove a source file too!

The only thing I'm not sure about use where to enable the USB_OHCI_HCD_PLATFORM driver for ARCH_EP93XX.

Right now the ohci-ep93xx glue driver is enabled automatically when USB_OHCI_HCD is enabled due to the ifdefery. I can add a new config option similar to the other users of USB_OHCI_HCD_PLATFORM but I was wondering if there is a cleaner way.

Regards,
Hartley

#12 lore raw

PATCH 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

Quoted 12 lines · Hartley Sweeten
Quoted 10 lines · Alan Stern
Quoted 6 lines · Hartley Sweeten

As an alternative to this patch, I have successfully used the ohci-platform driver on the ep93xx. This does move a bit of glue code into the ep93xx core (arch/arm/mach-ep93xx/core.c) but it removes the ohci-ep93xx glue driver completely.

I can post a patch for this shortly if you would like.

That would be great! It would save me the trouble of fixing Manjanuth's patch and it would remove a source file too!

Quoted 8 lines

The only thing I'm not sure about use where to enable the USB_OHCI_HCD_PLATFORM driver for ARCH_EP93XX.

Right now the ohci-ep93xx glue driver is enabled automatically when USB_OHCI_HCD is enabled due to the ifdefery. I can add a new config option similar to the other users of USB_OHCI_HCD_PLATFORM but I was wondering if there is a cleaner way.

Given that we're trying to reduce code under arch/arm and move it out to driver directories instead, I'm not sure this is a step in the right direction. :-) I guess it depends on how much code we're talking about here, so let's take that discussion once patches are posted.

-Olof

A message that is not in the archive (sent off-list or not yet received): CAKsNYyzFe+o0ctNYyHhL7m71LnAC4WTKbkfN37WHmLBRjgj9+w@mail.gmail.com

#14 lore raw

PATCH 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

Quoted 11 lines · manju goudar

Alan,

I am very sorry for this mistake.
I will fix this issue and sending back series.

Greg,
I am really sorry ?:((
Next time I will not make this kind of mistake. If any issue reported related to my patches I will fix it and send back to you.?
Now I am using my personal id to support my patches.

Thanks for continuing to work on this, that's great to hear. Please test your patches on all arches that you are modifying, simple build bugs shouldn't happen.

thanks,

greg k-h

#15 lore raw

PATCH 6/11 USB: OHCI: Properly handle ohci-exynos suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-exynos glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-exynos suspend scenario.

Calling explicitly the ohci_suspend() routine in exynos_ohci_suspend() will ensure proper handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-exynos.c |   20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/usb/host/ohci-exynos.c +5 -15
index 3e4bc74..f5f372e 100644
@@ -203,24 +203,15 @@ static int exynos_ohci_suspend(struct device *dev)
 	struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd);
 	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 	struct platform_device *pdev = to_platform_device(dev);
+	bool do_wakeup = device_may_wakeup(dev);
 	unsigned long flags;
 	int rc = 0;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED &&
-			ohci->rh_state != OHCI_RH_HALTED) {
-		rc = -EINVAL;
-		goto fail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
+	spin_lock_irqsave(&ohci->lock, flags);
 	if (exynos_ohci->otg)
 		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
 
@@ -228,7 +219,6 @@ static int exynos_ohci_suspend(struct device *dev)
 
 	clk_disable_unprepare(exynos_ohci->clk);
 
-fail:
 	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
Signature · 1 line
1.7.9.5
#16 lore raw

PATCH 6/11 USB: OHCI: Properly handle ohci-exynos suspend

Hi,

Quoted 38 lines · Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-exynos glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-exynos suspend scenario.

Calling explicitly the ohci_suspend() routine in exynos_ohci_suspend() will ensure proper handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-exynos.c |   20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/usb/host/ohci-exynos.c +1 -5
index 3e4bc74..f5f372e 100644
@@ -203,24 +203,15 @@ static int exynos_ohci_suspend(struct device *dev)
 	struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd);
 	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 	struct platform_device *pdev = to_platform_device(dev);
+	bool do_wakeup = device_may_wakeup(dev);
 	unsigned long flags;
 	int rc = 0;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.

drivers/usb/host/ohci-exynos.c static int exynos_ohci_suspend(struct device *dev) · line 210

Quoted 10 lines
drivers/usb/host/ohci-exynos.c +1 -9
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED &&
-			ohci->rh_state != OHCI_RH_HALTED) {
-		rc = -EINVAL;
-		goto fail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);

Maybe it would make sense to cleanup ohci_suspend() first (before adding new ohci_suspend() users) and remove unused do_wakeup parameter?

Quoted 8 lines
drivers/usb/host/ohci-exynos.c +3 -0
+	if (rc)
+		return rc;
 
+	spin_lock_irqsave(&ohci->lock, flags);
 	if (exynos_ohci->otg)
 		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
 

drivers/usb/host/ohci-exynos.c static int exynos_ohci_suspend(struct device *dev) · line 224

Quoted 7 lines
drivers/usb/host/ohci-exynos.c +0 -1
@@ -228,7 +219,6 @@ static int exynos_ohci_suspend(struct device *dev)
 
 	clk_disable_unprepare(exynos_ohci->clk);
 
-fail:
 	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

maintainer
#17 lore raw

PATCH 6/11 USB: OHCI: Properly handle ohci-exynos suspend

Quoted 2 lines · Bartlomiej Zolnierkiewicz

Maybe it would make sense to cleanup ohci_suspend() first (before adding new ohci_suspend() users) and remove unused do_wakeup parameter?

Not possible. The do_wakeup parameter is part of a function prototype shared by other callback routines (such as ehci_suspend()) that _do_ use the parameter.

Alan Stern

#18 lore raw

PATCH 6/11 USB: OHCI: Properly handle ohci-exynos suspend

Hi,

Quoted 8 lines · Alan Stern
Quoted 2 lines · Bartlomiej Zolnierkiewicz

Maybe it would make sense to cleanup ohci_suspend() first (before adding new ohci_suspend() users) and remove unused do_wakeup parameter?

Not possible. The do_wakeup parameter is part of a function prototype shared by other callback routines (such as ehci_suspend()) that _do_ use the parameter.

If you mean ohci-pci.c usage (which is currently the only usage of ohci_suspend() looking at the latest -next kernel) than it is enough to add a simple wrapper for it in ohci-pci.c:

...
static int ohci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)

{
	ohci_suspend(hcd);
}
...
    ohci_pci_hc_driver.pci_suspend = ohci_pci_suspend;

...

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

maintainer
#19 lore raw

PATCH 6/11 USB: OHCI: Properly handle ohci-exynos suspend

Quoted 17 lines · Bartlomiej Zolnierkiewicz

Hi,

Quoted 8 lines · Alan Stern
Quoted 2 lines · Bartlomiej Zolnierkiewicz

Maybe it would make sense to cleanup ohci_suspend() first (before adding new ohci_suspend() users) and remove unused do_wakeup parameter?

Not possible. The do_wakeup parameter is part of a function prototype shared by other callback routines (such as ehci_suspend()) that _do_ use the parameter.

If you mean ohci-pci.c usage (which is currently the only usage of ohci_suspend() looking at the latest -next kernel) than it is enough to add a simple wrapper for it in ohci-pci.c:

Quoted 8 lines

...
static int ohci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)

{
	ohci_suspend(hcd);
}
...
    ohci_pci_hc_driver.pci_suspend = ohci_pci_suspend;

...

Ah, now I see your point. Yes, it's true; that parameter could be eliminated.

Manjunath, would you like to update your patch series to get rid of the do_wakeup argument to ohci_suspend()?

Alan Stern

#20 lore raw

PATCH 7/11 USB: OHCI: Properly handle ohci-omap suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-omap glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-omap suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_omap_suspend() will ensure proper handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-omap.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-omap.c +10 -3
index 18b27a2..f253214 100644
@@ -431,16 +431,23 @@ static int ohci_hcd_omap_drv_remove(struct platform_device *dev)
 
 #ifdef	CONFIG_PM
 
-static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message)
+static int ohci_omap_suspend(struct platform_device *pdev, pm_message_t message)
 {
-	struct ohci_hcd	*ohci = hcd_to_ohci(platform_get_drvdata(dev));
+	struct usb_hcd *hcd = platform_get_drvdata(pdev);
+	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+	bool do_wakeup = device_may_wakeup(&pdev->dev);
+	int ret;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
 	omap_ohci_clock_power(0);
-	return 0;
+	return ret;
 }
 
 static int ohci_omap_resume(struct platform_device *dev)
Signature · 1 line
1.7.9.5
#21 lore raw

PATCH 8/11 USB: OHCI: Properly handle ohci-platform suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-platform glue was not properly handled as it was not suspending generic part of ohci controller.Alan Stern suggested, properly handle ohci-platform suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_platform_suspend() will ensure proper handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-platform.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-platform.c +9 -2
index a4c6410..f351ff5 100644
@@ -139,14 +139,21 @@ static int ohci_platform_remove(struct platform_device *dev)
 
 static int ohci_platform_suspend(struct device *dev)
 {
-	struct usb_ohci_pdata *pdata = dev_get_platdata(dev);
+	struct usb_hcd *hcd = dev_get_drvdata(dev);
+	struct usb_ohci_pdata *pdata = dev->platform_data;
 	struct platform_device *pdev =
 		container_of(dev, struct platform_device, dev);
+	bool do_wakeup = device_may_wakeup(dev);
+	int ret;
+
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
 
 	if (pdata->power_suspend)
 		pdata->power_suspend(pdev);
 
-	return 0;
+	return ret;
 }
 
 static int ohci_platform_resume(struct device *dev)
Signature · 1 line
1.7.9.5
#22 lore raw

PATCH 9/11 USB: OHCI: Properly handle ohci-pxa27x suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-pxa27x glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-pxa27x suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_pxa27x_drv_suspend() will ensure proper handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-pxa27x.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-pxa27x.c +8 -1
index c1b1fa3..deea5d1 100644
@@ -509,13 +509,20 @@ static int ohci_hcd_pxa27x_drv_suspend(struct device *dev)
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
 	struct pxa27x_ohci *pxa_ohci = to_pxa27x_ohci(hcd);
 	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+	bool do_wakeup = device_may_wakeup(dev);
+	int ret;
+
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
 	pxa27x_stop_hc(pxa_ohci, dev);
-	return 0;
+	return ret;
 }
 
 static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
Signature · 1 line
1.7.9.5
#23 lore raw

PATCH 10/11 USB: OHCI: Properly handle ohci-sm501 suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-sm501 glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-sm501 suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_sm501_suspend() will ensure proper handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-sm501.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-sm501.c +9 -2
index d479d5d..2a5de5f 100644
@@ -216,14 +216,21 @@ static int ohci_hcd_sm501_drv_remove(struct platform_device *pdev)
 static int ohci_sm501_suspend(struct platform_device *pdev, pm_message_t msg)
 {
 	struct device *dev = &pdev->dev;
-	struct ohci_hcd	*ohci = hcd_to_ohci(platform_get_drvdata(pdev));
+	struct usb_hcd  *hcd = platform_get_drvdata(pdev);
+	struct ohci_hcd	*ohci = hcd_to_ohci(hcd);
+	bool do_wakeup = device_may_wakeup(dev);
+	int ret;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
 	sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 0);
-	return 0;
+	return ret;
 }
 
 static int ohci_sm501_resume(struct platform_device *pdev)
Signature · 1 line
1.7.9.5
#24 lore raw

PATCH 11/11 USB: OHCI: Properly handle ohci-spear suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-spear glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-spear suspend scenario.

Calling explicitly the ohci_suspend() routine in
spear_ohci_hcd_drv_suspend() will ensure proper
handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-spear.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-spear.c +9 -3
index 31ff3fc..41148f8 100644
@@ -130,20 +130,26 @@ static int spear_ohci_hcd_drv_remove(struct platform_device *pdev)
 }
 
 #if defined(CONFIG_PM)
-static int spear_ohci_hcd_drv_suspend(struct platform_device *dev,
+static int spear_ohci_hcd_drv_suspend(struct platform_device *pdev,
 		pm_message_t message)
 {
-	struct usb_hcd *hcd = platform_get_drvdata(dev);
+	struct usb_hcd *hcd = platform_get_drvdata(pdev);
 	struct ohci_hcd	*ohci = hcd_to_ohci(hcd);
 	struct spear_ohci *sohci_p = to_spear_ohci(hcd);
+	bool do_wakeup = device_may_wakeup(&pdev->dev);
+	int ret;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
 	clk_disable_unprepare(sohci_p->clk);
 
-	return 0;
+	return ret;
 }
 
 static int spear_ohci_hcd_drv_resume(struct platform_device *dev)
Signature · 1 line
1.7.9.5
#25 lore raw

v2 cover USB: OHCI :Properly handle ohci_suspend()routine in bus glue

In reply to Majunath Goudar

Suspend scenario in case of ohci bus glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci suspend scenario.

Calling explicitly the ohci_suspend()routine will ensure proper handling of suspend scenario.

V1->V2:
-removed unused do_wakeup parameter.

Manjunath Goudar (11):
USB: OHCI: Properly handle OHCI controller suspend
USB: OHCI: Properly handle ohci-at91 suspend
USB: OHCI: Properly handle ohci-s3c2410 suspend
USB: OHCI: Properly handle ohci-da8xx suspend
USB: OHCI: Properly handle ohci-ep93xx suspend
USB: OHCI: Properly handle ohci-exynos suspend
USB: OHCI: Properly handle ohci-omap suspend
USB: OHCI: Properly handle ohci-platform suspend
USB: OHCI: Properly handle ohci-pxa27x suspend
USB: OHCI: Properly handle ohci-sm501 suspend
USB: OHCI: Properly handle ohci-spear suspend

 drivers/usb/host/ohci-at91.c     |    8 +++++---
 drivers/usb/host/ohci-da8xx.c    |   14 ++++++++++----
 drivers/usb/host/ohci-ep93xx.c   |   10 ++++++++--
 drivers/usb/host/ohci-exynos.c   |   19 ++++---------------
 drivers/usb/host/ohci-hcd.c      |   11 +++++++++--
 drivers/usb/host/ohci-omap.c     |   12 +++++++++---
 drivers/usb/host/ohci-platform.c |   10 ++++++++--
 drivers/usb/host/ohci-pxa27x.c   |    8 +++++++-
 drivers/usb/host/ohci-s3c2410.c  |   20 +++-----------------
 drivers/usb/host/ohci-sm501.c    |   10 ++++++++--
 drivers/usb/host/ohci-spear.c    |   11 ++++++++---
 drivers/usb/host/ohci.h          |    2 +-
 12 files changed, 80 insertions(+), 55 deletions(-)
Signature · 1 line
1.7.9.5
#26 lore raw

PATCH v2 1/11 USB: OHCI: Properly handle OHCI controller suspend

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of OHCI was not properly handled in ochi_suspend()routine. Alan Stern suggested, properly handle OHCI suspend scenario.

This does generic proper handling of suspend scenario to all OHCI SOC.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-hcd.c |   11 +++++++++--
 drivers/usb/host/ohci.h     |    2 +-
 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-hcd.c +9 -2
index 8ada13f..46087a1 100644
@@ -1032,10 +1032,11 @@ EXPORT_SYMBOL_GPL(ohci_restart);
 
 #ifdef CONFIG_PM
 
-int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
+int ohci_suspend(struct usb_hcd *hcd)
 {
 	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);
 	unsigned long	flags;
+	int		rc = 0;
 
 	/* Disable irq emission and mark HW unaccessible. Use
 	 * the spinlock to properly synchronize with possible pending
@@ -1048,7 +1049,13 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
 	spin_unlock_irqrestore (&ohci->lock, flags);
 
-	return 0;
+	synchronize_irq(hcd->irq);
+
+	if (HCD_WAKEUP_PENDING(hcd)) {
+		ohci_resume(hcd, false);
+		rc = -EBUSY;
+	}
+	return rc;
 }
 EXPORT_SYMBOL_GPL(ohci_suspend);
 
drivers/usb/host/ohci.h +1 -1
index e2e5faa..f2ebd423 100644
@@ -735,6 +735,6 @@ extern void	ohci_init_driver(struct hc_driver *drv,
 extern int	ohci_restart(struct ohci_hcd *ohci);
 extern int	ohci_setup(struct usb_hcd *hcd);
 #ifdef CONFIG_PM
-extern int	ohci_suspend(struct usb_hcd *hcd, bool do_wakeup);
+extern int	ohci_suspend(struct usb_hcd *hcd);
 extern int	ohci_resume(struct usb_hcd *hcd, bool hibernated);
 #endif
Signature · 1 line
1.7.9.5
#27 lore raw

PATCH v2 2/11 USB: OHCI: Properly handle ohci-at91 suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-at91 glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-at91 suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_at91_drv_suspend() will ensure proper handling of suspend scenario.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-at91.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-at91.c +5 -3
index 476b5a5..13449cc 100644
@@ -636,9 +636,11 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
 {
 	struct usb_hcd	*hcd = platform_get_drvdata(pdev);
 	struct ohci_hcd	*ohci = hcd_to_ohci(hcd);
+	int		ret;
 
-	if (device_may_wakeup(&pdev->dev))
-		enable_irq_wake(hcd->irq);
+	ret = ohci_suspend(hcd);
+	if (ret)
+		return ret;
 
 	/*
 	 * The integrated transceivers seem unable to notice disconnect,
@@ -658,7 +660,7 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
 		at91_stop_clock();
 	}
 
-	return 0;
+	return ret;
 }
 
 static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
Signature · 1 line
1.7.9.5
#28 lore raw

PATCH v2 3/11 USB: OHCI: Properly handle ohci-s3c2410 suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-s3c2410 glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-s3c2410 suspend scenario.

Calling explicitly the ohci_suspend()
routine in ohci_hcd_s3c2410_drv_suspend() will ensure proper handling of suspend scenario.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-s3c2410.c |   20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)
drivers/usb/host/ohci-s3c2410.c +3 -17
index be3429e..0d2a98d 100644
@@ -426,28 +426,14 @@ static int ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev)
 static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
 {
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
-	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 	struct platform_device *pdev = to_platform_device(dev);
-	unsigned long flags;
 	int rc = 0;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED) {
-		rc = -EINVAL;
-		goto bail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd);
+	if (rc)
+		return rc;
 
 	s3c2410_stop_hc(pdev);
-bail:
-	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
 }
Signature · 1 line
1.7.9.5
#29 lore raw

PATCH v2 4/11 USB: OHCI: Properly handle ohci-da8xx suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-da8xx glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-da8xx suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_da8xx_suspend() will ensure proper handling of suspend scenario.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-da8xx.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/usb/host/ohci-da8xx.c +10 -4
index 9be59f1..4b9a7a3 100644
@@ -406,19 +406,25 @@ static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev)
 }
 
 #ifdef CONFIG_PM
-static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message)
+static int ohci_da8xx_suspend(struct platform_device *pdev,
+				pm_message_t message)
 {
-	struct usb_hcd	*hcd	= platform_get_drvdata(dev);
+	struct usb_hcd	*hcd	= platform_get_drvdata(pdev);
 	struct ohci_hcd	*ohci	= hcd_to_ohci(hcd);
+	int		ret;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd);
+	if (ret)
+		return ret;
+
 	ohci_da8xx_clock(0);
 	hcd->state = HC_STATE_SUSPENDED;
-	dev->dev.power.power_state = PMSG_SUSPEND;
-	return 0;
+
+	return ret;
 }
 
 static int ohci_da8xx_resume(struct platform_device *dev)
Signature · 1 line
1.7.9.5
#30 lore raw

PATCH v2 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-ep93xx glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-ep93xx suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_ep93xx_drv_suspend() will ensure proper handling of suspend scenario.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-ep93xx.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-ep93xx.c +8 -2
index 492f681..fe60e72 100644
@@ -112,13 +112,19 @@ static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_
 {
 	struct usb_hcd *hcd = platform_get_drvdata(pdev);
 	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+	int ret;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
-	clk_disable(usb_host_clock);
-	return 0;
+	ret = ohci_suspend(hcd);
+	if (ret)
+		return ret;
+
+	ep93xx_stop_hc(&pdev->dev);
+
+	return ret;
 }
 
 static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
Signature · 1 line
1.7.9.5
#31 lore raw

PATCH v2 6/11 USB: OHCI: Properly handle ohci-exynos suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-exynos glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-exynos suspend scenario.

Calling explicitly the ohci_suspend() routine in exynos_ohci_suspend() will ensure proper handling of suspend scenario.

Cc Alan Stern <[email protected]>
Cc Bartlomiej Zolnierkiewicz <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-exynos.c |   19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
drivers/usb/host/ohci-exynos.c +4 -15
index 3e4bc74..47e9c38 100644
@@ -206,21 +206,11 @@ static int exynos_ohci_suspend(struct device *dev)
 	unsigned long flags;
 	int rc = 0;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED &&
-			ohci->rh_state != OHCI_RH_HALTED) {
-		rc = -EINVAL;
-		goto fail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd);
+	if (rc)
+		return rc;
 
+	spin_lock_irqsave(&ohci->lock, flags);
 	if (exynos_ohci->otg)
 		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
 
@@ -228,7 +218,6 @@ static int exynos_ohci_suspend(struct device *dev)
 
 	clk_disable_unprepare(exynos_ohci->clk);
 
-fail:
 	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
Signature · 1 line
1.7.9.5
#32 lore raw

PATCH v2 7/11 USB: OHCI: Properly handle ohci-omap suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-omap glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-omap suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_omap_suspend() will ensure proper handling of suspend scenario.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-omap.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-omap.c +9 -3
index 18b27a2..ec2d04c 100644
@@ -431,16 +431,22 @@ static int ohci_hcd_omap_drv_remove(struct platform_device *dev)
 
 #ifdef	CONFIG_PM
 
-static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message)
+static int ohci_omap_suspend(struct platform_device *pdev, pm_message_t message)
 {
-	struct ohci_hcd	*ohci = hcd_to_ohci(platform_get_drvdata(dev));
+	struct usb_hcd *hcd = platform_get_drvdata(pdev);
+	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+	int ret;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd);
+	if (ret)
+		return ret;
+
 	omap_ohci_clock_power(0);
-	return 0;
+	return ret;
 }
 
 static int ohci_omap_resume(struct platform_device *dev)
Signature · 1 line
1.7.9.5
#33 lore raw

PATCH v2 8/11 USB: OHCI: Properly handle ohci-platform suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-platform glue was not properly handled as it was not suspending generic part of ohci controller.Alan Stern suggested, properly handle ohci-platform suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_platform_suspend() will ensure proper handling of suspend scenario.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-platform.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-platform.c +8 -2
index a4c6410..d67f841 100644
@@ -139,14 +139,20 @@ static int ohci_platform_remove(struct platform_device *dev)
 
 static int ohci_platform_suspend(struct device *dev)
 {
-	struct usb_ohci_pdata *pdata = dev_get_platdata(dev);
+	struct usb_hcd *hcd = dev_get_drvdata(dev);
+	struct usb_ohci_pdata *pdata = dev->platform_data;
 	struct platform_device *pdev =
 		container_of(dev, struct platform_device, dev);
+	int ret;
+
+	ret = ohci_suspend(hcd);
+	if (ret)
+		return ret;
 
 	if (pdata->power_suspend)
 		pdata->power_suspend(pdev);
 
-	return 0;
+	return ret;
 }
 
 static int ohci_platform_resume(struct device *dev)
Signature · 1 line
1.7.9.5
#34 lore raw

PATCH v2 9/11 USB: OHCI: Properly handle ohci-pxa27x suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-pxa27x glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-pxa27x suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_pxa27x_drv_suspend() will ensure proper handling of suspend scenario.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-pxa27x.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-pxa27x.c +7 -1
index c1b1fa3..3b77109 100644
@@ -509,13 +509,19 @@ static int ohci_hcd_pxa27x_drv_suspend(struct device *dev)
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
 	struct pxa27x_ohci *pxa_ohci = to_pxa27x_ohci(hcd);
 	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+	int ret;
+
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd);
+	if (ret)
+		return ret;
+
 	pxa27x_stop_hc(pxa_ohci, dev);
-	return 0;
+	return ret;
 }
 
 static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
Signature · 1 line
1.7.9.5
#35 lore raw

PATCH v2 10/11 USB: OHCI: Properly handle ohci-sm501 suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-sm501 glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-sm501 suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_sm501_suspend() will ensure proper handling of suspend scenario.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-sm501.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-sm501.c +8 -2
index d479d5d..cdf25ef 100644
@@ -216,14 +216,20 @@ static int ohci_hcd_sm501_drv_remove(struct platform_device *pdev)
 static int ohci_sm501_suspend(struct platform_device *pdev, pm_message_t msg)
 {
 	struct device *dev = &pdev->dev;
-	struct ohci_hcd	*ohci = hcd_to_ohci(platform_get_drvdata(pdev));
+	struct usb_hcd  *hcd = platform_get_drvdata(pdev);
+	struct ohci_hcd	*ohci = hcd_to_ohci(hcd);
+	int ret;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd);
+	if (ret)
+		return ret;
+
 	sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 0);
-	return 0;
+	return ret;
 }
 
 static int ohci_sm501_resume(struct platform_device *pdev)
Signature · 1 line
1.7.9.5
#36 lore raw

PATCH v2 11/11 USB: OHCI: Properly handle ohci-spear suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-spear glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-spear suspend scenario.

Calling explicitly the ohci_suspend() routine in spear_ohci_hcd_drv_suspend() will ensure proper handling of suspend scenario.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-spear.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-spear.c +8 -3
index 31ff3fc..d6787a8 100644
@@ -130,20 +130,25 @@ static int spear_ohci_hcd_drv_remove(struct platform_device *pdev)
 }
 
 #if defined(CONFIG_PM)
-static int spear_ohci_hcd_drv_suspend(struct platform_device *dev,
+static int spear_ohci_hcd_drv_suspend(struct platform_device *pdev,
 		pm_message_t message)
 {
-	struct usb_hcd *hcd = platform_get_drvdata(dev);
+	struct usb_hcd *hcd = platform_get_drvdata(pdev);
 	struct ohci_hcd	*ohci = hcd_to_ohci(hcd);
 	struct spear_ohci *sohci_p = to_spear_ohci(hcd);
+	int ret;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd);
+	if (ret)
+		return ret;
+
 	clk_disable_unprepare(sohci_p->clk);
 
-	return 0;
+	return ret;
 }
 
 static int spear_ohci_hcd_drv_resume(struct platform_device *dev)
Signature · 1 line
1.7.9.5
#37 lore raw

v2 cover USB: OHCI:Properly handle ohci_suspend()routine in bus glue

In reply to Majunath Goudar

From: Majunath Goudar <[email protected]>

Suspend scenario in case of ohci bus glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci suspend scenario.

Calling explicitly the ohci_suspend()routine will ensure proper handling of suspend scenario.

V1->V2:
-This version is fixing the ohci-ep93xx build error reported by Olof Johansson:

drivers/usb/host/ohci-ep93xx.c: In function 'ohci_hcd_ep93xx_drv_suspend':
drivers/usb/host/ohci-ep93xx.c:126:2: error: implicit declaration of function 'ep93xx_stop_hc'

Due to the build failure on "[PATCH 5/11] USB: OHCI: Properly handle ohci-ep93xx suspend" following patches were reverted. [PATCH 1/11]USB: OHCI: Properly handle OHCI controller suspend [PATCH 2/11] USB: OHCI: Properly handle ohci-at91 suspend [PATCH 3/11] USB: OHCI: Properly handle ohci-s3c2410 suspend [PATCH 4/11] USB: OHCI: Properly handle ohci-da8xx suspend [PATCH 5/11] USB: OHCI: Properly handle ohci-ep93xx suspend [PATCH 6/11] USB: OHCI: Properly handle ohci-exynos suspend [PATCH 11/11] USB: OHCI: Properly handle ohci-spear suspend

The following 4 patches are fine and present in usb-next Commit id "10abfa13"[PATCH 7/11] Properly handle ohci-omap suspend. Commit id "39dbd7df"[PATCH 8/11] Properly handle ohci-platform suspend. Commit id "4ceaa893"[PATCH 9/11] Properly handle ohci-pxa suspend. Commit id "f3c60599"[PATCH 10/11] Properly handle ohci-sm501 suspend.

This patch set is working properly.

Majunath Goudar (1):
USB: OHCI: Properly handle ohci-ep93xx suspend

Manjunath Goudar (6):
USB: OHCI: Properly handle OHCI controller suspend
USB: OHCI: Properly handle ohci-at91 suspend
USB: OHCI: Properly handle ohci-s3c2410 suspend
USB: OHCI: Properly handle ohci-da8xx suspend
USB: OHCI: Properly handle ohci-exynos suspend
USB: OHCI: Properly handle ohci-spear suspend

 drivers/usb/host/ohci-at91.c    |   10 ++++++++--
 drivers/usb/host/ohci-da8xx.c   |   15 +++++++++++----
 drivers/usb/host/ohci-ep93xx.c  |    7 +++++--
 drivers/usb/host/ohci-exynos.c  |   20 +++++---------------
 drivers/usb/host/ohci-hcd.c     |    9 ++++++++-
 drivers/usb/host/ohci-s3c2410.c |   21 ++++-----------------
 drivers/usb/host/ohci-spear.c   |   12 +++++++++---
 7 files changed, 50 insertions(+), 44 deletions(-)
Signature · 1 line
1.7.9.5
#38 lore raw

PATCH v2 1/7 USB: OHCI: Properly handle OHCI controller suspend

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of OHCI was not properly
handled in ochi_suspend()routine. Alan Stern
suggested, properly handle OHCI suspend scenario.

This does generic proper handling of suspend
scenario to all OHCI SOC.

V1->V2:
- No change.
Due to build failure on ep93xx reverted this patch. This patch is needed as Alan mentioned, it is having common ohci suspend features w/o this following patches(still in usb-next) are not useful.

Commit id "10abfa13"[PATCH 7/11] Properly handle ohci-omap suspend. Commit id "39dbd7df"[PATCH 8/11] Properly handle ohci-platform suspend. Commit id "4ceaa893"[PATCH 9/11] Properly handle ohci-pxa suspend. Commit id "f3c60599"[PATCH 10/11] Properly handle ohci-sm501 suspend.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-hcd.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-hcd.c +8 -1
index 8ada13f..310bcfe 100644
@@ -1036,6 +1036,7 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 {
 	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);
 	unsigned long	flags;
+	int		rc = 0;
 
 	/* Disable irq emission and mark HW unaccessible. Use
 	 * the spinlock to properly synchronize with possible pending
@@ -1048,7 +1049,13 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
 	spin_unlock_irqrestore (&ohci->lock, flags);
 
-	return 0;
+	synchronize_irq(hcd->irq);
+
+	if (do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
+		ohci_resume(hcd, false);
+		rc = -EBUSY;
+	}
+	return rc;
 }
 EXPORT_SYMBOL_GPL(ohci_suspend);
 
Signature · 1 line
1.7.9.5
maintainer
#39 lore raw

PATCH v2 1/7 USB: OHCI: Properly handle OHCI controller suspend

Quoted 15 lines · Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of OHCI was not properly handled in ochi_suspend()routine. Alan Stern suggested, properly handle OHCI suspend scenario.

This does generic proper handling of suspend scenario to all OHCI SOC.

V1->V2:
- No change.
Due to build failure on ep93xx reverted this patch. This patch is needed as Alan mentioned, it is having common ohci suspend features w/o this following patches(still in usb-next) are not useful.

Quoted 7 lines

Commit id "10abfa13"[PATCH 7/11] Properly handle ohci-omap suspend. Commit id "39dbd7df"[PATCH 8/11] Properly handle ohci-platform suspend. Commit id "4ceaa893"[PATCH 9/11] Properly handle ohci-pxa suspend. Commit id "f3c60599"[PATCH 10/11] Properly handle ohci-sm501 suspend.

This is an invalid email address, please don't continue to use it, I'm tired of seeing the bounce response :(

And "v2" for this series? Really? I seem to recall many different versions of the series, so we should be on a much higher number by now...

How have you tested these patches?

thanks,

greg k-h

#40 lore raw

PATCH v2 2/7 USB: OHCI: Properly handle ohci-at91 suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-at91 glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-at91 suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_at91_drv_suspend() will ensure proper handling of suspend scenario. This task is sugested by Alan Stern.

V1->V2:
Due to version mismatch and build failure on ep93xx reverted this patch. This is a proper patch for ohci-at91 suspend as Alan Stern mentioned.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-at91.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-at91.c +8 -2
index 476b5a5..f2d8403 100644
@@ -636,8 +636,14 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
 {
 	struct usb_hcd	*hcd = platform_get_drvdata(pdev);
 	struct ohci_hcd	*ohci = hcd_to_ohci(hcd);
+	bool		do_wakeup = device_may_wakeup(&pdev->dev);
+	int		ret;
 
-	if (device_may_wakeup(&pdev->dev))
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
+	if (do_wakeup)
 		enable_irq_wake(hcd->irq);
 
 	/*
@@ -658,7 +664,7 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
 		at91_stop_clock();
 	}
 
-	return 0;
+	return ret;
 }
 
 static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
Signature · 1 line
1.7.9.5
#41 lore raw

PATCH v2 3/7 USB: OHCI: Properly handle ohci-s3c2410 suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-s3c2410 glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-s3c2410 suspend scenario.

Calling explicitly the ohci_suspend()
routine in ohci_hcd_s3c2410_drv_suspend() will ensure proper handling of suspend scenario.

V1->V2:
-No changes.
Due to the build failure on ep93xx reverted this patch. This patch is needed as Alan Stern suggestion.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-s3c2410.c |   21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
drivers/usb/host/ohci-s3c2410.c +4 -17
index be3429e..b5bf9b7 100644
@@ -426,28 +426,15 @@ static int ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev)
 static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
 {
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
-	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 	struct platform_device *pdev = to_platform_device(dev);
-	unsigned long flags;
+	bool do_wakeup = device_may_wakeup(dev);
 	int rc = 0;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED) {
-		rc = -EINVAL;
-		goto bail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
 	s3c2410_stop_hc(pdev);
-bail:
-	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
 }
Signature · 1 line
1.7.9.5
#42 lore raw

PATCH v2 4/7 USB: OHCI: Properly handle ohci-da8xx suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-da8xx glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-da8xx suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_da8xx_suspend() will ensure proper handling of suspend scenario.

V1->V2:
-No change.
Due to the build failure on ep93xx reverted this patch. This patch is needed as Alan Stern suggestion.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-da8xx.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/usb/host/ohci-da8xx.c +11 -4
index 9be59f1..f8238a4 100644
@@ -406,19 +406,26 @@ static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev)
 }
 
 #ifdef CONFIG_PM
-static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message)
+static int ohci_da8xx_suspend(struct platform_device *pdev,
+				pm_message_t message)
 {
-	struct usb_hcd	*hcd	= platform_get_drvdata(dev);
+	struct usb_hcd	*hcd	= platform_get_drvdata(pdev);
 	struct ohci_hcd	*ohci	= hcd_to_ohci(hcd);
+	bool		do_wakeup	= device_may_wakeup(&pdev->dev);
+	int		ret;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
 	ohci_da8xx_clock(0);
 	hcd->state = HC_STATE_SUSPENDED;
-	dev->dev.power.power_state = PMSG_SUSPEND;
-	return 0;
+
+	return ret;
 }
 
 static int ohci_da8xx_resume(struct platform_device *dev)
Signature · 1 line
1.7.9.5
#43 lore raw

PATCH v2 5/7 USB: OHCI: Properly handle ohci-ep93xx suspend

In reply to Majunath Goudar

From: Majunath Goudar <[email protected]>

Suspend scenario in case of ohci-ep93xx glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-ep93xx suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_ep93xx_drv_suspend() will ensure proper handling of suspend scenario.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org

V1->V2:
-Fixed Olof Johansson reported build error:
drivers/usb/host/ohci-ep93xx.c: In function 'ohci_hcd_ep93xx_drv_suspend':
drivers/usb/host/ohci-ep93xx.c:126:2: error: implicit declaration of function 'ep93xx_stop_hc'

---
 drivers/usb/host/ohci-ep93xx.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-ep93xx.c +5 -2
index 492f681..77ebdc8 100644
@@ -112,12 +112,15 @@ static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_
 {
 	struct usb_hcd *hcd = platform_get_drvdata(pdev);
 	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+	bool do_wakeup = device_may_wakeup(&pdev->dev);
+	int ret;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
-
-	clk_disable(usb_host_clock);
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
 	return 0;
 }
 
Signature · 1 line
1.7.9.5
maintainer
#44 lore raw

PATCH v2 5/7 USB: OHCI: Properly handle ohci-ep93xx suspend

Quoted 10 lines · Majunath Goudar

From: Majunath Goudar <[email protected]>

Suspend scenario in case of ohci-ep93xx glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-ep93xx suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_ep93xx_drv_suspend() will ensure proper handling of suspend scenario.

This patch isn't needed any more. H Hartley Sweeten has just submitted a patch to remove ohci-ep93xx entirely.

Alan Stern

#45 lore raw

PATCH v2 6/7 USB: OHCI: Properly handle ohci-exynos suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-exynos glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-exynos suspend scenario.

Calling explicitly the ohci_suspend() routine in exynos_ohci_suspend() will ensure proper handling of suspend scenario.

V1->V2:
-No changes.
Due to the build failure on ep93xx reverted this patch. This patch is needed as Alan Stern suggestion.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-exynos.c |   20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/usb/host/ohci-exynos.c +5 -15
index a87baed..aa50e18 100644
@@ -192,24 +192,15 @@ static int exynos_ohci_suspend(struct device *dev)
 	struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd);
 	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 	struct platform_device *pdev = to_platform_device(dev);
+	bool do_wakeup = device_may_wakeup(dev);
 	unsigned long flags;
 	int rc = 0;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED &&
-			ohci->rh_state != OHCI_RH_HALTED) {
-		rc = -EINVAL;
-		goto fail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
+	spin_lock_irqsave(&ohci->lock, flags);
 	if (exynos_ohci->otg)
 		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
 
@@ -217,7 +208,6 @@ static int exynos_ohci_suspend(struct device *dev)
 
 	clk_disable_unprepare(exynos_ohci->clk);
 
-fail:
 	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
Signature · 1 line
1.7.9.5
#46 lore raw

PATCH v2 7/7 USB: OHCI: Properly handle ohci-spear suspend

In reply to Majunath Goudar

From: Manjunath Goudar <[email protected]>

Suspend scenario in case of ohci-spear glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-spear suspend scenario.

Calling explicitly the ohci_suspend() routine in
spear_ohci_hcd_drv_suspend() will ensure proper
handling of suspend scenario.

V1->V2:
-No changes.
Due to the build failure on ep93xx reverted this patch. This patch is needed as Alan Stern suggestion.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-spear.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-spear.c +9 -3
index 31ff3fc..41148f8 100644
@@ -130,20 +130,26 @@ static int spear_ohci_hcd_drv_remove(struct platform_device *pdev)
 }
 
 #if defined(CONFIG_PM)
-static int spear_ohci_hcd_drv_suspend(struct platform_device *dev,
+static int spear_ohci_hcd_drv_suspend(struct platform_device *pdev,
 		pm_message_t message)
 {
-	struct usb_hcd *hcd = platform_get_drvdata(dev);
+	struct usb_hcd *hcd = platform_get_drvdata(pdev);
 	struct ohci_hcd	*ohci = hcd_to_ohci(hcd);
 	struct spear_ohci *sohci_p = to_spear_ohci(hcd);
+	bool do_wakeup = device_may_wakeup(&pdev->dev);
+	int ret;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
 	clk_disable_unprepare(sohci_p->clk);
 
-	return 0;
+	return ret;
 }
 
 static int spear_ohci_hcd_drv_resume(struct platform_device *dev)
Signature · 1 line
1.7.9.5

A message that is not in the archive (sent off-list or not yet received): [email protected]

#48 lore raw

PATCH v3 3/6 USB: OHCI: Properly handle ohci-s3c2410 suspend

Suspend scenario in case of ohci-s3c2410 glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-s3c2410 suspend scenario.

Calling explicitly the ohci_suspend()
routine in ohci_hcd_s3c2410_drv_suspend() will ensure proper handling of suspend scenario.

V1->V2:
-No changes.
Due to the build failure on ep93xx reverted this patch. This patch is needed as Alan Stern suggestion.

V2->V3:
-No changes.
As a build failure on "ep93xx proper suspend patch" and Linaro id bounced. Rewrote this patch on top of latest Greg usb-next branch. This patch not gives any build error. Patch is required for ohci-s3c2410 proper suspending as Alan mentioned.

Initially when I wrote this patch I was working in Linaro, now I am not part of Linaro that is why Linaro id is bouncing. Sending this patch from personal mail id.

Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc Ben Dooks <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc linux-samsung-soc at vger.kernel.org
Cc linux-kernel at vger.kernel.org
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-s3c2410.c |   21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
drivers/usb/host/ohci-s3c2410.c +4 -17
index be3429e..b5bf9b7 100644
@@ -426,28 +426,15 @@ static int ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev)
 static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
 {
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
-	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 	struct platform_device *pdev = to_platform_device(dev);
-	unsigned long flags;
+	bool do_wakeup = device_may_wakeup(dev);
 	int rc = 0;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED) {
-		rc = -EINVAL;
-		goto bail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
 	s3c2410_stop_hc(pdev);
-bail:
-	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
 }
Signature · 1 line
1.7.9.5
#49 lore raw

PATCH v3 5/6 USB: OHCI: Properly handle ohci-exynos suspend

In reply to a message not in the archive

Suspend scenario in case of ohci-exynos glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-exynos suspend scenario.

Calling explicitly the ohci_suspend() routine in exynos_ohci_suspend() will ensure proper handling of suspend scenario.

V1->V2:
-No changes.
Due to the build failure on ep93xx reverted this patch. This patch is needed as Alan Stern suggestion.

V2->V3:
-No changes.
As a build failure on "ep93xx proper suspend patch" and Linaro id bounced. Rewrote this patch on top of latest Greg usb-next branch. This patch not gives any build error. Patch is required for ohci-exynos proper suspending as Alan mentioned.

Initially when I wrote this patch I was working in Linaro, now I am not part of Linaro that is why Linaro id is bouncing. Sending this patch from personal mail id.

Cc Alan Stern <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc linux-samsung-soc at vger.kernel.org
Cc linux-kernel at vger.kernel.org
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-exynos.c |   22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
drivers/usb/host/ohci-exynos.c +6 -16
index a87baed..4b5c8bd 100644
@@ -192,23 +192,14 @@ static int exynos_ohci_suspend(struct device *dev)
 	struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd);
 	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 	struct platform_device *pdev = to_platform_device(dev);
+	bool do_wakeup = device_may_wakeup(dev);
 	unsigned long flags;
-	int rc = 0;
+	int rc = ohci_suspend(hcd, do_wakeup);
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED &&
-			ohci->rh_state != OHCI_RH_HALTED) {
-		rc = -EINVAL;
-		goto fail;
-	}
+	if (rc)
+		return rc;
 
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	spin_lock_irqsave(&ohci->lock, flags);
 
 	if (exynos_ohci->otg)
 		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
@@ -217,10 +208,9 @@ static int exynos_ohci_suspend(struct device *dev)
 
 	clk_disable_unprepare(exynos_ohci->clk);
 
-fail:
 	spin_unlock_irqrestore(&ohci->lock, flags);
 
-	return rc;
+	return 0;
 }
 
 static int exynos_ohci_resume(struct device *dev)
Signature · 1 line
1.7.9.5

A message that is not in the archive (sent off-list or not yet received): [email protected]

#51 lore raw

PATCH v3 3/6 USB: OHCI: Properly handle ohci-s3c2410 suspend

Suspend scenario in case of ohci-s3c2410 glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-s3c2410 suspend scenario.

Calling explicitly the ohci_suspend()
routine in ohci_hcd_s3c2410_drv_suspend() will ensure proper handling of suspend scenario.

Cc Greg KH <[email protected]>
Cc Ben Dooks <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc linux-samsung-soc at vger.kernel.org
Cc linux-kernel at vger.kernel.org
Cc linux-usb at vger.kernel.org

---
V2->V3:
-No changes.
As a build failure on "ep93xx proper suspend patch" and Linaro id bounced. Rewrote this patch on top of latest Greg usb-next branch. This patch not gives any build error. Patch is required for ohci-s3c2410 proper suspending as Alan mentioned.

Initially when I wrote this patch I was working in Linaro, now I am not part of Linaro that is why Linaro id is bouncing. Sending this patch from personal mail id.

V1->V2:
-No changes.
Due to the build failure on ep93xx reverted this patch. This patch is needed as Alan Stern suggestion.

 drivers/usb/host/ohci-s3c2410.c |   21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
drivers/usb/host/ohci-s3c2410.c +4 -17
index be3429e..b5bf9b7 100644
@@ -426,28 +426,15 @@ static int ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev)
 static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
 {
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
-	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 	struct platform_device *pdev = to_platform_device(dev);
-	unsigned long flags;
+	bool do_wakeup = device_may_wakeup(dev);
 	int rc = 0;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED) {
-		rc = -EINVAL;
-		goto bail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
 	s3c2410_stop_hc(pdev);
-bail:
-	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
 }
Signature · 1 line
1.7.9.5
#52 lore raw

PATCH v3 5/6 USB: OHCI: Properly handle ohci-exynos suspend

In reply to a message not in the archive

Suspend scenario in case of ohci-exynos glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-exynos suspend scenario.

Calling explicitly the ohci_suspend() routine in exynos_ohci_suspend() will ensure proper handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc linux-samsung-soc at vger.kernel.org
Cc linux-kernel at vger.kernel.org
Cc linux-usb at vger.kernel.org

---
V2->V3:
-No changes.
As a build failure on "ep93xx proper suspend patch" and Linaro id bounced. Rewrote this patch on top of latest Greg usb-next branch. This patch not gives any build error. Patch is required for ohci-exynos proper suspending as Alan mentioned.

Initially when I wrote this patch I was working in Linaro, now I am not part of Linaro that is why Linaro id is bouncing. Sending this patch from personal mail id.

V1->V2:
-No changes.
Due to the build failure on ep93xx reverted this patch. This patch is needed as Alan Stern suggestion.

 drivers/usb/host/ohci-exynos.c |   22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
drivers/usb/host/ohci-exynos.c +6 -16
index a87baed..4b5c8bd 100644
@@ -192,23 +192,14 @@ static int exynos_ohci_suspend(struct device *dev)
 	struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd);
 	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 	struct platform_device *pdev = to_platform_device(dev);
+	bool do_wakeup = device_may_wakeup(dev);
 	unsigned long flags;
-	int rc = 0;
+	int rc = ohci_suspend(hcd, do_wakeup);
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED &&
-			ohci->rh_state != OHCI_RH_HALTED) {
-		rc = -EINVAL;
-		goto fail;
-	}
+	if (rc)
+		return rc;
 
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	spin_lock_irqsave(&ohci->lock, flags);
 
 	if (exynos_ohci->otg)
 		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
@@ -217,10 +208,9 @@ static int exynos_ohci_suspend(struct device *dev)
 
 	clk_disable_unprepare(exynos_ohci->clk);
 
-fail:
 	spin_unlock_irqrestore(&ohci->lock, flags);
 
-	return rc;
+	return 0;
 }
 
 static int exynos_ohci_resume(struct device *dev)
Signature · 1 line
1.7.9.5

A message that is not in the archive (sent off-list or not yet received): [email protected]

#54 lore raw

PATCH v4 3/6 USB: OHCI: Properly handle ohci-s3c2410 suspend

Suspend scenario in case of ohci-s3c2410 glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-s3c2410 suspend scenario.

Calling explicitly the ohci_suspend()
routine in ohci_hcd_s3c2410_drv_suspend() will ensure proper handling of suspend scenario.

Cc Greg KH <[email protected]>
Cc Ben Dooks <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc linux-samsung-soc at vger.kernel.org
Cc linux-kernel at vger.kernel.org
Cc linux-usb at vger.kernel.org

---
V3->V4:
-No changes, only added Alan Acked-by.

V2->V3:
-No changes.
As a build failure on "ep93xx proper suspend patch" and Linaro id bounced. Rewrote this patch on top of latest Greg usb-next branch. This patch not gives any build error. Patch is required for ohci-s3c2410 proper suspending as Alan mentioned.

Initially when I wrote this patch I was working in Linaro, now I am not part of Linaro that is why Linaro id is bouncing. Sending this patch from personal mail id.

V1->V2:
-No changes.
Due to the build failure on ep93xx reverted this patch. This patch is needed as Alan Stern suggestion.

 drivers/usb/host/ohci-s3c2410.c |   21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
drivers/usb/host/ohci-s3c2410.c +4 -17
index be3429e..b5bf9b7 100644
@@ -426,28 +426,15 @@ static int ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev)
 static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
 {
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
-	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 	struct platform_device *pdev = to_platform_device(dev);
-	unsigned long flags;
+	bool do_wakeup = device_may_wakeup(dev);
 	int rc = 0;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED) {
-		rc = -EINVAL;
-		goto bail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
 	s3c2410_stop_hc(pdev);
-bail:
-	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
 }
Signature · 1 line
1.7.9.5
#55 lore raw

PATCH v4 5/6 USB: OHCI: Properly handle ohci-exynos suspend

In reply to a message not in the archive

Suspend scenario in case of ohci-exynos glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-exynos suspend scenario.

Calling explicitly the ohci_suspend() routine in exynos_ohci_suspend() will ensure proper handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc linux-samsung-soc at vger.kernel.org
Cc linux-kernel at vger.kernel.org
Cc linux-usb at vger.kernel.org

---
V3->V4:
-No changes, only added Alan Acked-by.

V2->V3:
-No changes.
As a build failure on "ep93xx proper suspend patch" and Linaro id bounced. Rewrote this patch on top of latest Greg usb-next branch. This patch not gives any build error. Patch is required for ohci-exynos proper suspending as Alan mentioned.

Initially when I wrote this patch I was working in Linaro, now I am not part of Linaro that is why Linaro id is bouncing. Sending this patch from personal mail id.

V1->V2:
-No changes.
Due to the build failure on ep93xx reverted this patch. This patch is needed as Alan Stern suggestion.

 drivers/usb/host/ohci-exynos.c |   22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
drivers/usb/host/ohci-exynos.c +6 -16
index a87baed..4b5c8bd 100644
@@ -192,23 +192,14 @@ static int exynos_ohci_suspend(struct device *dev)
 	struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd);
 	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 	struct platform_device *pdev = to_platform_device(dev);
+	bool do_wakeup = device_may_wakeup(dev);
 	unsigned long flags;
-	int rc = 0;
+	int rc = ohci_suspend(hcd, do_wakeup);
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED &&
-			ohci->rh_state != OHCI_RH_HALTED) {
-		rc = -EINVAL;
-		goto fail;
-	}
+	if (rc)
+		return rc;
 
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	spin_lock_irqsave(&ohci->lock, flags);
 
 	if (exynos_ohci->otg)
 		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
@@ -217,10 +208,9 @@ static int exynos_ohci_suspend(struct device *dev)
 
 	clk_disable_unprepare(exynos_ohci->clk);
 
-fail:
 	spin_unlock_irqrestore(&ohci->lock, flags);
 
-	return rc;
+	return 0;
 }
 
 static int exynos_ohci_resume(struct device *dev)
Signature · 1 line
1.7.9.5
#56 lore raw

v4 cover USB: OHCI:Properly handle ohci_suspend()routine in bus glue

In reply to Majunath Goudar

Suspend scenario in case of ohci bus glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci suspend scenario.

Calling explicitly the ohci_suspend()routine will ensure proper handling of suspend scenario.

This patch set is rebased on greghk/usb-next 3.13-rc1 and successfully built without any build error.

V3->V4:
-Dropped "[PATCH 5/7] USB: OHCI: Properly handle ohci-ep93xx suspend" in
this version, as H Hartley Sweeten has just submitted a patch to remove ohci-ep93xx entirely.

-[PATCH 2/6] The ohci_suspend() calling after enable_irq_wake, if ohci_suspend
fails disabling the irq.

-Added Alan acked-by.

V2->V3:
-Rewrote the remaining patches on top of the latest Greg usb-next branch. This patch set not gives any build error. Patch set is required for proper suspend of ohci host controller as Alan mentioned.

-Initially when I wrote this patch set I was working in Linaro, now I am not part of Linaro that is why Linaro id is bouncing. Sending this patch set from personal mail id.

V1->V2:
-This version is fixing the ohci-ep93xx build error reported by Olof Johansson:

drivers/usb/host/ohci-ep93xx.c: In function 'ohci_hcd_ep93xx_drv_suspend':
drivers/usb/host/ohci-ep93xx.c:126:2: error: implicit declaration of function 'ep93xx_stop_hc'

Due to the build failure on "[PATCH 5/11] USB: OHCI: Properly handle ohci-ep93xx suspend" following patches were reverted. [PATCH 1/11]USB: OHCI: Properly handle OHCI controller suspend [PATCH 2/11] USB: OHCI: Properly handle ohci-at91 suspend [PATCH 3/11] USB: OHCI: Properly handle ohci-s3c2410 suspend [PATCH 4/11] USB: OHCI: Properly handle ohci-da8xx suspend [PATCH 5/11] USB: OHCI: Properly handle ohci-ep93xx suspend [PATCH 6/11] USB: OHCI: Properly handle ohci-exynos suspend [PATCH 11/11] USB: OHCI: Properly handle ohci-spear suspend

The following 4 patches are fine and present in usb-next Commit id "10abfa13"[PATCH 7/11] Properly handle ohci-omap suspend. Commit id "39dbd7df"[PATCH 8/11] Properly handle ohci-platform suspend. Commit id "4ceaa893"[PATCH 9/11] Properly handle ohci-pxa suspend. Commit id "f3c60599"[PATCH 10/11] Properly handle ohci-sm501 suspend.

This patch set is working properly.

Majunath Goudar (6):
USB: OHCI: Properly handle OHCI controller suspend
USB: OHCI: Properly handle ohci-at91 suspend
USB: OHCI: Properly handle ohci-s3c2410 suspend
USB: OHCI: Properly handle ohci-da8xx suspend
USB: OHCI: Properly handle ohci-exynos suspend
USB: OHCI: Properly handle ohci-spear suspend

 drivers/usb/host/ohci-at91.c    |   11 +++++++++--
 drivers/usb/host/ohci-da8xx.c   |   16 ++++++++++++----
 drivers/usb/host/ohci-exynos.c  |   22 ++++++----------------
 drivers/usb/host/ohci-hcd.c     |    9 ++++++++-
 drivers/usb/host/ohci-s3c2410.c |   21 ++++-----------------
 drivers/usb/host/ohci-spear.c   |   12 +++++++++---
 6 files changed, 48 insertions(+), 43 deletions(-)
Signature · 1 line
1.7.9.5
#57 lore raw

PATCH v4 1/6 USB: OHCI: Properly handle OHCI controller suspend

Suspend scenario in case of OHCI was not properly handled in ochi_suspend()routine. Alan Stern suggested, properly handle OHCI suspend scenario.

This does generic proper handling of suspend scenario to all OHCI SOC.

Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org

---
V3->V4:
- No changes, only added Alan Acked-by.

V2->V3 :
- No changes.
As a build failure on ep93xx patch, reverted this patch(reveart commit id 476e4b). Rewrote this patch on top of latest Greg usb-next branch. This patch not gives any build error. patch is required for proper suspending as Alan mentioned. It is having common ohci suspend features w/o this following patches(still in usb-next) are not useful.

Commit id "10abfa13"[PATCH 7/11] Properly handle ohci-omap suspend. Commit id "39dbd7df"[PATCH 8/11] Properly handle ohci-platform suspend. Commit id "4ceaa893"[PATCH 9/11] Properly handle ohci-pxa suspend. Commit id "f3c60599"[PATCH 10/11] Properly handle ohci-sm501 suspend.

Initially when I wrote this patch I was working in Linaro, now I am not part of Linaro that is why Linaro id is bouncing. Sending this patch from personal mail id.

V1->V2:
- No change.
Due to build failure on ep93xx reverted this patch. This patch is needed as Alan mentioned, it is having common ohci suspend features w/o this following patches(still in usb-next) are not useful.

Commit id "10abfa13"[PATCH 7/11] Properly handle ohci-omap suspend. Commit id "39dbd7df"[PATCH 8/11] Properly handle ohci-platform suspend. Commit id "4ceaa893"[PATCH 9/11] Properly handle ohci-pxa suspend. Commit id "f3c60599"[PATCH 10/11] Properly handle ohci-sm501 suspend.

 drivers/usb/host/ohci-hcd.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-hcd.c +8 -1
index 8ada13f..310bcfe 100644
@@ -1036,6 +1036,7 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 {
 	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);
 	unsigned long	flags;
+	int		rc = 0;
 
 	/* Disable irq emission and mark HW unaccessible. Use
 	 * the spinlock to properly synchronize with possible pending
@@ -1048,7 +1049,13 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
 	spin_unlock_irqrestore (&ohci->lock, flags);
 
-	return 0;
+	synchronize_irq(hcd->irq);
+
+	if (do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
+		ohci_resume(hcd, false);
+		rc = -EBUSY;
+	}
+	return rc;
 }
 EXPORT_SYMBOL_GPL(ohci_suspend);
 
Signature · 1 line
1.7.9.5
#58 lore raw

PATCH v4 2/6 USB: OHCI: Properly handle ohci-at91 suspend

In reply to Majunath Goudar

Suspend scenario in case of ohci-at91 glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-at91 suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_at91_drv_suspend() will ensure proper handling of suspend scenario. This task is sugested by Alan Stern.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-at91.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-at91.c +9 -2
index 476b5a5..71eff0b 100644
@@ -636,10 +636,17 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
 {
 	struct usb_hcd	*hcd = platform_get_drvdata(pdev);
 	struct ohci_hcd	*ohci = hcd_to_ohci(hcd);
+	bool		do_wakeup = device_may_wakeup(&pdev->dev);
+	int		ret;
 
-	if (device_may_wakeup(&pdev->dev))
+	if (do_wakeup)
 		enable_irq_wake(hcd->irq);
 
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret) {
+		disable_irq_wake(hcd->irq);
+		return ret;
+	}
 	/*
 	 * The integrated transceivers seem unable to notice disconnect,
 	 * reconnect, or wakeup without the 48 MHz clock active.  so for
@@ -658,7 +665,7 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
 		at91_stop_clock();
 	}
 
-	return 0;
+	return ret;
 }
 
 static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
Signature · 1 line
1.7.9.5
#59 lore raw

PATCH v4 3/6 USB: OHCI: Properly handle ohci-s3c2410 suspend

In reply to Majunath Goudar

Suspend scenario in case of ohci-s3c2410 glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-s3c2410 suspend scenario.

Calling explicitly the ohci_suspend()
routine in ohci_hcd_s3c2410_drv_suspend() will ensure proper handling of suspend scenario.

Cc Greg KH <[email protected]>
Cc Ben Dooks <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc linux-samsung-soc at vger.kernel.org
Cc linux-kernel at vger.kernel.org
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-s3c2410.c |   21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
drivers/usb/host/ohci-s3c2410.c +4 -17
index be3429e..b5bf9b7 100644
@@ -426,28 +426,15 @@ static int ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev)
 static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
 {
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
-	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 	struct platform_device *pdev = to_platform_device(dev);
-	unsigned long flags;
+	bool do_wakeup = device_may_wakeup(dev);
 	int rc = 0;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED) {
-		rc = -EINVAL;
-		goto bail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
 	s3c2410_stop_hc(pdev);
-bail:
-	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
 }
Signature · 1 line
1.7.9.5
#60 lore raw

PATCH v4 4/6 USB: OHCI: Properly handle ohci-da8xx suspend

In reply to Majunath Goudar

Suspend scenario in case of ohci-da8xx glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-da8xx suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_da8xx_suspend() will ensure proper handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.or
---
 drivers/usb/host/ohci-da8xx.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/usb/host/ohci-da8xx.c +12 -4
index 9be59f1..71dbd85 100644
@@ -406,19 +406,27 @@ static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev)
 }
 
 #ifdef CONFIG_PM
-static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message)
+static int ohci_da8xx_suspend(struct platform_device *pdev,
+				pm_message_t message)
 {
-	struct usb_hcd	*hcd	= platform_get_drvdata(dev);
+	struct usb_hcd	*hcd	= platform_get_drvdata(pdev);
 	struct ohci_hcd	*ohci	= hcd_to_ohci(hcd);
+	bool		do_wakeup	= device_may_wakeup(&pdev->dev);
+	int		ret;
+
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
 	ohci_da8xx_clock(0);
 	hcd->state = HC_STATE_SUSPENDED;
-	dev->dev.power.power_state = PMSG_SUSPEND;
-	return 0;
+
+	return ret;
 }
 
 static int ohci_da8xx_resume(struct platform_device *dev)
Signature · 1 line
1.7.9.5
#61 lore raw

PATCH v4 5/6 USB: OHCI: Properly handle ohci-exynos suspend

In reply to Majunath Goudar

Suspend scenario in case of ohci-exynos glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-exynos suspend scenario.

Calling explicitly the ohci_suspend() routine in exynos_ohci_suspend() will ensure proper handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc linux-samsung-soc at vger.kernel.org
Cc linux-kernel at vger.kernel.org
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-exynos.c |   22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
drivers/usb/host/ohci-exynos.c +6 -16
index a87baed..4b5c8bd 100644
@@ -192,23 +192,14 @@ static int exynos_ohci_suspend(struct device *dev)
 	struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd);
 	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 	struct platform_device *pdev = to_platform_device(dev);
+	bool do_wakeup = device_may_wakeup(dev);
 	unsigned long flags;
-	int rc = 0;
+	int rc = ohci_suspend(hcd, do_wakeup);
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED &&
-			ohci->rh_state != OHCI_RH_HALTED) {
-		rc = -EINVAL;
-		goto fail;
-	}
+	if (rc)
+		return rc;
 
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	spin_lock_irqsave(&ohci->lock, flags);
 
 	if (exynos_ohci->otg)
 		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
@@ -217,10 +208,9 @@ static int exynos_ohci_suspend(struct device *dev)
 
 	clk_disable_unprepare(exynos_ohci->clk);
 
-fail:
 	spin_unlock_irqrestore(&ohci->lock, flags);
 
-	return rc;
+	return 0;
 }
 
 static int exynos_ohci_resume(struct device *dev)
Signature · 1 line
1.7.9.5
#62 lore raw

PATCH v4 6/6 USB: OHCI: Properly handle ohci-spear suspend

In reply to Majunath Goudar

Suspend scenario in case of ohci-spear glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-spear suspend scenario.

Calling explicitly the ohci_suspend() routine in spear_ohci_hcd_drv_suspend() will ensure proper handling of suspend scenario.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-spear.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-spear.c +9 -3
index 31ff3fc..41148f8 100644
@@ -130,20 +130,26 @@ static int spear_ohci_hcd_drv_remove(struct platform_device *pdev)
 }
 
 #if defined(CONFIG_PM)
-static int spear_ohci_hcd_drv_suspend(struct platform_device *dev,
+static int spear_ohci_hcd_drv_suspend(struct platform_device *pdev,
 		pm_message_t message)
 {
-	struct usb_hcd *hcd = platform_get_drvdata(dev);
+	struct usb_hcd *hcd = platform_get_drvdata(pdev);
 	struct ohci_hcd	*ohci = hcd_to_ohci(hcd);
 	struct spear_ohci *sohci_p = to_spear_ohci(hcd);
+	bool do_wakeup = device_may_wakeup(&pdev->dev);
+	int ret;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
 	clk_disable_unprepare(sohci_p->clk);
 
-	return 0;
+	return ret;
 }
 
 static int spear_ohci_hcd_drv_resume(struct platform_device *dev)
Signature · 1 line
1.7.9.5