linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 09/24 v2] ARM: cns3xxx: use ehci platform driver
       [not found] <1349363872-27004-1-git-send-email-florian@openwrt.org>
@ 2012-10-04 15:17 ` Florian Fainelli
  2012-10-04 15:17 ` [PATCH 14/24] USB: ohci: merge ohci_finish_controller_resume with ohci_resume Florian Fainelli
  2012-10-04 15:17 ` [PATCH 17/24 v2] ARM: cns3xxx: use OHCI platform driver Florian Fainelli
  2 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2012-10-04 15:17 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
No change since v1

 arch/arm/mach-cns3xxx/cns3420vb.c |   44 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c
index 2c5fb4c..906094c 100644
--- a/arch/arm/mach-cns3xxx/cns3420vb.c
+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
@@ -24,6 +24,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/partitions.h>
+#include <linux/usb/ehci_pdriver.h>
 #include <asm/setup.h>
 #include <asm/mach-types.h>
 #include <asm/hardware/gic.h>
@@ -32,6 +33,7 @@
 #include <asm/mach/time.h>
 #include <mach/cns3xxx.h>
 #include <mach/irqs.h>
+#include <mach/pm.h>
 #include "core.h"
 #include "devices.h"
 
@@ -125,13 +127,53 @@ static struct resource cns3xxx_usb_ehci_resources[] = {
 
 static u64 cns3xxx_usb_ehci_dma_mask = DMA_BIT_MASK(32);
 
+static int csn3xxx_usb_ehci_power_on(struct platform_device *pdev)
+{
+	/*
+	 * EHCI and OHCI share the same clock and power,
+	 * resetting twice would cause the 1st controller been reset.
+	 * Therefore only do power up  at the first up device, and
+	 * power down at the last down device.
+	 *
+	 * Set USB AHB INCR length to 16
+	 */
+	if (atomic_inc_return(&usb_pwr_ref) == 1) {
+		cns3xxx_pwr_power_up(1 << PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_USB);
+		cns3xxx_pwr_clk_en(1 << PM_CLK_GATE_REG_OFFSET_USB_HOST);
+		cns3xxx_pwr_soft_rst(1 << PM_SOFT_RST_REG_OFFST_USB_HOST);
+		__raw_writel((__raw_readl(MISC_CHIP_CONFIG_REG) | (0X2 << 24)),
+			MISC_CHIP_CONFIG_REG);
+	}
+
+	return 0;
+}
+
+static void csn3xxx_usb_ehci_power_off(struct platform_device *pdev)
+{
+	/*
+	 * EHCI and OHCI share the same clock and power,
+	 * resetting twice would cause the 1st controller been reset.
+	 * Therefore only do power up  at the first up device, and
+	 * power down@the last down device.
+	 */
+	if (atomic_dec_return(&usb_pwr_ref) == 0)
+		cns3xxx_pwr_clk_dis(1 << PM_CLK_GATE_REG_OFFSET_USB_HOST);
+}
+
+static struct usb_ehci_pdata cns3xxx_usb_ehci_pdata = {
+	.port_power_off	= 1,
+	.power_on	= csn3xxx_usb_ehci_power_on,
+	.power_off	= csn3xxx_usb_ehci_power_off,
+};
+
 static struct platform_device cns3xxx_usb_ehci_device = {
-	.name          = "cns3xxx-ehci",
+	.name          = "ehci-platform",
 	.num_resources = ARRAY_SIZE(cns3xxx_usb_ehci_resources),
 	.resource      = cns3xxx_usb_ehci_resources,
 	.dev           = {
 		.dma_mask          = &cns3xxx_usb_ehci_dma_mask,
 		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.platform_data     = &cns3xxx_usb_ehci_pdata,
 	},
 };
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 14/24] USB: ohci: merge ohci_finish_controller_resume with ohci_resume
       [not found] <1349363872-27004-1-git-send-email-florian@openwrt.org>
  2012-10-04 15:17 ` [PATCH 09/24 v2] ARM: cns3xxx: use ehci platform driver Florian Fainelli
@ 2012-10-04 15:17 ` Florian Fainelli
  2012-10-05  1:38   ` Jingoo Han
  2012-10-05  7:42   ` Nicolas Ferre
  2012-10-04 15:17 ` [PATCH 17/24 v2] ARM: cns3xxx: use OHCI platform driver Florian Fainelli
  2 siblings, 2 replies; 6+ messages in thread
From: Florian Fainelli @ 2012-10-04 15:17 UTC (permalink / raw)
  To: linux-arm-kernel

Merge ohci_finish_controller_resume with ohci_resume as suggested by Alan
Stern. Since ohci_finish_controller_resume no longer exists, update the
various OHCI drivers to call ohci_resume() instead. Some drivers used to set
themselves the bit HCD_FLAG_HW_ACCESSIBLE, which is now handled by
ohci_resume().

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
 drivers/usb/host/ohci-at91.c     |    2 +-
 drivers/usb/host/ohci-ep93xx.c   |    2 +-
 drivers/usb/host/ohci-exynos.c   |    5 +----
 drivers/usb/host/ohci-hcd.c      |   41 +++++++++++++++++++++++++++++++++++--
 drivers/usb/host/ohci-hub.c      |   42 --------------------------------------
 drivers/usb/host/ohci-omap.c     |    2 +-
 drivers/usb/host/ohci-platform.c |    2 +-
 drivers/usb/host/ohci-pxa27x.c   |    2 +-
 drivers/usb/host/ohci-s3c2410.c  |    3 +--
 drivers/usb/host/ohci-spear.c    |    2 +-
 drivers/usb/host/ohci-tmio.c     |    2 +-
 11 files changed, 48 insertions(+), 57 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 0bf72f9..908d84a 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -705,7 +705,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
 	if (!clocked)
 		at91_start_clock();
 
-	ohci_finish_controller_resume(hcd);
+	ohci_resume(hcd, false);
 	return 0;
 }
 #else
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
index dbfbd1d..a982f04 100644
--- a/drivers/usb/host/ohci-ep93xx.c
+++ b/drivers/usb/host/ohci-ep93xx.c
@@ -194,7 +194,7 @@ static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
 
 	ep93xx_start_hc(&pdev->dev);
 
-	ohci_finish_controller_resume(hcd);
+	ohci_resume(hcd, false);
 	return 0;
 }
 #endif
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index fc3091b..53c5a989 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -252,10 +252,7 @@ static int exynos_ohci_resume(struct device *dev)
 	if (pdata && pdata->phy_init)
 		pdata->phy_init(pdev, S5P_USB_PHY_HOST);
 
-	/* Mark hardware accessible again as we are out of D3 state by now */
-	set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
-
-	ohci_finish_controller_resume(hcd);
+	ohci_resume(hcd, false);
 
 	return 0;
 }
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 5d30992..568bdb3 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1003,13 +1003,50 @@ static int __maybe_unused ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 
 static int __maybe_unused ohci_resume(struct usb_hcd *hcd, bool hibernated)
 {
+	struct ohci_hcd		*ohci = hcd_to_ohci(hcd);
+	int			port;
+	bool			need_reinit = false;
+
 	set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
 
 	/* Make sure resume from hibernation re-enumerates everything */
 	if (hibernated)
-		ohci_usb_reset(hcd_to_ohci(hcd));
+		ohci_usb_reset(ohci);
+
+	/* See if the controller is already running or has been reset */
+	ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
+	if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) {
+		need_reinit = true;
+	} else {
+		switch (ohci->hc_control & OHCI_CTRL_HCFS) {
+		case OHCI_USB_OPER:
+		case OHCI_USB_RESET:
+			need_reinit = true;
+		}
+	}
+
+	/* If needed, reinitialize and suspend the root hub */
+	if (need_reinit) {
+		spin_lock_irq(&ohci->lock);
+		ohci_rh_resume(ohci);
+		ohci_rh_suspend(ohci, 0);
+		spin_unlock_irq(&ohci->lock);
+	}
+
+	/* Normally just turn on port power and enable interrupts */
+	else {
+		ohci_dbg(ohci, "powerup ports\n");
+		for (port = 0; port < ohci->num_ports; port++)
+			ohci_writel(ohci, RH_PS_PPS,
+					&ohci->regs->roothub.portstatus[port]);
+
+		ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable);
+		ohci_readl(ohci, &ohci->regs->intrenable);
+		msleep(20);
+	}
+
+	usb_hcd_resume_root_hub(hcd);
 
-	ohci_finish_controller_resume(hcd);
 	return 0;
 }
 
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index 2f3619e..db09dae 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -316,48 +316,6 @@ static int ohci_bus_resume (struct usb_hcd *hcd)
 	return rc;
 }
 
-/* Carry out the final steps of resuming the controller device */
-static void __maybe_unused ohci_finish_controller_resume(struct usb_hcd *hcd)
-{
-	struct ohci_hcd		*ohci = hcd_to_ohci(hcd);
-	int			port;
-	bool			need_reinit = false;
-
-	/* See if the controller is already running or has been reset */
-	ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
-	if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) {
-		need_reinit = true;
-	} else {
-		switch (ohci->hc_control & OHCI_CTRL_HCFS) {
-		case OHCI_USB_OPER:
-		case OHCI_USB_RESET:
-			need_reinit = true;
-		}
-	}
-
-	/* If needed, reinitialize and suspend the root hub */
-	if (need_reinit) {
-		spin_lock_irq(&ohci->lock);
-		ohci_rh_resume(ohci);
-		ohci_rh_suspend(ohci, 0);
-		spin_unlock_irq(&ohci->lock);
-	}
-
-	/* Normally just turn on port power and enable interrupts */
-	else {
-		ohci_dbg(ohci, "powerup ports\n");
-		for (port = 0; port < ohci->num_ports; port++)
-			ohci_writel(ohci, RH_PS_PPS,
-					&ohci->regs->roothub.portstatus[port]);
-
-		ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable);
-		ohci_readl(ohci, &ohci->regs->intrenable);
-		msleep(20);
-	}
-
-	usb_hcd_resume_root_hub(hcd);
-}
-
 /* Carry out polling-, autostop-, and autoresume-related state changes */
 static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
 		int any_connected, int rhsc_status)
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index f8b2d91..9fab4d8 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -530,7 +530,7 @@ static int ohci_omap_resume(struct platform_device *dev)
 	ohci->next_statechange = jiffies;
 
 	omap_ohci_clock_power(1);
-	ohci_finish_controller_resume(hcd);
+	ohci_resume(hcd, false);
 	return 0;
 }
 
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index 1caaf65..99d1755 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -203,7 +203,7 @@ static int ohci_platform_resume(struct device *dev)
 			return err;
 	}
 
-	ohci_finish_controller_resume(hcd);
+	ohci_resume(hcd, false);
 	return 0;
 }
 
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 77f4402..8bffde3 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -591,7 +591,7 @@ static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
 	/* Select Power Management Mode */
 	pxa27x_ohci_select_pmm(ohci, inf->port_mode);
 
-	ohci_finish_controller_resume(hcd);
+	ohci_resume(hcd, false);
 	return 0;
 }
 
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 664c869..8af53c6 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -524,8 +524,7 @@ static int ohci_hcd_s3c2410_drv_resume(struct device *dev)
 
 	s3c2410_start_hc(pdev, hcd);
 
-	set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
-	ohci_finish_controller_resume(hcd);
+	ohci_resume(hcd, false);
 
 	return 0;
 }
diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
index fc7305e..d607be3 100644
--- a/drivers/usb/host/ohci-spear.c
+++ b/drivers/usb/host/ohci-spear.c
@@ -231,7 +231,7 @@ static int spear_ohci_hcd_drv_resume(struct platform_device *dev)
 	ohci->next_statechange = jiffies;
 
 	spear_start_ohci(ohci_p);
-	ohci_finish_controller_resume(hcd);
+	ohci_resume(hcd, false);
 	return 0;
 }
 #endif
diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
index 60c2b07..2c9ab8f 100644
--- a/drivers/usb/host/ohci-tmio.c
+++ b/drivers/usb/host/ohci-tmio.c
@@ -352,7 +352,7 @@ static int ohci_hcd_tmio_drv_resume(struct platform_device *dev)
 
 	spin_unlock_irqrestore(&tmio->lock, flags);
 
-	ohci_finish_controller_resume(hcd);
+	ohci_resume(hcd, false);
 
 	return 0;
 }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 17/24 v2] ARM: cns3xxx: use OHCI platform driver
       [not found] <1349363872-27004-1-git-send-email-florian@openwrt.org>
  2012-10-04 15:17 ` [PATCH 09/24 v2] ARM: cns3xxx: use ehci platform driver Florian Fainelli
  2012-10-04 15:17 ` [PATCH 14/24] USB: ohci: merge ohci_finish_controller_resume with ohci_resume Florian Fainelli
@ 2012-10-04 15:17 ` Florian Fainelli
  2012-10-04 19:19   ` Alan Stern
  2 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2012-10-04 15:17 UTC (permalink / raw)
  To: linux-arm-kernel

Since both the EHCI and OHCI platform drivers use the same power_{on,off}
callbacks, rename them to cns3xx_usb_power_{on,off} to show that they are
shared.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
No changes since v1

 arch/arm/mach-cns3xxx/cns3420vb.c |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c
index 906094c..8a00cee8 100644
--- a/arch/arm/mach-cns3xxx/cns3420vb.c
+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
@@ -25,6 +25,7 @@
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/partitions.h>
 #include <linux/usb/ehci_pdriver.h>
+#include <linux/usb/ohci_pdriver.h>
 #include <asm/setup.h>
 #include <asm/mach-types.h>
 #include <asm/hardware/gic.h>
@@ -127,7 +128,7 @@ static struct resource cns3xxx_usb_ehci_resources[] = {
 
 static u64 cns3xxx_usb_ehci_dma_mask = DMA_BIT_MASK(32);
 
-static int csn3xxx_usb_ehci_power_on(struct platform_device *pdev)
+static int csn3xxx_usb_power_on(struct platform_device *pdev)
 {
 	/*
 	 * EHCI and OHCI share the same clock and power,
@@ -148,7 +149,7 @@ static int csn3xxx_usb_ehci_power_on(struct platform_device *pdev)
 	return 0;
 }
 
-static void csn3xxx_usb_ehci_power_off(struct platform_device *pdev)
+static void csn3xxx_usb_power_off(struct platform_device *pdev)
 {
 	/*
 	 * EHCI and OHCI share the same clock and power,
@@ -162,8 +163,8 @@ static void csn3xxx_usb_ehci_power_off(struct platform_device *pdev)
 
 static struct usb_ehci_pdata cns3xxx_usb_ehci_pdata = {
 	.port_power_off	= 1,
-	.power_on	= csn3xxx_usb_ehci_power_on,
-	.power_off	= csn3xxx_usb_ehci_power_off,
+	.power_on	= csn3xxx_usb_power_on,
+	.power_off	= csn3xxx_usb_power_off,
 };
 
 static struct platform_device cns3xxx_usb_ehci_device = {
@@ -191,13 +192,20 @@ static struct resource cns3xxx_usb_ohci_resources[] = {
 
 static u64 cns3xxx_usb_ohci_dma_mask = DMA_BIT_MASK(32);
 
+static struct usb_ohci_pdata cns3xxx_usb_ohci_pdata = {
+	.num_ports	= 1,
+	.power_on	= csn3xxx_usb_power_on,
+	.power_off	= csn3xxx_usb_power_off,
+};
+
 static struct platform_device cns3xxx_usb_ohci_device = {
-	.name          = "cns3xxx-ohci",
+	.name          = "ohci-platform",
 	.num_resources = ARRAY_SIZE(cns3xxx_usb_ohci_resources),
 	.resource      = cns3xxx_usb_ohci_resources,
 	.dev           = {
 		.dma_mask          = &cns3xxx_usb_ohci_dma_mask,
 		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.platform_data	   = &cns3xxx_usb_ohci_pdata,
 	},
 };
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 17/24 v2] ARM: cns3xxx: use OHCI platform driver
  2012-10-04 15:17 ` [PATCH 17/24 v2] ARM: cns3xxx: use OHCI platform driver Florian Fainelli
@ 2012-10-04 19:19   ` Alan Stern
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Stern @ 2012-10-04 19:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 4 Oct 2012, Florian Fainelli wrote:

> Since both the EHCI and OHCI platform drivers use the same power_{on,off}
> callbacks, rename them to cns3xx_usb_power_{on,off} to show that they are
> shared.

This is an example of the sort of thing I complained about before.  
People who read only the patch description and not the title will
wonder why this patch adds cns3xxx_usb_ohci_pdata and
cns3xxx_usb_ohci_device.

And people who read both will wonder why they talk about different 
things.

Alan Stern

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 14/24] USB: ohci: merge ohci_finish_controller_resume with ohci_resume
  2012-10-04 15:17 ` [PATCH 14/24] USB: ohci: merge ohci_finish_controller_resume with ohci_resume Florian Fainelli
@ 2012-10-05  1:38   ` Jingoo Han
  2012-10-05  7:42   ` Nicolas Ferre
  1 sibling, 0 replies; 6+ messages in thread
From: Jingoo Han @ 2012-10-05  1:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday, October 05, 2012 12:18 AM Florian Fainelli wrote
> 
> Merge ohci_finish_controller_resume with ohci_resume as suggested by Alan
> Stern. Since ohci_finish_controller_resume no longer exists, update the
> various OHCI drivers to call ohci_resume() instead. Some drivers used to set
> themselves the bit HCD_FLAG_HW_ACCESSIBLE, which is now handled by
> ohci_resume().
> 
> Signed-off-by: Florian Fainelli <florian@openwrt.org>

For drivers/usb/host/ohci-exynos.c, it looks good.

Acked-by: Jingoo Han <jg1.han@samsung.com>


Best regards,
Jingoo Han


> ---
>  drivers/usb/host/ohci-at91.c     |    2 +-
>  drivers/usb/host/ohci-ep93xx.c   |    2 +-
>  drivers/usb/host/ohci-exynos.c   |    5 +----
>  drivers/usb/host/ohci-hcd.c      |   41 +++++++++++++++++++++++++++++++++++--
>  drivers/usb/host/ohci-hub.c      |   42 --------------------------------------
>  drivers/usb/host/ohci-omap.c     |    2 +-
>  drivers/usb/host/ohci-platform.c |    2 +-
>  drivers/usb/host/ohci-pxa27x.c   |    2 +-
>  drivers/usb/host/ohci-s3c2410.c  |    3 +--
>  drivers/usb/host/ohci-spear.c    |    2 +-
>  drivers/usb/host/ohci-tmio.c     |    2 +-
>  11 files changed, 48 insertions(+), 57 deletions(-)
> 
> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
> index 0bf72f9..908d84a 100644
> --- a/drivers/usb/host/ohci-at91.c
> +++ b/drivers/usb/host/ohci-at91.c
> @@ -705,7 +705,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
>  	if (!clocked)
>  		at91_start_clock();
> 
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
>  	return 0;
>  }
>  #else
> diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
> index dbfbd1d..a982f04 100644
> --- a/drivers/usb/host/ohci-ep93xx.c
> +++ b/drivers/usb/host/ohci-ep93xx.c
> @@ -194,7 +194,7 @@ static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
> 
>  	ep93xx_start_hc(&pdev->dev);
> 
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
>  	return 0;
>  }
>  #endif
> diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
> index fc3091b..53c5a989 100644
> --- a/drivers/usb/host/ohci-exynos.c
> +++ b/drivers/usb/host/ohci-exynos.c
> @@ -252,10 +252,7 @@ static int exynos_ohci_resume(struct device *dev)
>  	if (pdata && pdata->phy_init)
>  		pdata->phy_init(pdev, S5P_USB_PHY_HOST);
> 
> -	/* Mark hardware accessible again as we are out of D3 state by now */
> -	set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
> -
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
> 
>  	return 0;
>  }
> diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
> index 5d30992..568bdb3 100644
> --- a/drivers/usb/host/ohci-hcd.c
> +++ b/drivers/usb/host/ohci-hcd.c
> @@ -1003,13 +1003,50 @@ static int __maybe_unused ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
> 
>  static int __maybe_unused ohci_resume(struct usb_hcd *hcd, bool hibernated)
>  {
> +	struct ohci_hcd		*ohci = hcd_to_ohci(hcd);
> +	int			port;
> +	bool			need_reinit = false;
> +
>  	set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
> 
>  	/* Make sure resume from hibernation re-enumerates everything */
>  	if (hibernated)
> -		ohci_usb_reset(hcd_to_ohci(hcd));
> +		ohci_usb_reset(ohci);
> +
> +	/* See if the controller is already running or has been reset */
> +	ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
> +	if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) {
> +		need_reinit = true;
> +	} else {
> +		switch (ohci->hc_control & OHCI_CTRL_HCFS) {
> +		case OHCI_USB_OPER:
> +		case OHCI_USB_RESET:
> +			need_reinit = true;
> +		}
> +	}
> +
> +	/* If needed, reinitialize and suspend the root hub */
> +	if (need_reinit) {
> +		spin_lock_irq(&ohci->lock);
> +		ohci_rh_resume(ohci);
> +		ohci_rh_suspend(ohci, 0);
> +		spin_unlock_irq(&ohci->lock);
> +	}
> +
> +	/* Normally just turn on port power and enable interrupts */
> +	else {
> +		ohci_dbg(ohci, "powerup ports\n");
> +		for (port = 0; port < ohci->num_ports; port++)
> +			ohci_writel(ohci, RH_PS_PPS,
> +					&ohci->regs->roothub.portstatus[port]);
> +
> +		ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable);
> +		ohci_readl(ohci, &ohci->regs->intrenable);
> +		msleep(20);
> +	}
> +
> +	usb_hcd_resume_root_hub(hcd);
> 
> -	ohci_finish_controller_resume(hcd);
>  	return 0;
>  }
> 
> diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
> index 2f3619e..db09dae 100644
> --- a/drivers/usb/host/ohci-hub.c
> +++ b/drivers/usb/host/ohci-hub.c
> @@ -316,48 +316,6 @@ static int ohci_bus_resume (struct usb_hcd *hcd)
>  	return rc;
>  }
> 
> -/* Carry out the final steps of resuming the controller device */
> -static void __maybe_unused ohci_finish_controller_resume(struct usb_hcd *hcd)
> -{
> -	struct ohci_hcd		*ohci = hcd_to_ohci(hcd);
> -	int			port;
> -	bool			need_reinit = false;
> -
> -	/* See if the controller is already running or has been reset */
> -	ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
> -	if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) {
> -		need_reinit = true;
> -	} else {
> -		switch (ohci->hc_control & OHCI_CTRL_HCFS) {
> -		case OHCI_USB_OPER:
> -		case OHCI_USB_RESET:
> -			need_reinit = true;
> -		}
> -	}
> -
> -	/* If needed, reinitialize and suspend the root hub */
> -	if (need_reinit) {
> -		spin_lock_irq(&ohci->lock);
> -		ohci_rh_resume(ohci);
> -		ohci_rh_suspend(ohci, 0);
> -		spin_unlock_irq(&ohci->lock);
> -	}
> -
> -	/* Normally just turn on port power and enable interrupts */
> -	else {
> -		ohci_dbg(ohci, "powerup ports\n");
> -		for (port = 0; port < ohci->num_ports; port++)
> -			ohci_writel(ohci, RH_PS_PPS,
> -					&ohci->regs->roothub.portstatus[port]);
> -
> -		ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable);
> -		ohci_readl(ohci, &ohci->regs->intrenable);
> -		msleep(20);
> -	}
> -
> -	usb_hcd_resume_root_hub(hcd);
> -}
> -
>  /* Carry out polling-, autostop-, and autoresume-related state changes */
>  static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
>  		int any_connected, int rhsc_status)
> diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
> index f8b2d91..9fab4d8 100644
> --- a/drivers/usb/host/ohci-omap.c
> +++ b/drivers/usb/host/ohci-omap.c
> @@ -530,7 +530,7 @@ static int ohci_omap_resume(struct platform_device *dev)
>  	ohci->next_statechange = jiffies;
> 
>  	omap_ohci_clock_power(1);
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
>  	return 0;
>  }
> 
> diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
> index 1caaf65..99d1755 100644
> --- a/drivers/usb/host/ohci-platform.c
> +++ b/drivers/usb/host/ohci-platform.c
> @@ -203,7 +203,7 @@ static int ohci_platform_resume(struct device *dev)
>  			return err;
>  	}
> 
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
>  	return 0;
>  }
> 
> diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
> index 77f4402..8bffde3 100644
> --- a/drivers/usb/host/ohci-pxa27x.c
> +++ b/drivers/usb/host/ohci-pxa27x.c
> @@ -591,7 +591,7 @@ static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
>  	/* Select Power Management Mode */
>  	pxa27x_ohci_select_pmm(ohci, inf->port_mode);
> 
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
>  	return 0;
>  }
> 
> diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
> index 664c869..8af53c6 100644
> --- a/drivers/usb/host/ohci-s3c2410.c
> +++ b/drivers/usb/host/ohci-s3c2410.c
> @@ -524,8 +524,7 @@ static int ohci_hcd_s3c2410_drv_resume(struct device *dev)
> 
>  	s3c2410_start_hc(pdev, hcd);
> 
> -	set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
> 
>  	return 0;
>  }
> diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
> index fc7305e..d607be3 100644
> --- a/drivers/usb/host/ohci-spear.c
> +++ b/drivers/usb/host/ohci-spear.c
> @@ -231,7 +231,7 @@ static int spear_ohci_hcd_drv_resume(struct platform_device *dev)
>  	ohci->next_statechange = jiffies;
> 
>  	spear_start_ohci(ohci_p);
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
>  	return 0;
>  }
>  #endif
> diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
> index 60c2b07..2c9ab8f 100644
> --- a/drivers/usb/host/ohci-tmio.c
> +++ b/drivers/usb/host/ohci-tmio.c
> @@ -352,7 +352,7 @@ static int ohci_hcd_tmio_drv_resume(struct platform_device *dev)
> 
>  	spin_unlock_irqrestore(&tmio->lock, flags);
> 
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
> 
>  	return 0;
>  }
> --
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 14/24] USB: ohci: merge ohci_finish_controller_resume with ohci_resume
  2012-10-04 15:17 ` [PATCH 14/24] USB: ohci: merge ohci_finish_controller_resume with ohci_resume Florian Fainelli
  2012-10-05  1:38   ` Jingoo Han
@ 2012-10-05  7:42   ` Nicolas Ferre
  1 sibling, 0 replies; 6+ messages in thread
From: Nicolas Ferre @ 2012-10-05  7:42 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/04/2012 05:17 PM, Florian Fainelli :
> Merge ohci_finish_controller_resume with ohci_resume as suggested by Alan
> Stern. Since ohci_finish_controller_resume no longer exists, update the
> various OHCI drivers to call ohci_resume() instead. Some drivers used to set
> themselves the bit HCD_FLAG_HW_ACCESSIBLE, which is now handled by
> ohci_resume().
> 
> Signed-off-by: Florian Fainelli <florian@openwrt.org>
> ---
>  drivers/usb/host/ohci-at91.c     |    2 +-

Seems ok for AT91, so

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Thanks Florian, bye,

>  drivers/usb/host/ohci-ep93xx.c   |    2 +-
>  drivers/usb/host/ohci-exynos.c   |    5 +----
>  drivers/usb/host/ohci-hcd.c      |   41 +++++++++++++++++++++++++++++++++++--
>  drivers/usb/host/ohci-hub.c      |   42 --------------------------------------
>  drivers/usb/host/ohci-omap.c     |    2 +-
>  drivers/usb/host/ohci-platform.c |    2 +-
>  drivers/usb/host/ohci-pxa27x.c   |    2 +-
>  drivers/usb/host/ohci-s3c2410.c  |    3 +--
>  drivers/usb/host/ohci-spear.c    |    2 +-
>  drivers/usb/host/ohci-tmio.c     |    2 +-
>  11 files changed, 48 insertions(+), 57 deletions(-)
> 
> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
> index 0bf72f9..908d84a 100644
> --- a/drivers/usb/host/ohci-at91.c
> +++ b/drivers/usb/host/ohci-at91.c
> @@ -705,7 +705,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
>  	if (!clocked)
>  		at91_start_clock();
>  
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
>  	return 0;
>  }
>  #else
> diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
> index dbfbd1d..a982f04 100644
> --- a/drivers/usb/host/ohci-ep93xx.c
> +++ b/drivers/usb/host/ohci-ep93xx.c
> @@ -194,7 +194,7 @@ static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
>  
>  	ep93xx_start_hc(&pdev->dev);
>  
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
>  	return 0;
>  }
>  #endif
> diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
> index fc3091b..53c5a989 100644
> --- a/drivers/usb/host/ohci-exynos.c
> +++ b/drivers/usb/host/ohci-exynos.c
> @@ -252,10 +252,7 @@ static int exynos_ohci_resume(struct device *dev)
>  	if (pdata && pdata->phy_init)
>  		pdata->phy_init(pdev, S5P_USB_PHY_HOST);
>  
> -	/* Mark hardware accessible again as we are out of D3 state by now */
> -	set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
> -
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
>  
>  	return 0;
>  }
> diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
> index 5d30992..568bdb3 100644
> --- a/drivers/usb/host/ohci-hcd.c
> +++ b/drivers/usb/host/ohci-hcd.c
> @@ -1003,13 +1003,50 @@ static int __maybe_unused ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
>  
>  static int __maybe_unused ohci_resume(struct usb_hcd *hcd, bool hibernated)
>  {
> +	struct ohci_hcd		*ohci = hcd_to_ohci(hcd);
> +	int			port;
> +	bool			need_reinit = false;
> +
>  	set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
>  
>  	/* Make sure resume from hibernation re-enumerates everything */
>  	if (hibernated)
> -		ohci_usb_reset(hcd_to_ohci(hcd));
> +		ohci_usb_reset(ohci);
> +
> +	/* See if the controller is already running or has been reset */
> +	ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
> +	if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) {
> +		need_reinit = true;
> +	} else {
> +		switch (ohci->hc_control & OHCI_CTRL_HCFS) {
> +		case OHCI_USB_OPER:
> +		case OHCI_USB_RESET:
> +			need_reinit = true;
> +		}
> +	}
> +
> +	/* If needed, reinitialize and suspend the root hub */
> +	if (need_reinit) {
> +		spin_lock_irq(&ohci->lock);
> +		ohci_rh_resume(ohci);
> +		ohci_rh_suspend(ohci, 0);
> +		spin_unlock_irq(&ohci->lock);
> +	}
> +
> +	/* Normally just turn on port power and enable interrupts */
> +	else {
> +		ohci_dbg(ohci, "powerup ports\n");
> +		for (port = 0; port < ohci->num_ports; port++)
> +			ohci_writel(ohci, RH_PS_PPS,
> +					&ohci->regs->roothub.portstatus[port]);
> +
> +		ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable);
> +		ohci_readl(ohci, &ohci->regs->intrenable);
> +		msleep(20);
> +	}
> +
> +	usb_hcd_resume_root_hub(hcd);
>  
> -	ohci_finish_controller_resume(hcd);
>  	return 0;
>  }
>  
> diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
> index 2f3619e..db09dae 100644
> --- a/drivers/usb/host/ohci-hub.c
> +++ b/drivers/usb/host/ohci-hub.c
> @@ -316,48 +316,6 @@ static int ohci_bus_resume (struct usb_hcd *hcd)
>  	return rc;
>  }
>  
> -/* Carry out the final steps of resuming the controller device */
> -static void __maybe_unused ohci_finish_controller_resume(struct usb_hcd *hcd)
> -{
> -	struct ohci_hcd		*ohci = hcd_to_ohci(hcd);
> -	int			port;
> -	bool			need_reinit = false;
> -
> -	/* See if the controller is already running or has been reset */
> -	ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
> -	if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) {
> -		need_reinit = true;
> -	} else {
> -		switch (ohci->hc_control & OHCI_CTRL_HCFS) {
> -		case OHCI_USB_OPER:
> -		case OHCI_USB_RESET:
> -			need_reinit = true;
> -		}
> -	}
> -
> -	/* If needed, reinitialize and suspend the root hub */
> -	if (need_reinit) {
> -		spin_lock_irq(&ohci->lock);
> -		ohci_rh_resume(ohci);
> -		ohci_rh_suspend(ohci, 0);
> -		spin_unlock_irq(&ohci->lock);
> -	}
> -
> -	/* Normally just turn on port power and enable interrupts */
> -	else {
> -		ohci_dbg(ohci, "powerup ports\n");
> -		for (port = 0; port < ohci->num_ports; port++)
> -			ohci_writel(ohci, RH_PS_PPS,
> -					&ohci->regs->roothub.portstatus[port]);
> -
> -		ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable);
> -		ohci_readl(ohci, &ohci->regs->intrenable);
> -		msleep(20);
> -	}
> -
> -	usb_hcd_resume_root_hub(hcd);
> -}
> -
>  /* Carry out polling-, autostop-, and autoresume-related state changes */
>  static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
>  		int any_connected, int rhsc_status)
> diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
> index f8b2d91..9fab4d8 100644
> --- a/drivers/usb/host/ohci-omap.c
> +++ b/drivers/usb/host/ohci-omap.c
> @@ -530,7 +530,7 @@ static int ohci_omap_resume(struct platform_device *dev)
>  	ohci->next_statechange = jiffies;
>  
>  	omap_ohci_clock_power(1);
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
>  	return 0;
>  }
>  
> diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
> index 1caaf65..99d1755 100644
> --- a/drivers/usb/host/ohci-platform.c
> +++ b/drivers/usb/host/ohci-platform.c
> @@ -203,7 +203,7 @@ static int ohci_platform_resume(struct device *dev)
>  			return err;
>  	}
>  
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
>  	return 0;
>  }
>  
> diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
> index 77f4402..8bffde3 100644
> --- a/drivers/usb/host/ohci-pxa27x.c
> +++ b/drivers/usb/host/ohci-pxa27x.c
> @@ -591,7 +591,7 @@ static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
>  	/* Select Power Management Mode */
>  	pxa27x_ohci_select_pmm(ohci, inf->port_mode);
>  
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
>  	return 0;
>  }
>  
> diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
> index 664c869..8af53c6 100644
> --- a/drivers/usb/host/ohci-s3c2410.c
> +++ b/drivers/usb/host/ohci-s3c2410.c
> @@ -524,8 +524,7 @@ static int ohci_hcd_s3c2410_drv_resume(struct device *dev)
>  
>  	s3c2410_start_hc(pdev, hcd);
>  
> -	set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
>  
>  	return 0;
>  }
> diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
> index fc7305e..d607be3 100644
> --- a/drivers/usb/host/ohci-spear.c
> +++ b/drivers/usb/host/ohci-spear.c
> @@ -231,7 +231,7 @@ static int spear_ohci_hcd_drv_resume(struct platform_device *dev)
>  	ohci->next_statechange = jiffies;
>  
>  	spear_start_ohci(ohci_p);
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
>  	return 0;
>  }
>  #endif
> diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
> index 60c2b07..2c9ab8f 100644
> --- a/drivers/usb/host/ohci-tmio.c
> +++ b/drivers/usb/host/ohci-tmio.c
> @@ -352,7 +352,7 @@ static int ohci_hcd_tmio_drv_resume(struct platform_device *dev)
>  
>  	spin_unlock_irqrestore(&tmio->lock, flags);
>  
> -	ohci_finish_controller_resume(hcd);
> +	ohci_resume(hcd, false);
>  
>  	return 0;
>  }
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-10-05  7:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1349363872-27004-1-git-send-email-florian@openwrt.org>
2012-10-04 15:17 ` [PATCH 09/24 v2] ARM: cns3xxx: use ehci platform driver Florian Fainelli
2012-10-04 15:17 ` [PATCH 14/24] USB: ohci: merge ohci_finish_controller_resume with ohci_resume Florian Fainelli
2012-10-05  1:38   ` Jingoo Han
2012-10-05  7:42   ` Nicolas Ferre
2012-10-04 15:17 ` [PATCH 17/24 v2] ARM: cns3xxx: use OHCI platform driver Florian Fainelli
2012-10-04 19:19   ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).