RE: [PATCH] usb: ohci-exynos: use clk_prepare_enable and clk_disable_unprepare

2012-10-04 Thread Jingoo Han
On Wednesday, October 03, 2012 8:42 AM Thomas Abraham wrote
 
 Convert clk_enable/clk_disable to clk_prepare_enable/clk_disable_unprepare
 calls as required by common clock framework.
 
 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org


Acked-by: Jingoo Han jg1@samsung.com


Best regards,
Jingoo Han


 ---
  drivers/usb/host/ohci-exynos.c |   10 +-
  1 files changed, 5 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
 index 20a5008..7bca600 100644
 --- a/drivers/usb/host/ohci-exynos.c
 +++ b/drivers/usb/host/ohci-exynos.c
 @@ -123,7 +123,7 @@ static int __devinit exynos_ohci_probe(struct 
 platform_device *pdev)
   goto fail_clk;
   }
 
 - err = clk_enable(exynos_ohci-clk);
 + err = clk_prepare_enable(exynos_ohci-clk);
   if (err)
   goto fail_clken;
 
 @@ -167,7 +167,7 @@ static int __devinit exynos_ohci_probe(struct 
 platform_device *pdev)
   return 0;
 
  fail_io:
 - clk_disable(exynos_ohci-clk);
 + clk_disable_unprepare(exynos_ohci-clk);
  fail_clken:
   clk_put(exynos_ohci-clk);
  fail_clk:
 @@ -186,7 +186,7 @@ static int __devexit exynos_ohci_remove(struct 
 platform_device *pdev)
   if (pdata  pdata-phy_exit)
   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
 
 - clk_disable(exynos_ohci-clk);
 + clk_disable_unprepare(exynos_ohci-clk);
   clk_put(exynos_ohci-clk);
 
   usb_put_hcd(hcd);
 @@ -232,7 +232,7 @@ static int exynos_ohci_suspend(struct device *dev)
   if (pdata  pdata-phy_exit)
   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
 
 - clk_disable(exynos_ohci-clk);
 + clk_disable_unprepare(exynos_ohci-clk);
 
  fail:
   spin_unlock_irqrestore(ohci-lock, flags);
 @@ -247,7 +247,7 @@ static int exynos_ohci_resume(struct device *dev)
   struct platform_device *pdev = to_platform_device(dev);
   struct exynos4_ohci_platdata *pdata = pdev-dev.platform_data;
 
 - clk_enable(exynos_ohci-clk);
 + clk_prepare_enable(exynos_ohci-clk);
 
   if (pdata  pdata-phy_init)
   pdata-phy_init(pdev, S5P_USB_PHY_HOST);
 --
 1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/25] MIPS: Netlogic: use ehci-platform driver

2012-10-04 Thread Jonas Gorski
On 3 October 2012 17:02, Florian Fainelli flor...@openwrt.org wrote:
 Signed-off-by: Florian Fainelli flor...@openwrt.org
 ---
  arch/mips/netlogic/xlr/platform.c |6 ++
  1 file changed, 6 insertions(+)

 diff --git a/arch/mips/netlogic/xlr/platform.c 
 b/arch/mips/netlogic/xlr/platform.c
 index 71b44d8..1731dfd 100644
 --- a/arch/mips/netlogic/xlr/platform.c
 +++ b/arch/mips/netlogic/xlr/platform.c
 @@ -15,6 +15,7 @@
  #include linux/serial_8250.h
  #include linux/serial_reg.h
  #include linux/i2c.h
 +#include linux/usb/ehci_pdriver.h

  #include asm/netlogic/haldefs.h
  #include asm/netlogic/xlr/iomap.h
 @@ -123,6 +124,10 @@ static u64 xls_usb_dmamask = ~(u32)0;
 },  \
 }

 +static struct usb_ehci_pdata xls_usb_ehci_pdata = {
 +   .caps_offset= 0,
 +};
 +
  static struct platform_device xls_usb_ehci_device =
  USB_PLATFORM_DEV(ehci-xls, 0, PIC_USB_IRQ);

Don't you also need to change this to ehci-platform?

  static struct platform_device xls_usb_ohci_device_0 =
 @@ -172,6 +177,7 @@ int xls_platform_usb_init(void)
 memres = CPHYSADDR((unsigned long)usb_mmio);
 xls_usb_ehci_device.resource[0].start = memres;
 xls_usb_ehci_device.resource[0].end = memres + 0x400 - 1;
 +   xls_usb_ehci_device.dev.platform_data = xls_usb_ehci_pdata;

 memres += 0x400;
 xls_usb_ohci_device_0.resource[0].start = memres;
 --
 1.7.9.5

Jonas
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 20/25] MIPS: Netlogic: convert to use OHCI platform driver

2012-10-04 Thread Jonas Gorski
On 3 October 2012 17:03, Florian Fainelli flor...@openwrt.org wrote:
 Signed-off-by: Florian Fainelli flor...@openwrt.org
 ---
  arch/mips/netlogic/xlr/platform.c |5 +
  1 file changed, 5 insertions(+)

 diff --git a/arch/mips/netlogic/xlr/platform.c 
 b/arch/mips/netlogic/xlr/platform.c
 index 320b7ef..755ddcc 100644
 --- a/arch/mips/netlogic/xlr/platform.c
 +++ b/arch/mips/netlogic/xlr/platform.c
 @@ -16,6 +16,7 @@
  #include linux/serial_reg.h
  #include linux/i2c.h
  #include linux/usb/ehci_pdriver.h
 +#include linux/usb/ohci_pdriver.h

  #include asm/netlogic/haldefs.h
  #include asm/netlogic/xlr/iomap.h
 @@ -129,6 +130,8 @@ static struct usb_ehci_pdata xls_usb_ehci_pdata = {
 .need_io_watchdog = 1,
  };

 +static struct usb_ohci_pdata xls_usb_ohci_pdata;
 +
  static struct platform_device xls_usb_ehci_device =
  USB_PLATFORM_DEV(ehci-xls, 0, PIC_USB_IRQ);
  static struct platform_device xls_usb_ohci_device_0 =

And change after the device names of the ohci devices to ohci-platform?

 @@ -183,10 +186,12 @@ int xls_platform_usb_init(void)
 memres += 0x400;
 xls_usb_ohci_device_0.resource[0].start = memres;
 xls_usb_ohci_device_0.resource[0].end = memres + 0x400 - 1;
 +   xls_usb_ohci_device_0.dev.platform_data = xls_usb_ohci_pdata;

 memres += 0x400;
 xls_usb_ohci_device_1.resource[0].start = memres;
 xls_usb_ohci_device_1.resource[0].end = memres + 0x400 - 1;
 +   xls_usb_ohci_device_1.dev.platform_data = xls_usb_ohci_pdata;

 return platform_add_devices(xls_platform_devices,
 ARRAY_SIZE(xls_platform_devices));
 --
 1.7.9.5

Jonas
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: musb: am35xx: drop spurious unplugging a device

2012-10-04 Thread Stefano Babic
On AM3517, tx and rx interrupt are detected together with
the disconnect event. This generates a kernel panic in musb_interrupt,
because rx / tx are handled after disconnect.
This issue was seen with Technexion's TAM3517 SOM. Unplugging a device,
tx / rx interrupts togetehr with disconnect are detected. This brings
to kernel panic like this:

[   68.526153] Unable to handle kernel NULL pointer dereference at virtual 
address 0011
[   68.534698] pgd = c0004000
[   68.537536] [0011] *pgd=
[   68.541351] Internal error: Oops: 17 [#1] ARM
[   68.545928] Modules linked in:
[   68.549163] CPU: 0Not tainted  (3.6.0-rc5-00020-g9e05905 #178)
[   68.555694] PC is at rxstate+0x8/0xdc
[   68.559539] LR is at musb_interrupt+0x98/0x858
[   68.564239] pc : [c035cd88]lr : [c035af1c]psr: 4193
[   68.564239] sp : ce83fb40  ip : d0906410  fp : 
[   68.576293] r10:   r9 : cf3b0e40  r8 : 0002
[   68.581817] r7 : 0019  r6 : 0001  r5 : 0001  r4 : 00d4
[   68.588684] r3 :   r2 :   r1 : ffcc  r0 : cf23c108
[   68.595550] Flags: nZcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment ke

Note: this behavior is not seen with a USB hub, while it is
easy to reproduce connectict a USB-poen directly to the USB-A of
the board.

Drop tx / rx interrupts if disconnect is detected.

Signed-off-by: Stefano Babic sba...@denx.de
CC: Felipe Balbi ba...@ti.com
---

 drivers/usb/musb/am35x.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index b9b165b..b5c813a 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -312,6 +312,12 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
ret = IRQ_HANDLED;
}
 
+   /* Drop spurious RX and TX if device is disconnected */
+   if (musb-int_usb  MUSB_INTR_DISCONNECT) {
+   musb-int_tx = 0;
+   musb-int_rx = 0;
+   }
+
if (musb-int_tx || musb-int_rx || musb-int_usb)
ret |= musb_interrupt(musb);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: some question about xhci spec

2012-10-04 Thread Alan Stern
On Thu, 4 Oct 2012, loody wrote:

 hi all:
 in xhci spec rev1.0 05/21/10 section 6.2.3.4, there is a line said
 For  SuperSpeed  endpoints  this  field  shall  be  set  to  the
 value  defined  in  the  bMaxBurst  field  of  the
 SuperSpeed Endpoint Companion Descriptor. Refer to section 8.6.8 of
 the USB3 Specification.
 
 but I cannot find section 8.6.8 in usb3 spec I download from usb.org.
 
 Does anyone can tell me where I can find this section?

Section 9.6.7.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/25] MIPS: Netlogic: use ehci-platform driver

2012-10-04 Thread Florian Fainelli
On Wednesday 03 October 2012 12:47:58 Alan Stern wrote:
 On Wed, 3 Oct 2012, Florian Fainelli wrote:
 
  Signed-off-by: Florian Fainelli flor...@openwrt.org
 
 IMO, patches should always have a non-empty changelog.  Even if it is 
 relatively trivial.  The same comment applies to several other patches 
 in this series.
 
  ---
   arch/mips/netlogic/xlr/platform.c |6 ++
   1 file changed, 6 insertions(+)
 
 Does this need to enable CONFIG_USB_EHCI_HCD_PLATFORM is some 
 defconfig file, like you did with the MIPS Loongson 1B?

Netlogic platforms have USB disabled by default in their defconfig, so I'd say 
no, but only for them.

 
 And likewise for quite a few of the other patches in this series.
 
  diff --git a/arch/mips/netlogic/xlr/platform.c 
b/arch/mips/netlogic/xlr/platform.c
  index 71b44d8..1731dfd 100644
  --- a/arch/mips/netlogic/xlr/platform.c
  +++ b/arch/mips/netlogic/xlr/platform.c
  @@ -15,6 +15,7 @@
   #include linux/serial_8250.h
   #include linux/serial_reg.h
   #include linux/i2c.h
  +#include linux/usb/ehci_pdriver.h
   
   #include asm/netlogic/haldefs.h
   #include asm/netlogic/xlr/iomap.h
  @@ -123,6 +124,10 @@ static u64 xls_usb_dmamask = ~(u32)0;
  },  \
  }
   
  +static struct usb_ehci_pdata xls_usb_ehci_pdata = {
  +   .caps_offset= 0,
  +};
  +
   static struct platform_device xls_usb_ehci_device =
   USB_PLATFORM_DEV(ehci-xls, 0, PIC_USB_IRQ);
   static struct platform_device xls_usb_ohci_device_0 =
  @@ -172,6 +177,7 @@ int xls_platform_usb_init(void)
  memres = CPHYSADDR((unsigned long)usb_mmio);
  xls_usb_ehci_device.resource[0].start = memres;
  xls_usb_ehci_device.resource[0].end = memres + 0x400 - 1;
  +   xls_usb_ehci_device.dev.platform_data = xls_usb_ehci_pdata;
   
  memres += 0x400;
  xls_usb_ohci_device_0.resource[0].start = memres;
 
 Don't you need to change/set the pdev name also?  Likewise for patch 
 20/25 and 24/25.
 
 Alan Stern
 
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/24 v2] USB: OHCI and EHCI platform driver conversions

2012-10-04 Thread Florian Fainelli
Hi all,

This patch series contains various EHCI and OHCI conversions as well as
some cleanups in the existing OHCI HCD driver regarding suspend/resume
as suggested by Alan Stern.

Changes since previous version summed up are:
- improved various commit messages
- changed the logic regarding need_io_watchdog
- fixed arch/ files not using {e,o}hci-platform despite their conversion
- updated more defconfigs
- cleaned up OHCI HCD driver
- dropped Octeon conversion per David Daney's request

Per-patch changes are detailed in the patches.

Thanks!

Florian Fainelli (24):
  USB: EHCI: remove IXP4xx EHCI driver
  MIPS: Loongson 1B: use ehci-platform instead of ehci-ls1x.
  USB: EHCI: remove Loongson 1B EHCI driver.
  MIPS: Netlogic: use ehci-platform driver
  USB: EHCI: remove Netlogic XLS EHCI driver
  USB: EHCI: add no_io_watchdog platform_data parameter to
ehci-platform
  MIPS: Alchemy: use the ehci platform driver
  USB: EHCI: remove Alchemy EHCI driver
  ARM: cns3xxx: use ehci platform driver
  USB: EHCI: remove CNS3xxx EHCI platform driver
  USB: ohci: allow platform driver to specify the number of ports
  USB: ohci: move ohci_pci_{suspend,resume} to ohci-hcd.c
  USB: ohci: remove check for RH already suspended in ohci_suspend
  USB: ohci: merge ohci_finish_controller_resume with ohci_resume
  MIPS: PNX8550: use OHCI platform driver
  USB: OHCI: remove PNX8550 OHCI driver
  ARM: cns3xxx: use OHCI platform driver
  USB: OHCI: remove CNS3xxx OHCI platform driver
  MIPS: Netlogic: convert to use OHCI platform driver
  USB: OHCI: remove Netlogic XLS OHCI platform driver
  sh: convert boards to use the OHCI platform driver
  USB: OHCI: remove OHCI SH platform driver
  MIPS: Alchemy: use the OHCI platform driver
  USB: OHCI: remove Alchemy OHCI platform driver.

 arch/arm/mach-cns3xxx/cns3420vb.c  |   54 ++-
 arch/mips/alchemy/common/platform.c|   58 +++-
 arch/mips/configs/db1000_defconfig |1 +
 arch/mips/configs/db1200_defconfig |2 +
 arch/mips/configs/db1300_defconfig |2 +
 arch/mips/configs/db1550_defconfig |1 +
 arch/mips/configs/gpr_defconfig|1 +
 arch/mips/configs/ls1b_defconfig   |1 +
 arch/mips/configs/mtx1_defconfig   |1 +
 arch/mips/configs/pb1100_defconfig |1 +
 arch/mips/configs/pb1500_defconfig |1 +
 arch/mips/configs/pb1550_defconfig |1 +
 arch/mips/loongson1/common/platform.c  |8 +-
 arch/mips/netlogic/xlr/platform.c  |   17 ++-
 arch/mips/pnx8550/common/platform.c|   31 +++-
 arch/sh/kernel/cpu/sh3/setup-sh7720.c  |6 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7757.c |6 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7763.c |6 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7786.c |6 +-
 drivers/usb/host/Kconfig   |   18 ++-
 drivers/usb/host/ehci-au1xxx.c |  184 
 drivers/usb/host/ehci-cns3xxx.c|  155 
 drivers/usb/host/ehci-hcd.c|   25 
 drivers/usb/host/ehci-ixp4xx.c |  139 --
 drivers/usb/host/ehci-ls1x.c   |  147 ---
 drivers/usb/host/ehci-platform.c   |2 +
 drivers/usb/host/ehci-xls.c|  142 ---
 drivers/usb/host/ohci-at91.c   |2 +-
 drivers/usb/host/ohci-au1xxx.c |  234 --
 drivers/usb/host/ohci-cns3xxx.c|  166 --
 drivers/usb/host/ohci-ep93xx.c |2 +-
 drivers/usb/host/ohci-exynos.c |5 +-
 drivers/usb/host/ohci-hcd.c|   94 
 drivers/usb/host/ohci-hub.c|   42 --
 drivers/usb/host/ohci-omap.c   |2 +-
 drivers/usb/host/ohci-pci.c|   43 +-
 drivers/usb/host/ohci-platform.c   |6 +-
 drivers/usb/host/ohci-pnx8550.c|  243 
 drivers/usb/host/ohci-pxa27x.c |2 +-
 drivers/usb/host/ohci-s3c2410.c|3 +-
 drivers/usb/host/ohci-sh.c |  141 --
 drivers/usb/host/ohci-spear.c  |2 +-
 drivers/usb/host/ohci-tmio.c   |2 +-
 drivers/usb/host/ohci-xls.c|  152 
 include/linux/usb/ehci_pdriver.h   |3 +
 include/linux/usb/ohci_pdriver.h   |2 +
 46 files changed, 296 insertions(+), 1866 deletions(-)
 delete mode 100644 drivers/usb/host/ehci-au1xxx.c
 delete mode 100644 drivers/usb/host/ehci-cns3xxx.c
 delete mode 100644 drivers/usb/host/ehci-ixp4xx.c
 delete mode 100644 drivers/usb/host/ehci-ls1x.c
 delete mode 100644 drivers/usb/host/ehci-xls.c
 delete mode 100644 drivers/usb/host/ohci-au1xxx.c
 delete mode 100644 drivers/usb/host/ohci-cns3xxx.c
 delete mode 100644 drivers/usb/host/ohci-pnx8550.c
 delete mode 100644 drivers/usb/host/ohci-sh.c
 delete mode 100644 drivers/usb/host/ohci-xls.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to 

[PATCH 04/24 v2] MIPS: Netlogic: use ehci-platform driver

2012-10-04 Thread Florian Fainelli
The EHCI platform driver is suitable for use by the Netlogic XLR platform
since there is nothing specific that the EHCI XLR platform driver does.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
Changes since v1:
- really change driver name to ehci-platform
- slightly reworded commit message

 arch/mips/netlogic/xlr/platform.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/mips/netlogic/xlr/platform.c 
b/arch/mips/netlogic/xlr/platform.c
index 71b44d8..144c5c6 100644
--- a/arch/mips/netlogic/xlr/platform.c
+++ b/arch/mips/netlogic/xlr/platform.c
@@ -15,6 +15,7 @@
 #include linux/serial_8250.h
 #include linux/serial_reg.h
 #include linux/i2c.h
+#include linux/usb/ehci_pdriver.h
 
 #include asm/netlogic/haldefs.h
 #include asm/netlogic/xlr/iomap.h
@@ -123,8 +124,12 @@ static u64 xls_usb_dmamask = ~(u32)0;
},  \
}
 
+static struct usb_ehci_pdata xls_usb_ehci_pdata = {
+   .caps_offset= 0,
+};
+
 static struct platform_device xls_usb_ehci_device =
-USB_PLATFORM_DEV(ehci-xls, 0, PIC_USB_IRQ);
+USB_PLATFORM_DEV(ehci-platform, 0, PIC_USB_IRQ);
 static struct platform_device xls_usb_ohci_device_0 =
 USB_PLATFORM_DEV(ohci-xls-0, 1, PIC_USB_IRQ);
 static struct platform_device xls_usb_ohci_device_1 =
@@ -172,6 +177,7 @@ int xls_platform_usb_init(void)
memres = CPHYSADDR((unsigned long)usb_mmio);
xls_usb_ehci_device.resource[0].start = memres;
xls_usb_ehci_device.resource[0].end = memres + 0x400 - 1;
+   xls_usb_ehci_device.dev.platform_data = xls_usb_ehci_pdata;
 
memres += 0x400;
xls_usb_ohci_device_0.resource[0].start = memres;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/24 v2] USB: EHCI: remove Alchemy EHCI driver

2012-10-04 Thread Florian Fainelli
The platform code has been converted to use the ehci-platform driver instead
thus obsoleting the ehci-au1xxx driver, which can be removed.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
Changes since v1:
- reworded commit message

 drivers/usb/host/ehci-au1xxx.c |  184 
 drivers/usb/host/ehci-hcd.c|5 --
 2 files changed, 189 deletions(-)
 delete mode 100644 drivers/usb/host/ehci-au1xxx.c

diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
deleted file mode 100644
index 65c945e..000
--- a/drivers/usb/host/ehci-au1xxx.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * EHCI HCD (Host Controller Driver) for USB.
- *
- * Bus Glue for AMD Alchemy Au1xxx
- *
- * Based on ohci-au1xxx.c by Matt Porter mpor...@kernel.crashing.org
- *
- * Modified for AMD Alchemy Au1200 EHC
- *  by K.Boge karsten.b...@amd.com
- *
- * This file is licenced under the GPL.
- */
-
-#include linux/platform_device.h
-#include asm/mach-au1x00/au1000.h
-
-
-extern int usb_disabled(void);
-
-static int au1xxx_ehci_setup(struct usb_hcd *hcd)
-{
-   struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-   int ret;
-
-   ehci-caps = hcd-regs;
-   ret = ehci_setup(hcd);
-
-   ehci-need_io_watchdog = 0;
-   return ret;
-}
-
-static const struct hc_driver ehci_au1xxx_hc_driver = {
-   .description= hcd_name,
-   .product_desc   = Au1xxx EHCI,
-   .hcd_priv_size  = sizeof(struct ehci_hcd),
-
-   /*
-* generic hardware linkage
-*/
-   .irq= ehci_irq,
-   .flags  = HCD_MEMORY | HCD_USB2,
-
-   /*
-* basic lifecycle operations
-*
-* FIXME -- ehci_init() doesn't do enough here.
-* See ehci-ppc-soc for a complete implementation.
-*/
-   .reset  = au1xxx_ehci_setup,
-   .start  = ehci_run,
-   .stop   = ehci_stop,
-   .shutdown   = ehci_shutdown,
-
-   /*
-* managing i/o requests and associated device resources
-*/
-   .urb_enqueue= ehci_urb_enqueue,
-   .urb_dequeue= ehci_urb_dequeue,
-   .endpoint_disable   = ehci_endpoint_disable,
-   .endpoint_reset = ehci_endpoint_reset,
-
-   /*
-* scheduling support
-*/
-   .get_frame_number   = ehci_get_frame,
-
-   /*
-* root hub support
-*/
-   .hub_status_data= ehci_hub_status_data,
-   .hub_control= ehci_hub_control,
-   .bus_suspend= ehci_bus_suspend,
-   .bus_resume = ehci_bus_resume,
-   .relinquish_port= ehci_relinquish_port,
-   .port_handed_over   = ehci_port_handed_over,
-
-   .clear_tt_buffer_complete   = ehci_clear_tt_buffer_complete,
-};
-
-static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev)
-{
-   struct usb_hcd *hcd;
-   struct resource *res;
-   int ret;
-
-   if (usb_disabled())
-   return -ENODEV;
-
-   if (pdev-resource[1].flags != IORESOURCE_IRQ) {
-   pr_debug(resource[1] is not IORESOURCE_IRQ);
-   return -ENOMEM;
-   }
-   hcd = usb_create_hcd(ehci_au1xxx_hc_driver, pdev-dev, Au1xxx);
-   if (!hcd)
-   return -ENOMEM;
-
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   hcd-rsrc_start = res-start;
-   hcd-rsrc_len = resource_size(res);
-
-   hcd-regs = devm_request_and_ioremap(pdev-dev, res);
-   if (!hcd-regs) {
-   pr_debug(devm_request_and_ioremap failed);
-   ret = -ENOMEM;
-   goto err1;
-   }
-
-   if (alchemy_usb_control(ALCHEMY_USB_EHCI0, 1)) {
-   printk(KERN_INFO %s: controller init failed!\n, pdev-name);
-   ret = -ENODEV;
-   goto err1;
-   }
-
-   ret = usb_add_hcd(hcd, pdev-resource[1].start,
- IRQF_SHARED);
-   if (ret == 0) {
-   platform_set_drvdata(pdev, hcd);
-   return ret;
-   }
-
-   alchemy_usb_control(ALCHEMY_USB_EHCI0, 0);
-err1:
-   usb_put_hcd(hcd);
-   return ret;
-}
-
-static int ehci_hcd_au1xxx_drv_remove(struct platform_device *pdev)
-{
-   struct usb_hcd *hcd = platform_get_drvdata(pdev);
-
-   usb_remove_hcd(hcd);
-   alchemy_usb_control(ALCHEMY_USB_EHCI0, 0);
-   usb_put_hcd(hcd);
-   platform_set_drvdata(pdev, NULL);
-
-   return 0;
-}
-
-#ifdef CONFIG_PM
-static int ehci_hcd_au1xxx_drv_suspend(struct device *dev)
-{
-   struct usb_hcd *hcd = dev_get_drvdata(dev);
-   bool do_wakeup = device_may_wakeup(dev);
-   int rc;
-
-   rc = ehci_suspend(hcd, do_wakeup);
-   alchemy_usb_control(ALCHEMY_USB_EHCI0, 0);
-
-   return rc;
-}
-
-static int ehci_hcd_au1xxx_drv_resume(struct device *dev)
-{
-   struct usb_hcd *hcd = 

[PATCH 10/24 v2] USB: EHCI: remove CNS3xxx EHCI platform driver

2012-10-04 Thread Florian Fainelli
The users have been converted to use the ehci platform driver instead, thus
making the ehci-cns3xxx driver obsolete, so remove it.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
Changes since v1:
- only remove the corresponding chunk from ehci-hcd

 drivers/usb/host/Kconfig|6 +-
 drivers/usb/host/ehci-cns3xxx.c |  155 ---
 drivers/usb/host/ehci-hcd.c |5 --
 3 files changed, 5 insertions(+), 161 deletions(-)
 delete mode 100644 drivers/usb/host/ehci-cns3xxx.c

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index b1deb0f..15304e7 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -215,9 +215,13 @@ config USB_W90X900_EHCI
Enables support for the W90X900 USB controller
 
 config USB_CNS3XXX_EHCI
-   bool Cavium CNS3XXX EHCI Module
+   bool Cavium CNS3XXX EHCI Module (DEPRECATED)
depends on USB_EHCI_HCD  ARCH_CNS3XXX
+   select USB_EHCI_HCD_PLATFORM
---help---
+ This option is deprecated now and the driver was removed, use
+ USB_EHCI_HCD_PLATFORM instead.
+
  Enable support for the CNS3XXX SOC's on-chip EHCI controller.
  It is needed for high-speed (480Mbit/sec) USB 2.0 device
  support.
diff --git a/drivers/usb/host/ehci-cns3xxx.c b/drivers/usb/host/ehci-cns3xxx.c
deleted file mode 100644
index d91708d..000
--- a/drivers/usb/host/ehci-cns3xxx.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright 2008 Cavium Networks
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, Version 2, as
- * published by the Free Software Foundation.
- */
-
-#include linux/platform_device.h
-#include linux/atomic.h
-#include mach/cns3xxx.h
-#include mach/pm.h
-
-static int cns3xxx_ehci_init(struct usb_hcd *hcd)
-{
-   struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-   int retval;
-
-   /*
-* 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);
-   }
-
-   ehci-caps = hcd-regs;
-
-   hcd-has_tt = 0;
-
-   retval = ehci_setup(hcd);
-   if (retval)
-   return retval;
-
-   ehci_port_power(ehci, 0);
-
-   return retval;
-}
-
-static const struct hc_driver cns3xxx_ehci_hc_driver = {
-   .description= hcd_name,
-   .product_desc   = CNS3XXX EHCI Host Controller,
-   .hcd_priv_size  = sizeof(struct ehci_hcd),
-   .irq= ehci_irq,
-   .flags  = HCD_MEMORY | HCD_USB2,
-   .reset  = cns3xxx_ehci_init,
-   .start  = ehci_run,
-   .stop   = ehci_stop,
-   .shutdown   = ehci_shutdown,
-   .urb_enqueue= ehci_urb_enqueue,
-   .urb_dequeue= ehci_urb_dequeue,
-   .endpoint_disable   = ehci_endpoint_disable,
-   .endpoint_reset = ehci_endpoint_reset,
-   .get_frame_number   = ehci_get_frame,
-   .hub_status_data= ehci_hub_status_data,
-   .hub_control= ehci_hub_control,
-#ifdef CONFIG_PM
-   .bus_suspend= ehci_bus_suspend,
-   .bus_resume = ehci_bus_resume,
-#endif
-   .relinquish_port= ehci_relinquish_port,
-   .port_handed_over   = ehci_port_handed_over,
-
-   .clear_tt_buffer_complete   = ehci_clear_tt_buffer_complete,
-};
-
-static int cns3xxx_ehci_probe(struct platform_device *pdev)
-{
-   struct device *dev = pdev-dev;
-   struct usb_hcd *hcd;
-   const struct hc_driver *driver = cns3xxx_ehci_hc_driver;
-   struct resource *res;
-   int irq;
-   int retval;
-
-   if (usb_disabled())
-   return -ENODEV;
-
-   res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-   if (!res) {
-   dev_err(dev, Found HC with no IRQ.\n);
-   return -ENODEV;
-   }
-   irq = res-start;
-
-   hcd = usb_create_hcd(driver, pdev-dev, dev_name(pdev-dev));
-   if (!hcd)
-   return -ENOMEM;
-
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res) {
-   dev_err(dev, Found HC with no register addr.\n);
-   retval = -ENODEV;
-   goto err1;
-   }
-
-   

[PATCH 18/24 v2] USB: OHCI: remove CNS3xxx OHCI platform driver

2012-10-04 Thread Florian Fainelli
All users have been converted to use the OHCI platform driver instead, thus
making ohci-cns3xxx, so remove it.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
Changes since v1:
- reworded commit message

 drivers/usb/host/Kconfig|6 +-
 drivers/usb/host/ohci-cns3xxx.c |  166 ---
 drivers/usb/host/ohci-hcd.c |5 --
 3 files changed, 5 insertions(+), 172 deletions(-)
 delete mode 100644 drivers/usb/host/ohci-cns3xxx.c

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 15304e7..86a7995 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -410,9 +410,13 @@ config USB_OHCI_EXYNOS
 Enable support for the Samsung Exynos SOC's on-chip OHCI controller.
 
 config USB_CNS3XXX_OHCI
-   bool Cavium CNS3XXX OHCI Module
+   bool Cavium CNS3XXX OHCI Module (DEPRECATED)
depends on USB_OHCI_HCD  ARCH_CNS3XXX
+   select USB_OHCI_HCD_PLATFORM
---help---
+ This option is deprecated now and the driver was removed, use
+ USB_OHCI_HCD_PLATFORM instead.
+
  Enable support for the CNS3XXX SOC's on-chip OHCI controller.
  It is needed for low-speed USB 1.0 device support.
 
diff --git a/drivers/usb/host/ohci-cns3xxx.c b/drivers/usb/host/ohci-cns3xxx.c
deleted file mode 100644
index 2c9f233..000
--- a/drivers/usb/host/ohci-cns3xxx.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright 2008 Cavium Networks
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, Version 2, as
- * published by the Free Software Foundation.
- */
-
-#include linux/platform_device.h
-#include linux/atomic.h
-#include mach/cns3xxx.h
-#include mach/pm.h
-
-static int __devinit
-cns3xxx_ohci_start(struct usb_hcd *hcd)
-{
-   struct ohci_hcd *ohci = hcd_to_ohci(hcd);
-   int ret;
-
-   /*
-* 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);
-   }
-
-   ret = ohci_init(ohci);
-   if (ret  0)
-   return ret;
-
-   ohci-num_ports = 1;
-
-   ret = ohci_run(ohci);
-   if (ret  0) {
-   dev_err(hcd-self.controller, can't start %s\n,
-   hcd-self.bus_name);
-   ohci_stop(hcd);
-   return ret;
-   }
-   return 0;
-}
-
-static const struct hc_driver cns3xxx_ohci_hc_driver = {
-   .description= hcd_name,
-   .product_desc   = CNS3XXX OHCI Host controller,
-   .hcd_priv_size  = sizeof(struct ohci_hcd),
-   .irq= ohci_irq,
-   .flags  = HCD_USB11 | HCD_MEMORY,
-   .start  = cns3xxx_ohci_start,
-   .stop   = ohci_stop,
-   .shutdown   = ohci_shutdown,
-   .urb_enqueue= ohci_urb_enqueue,
-   .urb_dequeue= ohci_urb_dequeue,
-   .endpoint_disable   = ohci_endpoint_disable,
-   .get_frame_number   = ohci_get_frame,
-   .hub_status_data= ohci_hub_status_data,
-   .hub_control= ohci_hub_control,
-#ifdef CONFIG_PM
-   .bus_suspend= ohci_bus_suspend,
-   .bus_resume = ohci_bus_resume,
-#endif
-   .start_port_reset   = ohci_start_port_reset,
-};
-
-static int cns3xxx_ohci_probe(struct platform_device *pdev)
-{
-   struct device *dev = pdev-dev;
-   struct usb_hcd *hcd;
-   const struct hc_driver *driver = cns3xxx_ohci_hc_driver;
-   struct resource *res;
-   int irq;
-   int retval;
-
-   if (usb_disabled())
-   return -ENODEV;
-
-   res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-   if (!res) {
-   dev_err(dev, Found HC with no IRQ.\n);
-   return -ENODEV;
-   }
-   irq = res-start;
-
-   hcd = usb_create_hcd(driver, dev, dev_name(dev));
-   if (!hcd)
-   return -ENOMEM;
-
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res) {
-   dev_err(dev, Found HC with no register addr.\n);
-   retval = -ENODEV;
-   goto err1;
-   }
-   hcd-rsrc_start = res-start;
-   hcd-rsrc_len = resource_size(res);
-
-   if (!request_mem_region(hcd-rsrc_start, hcd-rsrc_len,
-

[PATCH 21/24 v2] sh: convert boards to use the OHCI platform driver

2012-10-04 Thread Florian Fainelli
Signed-off-by: Florian Fainelli flor...@openwrt.org
---
No changes since v1

 arch/sh/kernel/cpu/sh3/setup-sh7720.c  |6 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7757.c |6 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7763.c |6 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7786.c |6 +-
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7720.c 
b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
index 0c2f1b2..42d991f 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh7720.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
@@ -20,6 +20,7 @@
 #include linux/serial_sci.h
 #include linux/sh_timer.h
 #include linux/sh_intc.h
+#include linux/usb/ohci_pdriver.h
 #include asm/rtc.h
 #include cpu/serial.h
 
@@ -103,12 +104,15 @@ static struct resource usb_ohci_resources[] = {
 
 static u64 usb_ohci_dma_mask = 0xUL;
 
+static struct usb_ohci_pdata usb_ohci_pdata;
+
 static struct platform_device usb_ohci_device = {
-   .name   = sh_ohci,
+   .name   = ohci-platform,
.id = -1,
.dev = {
.dma_mask   = usb_ohci_dma_mask,
.coherent_dma_mask  = 0x,
+   .platform_data  = usb_ohci_pdata,
},
.num_resources  = ARRAY_SIZE(usb_ohci_resources),
.resource   = usb_ohci_resources,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c 
b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
index 4a2f357..9079a0f 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
@@ -19,6 +19,7 @@
 #include linux/sh_timer.h
 #include linux/sh_dma.h
 #include linux/sh_intc.h
+#include linux/usb/ohci_pdriver.h
 #include cpu/dma-register.h
 #include cpu/sh7757.h
 
@@ -750,12 +751,15 @@ static struct resource usb_ohci_resources[] = {
},
 };
 
+static struct usb_ohci_pdata usb_ohci_pdata;
+
 static struct platform_device usb_ohci_device = {
-   .name   = sh_ohci,
+   .name   = ohci-platform,
.id = -1,
.dev = {
.dma_mask = usb_ohci_device.dev.coherent_dma_mask,
.coherent_dma_mask = DMA_BIT_MASK(32),
+   .platform_data  = usb_ohci_pdata,
},
.num_resources  = ARRAY_SIZE(usb_ohci_resources),
.resource   = usb_ohci_resources,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c 
b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
index bd0a8fb..1686aca 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
@@ -16,6 +16,7 @@
 #include linux/sh_intc.h
 #include linux/io.h
 #include linux/serial_sci.h
+#include linux/usb/ohci_pdriver.h
 
 static struct plat_sci_port scif0_platform_data = {
.mapbase= 0xffe0,
@@ -106,12 +107,15 @@ static struct resource usb_ohci_resources[] = {
 
 static u64 usb_ohci_dma_mask = 0xUL;
 
+static struct usb_ohci_pdata usb_ohci_pdata;
+
 static struct platform_device usb_ohci_device = {
-   .name   = sh_ohci,
+   .name   = ohci-platform,
.id = -1,
.dev = {
.dma_mask   = usb_ohci_dma_mask,
.coherent_dma_mask  = 0x,
+   .platform_data  = usb_ohci_pdata,
},
.num_resources  = ARRAY_SIZE(usb_ohci_resources),
.resource   = usb_ohci_resources,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c 
b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
index 2e6952f..ab52d4d 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
@@ -23,6 +23,7 @@
 #include linux/sh_timer.h
 #include linux/sh_dma.h
 #include linux/sh_intc.h
+#include linux/usb/ohci_pdriver.h
 #include cpu/dma-register.h
 #include asm/mmzone.h
 
@@ -583,12 +584,15 @@ static struct resource usb_ohci_resources[] = {
},
 };
 
+static struct usb_ohci_pdata usb_ohci_pdata;
+
 static struct platform_device usb_ohci_device = {
-   .name   = sh_ohci,
+   .name   = ohci-platform,
.id = -1,
.dev = {
.dma_mask   = 
usb_ohci_device.dev.coherent_dma_mask,
.coherent_dma_mask  = DMA_BIT_MASK(32),
+   .platform_data  = usb_ohci_pdata,
},
.num_resources  = ARRAY_SIZE(usb_ohci_resources),
.resource   = usb_ohci_resources,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 23/24 v2] MIPS: Alchemy: use the OHCI platform driver

2012-10-04 Thread Florian Fainelli
Convert the Alchemy platform to register the ohci-platform driver, now that
the ohci-platform driver properly handles the specific ohci-au1xxx resume
from suspend case.

This also greatly simplifies the power_{on,off} callbacks and make them
work on platform device id instead of checking the OHCI controller base
address like what was done in ohci-au1xxx.c.

Impacted defconfigs are also updated accordingly to select the OHCI platform
driver.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
Changes since v1:
- updated defconfigs accordingly
- really instantiate ohci-platform instead of ohci-au1xxx
- rebased on top of the latest OHCI HCD changes

 arch/mips/alchemy/common/platform.c |   35 +--
 arch/mips/configs/db1000_defconfig  |1 +
 arch/mips/configs/db1200_defconfig  |1 +
 arch/mips/configs/db1300_defconfig  |1 +
 arch/mips/configs/db1550_defconfig  |1 +
 arch/mips/configs/gpr_defconfig |1 +
 arch/mips/configs/mtx1_defconfig|1 +
 arch/mips/configs/pb1100_defconfig  |1 +
 arch/mips/configs/pb1500_defconfig  |1 +
 arch/mips/configs/pb1550_defconfig  |1 +
 10 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/arch/mips/alchemy/common/platform.c 
b/arch/mips/alchemy/common/platform.c
index b9a5f6d..7af941d 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -18,6 +18,7 @@
 #include linux/serial_8250.h
 #include linux/slab.h
 #include linux/usb/ehci_pdriver.h
+#include linux/usb/ohci_pdriver.h
 
 #include asm/mach-au1x00/au1000.h
 #include asm/mach-au1x00/au1xxx_dbdma.h
@@ -142,6 +143,34 @@ static struct usb_ehci_pdata alchemy_ehci_pdata = {
.power_suspend  = alchemy_ehci_power_off,
 };
 
+/* Power on callback for the ohci platform driver */
+static int alchemy_ohci_power_on(struct platform_device *pdev)
+{
+   int unit;
+
+   unit = (pdev-id == 1) ?
+   ALCHEMY_USB_OHCI1 : ALCHEMY_USB_OHCI0;
+
+   return alchemy_usb_control(unit, 1);
+}
+
+/* Power off/suspend callback for the ohci platform driver */
+static void alchemy_ohci_power_off(struct platform_device *pdev)
+{
+   int unit;
+
+   unit = (pdev-id == 1) ?
+   ALCHEMY_USB_OHCI1 : ALCHEMY_USB_OHCI0;
+
+   alchemy_usb_control(unit, 0);
+}
+
+static struct usb_ohci_pdata alchemy_ohci_pdata = {
+   .power_on   = alchemy_ohci_power_on,
+   .power_off  = alchemy_ohci_power_off,
+   .power_suspend  = alchemy_ohci_power_off,
+};
+
 static unsigned long alchemy_ohci_data[][2] __initdata = {
[ALCHEMY_CPU_AU1000] = { AU1000_USB_OHCI_PHYS_ADDR, AU1000_USB_HOST_INT 
},
[ALCHEMY_CPU_AU1500] = { AU1000_USB_OHCI_PHYS_ADDR, AU1500_USB_HOST_INT 
},
@@ -189,9 +218,10 @@ static void __init alchemy_setup_usb(int ctype)
res[1].start = alchemy_ohci_data[ctype][1];
res[1].end = res[1].start;
res[1].flags = IORESOURCE_IRQ;
-   pdev-name = au1xxx-ohci;
+   pdev-name = ohci-platform;
pdev-id = 0;
pdev-dev.dma_mask = alchemy_ohci_dmamask;
+   pdev-dev.platform_data = alchemy_ohci_pdata;
 
if (platform_device_register(pdev))
printk(KERN_INFO Alchemy USB: cannot add OHCI0\n);
@@ -228,9 +258,10 @@ static void __init alchemy_setup_usb(int ctype)
res[1].start = AU1300_USB_INT;
res[1].end = res[1].start;
res[1].flags = IORESOURCE_IRQ;
-   pdev-name = au1xxx-ohci;
+   pdev-name = ohci-platform;
pdev-id = 1;
pdev-dev.dma_mask = alchemy_ohci_dmamask;
+   pdev-dev.platform_data = alchemy_ohci_pdata;
 
if (platform_device_register(pdev))
printk(KERN_INFO Alchemy USB: cannot add OHCI1\n);
diff --git a/arch/mips/configs/db1000_defconfig 
b/arch/mips/configs/db1000_defconfig
index 17a36c1..face9d2 100644
--- a/arch/mips/configs/db1000_defconfig
+++ b/arch/mips/configs/db1000_defconfig
@@ -233,6 +233,7 @@ CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 CONFIG_USB_EHCI_TT_NEWSCHED=y
 CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_HCD_PLATFORM=y
 CONFIG_USB_UHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_NEW_LEDS=y
diff --git a/arch/mips/configs/db1200_defconfig 
b/arch/mips/configs/db1200_defconfig
index d31ac85..e36f44a 100644
--- a/arch/mips/configs/db1200_defconfig
+++ b/arch/mips/configs/db1200_defconfig
@@ -120,6 +120,7 @@ CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_HCD_PLATFORM=y
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_HCD_PLATFORM=y
 CONFIG_MMC=y
 # CONFIG_MMC_BLOCK_BOUNCE is not set
 CONFIG_MMC_AU1X=y
diff --git a/arch/mips/configs/db1300_defconfig 
b/arch/mips/configs/db1300_defconfig
index 717e7b2..6873443 100644
--- a/arch/mips/configs/db1300_defconfig
+++ b/arch/mips/configs/db1300_defconfig
@@ -292,6 +292,7 @@ CONFIG_USB_EHCI_HCD_PLATFORM=y
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 

[PATCH 24/24 v2] USB: OHCI: remove Alchemy OHCI platform driver.

2012-10-04 Thread Florian Fainelli
All users have been converted to use the OHCI platform driver instead, thus
making ohci-au1xxx obsolete, remove it.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
Changes since v1:
- rebased on top of the latest OHCI HCD changes

 drivers/usb/host/ohci-au1xxx.c |  234 
 drivers/usb/host/ohci-hcd.c|5 -
 2 files changed, 239 deletions(-)
 delete mode 100644 drivers/usb/host/ohci-au1xxx.c

diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
deleted file mode 100644
index c611699..000
--- a/drivers/usb/host/ohci-au1xxx.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * OHCI HCD (Host Controller Driver) for USB.
- *
- * (C) Copyright 1999 Roman Weissgaerber wei...@vienna.at
- * (C) Copyright 2000-2002 David Brownell dbrown...@users.sourceforge.net
- * (C) Copyright 2002 Hewlett-Packard Company
- *
- * Bus Glue for AMD Alchemy Au1xxx
- *
- * Written by Christopher Hoover c...@hpl.hp.com
- * Based on fragments of previous driver by Russell King et al.
- *
- * Modified for LH7A404 from ohci-sa.c
- *  by Durgesh Pattamatta pattamat...@sharpsec.com
- * Modified for AMD Alchemy Au1xxx
- *  by Matt Porter mpor...@kernel.crashing.org
- *
- * This file is licenced under the GPL.
- */
-
-#include linux/platform_device.h
-#include linux/signal.h
-
-#include asm/mach-au1x00/au1000.h
-
-
-extern int usb_disabled(void);
-
-static int __devinit ohci_au1xxx_start(struct usb_hcd *hcd)
-{
-   struct ohci_hcd *ohci = hcd_to_ohci(hcd);
-   int ret;
-
-   ohci_dbg(ohci, ohci_au1xxx_start, ohci:%p, ohci);
-
-   if ((ret = ohci_init(ohci))  0)
-   return ret;
-
-   if ((ret = ohci_run(ohci))  0) {
-   dev_err(hcd-self.controller, can't start %s,
-   hcd-self.bus_name);
-   ohci_stop(hcd);
-   return ret;
-   }
-
-   return 0;
-}
-
-static const struct hc_driver ohci_au1xxx_hc_driver = {
-   .description =  hcd_name,
-   .product_desc = Au1xxx OHCI,
-   .hcd_priv_size =sizeof(struct ohci_hcd),
-
-   /*
-* generic hardware linkage
-*/
-   .irq =  ohci_irq,
-   .flags =HCD_USB11 | HCD_MEMORY,
-
-   /*
-* basic lifecycle operations
-*/
-   .start =ohci_au1xxx_start,
-   .stop = ohci_stop,
-   .shutdown = ohci_shutdown,
-
-   /*
-* managing i/o requests and associated device resources
-*/
-   .urb_enqueue =  ohci_urb_enqueue,
-   .urb_dequeue =  ohci_urb_dequeue,
-   .endpoint_disable = ohci_endpoint_disable,
-
-   /*
-* scheduling support
-*/
-   .get_frame_number = ohci_get_frame,
-
-   /*
-* root hub support
-*/
-   .hub_status_data =  ohci_hub_status_data,
-   .hub_control =  ohci_hub_control,
-#ifdef CONFIG_PM
-   .bus_suspend =  ohci_bus_suspend,
-   .bus_resume =   ohci_bus_resume,
-#endif
-   .start_port_reset = ohci_start_port_reset,
-};
-
-static int ohci_hcd_au1xxx_drv_probe(struct platform_device *pdev)
-{
-   int ret, unit;
-   struct usb_hcd *hcd;
-
-   if (usb_disabled())
-   return -ENODEV;
-
-   if (pdev-resource[1].flags != IORESOURCE_IRQ) {
-   pr_debug(resource[1] is not IORESOURCE_IRQ\n);
-   return -ENOMEM;
-   }
-
-   hcd = usb_create_hcd(ohci_au1xxx_hc_driver, pdev-dev, au1xxx);
-   if (!hcd)
-   return -ENOMEM;
-
-   hcd-rsrc_start = pdev-resource[0].start;
-   hcd-rsrc_len = pdev-resource[0].end - pdev-resource[0].start + 1;
-
-   if (!request_mem_region(hcd-rsrc_start, hcd-rsrc_len, hcd_name)) {
-   pr_debug(request_mem_region failed\n);
-   ret = -EBUSY;
-   goto err1;
-   }
-
-   hcd-regs = ioremap(hcd-rsrc_start, hcd-rsrc_len);
-   if (!hcd-regs) {
-   pr_debug(ioremap failed\n);
-   ret = -ENOMEM;
-   goto err2;
-   }
-
-   unit = (hcd-rsrc_start == AU1300_USB_OHCI1_PHYS_ADDR) ?
-   ALCHEMY_USB_OHCI1 : ALCHEMY_USB_OHCI0;
-   if (alchemy_usb_control(unit, 1)) {
-   printk(KERN_INFO %s: controller init failed!\n, pdev-name);
-   ret = -ENODEV;
-   goto err3;
-   }
-
-   ohci_hcd_init(hcd_to_ohci(hcd));
-
-   ret = usb_add_hcd(hcd, pdev-resource[1].start,
- IRQF_SHARED);
-   if (ret == 0) {
-   platform_set_drvdata(pdev, hcd);
-   return ret;
-   }
-
-   alchemy_usb_control(unit, 0);
-err3:
-   iounmap(hcd-regs);
-err2:
-   release_mem_region(hcd-rsrc_start, hcd-rsrc_len);
-err1:
-   usb_put_hcd(hcd);
-   return ret;
-}
-
-static int ohci_hcd_au1xxx_drv_remove(struct platform_device *pdev)
-{
-   

[PATCH 22/24 v2] USB: OHCI: remove OHCI SH platform driver

2012-10-04 Thread Florian Fainelli
All users have been converted to use the OHCI platform driver instead, thus
making ohci-sh obsolete, so remove it.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
No changes since v1

 drivers/usb/host/Kconfig|6 +-
 drivers/usb/host/ohci-hcd.c |5 --
 drivers/usb/host/ohci-sh.c  |  141 ---
 3 files changed, 5 insertions(+), 147 deletions(-)
 delete mode 100644 drivers/usb/host/ohci-sh.c

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 86a7995..b05b6aa 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -397,9 +397,13 @@ config USB_OHCI_HCD_SSB
  If unsure, say N.
 
 config USB_OHCI_SH
-   bool OHCI support for SuperH USB controller
+   bool OHCI support for SuperH USB controller (DEPRECATED)
depends on USB_OHCI_HCD  SUPERH
+   select USB_OHCI_HCD_PLATFORM
---help---
+ This option is deprecated now and the driver was removed, use
+ USB_OHCI_HCD_PLATFORM instead.
+
  Enables support for the on-chip OHCI controller on the SuperH.
  If you use the PCI OHCI controller, this option is not necessary.
 
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index b0fc042..2204759 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1123,11 +1123,6 @@ MODULE_LICENSE (GPL);
 #define PLATFORM_DRIVERohci_hcd_da8xx_driver
 #endif
 
-#ifdef CONFIG_USB_OHCI_SH
-#include ohci-sh.c
-#define PLATFORM_DRIVERohci_hcd_sh_driver
-#endif
-
 
 #ifdef CONFIG_USB_OHCI_HCD_PPC_OF
 #include ohci-ppc-of.c
diff --git a/drivers/usb/host/ohci-sh.c b/drivers/usb/host/ohci-sh.c
deleted file mode 100644
index 76a20c2..000
--- a/drivers/usb/host/ohci-sh.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * OHCI HCD (Host Controller Driver) for USB.
- *
- * Copyright (C) 2008 Renesas Solutions Corp.
- *
- * Author : Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-#include linux/platform_device.h
-
-static int ohci_sh_start(struct usb_hcd *hcd)
-{
-   struct ohci_hcd *ohci = hcd_to_ohci(hcd);
-
-   ohci_hcd_init(ohci);
-   ohci_init(ohci);
-   ohci_run(ohci);
-   return 0;
-}
-
-static const struct hc_driver ohci_sh_hc_driver = {
-   .description =  hcd_name,
-   .product_desc = SuperH OHCI,
-   .hcd_priv_size =sizeof(struct ohci_hcd),
-
-   /*
-* generic hardware linkage
-*/
-   .irq =  ohci_irq,
-   .flags =HCD_USB11 | HCD_MEMORY,
-
-   /*
-* basic lifecycle operations
-*/
-   .start =ohci_sh_start,
-   .stop = ohci_stop,
-   .shutdown = ohci_shutdown,
-
-   /*
-* managing i/o requests and associated device resources
-*/
-   .urb_enqueue =  ohci_urb_enqueue,
-   .urb_dequeue =  ohci_urb_dequeue,
-   .endpoint_disable = ohci_endpoint_disable,
-
-   /*
-* scheduling support
-*/
-   .get_frame_number = ohci_get_frame,
-
-   /*
-* root hub support
-*/
-   .hub_status_data =  ohci_hub_status_data,
-   .hub_control =  ohci_hub_control,
-#ifdef CONFIG_PM
-   .bus_suspend =  ohci_bus_suspend,
-   .bus_resume =   ohci_bus_resume,
-#endif
-   .start_port_reset = ohci_start_port_reset,
-};
-
-/*-*/
-
-static int ohci_hcd_sh_probe(struct platform_device *pdev)
-{
-   struct resource *res = NULL;
-   struct usb_hcd *hcd = NULL;
-   int irq = -1;
-   int ret;
-
-   if (usb_disabled())
-   return -ENODEV;
-
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res) {
-   dev_err(pdev-dev, platform_get_resource error.\n);
-   return -ENODEV;
-   }
-
-   irq = platform_get_irq(pdev, 0);
-   if (irq  0) {
-   dev_err(pdev-dev, platform_get_irq error.\n);
-   return -ENODEV;
-   }
-
-   /* initialize hcd */
-   hcd = usb_create_hcd(ohci_sh_hc_driver, pdev-dev, (char *)hcd_name);
-   if (!hcd) {
-   

[PATCH 19/24 v2] MIPS: Netlogic: convert to use OHCI platform driver

2012-10-04 Thread Florian Fainelli
The OHCI platform driver is suitable for use by the Netlogic XLR platform
so use this driver instead of the OHCI XLS platform driver.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
Changes since v1:
- really make the code register the ohci-platform driver instead of ohci-xls

 arch/mips/netlogic/xlr/platform.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/mips/netlogic/xlr/platform.c 
b/arch/mips/netlogic/xlr/platform.c
index 144c5c6..507230e 100644
--- a/arch/mips/netlogic/xlr/platform.c
+++ b/arch/mips/netlogic/xlr/platform.c
@@ -16,6 +16,7 @@
 #include linux/serial_reg.h
 #include linux/i2c.h
 #include linux/usb/ehci_pdriver.h
+#include linux/usb/ohci_pdriver.h
 
 #include asm/netlogic/haldefs.h
 #include asm/netlogic/xlr/iomap.h
@@ -128,12 +129,14 @@ static struct usb_ehci_pdata xls_usb_ehci_pdata = {
.caps_offset= 0,
 };
 
+static struct usb_ohci_pdata xls_usb_ohci_pdata;
+
 static struct platform_device xls_usb_ehci_device =
 USB_PLATFORM_DEV(ehci-platform, 0, PIC_USB_IRQ);
 static struct platform_device xls_usb_ohci_device_0 =
-USB_PLATFORM_DEV(ohci-xls-0, 1, PIC_USB_IRQ);
+USB_PLATFORM_DEV(ohci-platform, 1, PIC_USB_IRQ);
 static struct platform_device xls_usb_ohci_device_1 =
-USB_PLATFORM_DEV(ohci-xls-1, 2, PIC_USB_IRQ);
+USB_PLATFORM_DEV(ohci-platform, 2, PIC_USB_IRQ);
 
 static struct platform_device *xls_platform_devices[] = {
xls_usb_ehci_device,
@@ -182,10 +185,12 @@ int xls_platform_usb_init(void)
memres += 0x400;
xls_usb_ohci_device_0.resource[0].start = memres;
xls_usb_ohci_device_0.resource[0].end = memres + 0x400 - 1;
+   xls_usb_ohci_device_0.dev.platform_data = xls_usb_ohci_pdata;
 
memres += 0x400;
xls_usb_ohci_device_1.resource[0].start = memres;
xls_usb_ohci_device_1.resource[0].end = memres + 0x400 - 1;
+   xls_usb_ohci_device_1.dev.platform_data = xls_usb_ohci_pdata;
 
return platform_add_devices(xls_platform_devices,
ARRAY_SIZE(xls_platform_devices));
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 16/24 v2] USB: OHCI: remove PNX8550 OHCI driver

2012-10-04 Thread Florian Fainelli
The users have been converted to use the platform OHCI driver instead, thus
making the ohci-pnx8550 driver obsolete, so remove it.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
No changes since v1

 drivers/usb/host/ohci-hcd.c |5 -
 drivers/usb/host/ohci-pnx8550.c |  243 ---
 2 files changed, 248 deletions(-)
 delete mode 100644 drivers/usb/host/ohci-pnx8550.c

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 568bdb3..9453eea 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1103,11 +1103,6 @@ MODULE_LICENSE (GPL);
 #define PLATFORM_DRIVERohci_hcd_au1xxx_driver
 #endif
 
-#ifdef CONFIG_PNX8550
-#include ohci-pnx8550.c
-#define PLATFORM_DRIVERohci_hcd_pnx8550_driver
-#endif
-
 #ifdef CONFIG_USB_OHCI_HCD_PPC_SOC
 #include ohci-ppc-soc.c
 #define PLATFORM_DRIVERohci_hcd_ppc_soc_driver
diff --git a/drivers/usb/host/ohci-pnx8550.c b/drivers/usb/host/ohci-pnx8550.c
deleted file mode 100644
index 148d27d..000
--- a/drivers/usb/host/ohci-pnx8550.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * OHCI HCD (Host Controller Driver) for USB.
- *
- * (C) Copyright 1999 Roman Weissgaerber wei...@vienna.at
- * (C) Copyright 2000-2002 David Brownell dbrown...@users.sourceforge.net
- * (C) Copyright 2002 Hewlett-Packard Company
- * (C) Copyright 2005 Embedded Alley Solutions, Inc.
- *
- * Bus Glue for PNX8550
- *
- * Written by Christopher Hoover c...@hpl.hp.com
- * Based on fragments of previous driver by Russell King et al.
- *
- * Modified for LH7A404 from ohci-sa.c
- *  by Durgesh Pattamatta pattamat...@sharpsec.com
- *
- * Modified for PNX8550 from ohci-sa.c and sa-omap.c
- *  by Vitaly Wool vitalyw...@gmail.com
- *
- * This file is licenced under the GPL.
- */
-
-#include linux/device.h
-#include linux/platform_device.h
-#include asm/mach-pnx8550/usb.h
-#include asm/mach-pnx8550/int.h
-#include asm/mach-pnx8550/pci.h
-
-#ifndef CONFIG_PNX8550
-#error This file is PNX8550 bus glue.  CONFIG_PNX8550 must be defined.
-#endif
-
-extern int usb_disabled(void);
-
-/*-*/
-
-static void pnx8550_start_hc(struct platform_device *dev)
-{
-   /*
-* Set register CLK48CTL to enable and 48MHz
-*/
-   outl(0x0003, PCI_BASE | 0x0004770c);
-
-   /*
-* Set register CLK12CTL to enable and 48MHz
-*/
-   outl(0x0003, PCI_BASE | 0x00047710);
-
-   udelay(100);
-}
-
-static void pnx8550_stop_hc(struct platform_device *dev)
-{
-   udelay(10);
-}
-
-
-/*-*/
-
-/* configure so an HC device and id are always provided */
-/* always called with process context; sleeping is OK */
-
-
-/**
- * usb_hcd_pnx8550_probe - initialize pnx8550-based HCDs
- * Context: !in_interrupt()
- *
- * Allocates basic resources for this USB host controller, and
- * then invokes the start() method for the HCD associated with it
- * through the hotplug entry's driver_data.
- *
- */
-int usb_hcd_pnx8550_probe (const struct hc_driver *driver,
- struct platform_device *dev)
-{
-   int retval;
-   struct usb_hcd *hcd;
-
-   if (dev-resource[0].flags != IORESOURCE_MEM ||
-   dev-resource[1].flags != IORESOURCE_IRQ) {
-   dev_err (dev-dev,invalid resource type\n);
-   return -ENOMEM;
-   }
-
-   hcd = usb_create_hcd (driver, dev-dev, pnx8550);
-   if (!hcd)
-   return -ENOMEM;
-   hcd-rsrc_start = dev-resource[0].start;
-   hcd-rsrc_len = dev-resource[0].end - dev-resource[0].start + 1;
-
-   if (!request_mem_region(hcd-rsrc_start, hcd-rsrc_len, hcd_name)) {
-   dev_err(dev-dev, request_mem_region [0x%08llx, 0x%08llx] 
-   failed\n, hcd-rsrc_start, hcd-rsrc_len);
-   retval = -EBUSY;
-   goto err1;
-   }
-
-   hcd-regs = ioremap(hcd-rsrc_start, hcd-rsrc_len);
-   if (!hcd-regs) {
-   dev_err(dev-dev, ioremap [[0x%08llx, 0x%08llx] failed\n,
-   hcd-rsrc_start, hcd-rsrc_len);
-   retval = -ENOMEM;
-   goto err2;
-   }
-
-   pnx8550_start_hc(dev);
-
-   ohci_hcd_init(hcd_to_ohci(hcd));
-
-   retval = usb_add_hcd(hcd, dev-resource[1].start, 0);
-   if (retval == 0)
-   return retval;
-
-   pnx8550_stop_hc(dev);
-   iounmap(hcd-regs);
- err2:
-   release_mem_region(hcd-rsrc_start, hcd-rsrc_len);
- err1:
-   usb_put_hcd(hcd);
-   return retval;
-}
-
-
-/* may be called without controller electrically present */
-/* may be called with controller, bus, and devices active */
-
-/**
- * usb_hcd_pnx8550_remove - shutdown processing for pnx8550-based HCDs
- * @dev: USB Host Controller being removed
- * Context: 

[PATCH 17/24 v2] ARM: cns3xxx: use OHCI platform driver

2012-10-04 Thread Florian Fainelli
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 flor...@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

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/24 v2] USB: ohci: allow platform driver to specify the number of ports

2012-10-04 Thread Florian Fainelli
Signed-off-by: Florian Fainelli flor...@openwrt.org
---
No changes since v1

 drivers/usb/host/ohci-platform.c |4 
 include/linux/usb/ohci_pdriver.h |2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index e24ec9f..1caaf65 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -31,6 +31,10 @@ static int ohci_platform_reset(struct usb_hcd *hcd)
ohci-flags |= OHCI_QUIRK_FRAME_NO;
 
ohci_hcd_init(ohci);
+
+   if (pdata-num_ports)
+   ohci-num_ports = pdata-num_ports;
+
err = ohci_init(ohci);
 
return err;
diff --git a/include/linux/usb/ohci_pdriver.h b/include/linux/usb/ohci_pdriver.h
index 74e7755..012f2b7 100644
--- a/include/linux/usb/ohci_pdriver.h
+++ b/include/linux/usb/ohci_pdriver.h
@@ -25,6 +25,7 @@
  * @big_endian_desc:   BE descriptors
  * @big_endian_mmio:   BE registers
  * @no_big_frame_no:   no big endian frame_no shift
+ * @num_ports: number of ports
  *
  * These are general configuration options for the OHCI controller. All of
  * these options are activating more or less workarounds for some hardware.
@@ -33,6 +34,7 @@ struct usb_ohci_pdata {
unsignedbig_endian_desc:1;
unsignedbig_endian_mmio:1;
unsignedno_big_frame_no:1;
+   unsigned intnum_ports;
 
/* Turn on all power and clocks */
int (*power_on)(struct platform_device *pdev);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/24 v2] USB: EHCI: remove IXP4xx EHCI driver

2012-10-04 Thread Florian Fainelli
This driver is not registered by any in-tree user. If needed it the EHCI
driver can be reinstatied using the ehci-platform driver with caps_offset to
0x100.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
Changes since v1:
- slightly reworded commit message

 drivers/usb/host/ehci-hcd.c|5 --
 drivers/usb/host/ehci-ixp4xx.c |  139 
 2 files changed, 144 deletions(-)
 delete mode 100644 drivers/usb/host/ehci-ixp4xx.c

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 6bf6c42..442f774 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1249,11 +1249,6 @@ MODULE_LICENSE (GPL);
 #definePLATFORM_DRIVER ehci_orion_driver
 #endif
 
-#ifdef CONFIG_ARCH_IXP4XX
-#include ehci-ixp4xx.c
-#definePLATFORM_DRIVER ixp4xx_ehci_driver
-#endif
-
 #ifdef CONFIG_USB_W90X900_EHCI
 #include ehci-w90x900.c
 #definePLATFORM_DRIVER ehci_hcd_w90x900_driver
diff --git a/drivers/usb/host/ehci-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c
deleted file mode 100644
index f224c0a..000
--- a/drivers/usb/host/ehci-ixp4xx.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * IXP4XX EHCI Host Controller Driver
- *
- * Author: Vladimir Barinov vbari...@embeddedalley.com
- *
- * Based on ehci-fsl.c by Randy Vinson rvin...@mvista.com
- *
- * 2007 (c) MontaVista Software, Inc. This file is licensed under
- * the terms of the GNU General Public License version 2. This program
- * is licensed as is without any warranty of any kind, whether express
- * or implied.
- */
-
-#include linux/platform_device.h
-
-static int ixp4xx_ehci_init(struct usb_hcd *hcd)
-{
-   struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-   int retval = 0;
-
-   ehci-big_endian_desc = 1;
-   ehci-big_endian_mmio = 1;
-
-   ehci-caps = hcd-regs + 0x100;
-
-   hcd-has_tt = 1;
-
-   retval = ehci_setup(hcd);
-   if (retval)
-   return retval;
-
-   ehci_port_power(ehci, 0);
-
-   return retval;
-}
-
-static const struct hc_driver ixp4xx_ehci_hc_driver = {
-   .description= hcd_name,
-   .product_desc   = IXP4XX EHCI Host Controller,
-   .hcd_priv_size  = sizeof(struct ehci_hcd),
-   .irq= ehci_irq,
-   .flags  = HCD_MEMORY | HCD_USB2,
-   .reset  = ixp4xx_ehci_init,
-   .start  = ehci_run,
-   .stop   = ehci_stop,
-   .shutdown   = ehci_shutdown,
-   .urb_enqueue= ehci_urb_enqueue,
-   .urb_dequeue= ehci_urb_dequeue,
-   .endpoint_disable   = ehci_endpoint_disable,
-   .endpoint_reset = ehci_endpoint_reset,
-   .get_frame_number   = ehci_get_frame,
-   .hub_status_data= ehci_hub_status_data,
-   .hub_control= ehci_hub_control,
-#if defined(CONFIG_PM)
-   .bus_suspend= ehci_bus_suspend,
-   .bus_resume = ehci_bus_resume,
-#endif
-   .relinquish_port= ehci_relinquish_port,
-   .port_handed_over   = ehci_port_handed_over,
-
-   .clear_tt_buffer_complete   = ehci_clear_tt_buffer_complete,
-};
-
-static int ixp4xx_ehci_probe(struct platform_device *pdev)
-{
-   struct usb_hcd *hcd;
-   const struct hc_driver *driver = ixp4xx_ehci_hc_driver;
-   struct resource *res;
-   int irq;
-   int retval;
-
-   if (usb_disabled())
-   return -ENODEV;
-
-   res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-   if (!res) {
-   dev_err(pdev-dev,
-   Found HC with no IRQ. Check %s setup!\n,
-   dev_name(pdev-dev));
-   return -ENODEV;
-   }
-   irq = res-start;
-
-   hcd = usb_create_hcd(driver, pdev-dev, dev_name(pdev-dev));
-   if (!hcd) {
-   retval = -ENOMEM;
-   goto fail_create_hcd;
-   }
-
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res) {
-   dev_err(pdev-dev,
-   Found HC with no register addr. Check %s setup!\n,
-   dev_name(pdev-dev));
-   retval = -ENODEV;
-   goto fail_request_resource;
-   }
-   hcd-rsrc_start = res-start;
-   hcd-rsrc_len = resource_size(res);
-
-   hcd-regs = devm_request_and_ioremap(pdev-dev, res);
-   if (hcd-regs == NULL) {
-   dev_dbg(pdev-dev, error mapping memory\n);
-   retval = -EFAULT;
-   goto fail_request_resource;
-   }
-
-   retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
-   if (retval)
-   goto fail_request_resource;
-
-   return retval;
-
-fail_request_resource:
-   usb_put_hcd(hcd);
-fail_create_hcd:
-   dev_err(pdev-dev, init %s fail, %d\n, dev_name(pdev-dev), retval);
-   return retval;
-}
-
-static int 

[PATCH 02/24 v2] MIPS: Loongson 1B: use ehci-platform instead of ehci-ls1x.

2012-10-04 Thread Florian Fainelli
The Loongson 1B EHCI driver does nothing more than what the EHCI platform
driver already does, so use the generic implementation.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
No changes since v1

 arch/mips/configs/ls1b_defconfig  |1 +
 arch/mips/loongson1/common/platform.c |8 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/mips/configs/ls1b_defconfig b/arch/mips/configs/ls1b_defconfig
index 80cff8b..7eb7554 100644
--- a/arch/mips/configs/ls1b_defconfig
+++ b/arch/mips/configs/ls1b_defconfig
@@ -76,6 +76,7 @@ CONFIG_HID_GENERIC=m
 CONFIG_USB=y
 CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_HCD_PLATFORM=y
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
 CONFIG_USB_STORAGE=m
 CONFIG_USB_SERIAL=m
diff --git a/arch/mips/loongson1/common/platform.c 
b/arch/mips/loongson1/common/platform.c
index e92d59c..2874bf2 100644
--- a/arch/mips/loongson1/common/platform.c
+++ b/arch/mips/loongson1/common/platform.c
@@ -13,6 +13,7 @@
 #include linux/phy.h
 #include linux/serial_8250.h
 #include linux/stmmac.h
+#include linux/usb/ehci_pdriver.h
 #include asm-generic/sizes.h
 
 #include loongson1.h
@@ -107,13 +108,18 @@ static struct resource ls1x_ehci_resources[] = {
},
 };
 
+static struct usb_ehci_pdata ls1x_ehci_pdata = {
+   .port_power_off = 1,
+};
+
 struct platform_device ls1x_ehci_device = {
-   .name   = ls1x-ehci,
+   .name   = ehci-platform,
.id = -1,
.num_resources  = ARRAY_SIZE(ls1x_ehci_resources),
.resource   = ls1x_ehci_resources,
.dev= {
.dma_mask = ls1x_ehci_dmamask,
+   .platform_data = ls1x_ehci_pdata,
},
 };
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/24 v2] USB: EHCI: remove Netlogic XLS EHCI driver

2012-10-04 Thread Florian Fainelli
The platform code has been migrated to register the ehci-platform driver, thus
obsoleting the ehci-xls driver, which can be removed.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
Changes since v1:
- reworded commit message

 drivers/usb/host/ehci-hcd.c |5 --
 drivers/usb/host/ehci-xls.c |  142 ---
 2 files changed, 147 deletions(-)
 delete mode 100644 drivers/usb/host/ehci-xls.c

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 2f517d9..f2a9982 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1309,11 +1309,6 @@ MODULE_LICENSE (GPL);
 #define PLATFORM_DRIVERehci_grlib_driver
 #endif
 
-#ifdef CONFIG_CPU_XLR
-#include ehci-xls.c
-#define PLATFORM_DRIVERehci_xls_driver
-#endif
-
 #ifdef CONFIG_USB_EHCI_MV
 #include ehci-mv.c
 #definePLATFORM_DRIVER ehci_mv_driver
diff --git a/drivers/usb/host/ehci-xls.c b/drivers/usb/host/ehci-xls.c
deleted file mode 100644
index 8dc6a22..000
--- a/drivers/usb/host/ehci-xls.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * EHCI HCD for Netlogic XLS processors.
- *
- * (C) Copyright 2011 Netlogic Microsystems Inc.
- *
- *  Based on various ehci-*.c drivers
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file COPYING in the main directory of this archive for
- * more details.
- */
-
-#include linux/platform_device.h
-
-static int ehci_xls_setup(struct usb_hcd *hcd)
-{
-   struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-
-   ehci-caps = hcd-regs;
-
-   return ehci_setup(hcd);
-}
-
-int ehci_xls_probe_internal(const struct hc_driver *driver,
-   struct platform_device *pdev)
-{
-   struct usb_hcd  *hcd;
-   struct resource *res;
-   int retval, irq;
-
-   /* Get our IRQ from an earlier registered Platform Resource */
-   irq = platform_get_irq(pdev, 0);
-   if (irq  0) {
-   dev_err(pdev-dev, Found HC with no IRQ. Check %s setup!\n,
-   dev_name(pdev-dev));
-   return -ENODEV;
-   }
-
-   /* Get our Memory Handle */
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res) {
-   dev_err(pdev-dev, Error: MMIO Handle %s setup!\n,
-   dev_name(pdev-dev));
-   return -ENODEV;
-   }
-   hcd = usb_create_hcd(driver, pdev-dev, dev_name(pdev-dev));
-   if (!hcd) {
-   retval = -ENOMEM;
-   goto err1;
-   }
-
-   hcd-rsrc_start = res-start;
-   hcd-rsrc_len = resource_size(res);
-
-   if (!request_mem_region(hcd-rsrc_start, hcd-rsrc_len,
-   driver-description)) {
-   dev_dbg(pdev-dev, controller already in use\n);
-   retval = -EBUSY;
-   goto err2;
-   }
-   hcd-regs = ioremap_nocache(hcd-rsrc_start, hcd-rsrc_len);
-
-   if (hcd-regs == NULL) {
-   dev_dbg(pdev-dev, error mapping memory\n);
-   retval = -EFAULT;
-   goto err3;
-   }
-
-   retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
-   if (retval != 0)
-   goto err4;
-   return retval;
-
-err4:
-   iounmap(hcd-regs);
-err3:
-   release_mem_region(hcd-rsrc_start, hcd-rsrc_len);
-err2:
-   usb_put_hcd(hcd);
-err1:
-   dev_err(pdev-dev, init %s fail, %d\n, dev_name(pdev-dev),
-   retval);
-   return retval;
-}
-
-static struct hc_driver ehci_xls_hc_driver = {
-   .description= hcd_name,
-   .product_desc   = XLS EHCI Host Controller,
-   .hcd_priv_size  = sizeof(struct ehci_hcd),
-   .irq= ehci_irq,
-   .flags  = HCD_USB2 | HCD_MEMORY,
-   .reset  = ehci_xls_setup,
-   .start  = ehci_run,
-   .stop   = ehci_stop,
-   .shutdown   = ehci_shutdown,
-
-   .urb_enqueue= ehci_urb_enqueue,
-   .urb_dequeue= ehci_urb_dequeue,
-   .endpoint_disable = ehci_endpoint_disable,
-   .endpoint_reset = ehci_endpoint_reset,
-
-   .get_frame_number = ehci_get_frame,
-
-   .hub_status_data = ehci_hub_status_data,
-   .hub_control= ehci_hub_control,
-   .bus_suspend= ehci_bus_suspend,
-   .bus_resume = ehci_bus_resume,
-   .relinquish_port = ehci_relinquish_port,
-   .port_handed_over = ehci_port_handed_over,
-
-   .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
-};
-
-static int ehci_xls_probe(struct platform_device *pdev)
-{
-   if (usb_disabled())
-   return -ENODEV;
-
-   return ehci_xls_probe_internal(ehci_xls_hc_driver, pdev);
-}
-
-static int ehci_xls_remove(struct platform_device *pdev)
-{
-   struct usb_hcd *hcd = platform_get_drvdata(pdev);
-
-   usb_remove_hcd(hcd);
-   iounmap(hcd-regs);
-   release_mem_region(hcd-rsrc_start, hcd-rsrc_len);
-   

[PATCH 07/24 v2] MIPS: Alchemy: use the ehci platform driver

2012-10-04 Thread Florian Fainelli
Use the ehci platform driver power_{on,suspend,off} callbacks to perform the
USB block gate enabling/disabling as what the ehci-au1xxx.c driver does.
Update the db1200 and db1300 defconfigs to now select the EHCI platform
driver.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
Changes since v1:
- update impacted alchemy defconfigs accordingly

 arch/mips/alchemy/common/platform.c |   23 ++-
 arch/mips/configs/db1200_defconfig  |1 +
 arch/mips/configs/db1300_defconfig  |1 +
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/arch/mips/alchemy/common/platform.c 
b/arch/mips/alchemy/common/platform.c
index c0f3ce6..b9a5f6d 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -17,6 +17,7 @@
 #include linux/platform_device.h
 #include linux/serial_8250.h
 #include linux/slab.h
+#include linux/usb/ehci_pdriver.h
 
 #include asm/mach-au1x00/au1000.h
 #include asm/mach-au1x00/au1xxx_dbdma.h
@@ -122,6 +123,25 @@ static void __init alchemy_setup_uarts(int ctype)
 static u64 alchemy_ohci_dmamask = DMA_BIT_MASK(32);
 static u64 __maybe_unused alchemy_ehci_dmamask = DMA_BIT_MASK(32);
 
+/* Power on callback for the ehci platform driver */
+static int alchemy_ehci_power_on(struct platform_device *pdev)
+{
+   return alchemy_usb_control(ALCHEMY_USB_EHCI0, 1);
+}
+
+/* Power off/suspend callback for the ehci platform driver */
+static void alchemy_ehci_power_off(struct platform_device *pdev)
+{
+   alchemy_usb_control(ALCHEMY_USB_EHCI0, 0);
+}
+
+static struct usb_ehci_pdata alchemy_ehci_pdata = {
+   .no_io_watchdog = 1,
+   .power_on   = alchemy_ehci_power_on,
+   .power_off  = alchemy_ehci_power_off,
+   .power_suspend  = alchemy_ehci_power_off,
+};
+
 static unsigned long alchemy_ohci_data[][2] __initdata = {
[ALCHEMY_CPU_AU1000] = { AU1000_USB_OHCI_PHYS_ADDR, AU1000_USB_HOST_INT 
},
[ALCHEMY_CPU_AU1500] = { AU1000_USB_OHCI_PHYS_ADDR, AU1500_USB_HOST_INT 
},
@@ -188,9 +208,10 @@ static void __init alchemy_setup_usb(int ctype)
res[1].start = alchemy_ehci_data[ctype][1];
res[1].end = res[1].start;
res[1].flags = IORESOURCE_IRQ;
-   pdev-name = au1xxx-ehci;
+   pdev-name = ehci-platform;
pdev-id = 0;
pdev-dev.dma_mask = alchemy_ehci_dmamask;
+   pdev-dev.platform_data = alchemy_ehci_pdata;
 
if (platform_device_register(pdev))
printk(KERN_INFO Alchemy USB: cannot add EHCI0\n);
diff --git a/arch/mips/configs/db1200_defconfig 
b/arch/mips/configs/db1200_defconfig
index 1f69249..d31ac85 100644
--- a/arch/mips/configs/db1200_defconfig
+++ b/arch/mips/configs/db1200_defconfig
@@ -117,6 +117,7 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
 # CONFIG_USB_DEVICE_CLASS is not set
 CONFIG_USB_DYNAMIC_MINORS=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_HCD_PLATFORM=y
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 CONFIG_USB_OHCI_HCD=y
 CONFIG_MMC=y
diff --git a/arch/mips/configs/db1300_defconfig 
b/arch/mips/configs/db1300_defconfig
index 3590ab5..717e7b2 100644
--- a/arch/mips/configs/db1300_defconfig
+++ b/arch/mips/configs/db1300_defconfig
@@ -288,6 +288,7 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 CONFIG_USB=y
 CONFIG_USB_DYNAMIC_MINORS=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_HCD_PLATFORM=y
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 CONFIG_USB_EHCI_TT_NEWSCHED=y
 CONFIG_USB_OHCI_HCD=y
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/24] USB: ohci: move ohci_pci_{suspend,resume} to ohci-hcd.c

2012-10-04 Thread Florian Fainelli
As suggested by Alan Stern, move the ohci-pci.c ohci_pci_{suspend,resume}
routines to ohci-hcd.c. Due to their move, also rename them to
ohci_{suspend,resume} to make it clear they operate on ohci_hcd. Since they
are not necessarily called, annotate them with __maybe_unused.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
 drivers/usb/host/ohci-hcd.c |   39 +++
 drivers/usb/host/ohci-pci.c |   43 ++-
 2 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 2b1e8d8..0cba8d6 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -981,6 +981,45 @@ static int ohci_restart (struct ohci_hcd *ohci)
return 0;
 }
 
+static int __maybe_unused ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
+{
+   struct ohci_hcd *ohci = hcd_to_ohci (hcd);
+   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;
+   }
+   ohci_writel(ohci, OHCI_INTR_MIE, ohci-regs-intrdisable);
+   (void)ohci_readl(ohci, ohci-regs-intrdisable);
+
+   clear_bit(HCD_FLAG_HW_ACCESSIBLE, hcd-flags);
+ bail:
+   spin_unlock_irqrestore (ohci-lock, flags);
+
+   return rc;
+}
+
+
+static int __maybe_unused ohci_resume(struct usb_hcd *hcd, bool hibernated)
+{
+   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_finish_controller_resume(hcd);
+   return 0;
+}
+
 #endif
 
 /*-*/
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index 1843bb6..926f08b 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -298,45 +298,6 @@ static int __devinit ohci_pci_start (struct usb_hcd *hcd)
 
 #ifdef CONFIG_PM
 
-static int ohci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
-{
-   struct ohci_hcd *ohci = hcd_to_ohci (hcd);
-   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;
-   }
-   ohci_writel(ohci, OHCI_INTR_MIE, ohci-regs-intrdisable);
-   (void)ohci_readl(ohci, ohci-regs-intrdisable);
-
-   clear_bit(HCD_FLAG_HW_ACCESSIBLE, hcd-flags);
- bail:
-   spin_unlock_irqrestore (ohci-lock, flags);
-
-   return rc;
-}
-
-
-static int ohci_pci_resume(struct usb_hcd *hcd, bool hibernated)
-{
-   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_finish_controller_resume(hcd);
-   return 0;
-}
-
 #endif /* CONFIG_PM */
 
 
@@ -362,8 +323,8 @@ static const struct hc_driver ohci_pci_hc_driver = {
.shutdown = ohci_shutdown,
 
 #ifdef CONFIG_PM
-   .pci_suspend =  ohci_pci_suspend,
-   .pci_resume =   ohci_pci_resume,
+   .pci_suspend =  ohci_suspend,
+   .pci_resume =   ohci_resume,
 #endif
 
/*
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/24] USB: ohci: remove check for RH already suspended in ohci_suspend

2012-10-04 Thread Florian Fainelli
As suggested by Alan Stern, the code checking for the OHCI Root Hub already
suspended is no longer required since the bug it fixes has not been seen in
ages, remove that check making ohci_suspend much simpler.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
 drivers/usb/host/ohci-hcd.c |   11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 0cba8d6..5d30992 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -985,26 +985,19 @@ static int __maybe_unused ohci_suspend(struct usb_hcd 
*hcd, bool do_wakeup)
 {
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
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
+   /* Disable irq emission and mark HW unaccessible. 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;
-   }
ohci_writel(ohci, OHCI_INTR_MIE, ohci-regs-intrdisable);
(void)ohci_readl(ohci, ohci-regs-intrdisable);
 
clear_bit(HCD_FLAG_HW_ACCESSIBLE, hcd-flags);
- bail:
spin_unlock_irqrestore (ohci-lock, flags);
 
-   return rc;
+   return 0;
 }
 
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/24 v2] ARM: cns3xxx: use ehci platform driver

2012-10-04 Thread Florian Fainelli
Signed-off-by: Florian Fainelli flor...@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 at 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

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/24 v2] USB: EHCI: add no_io_watchdog platform_data parameter to ehci-platform

2012-10-04 Thread Florian Fainelli
Enhance the ehci-platform driver to also accept no_io_watchdog as a platform
data parameter. When no_io_watchdog is set to 1, the ehci controller will set
ehci-need_io_watchdog to 0. Since most EHCI controllers do need the I/O
watchdog to be on, only let those which need it to turn the watchdog off.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
Changes since v1:
- reworked patch to introduce no_io_watchdog instead of need_io_watchdog
- reworded commit message accordingly

 drivers/usb/host/ehci-platform.c |2 ++
 include/linux/usb/ehci_pdriver.h |3 +++
 2 files changed, 5 insertions(+)

diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index 764e010..83b486e 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -32,6 +32,8 @@ static int ehci_platform_reset(struct usb_hcd *hcd)
ehci-has_synopsys_hc_bug = pdata-has_synopsys_hc_bug;
ehci-big_endian_desc = pdata-big_endian_desc;
ehci-big_endian_mmio = pdata-big_endian_mmio;
+   if (pdata-no_io_watchdog)
+   ehci-need_io_watchdog = 0;
 
ehci-caps = hcd-regs + pdata-caps_offset;
retval = ehci_setup(hcd);
diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h
index c9d09f8..67ac74b 100644
--- a/include/linux/usb/ehci_pdriver.h
+++ b/include/linux/usb/ehci_pdriver.h
@@ -29,6 +29,8 @@
  * initialization.
  * @port_power_off:set to 1 if the controller needs to be powered down
  * after initialization.
+ * @no_io_watchdog:set to 1 if the controller does not need the I/O
+ * watchdog to run.
  *
  * These are general configuration options for the EHCI controller. All of
  * these options are activating more or less workarounds for some hardware.
@@ -41,6 +43,7 @@ struct usb_ehci_pdata {
unsignedbig_endian_mmio:1;
unsignedport_power_on:1;
unsignedport_power_off:1;
+   unsignedno_io_watchdog:1;
 
/* Turn on all power and clocks */
int (*power_on)(struct platform_device *pdev);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/24 v2] USB: EHCI: remove Loongson 1B EHCI driver.

2012-10-04 Thread Florian Fainelli
The platform code registering the Loongson 1B EHCI driver has now been
converted to register the ehci-platform driver instead, thus obsoleting the
ehci-ls1x driver, which can be removed.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
Changes since v1:
- reworded commit message

 drivers/usb/host/ehci-hcd.c  |5 --
 drivers/usb/host/ehci-ls1x.c |  147 --
 2 files changed, 152 deletions(-)
 delete mode 100644 drivers/usb/host/ehci-ls1x.c

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 442f774..2f517d9 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1319,11 +1319,6 @@ MODULE_LICENSE (GPL);
 #definePLATFORM_DRIVER ehci_mv_driver
 #endif
 
-#ifdef CONFIG_MACH_LOONGSON1
-#include ehci-ls1x.c
-#define PLATFORM_DRIVERehci_ls1x_driver
-#endif
-
 #ifdef CONFIG_MIPS_SEAD3
 #include ehci-sead3.c
 #definePLATFORM_DRIVER ehci_hcd_sead3_driver
diff --git a/drivers/usb/host/ehci-ls1x.c b/drivers/usb/host/ehci-ls1x.c
deleted file mode 100644
index ca75965..000
--- a/drivers/usb/host/ehci-ls1x.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- *  Bus Glue for Loongson LS1X built-in EHCI controller.
- *
- *  Copyright (c) 2012 Zhang, Keguang keguang.zh...@gmail.com
- *
- *  This program is free software; you can redistribute it and/or modify it
- *  under the terms of the GNU General Public License version 2 as published
- *  by the Free Software Foundation.
- */
-
-
-#include linux/platform_device.h
-
-static int ehci_ls1x_reset(struct usb_hcd *hcd)
-{
-   struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-   int ret;
-
-   ehci-caps = hcd-regs;
-
-   ret = ehci_setup(hcd);
-   if (ret)
-   return ret;
-
-   ehci_port_power(ehci, 0);
-
-   return 0;
-}
-
-static const struct hc_driver ehci_ls1x_hc_driver = {
-   .description= hcd_name,
-   .product_desc   = LOONGSON1 EHCI,
-   .hcd_priv_size  = sizeof(struct ehci_hcd),
-
-   /*
-* generic hardware linkage
-*/
-   .irq= ehci_irq,
-   .flags  = HCD_MEMORY | HCD_USB2,
-
-   /*
-* basic lifecycle operations
-*/
-   .reset  = ehci_ls1x_reset,
-   .start  = ehci_run,
-   .stop   = ehci_stop,
-   .shutdown   = ehci_shutdown,
-
-   /*
-* managing i/o requests and associated device resources
-*/
-   .urb_enqueue= ehci_urb_enqueue,
-   .urb_dequeue= ehci_urb_dequeue,
-   .endpoint_disable   = ehci_endpoint_disable,
-   .endpoint_reset = ehci_endpoint_reset,
-
-   /*
-* scheduling support
-*/
-   .get_frame_number   = ehci_get_frame,
-
-   /*
-* root hub support
-*/
-   .hub_status_data= ehci_hub_status_data,
-   .hub_control= ehci_hub_control,
-   .relinquish_port= ehci_relinquish_port,
-   .port_handed_over   = ehci_port_handed_over,
-
-   .clear_tt_buffer_complete   = ehci_clear_tt_buffer_complete,
-};
-
-static int ehci_hcd_ls1x_probe(struct platform_device *pdev)
-{
-   struct usb_hcd *hcd;
-   struct resource *res;
-   int irq;
-   int ret;
-
-   pr_debug(initializing loongson1 ehci USB Controller\n);
-
-   if (usb_disabled())
-   return -ENODEV;
-
-   res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-   if (!res) {
-   dev_err(pdev-dev,
-   Found HC with no IRQ. Check %s setup!\n,
-   dev_name(pdev-dev));
-   return -ENODEV;
-   }
-   irq = res-start;
-
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res) {
-   dev_err(pdev-dev,
-   Found HC with no register addr. Check %s setup!\n,
-   dev_name(pdev-dev));
-   return -ENODEV;
-   }
-
-   hcd = usb_create_hcd(ehci_ls1x_hc_driver, pdev-dev,
-   dev_name(pdev-dev));
-   if (!hcd)
-   return -ENOMEM;
-   hcd-rsrc_start = res-start;
-   hcd-rsrc_len   = resource_size(res);
-
-   hcd-regs = devm_request_and_ioremap(pdev-dev, res);
-   if (hcd-regs == NULL) {
-   dev_dbg(pdev-dev, error mapping memory\n);
-   ret = -EFAULT;
-   goto err_put_hcd;
-   }
-
-   ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
-   if (ret)
-   goto err_put_hcd;
-
-   return ret;
-
-err_put_hcd:
-   usb_put_hcd(hcd);
-   return ret;
-}
-
-static int ehci_hcd_ls1x_remove(struct platform_device *pdev)
-{
-   struct usb_hcd *hcd = platform_get_drvdata(pdev);
-
-   usb_remove_hcd(hcd);
-   usb_put_hcd(hcd);
-
-   return 0;
-}
-
-static struct 

[PATCH v4] Enable USB peripheral on dm365 EVM

2012-10-04 Thread Constantine Shulyupin
From: Constantine Shulyupin co...@makelinux.com

Signed-off-by: Constantine Shulyupin co...@makelinux.com
---

Note:

USBPHY_CTL_PADDR and USBPHY_CLKFREQ_24MHZ are defined in board-dm365-evm.c 
because davinci.h can't be included from drivers/usb/musb/. May be davinci.h 
should be renamed and moved to arch/arm/mach-davinci/include/mach/usb.h like 
arch/arm/plat-omap/include/plat/usb.h

Tested with usb gadget g_zero.

Changelog 

Changes since v3 http://www.spinics.net/lists/kernel/msg1412544.html:
- removed optional altering of pr_info

Changes since v2 http://article.gmane.org/gmane.linux.kernel/1159868/
- reordered code
- removed alternation of GPIO33, which is multiplexed with DRVVBUS, because is 
not need for peripheral USB

Changes since v1 http://marc.info/?l=linux-kernelm=130894150803661w=2:
- removed optional code and reordered

This patch is based on code from Arago, Angstom, and RidgeRun projects.
Original patch by miguel.agui...@ridgerun.com is three years ago:
- 
http://www.mail-archive.com/davinci-linux-open-source@linux.davincidsp.com/msg14741.html

---
 arch/arm/mach-davinci/board-dm365-evm.c |8 
 arch/arm/mach-davinci/usb.c |2 ++
 drivers/usb/musb/davinci.h  |1 +
 drivers/usb/musb/musb_core.c|   20 
 4 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm365-evm.c 
b/arch/arm/mach-davinci/board-dm365-evm.c
index 3a4743b..dfcb67f 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -38,6 +38,8 @@
 #include mach/mmc.h
 #include mach/nand.h
 #include mach/keyscan.h
+#include mach/usb.h
+#include mach/hardware.h
 
 #include media/tvp514x.h
 
@@ -92,6 +94,9 @@ static inline int have_tvp7002(void)
 #define CPLD_CCD_DIR3  CPLD_OFFSET(0x3f,0)
 #define CPLD_CCD_IO3   CPLD_OFFSET(0x3f,1)
 
+#define USBPHY_CTL_PADDR   0x01c40034
+#define USBPHY_CLKFREQ_24MHZ   BIT(13)
+
 static void __iomem *cpld;
 
 
@@ -613,6 +618,9 @@ static __init void dm365_evm_init(void)
 
dm365_init_spi0(BIT(0), dm365_evm_spi_info,
ARRAY_SIZE(dm365_evm_spi_info));
+   writel(readl(IO_ADDRESS(USBPHY_CTL_PADDR)) | USBPHY_CLKFREQ_24MHZ,
+   IO_ADDRESS(USBPHY_CTL_PADDR));
+   davinci_setup_usb(500, 8);
 }
 
 MACHINE_START(DAVINCI_DM365_EVM, DaVinci DM365 EVM)
diff --git a/arch/arm/mach-davinci/usb.c b/arch/arm/mach-davinci/usb.c
index 23d2b6d..664c689 100644
--- a/arch/arm/mach-davinci/usb.c
+++ b/arch/arm/mach-davinci/usb.c
@@ -49,6 +49,8 @@ static struct musb_hdrc_platform_data usb_data = {
.mode   = MUSB_PERIPHERAL,
 #elif defined(CONFIG_USB_MUSB_HOST)
.mode   = MUSB_HOST,
+#else
+   .mode   = MUSB_OTG,
 #endif
.clock  = usb,
.config = musb_config,
diff --git a/drivers/usb/musb/davinci.h b/drivers/usb/musb/davinci.h
index 371baa0..e737d97 100644
--- a/drivers/usb/musb/davinci.h
+++ b/drivers/usb/musb/davinci.h
@@ -16,6 +16,7 @@
 
 /* Integrated highspeed/otg PHY */
 #define USBPHY_CTL_PADDR   0x01c40034
+#define USBPHY_CLKFREQ_24MHZ   BIT(13)
 #define USBPHY_DATAPOL BIT(11) /* (dm355) switch D+/D- */
 #define USBPHY_PHYCLKGDBIT(8)
 #define USBPHY_SESNDEN BIT(7)  /* v(sess_end) comparator */
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 26f1bef..277fe65 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2051,9 +2051,17 @@ musb_init_controller(struct device *dev, int nIrq, void 
__iomem *ctrl)
dev_info(dev, USB %s mode controller at %p using %s, IRQ %d\n,
({char *s;
 switch (musb-board_mode) {
-case MUSB_HOST:s = Host; break;
-case MUSB_PERIPHERAL:  s = Peripheral; break;
-default:   s = OTG; break;
+case MUSB_HOST:
+   s = Host;
+break;
+case MUSB_PERIPHERAL:
+   s = Peripheral;
+break;
+case MUSB_OTG:
+   s = OTG;
+break;
+default:
+   s = Undefined;
 }; s; }),
ctrl,
(is_dma_capable()  musb-dma_controller)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Dead lock in ehci hcd (3.5.3) with usb-serial adapters.

2012-10-04 Thread Alan Stern
On Thu, 4 Oct 2012, jx chang wrote:

 Hi, all,
 
 Recently I get a dead lock in ehci_hcd and hope someone can look at my 
 analysis.
 
 The symptom is:
 
 When I set loglevel=8 in command line and set console=ttyUSB0,
 115200n8..., and connect a usb-serial adapter to my target device (a
 tablet running kernel 3.5.3 with several other changes but I guess
 ehci parts should be same as mainstream), the device is dead withing
 several seconds after reboot.
 
 I wrote a small program in user space to dump to disk and enabled
 several debug options in kernel configuration.
 
 The result is the dead lock caught in ehci_hcd as below backtrace
 shows. My analysis is when a function driver submits a urb to ehci_hcd
 in a process, it will finally grab the spin lock ehci-lock in
 functions called by ehci_urb_enqueue() to do the job, but it seems
 some lower layer will print out echi's debug information in the
 further steps. If console is set to a usb-serial adapter and loglevel
 is big enough to allow these debug messages out, the prink() just
 output log to the user-serial module which should be a function driver
 based on ehci_hcd stack. Then a new sequence of urb submitting starts
 and calls the same ehci_urb_enqueue() again. The result is the same
 process will try to get the ehci-lock it has held.
 
 Does my analysis make sense? any good solutions if it is so?

Yep, that sounds right.

The solution is: Don't do that!  USB doesn't make for a very good
console device (Greg KH is fond of pointing out that the original
version was written late one night as the result of a drunken bet).

The same deadlock will occur no matter which USB host controller driver 
you use, by the way.  There's nothing special about ehci-hcd.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] musb : remove generic_interrupt and have all drivers define the isr on their own. Remove some unneeded CONFIG_SOC_OMAP_3430 instances

2012-10-04 Thread Philippe De Swert
This patch is based on the discussion of a previous patch to fix an issue
where the omap2430 musb driver is not working for N9/N950.

Moving all the interrupt handling to the devices. Avoids inclusion of generic
interrupt and breakage due to sometimes misleading CONFIG options. This makes 
sure usb always works if on of the subdrivers is chosen. Tested on Nokia 
N9/N950. 

Partially clean up CONFIG_SOC_OMAP3430 which is not necessary in the cases
where I removed it. Also helps with the removal work of those options that 
Tony Lindgren predicted would happen at some point.

Signed-off-by: Philippe De Swert philippe.desw...@jollamobile.com
---
 drivers/usb/musb/musb_core.c |   31 ++-
 drivers/usb/musb/musbhsdma.h |4 
 drivers/usb/musb/omap2430.c  |   22 ++
 drivers/usb/musb/ux500.c |   22 ++
 4 files changed, 46 insertions(+), 33 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 26f1bef..37c770e 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1498,33 +1498,6 @@ static int __devinit musb_core_init(u16 musb_type, 
struct musb *musb)
 
 /*-*/
 
-#if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430) || \
-   defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_ARCH_U8500)
-
-static irqreturn_t generic_interrupt(int irq, void *__hci)
-{
-   unsigned long   flags;
-   irqreturn_t retval = IRQ_NONE;
-   struct musb *musb = __hci;
-
-   spin_lock_irqsave(musb-lock, flags);
-
-   musb-int_usb = musb_readb(musb-mregs, MUSB_INTRUSB);
-   musb-int_tx = musb_readw(musb-mregs, MUSB_INTRTX);
-   musb-int_rx = musb_readw(musb-mregs, MUSB_INTRRX);
-
-   if (musb-int_usb || musb-int_tx || musb-int_rx)
-   retval = musb_interrupt(musb);
-
-   spin_unlock_irqrestore(musb-lock, flags);
-
-   return retval;
-}
-
-#else
-#define generic_interrupt  NULL
-#endif
-
 /*
  * handle all the irqs defined by the HDRC core. for now we expect:  other
  * irq sources (phy, dma, etc) will be handled first, musb-int_* values
@@ -1907,7 +1880,8 @@ musb_init_controller(struct device *dev, int nIrq, void 
__iomem *ctrl)
musb-ops = plat-platform_ops;
 
/* The musb_platform_init() call:
-*   - adjusts musb-mregs and musb-isr if needed,
+*   - adjusts musb-mregs
+*   - sets the musb-isr
 *   - may initialize an integrated tranceiver
 *   - initializes musb-xceiv, usually by otg_get_phy()
 *   - stops powering VBUS
@@ -1917,7 +1891,6 @@ musb_init_controller(struct device *dev, int nIrq, void 
__iomem *ctrl)
 * external/discrete ones in various flavors (twl4030 family,
 * isp1504, non-OTG, etc) mostly hooking up through ULPI.
 */
-   musb-isr = generic_interrupt;
status = musb_platform_init(musb);
if (status  0)
goto fail1;
diff --git a/drivers/usb/musb/musbhsdma.h b/drivers/usb/musb/musbhsdma.h
index 320fd4a..f7b13fd2 100644
--- a/drivers/usb/musb/musbhsdma.h
+++ b/drivers/usb/musb/musbhsdma.h
@@ -31,10 +31,6 @@
  *
  */
 
-#if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430)
-#include omap2430.h
-#endif
-
 #ifndef CONFIG_BLACKFIN
 
 #define MUSB_HSDMA_BASE0x200
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 5fdb9da..c63aea8 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -306,6 +306,26 @@ static void omap_musb_mailbox_work(struct work_struct 
*mailbox_work)
omap_musb_set_mailbox(glue);
 }
 
+static irqreturn_t omap2430_musb_interrupt(int irq, void *__hci)
+{
+   unsigned long   flags;
+   irqreturn_t retval = IRQ_NONE;
+   struct musb *musb = __hci;
+
+   spin_lock_irqsave(musb-lock, flags);
+
+   musb-int_usb = musb_readb(musb-mregs, MUSB_INTRUSB);
+   musb-int_tx = musb_readw(musb-mregs, MUSB_INTRTX);
+   musb-int_rx = musb_readw(musb-mregs, MUSB_INTRRX);
+
+   if (musb-int_usb || musb-int_tx || musb-int_rx)
+   retval = musb_interrupt(musb);
+
+   spin_unlock_irqrestore(musb-lock, flags);
+
+   return retval;
+}
+
 static int omap2430_musb_init(struct musb *musb)
 {
u32 l;
@@ -325,6 +345,8 @@ static int omap2430_musb_init(struct musb *musb)
return -ENODEV;
}
 
+   musb-isr = omap2430_musb_interrupt;
+
status = pm_runtime_get_sync(dev);
if (status  0) {
dev_err(dev, pm_runtime_get_sync FAILED %d\n, status);
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index a8c0fad..bce5574 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -36,6 +36,26 @@ struct ux500_glue {
 };
 #define glue_to_musb(g)platform_get_drvdata(g-musb)
 
+static irqreturn_t ux500_musb_interrupt(int 

Re: [PATCH v4] Enable USB peripheral on dm365 EVM

2012-10-04 Thread Greg KH
On Thu, Oct 04, 2012 at 06:22:33PM +0200, Constantine Shulyupin wrote:
 From: Constantine Shulyupin co...@makelinux.com
 
 Signed-off-by: Constantine Shulyupin co...@makelinux.com
 ---
 
 Note:
 
 USBPHY_CTL_PADDR and USBPHY_CLKFREQ_24MHZ are defined in board-dm365-evm.c 
 because davinci.h can't be included from drivers/usb/musb/. May be davinci.h 
 should be renamed and moved to arch/arm/mach-davinci/include/mach/usb.h like 
 arch/arm/plat-omap/include/plat/usb.h
 
 Tested with usb gadget g_zero.
 
 Changelog 
 
 Changes since v3 http://www.spinics.net/lists/kernel/msg1412544.html:
 - removed optional altering of pr_info
 
 Changes since v2 http://article.gmane.org/gmane.linux.kernel/1159868/
 - reordered code
 - removed alternation of GPIO33, which is multiplexed with DRVVBUS, because 
 is not need for peripheral USB
 
 Changes since v1 http://marc.info/?l=linux-kernelm=130894150803661w=2:
 - removed optional code and reordered
 
 This patch is based on code from Arago, Angstom, and RidgeRun projects.
 Original patch by miguel.agui...@ridgerun.com is three years ago:
 - 
 http://www.mail-archive.com/davinci-linux-open-source@linux.davincidsp.com/msg14741.html

Almost all of the information you put below the --- line here, should be
above it, saying where the code originally came from, and most
importantly, what exactly this patch does, and for what hardware.  Your
one-line Subject really isn't that descriptive at all.

 --- a/drivers/usb/musb/musb_core.c
 +++ b/drivers/usb/musb/musb_core.c
 @@ -2051,9 +2051,17 @@ musb_init_controller(struct device *dev, int nIrq, 
 void __iomem *ctrl)
   dev_info(dev, USB %s mode controller at %p using %s, IRQ %d\n,
   ({char *s;
switch (musb-board_mode) {
 -  case MUSB_HOST:s = Host; break;
 -  case MUSB_PERIPHERAL:  s = Peripheral; break;
 -  default:   s = OTG; break;
 +  case MUSB_HOST:
 + s = Host;
 +  break;
 +  case MUSB_PERIPHERAL:
 + s = Peripheral;
 +  break;
 +  case MUSB_OTG:
 + s = OTG;
 +  break;
 +  default:
 + s = Undefined;

Is this change really needed to get your hardware working?  Shouldn't it
be a separate patch?

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Dead lock in ehci hcd (3.5.3) with usb-serial adapters.

2012-10-04 Thread Greg KH
On Thu, Oct 04, 2012 at 12:52:24PM -0400, Alan Stern wrote:
 On Thu, 4 Oct 2012, jx chang wrote:
 
  Hi, all,
  
  Recently I get a dead lock in ehci_hcd and hope someone can look at my 
  analysis.
  
  The symptom is:
  
  When I set loglevel=8 in command line and set console=ttyUSB0,
  115200n8..., and connect a usb-serial adapter to my target device (a
  tablet running kernel 3.5.3 with several other changes but I guess
  ehci parts should be same as mainstream), the device is dead withing
  several seconds after reboot.
  
  I wrote a small program in user space to dump to disk and enabled
  several debug options in kernel configuration.
  
  The result is the dead lock caught in ehci_hcd as below backtrace
  shows. My analysis is when a function driver submits a urb to ehci_hcd
  in a process, it will finally grab the spin lock ehci-lock in
  functions called by ehci_urb_enqueue() to do the job, but it seems
  some lower layer will print out echi's debug information in the
  further steps. If console is set to a usb-serial adapter and loglevel
  is big enough to allow these debug messages out, the prink() just
  output log to the user-serial module which should be a function driver
  based on ehci_hcd stack. Then a new sequence of urb submitting starts
  and calls the same ehci_urb_enqueue() again. The result is the same
  process will try to get the ehci-lock it has held.
  
  Does my analysis make sense? any good solutions if it is so?
 
 Yep, that sounds right.
 
 The solution is: Don't do that!  USB doesn't make for a very good
 console device (Greg KH is fond of pointing out that the original
 version was written late one night as the result of a drunken bet).
 
 The same deadlock will occur no matter which USB host controller driver 
 you use, by the way.  There's nothing special about ehci-hcd.

Yes, I agree, never try to debug the USB subsystem, while using the USB
subsystem, doing that usually ends up in buffer overflows and endless
loops.

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


MUSB regression in linux next at least for pandboard

2012-10-04 Thread Tony Lindgren
Hi Felipe  Kishon,

Looks like musb is broken at least on pandaboard es
in current linux next while it works with v3.6:

[1.933074] musb-hdrc: version 6.0, ?dma?, otg (peripheral+host)
[1.939422] unable to find transceiver of type USB2 PHYrouping on.  Total 
pages: 251648
[1.945190] HS USB OTG: no transceiver configured
[1.950134] musb-hdrc musb-hdrc.0: musb_init_controller failed with status 
-19
[1.958160] couldn't find an available UDC

I do have CONFIG_OMAP_USB2 set.

Note that we won't be able to flip omap4 over to be
device tree only probably until v3.9 because of the
bindings we're still missing from usability point of
view. So this regression should be fixed.

Also on the EHCI port, I've seen issues where unplugging
the cable hangs kernel with an infinite loop. But that happens
only occasionally, sorry does not seem to happen right
now so no output to paste here. Or maybe this issue
has already been fixed?

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Dead lock in ehci hcd (3.5.3) with usb-serial adapters.

2012-10-04 Thread jx chang
Alan and Greg,

Appreciate your quick feedback. I guess even if I could fix dead lock
with other APIs like spin_is_locked(), it will just make code
convoluted. I don't think there is a solution either.

Thanks lot for the help!



On Thu, Oct 4, 2012 at 10:24 AM, Greg KH gre...@linuxfoundation.org wrote:
 On Thu, Oct 04, 2012 at 12:52:24PM -0400, Alan Stern wrote:
 On Thu, 4 Oct 2012, jx chang wrote:

  Hi, all,
 
  Recently I get a dead lock in ehci_hcd and hope someone can look at my 
  analysis.
 
  The symptom is:
 
  When I set loglevel=8 in command line and set console=ttyUSB0,
  115200n8..., and connect a usb-serial adapter to my target device (a
  tablet running kernel 3.5.3 with several other changes but I guess
  ehci parts should be same as mainstream), the device is dead withing
  several seconds after reboot.
 
  I wrote a small program in user space to dump to disk and enabled
  several debug options in kernel configuration.
 
  The result is the dead lock caught in ehci_hcd as below backtrace
  shows. My analysis is when a function driver submits a urb to ehci_hcd
  in a process, it will finally grab the spin lock ehci-lock in
  functions called by ehci_urb_enqueue() to do the job, but it seems
  some lower layer will print out echi's debug information in the
  further steps. If console is set to a usb-serial adapter and loglevel
  is big enough to allow these debug messages out, the prink() just
  output log to the user-serial module which should be a function driver
  based on ehci_hcd stack. Then a new sequence of urb submitting starts
  and calls the same ehci_urb_enqueue() again. The result is the same
  process will try to get the ehci-lock it has held.
 
  Does my analysis make sense? any good solutions if it is so?

 Yep, that sounds right.

 The solution is: Don't do that!  USB doesn't make for a very good
 console device (Greg KH is fond of pointing out that the original
 version was written late one night as the result of a drunken bet).

 The same deadlock will occur no matter which USB host controller driver
 you use, by the way.  There's nothing special about ehci-hcd.

 Yes, I agree, never try to debug the USB subsystem, while using the USB
 subsystem, doing that usually ends up in buffer overflows and endless
 loops.

 greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: dwc3: gadget: fix 'endpoint always busy' bug

2012-10-04 Thread Felipe Balbi
If a USB transfer has already been started, meaning
we have already issued StartTransfer command to that
particular endpoint, DWC3_EP_BUSY flag has also
already been set.

When we try to cancel this transfer which is already
in controller's cache, we will not receive XferComplete
event and we must clear DWC3_EP_BUSY in order to allow
subsequent requests to be properly started.

The best place to clear that flag is right after issuing
DWC3_DEPCMD_ENDTRANSFER.

Cc: sta...@vger.kernel.org # v3.4 v3.5 v3.6
Reported-by: Moiz Sonasath m-sonas...@ti.com
Signed-off-by: Felipe Balbi ba...@ti.com
---

If nobody has anything against this, I will line this up for v3.7-rc
series once merge window is closed.

cheers

 drivers/usb/dwc3/gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index c9e729a..7b7dedd 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1904,7 +1904,7 @@ static void dwc3_stop_active_transfer(struct dwc3 *dwc, 
u32 epnum)
ret = dwc3_send_gadget_ep_cmd(dwc, dep-number, cmd, params);
WARN_ON_ONCE(ret);
dep-resource_index = 0;
-
+   dep-flags = ~DWC3_EP_BUSY;
udelay(100);
 }
 
-- 
1.8.0.rc0

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: MUSB regression in linux next at least for pandboard

2012-10-04 Thread Felipe Balbi
Hi,

On Thu, Oct 04, 2012 at 10:31:08AM -0700, Tony Lindgren wrote:
 Hi Felipe  Kishon,
 
 Looks like musb is broken at least on pandaboard es
 in current linux next while it works with v3.6:
 
 [1.933074] musb-hdrc: version 6.0, ?dma?, otg (peripheral+host)
 [1.939422] unable to find transceiver of type USB2 PHYrouping on.  Total 
 pages: 251648
 [1.945190] HS USB OTG: no transceiver configured
 [1.950134] musb-hdrc musb-hdrc.0: musb_init_controller failed with status 
 -19
 [1.958160] couldn't find an available UDC
 
 I do have CONFIG_OMAP_USB2 set.
 
 Note that we won't be able to flip omap4 over to be
 device tree only probably until v3.9 because of the
 bindings we're still missing from usability point of
 view. So this regression should be fixed.

I see. Kishon, can you cook a patch adding platform_data until we
actually move to DT-only for OMAP4 ?

 Also on the EHCI port, I've seen issues where unplugging
 the cable hangs kernel with an infinite loop. But that happens
 only occasionally, sorry does not seem to happen right
 now so no output to paste here. Or maybe this issue
 has already been fixed?

Keshava, would you have time to look into this for this -rc cycle ?

cheers

-- 
balbi


signature.asc
Description: Digital signature


fl1000 usb3 controller vanished

2012-10-04 Thread Jan-Simon Möller
Hi all!

Here's summary from bug 48331 (bugzilla.kernel.org) as requested.

Hardware: Asus g74sx / i7-2, 3x USB2 ports, 1x USB3 port
OS: openSUSE 11.4 with latest stable kernel (- 3.6 atm)

With the (old) distro kernel the USB3 port does not work at all.
Started to work with 2.6.39 but now it seems broken and even does 
not show in lspci anymore.

Some relevant sections from grepping /var/log/messages 
(sri for the line-wrapping!)
https://bugzilla.kernel.org/show_bug.cgi?id=48331


We see some printouts about restoring the config space.
Could something go wrong there?


Kernel is a0d271cbfed1dd50278c6b06bead3d00ba0a88f9 / v3.6 .

kernel config used for latest/running kernel build:
https://bugzilla.kernel.org/attachment.cgi?id=82061

bzgrep xhci /var/log/messages*.bz2  (txt.gz)
https://bugzilla.kernel.org/attachment.cgi?id=82071

dmesg from running system (kernel 3.6) 
https://bugzilla.kernel.org/attachment.cgi?id=82081

lspci -vv (kernel 3.6)
https://bugzilla.kernel.org/attachment.cgi?id=82091


Best,
Jan-Simon
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 06/24 v2] USB: EHCI: add no_io_watchdog platform_data parameter to ehci-platform

2012-10-04 Thread Alan Stern
On Thu, 4 Oct 2012, Florian Fainelli wrote:

 Enhance the ehci-platform driver to also accept no_io_watchdog as a platform
 data parameter. When no_io_watchdog is set to 1, the ehci controller will set
 ehci-need_io_watchdog to 0. Since most EHCI controllers do need the I/O
 watchdog to be on, only let those which need it to turn the watchdog off.
 
 Signed-off-by: Florian Fainelli flor...@openwrt.org
 ---
 Changes since v1:
 - reworked patch to introduce no_io_watchdog instead of need_io_watchdog
 - reworded commit message accordingly

Very good except for one thing...

 --- a/drivers/usb/host/ehci-platform.c
 +++ b/drivers/usb/host/ehci-platform.c
 @@ -32,6 +32,8 @@ static int ehci_platform_reset(struct usb_hcd *hcd)
   ehci-has_synopsys_hc_bug = pdata-has_synopsys_hc_bug;
   ehci-big_endian_desc = pdata-big_endian_desc;
   ehci-big_endian_mmio = pdata-big_endian_mmio;
 + if (pdata-no_io_watchdog)
 + ehci-need_io_watchdog = 0;
  
   ehci-caps = hcd-regs + pdata-caps_offset;
   retval = ehci_setup(hcd);

ehci_setup calls ehci_init, which unconditionally sets 
need_io_watchdog.  Your new if statement has to come after this call.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Mouse and keyboard freeze on Ivy Bridge platform

2012-10-04 Thread Sébastien Dinot
Hi,

Jonathan Nieder a écrit :
 Sebastien: for reference, here's a way to build a kernel with
 CONFIG_USB_DEBUG enabled.

Thank you for these useful instructions, I had not compiled a kernel for
some years.

Sébastien

-- 
Sébastien Dinot, sebastien.di...@free.fr
http://sebastien.dinot.free.fr/
Ne goûtez pas au logiciel libre, vous ne pourriez plus vous en passer !
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Mouse and keyboard freeze on Ivy Bridge platform

2012-10-04 Thread Alan Stern
On Thu, 4 Oct 2012, Sébastien Dinot wrote:

 Hi,
 
 Alan Stern a écrit :
  Please build a kernel with CONFIG_USB_DEBUG enabled.
 
 Done (3.6.0+ kernel)
 
  When a hang occurs, get a list of hang tasks (Alt-SysRq-w probably
  won't work, but echo w /proc/sysrq-trigger from a network login
  should). Then send the dmesg output
 
 The mouse and the keyboard froze four times tonight in half an hour :
 
 - at 20:42:05
 - at 20:53:44
 - at 20:58:21
 - at 21:15:19
 
 But the SysRq command (executed through a remote SSH connection)
 displayed nothing. :(

No tasks were hung.  That's okay.

 In attachment, you will find the kern.log file.
 
The log file shows lots and lots of low-level communication errors.  
They could be caused by bad cabling or by bad USB hardware in your
computer.  It's unlikely that they were caused by the mouse or
keyboard, because the log shows errors for both of them starting at
exactly the same times.
 
You could try getting a USB-2 hub and attaching your mouse and
keyboard through the hub.  That might help ... or it might not.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Mouse and keyboard freeze on Ivy Bridge platform

2012-10-04 Thread Sébastien Dinot
Alan Stern a écrit :
 The log file shows lots and lots of low-level communication errors.
 They could be caused by bad cabling or by bad USB hardware in your
 computer. It's unlikely that they were caused by the mouse or
 keyboard, because the log shows errors for both of them starting at
 exactly the same times.

In my humble opinion, this issue is not caused by a bad USB hardware
because I am encountering it with two different motherboards (MSI
Z77A-G43 and ASUS P8Z77-V LX), both with an uptodate BIOS.

May be it is caused by a bad cabling but my mouse and my keyboard worked
fine with my previous PC. They are connected to USB2 ports in both
cases. But to clear up this point, I will try new mouse and keyboard.

A last question: if it is a cable failure, why does it disappear
temporarily when I unload then reload the module? I do not have deep
experience and knowledge of hardware, may be there is a rational
explanation to it.

 You could try getting a USB-2 hub and attaching your mouse and
 keyboard through the hub. That might help ... or it might not.

Sorry, I do not understand the aim of this operation. Could you explain
me it?

Thanks for your help,

Sébastien

-- 
Sébastien Dinot, sebastien.di...@free.fr
http://sebastien.dinot.free.fr/
Ne goûtez pas au logiciel libre, vous ne pourriez plus vous en passer !
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/24 v2] USB: OHCI and EHCI platform driver conversions

2012-10-04 Thread Florian Fainelli

Le 04/10/2012 21:36, Alan Stern a écrit :

On Thu, 4 Oct 2012, Florian Fainelli wrote:


Hi all,

This patch series contains various EHCI and OHCI conversions as well as
some cleanups in the existing OHCI HCD driver regarding suspend/resume
as suggested by Alan Stern.

Changes since previous version summed up are:
- improved various commit messages
- changed the logic regarding need_io_watchdog
- fixed arch/ files not using {e,o}hci-platform despite their conversion
- updated more defconfigs
- cleaned up OHCI HCD driver
- dropped Octeon conversion per David Daney's request

Per-patch changes are detailed in the patches.


This is great stuff!  Thanks a lot for doing all this work.  A couple
of things still to be fixed (described in separate emails); nothing
very big.


Thanks a lot for reviewing!



One more request: How'd you like to convert ehci-platform.c and
ohci-platform.c to use devm_request_and_ioremap() for the memory
resources (like in the IXP4xx and Loongson files you removed)?  At the
same time you could fix the spelling of resource in the error
messages, and change all the pr_err() lines to dev_err().


Sounds good, I will fold these patches in the next series.
--
Florian
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/16] ARM: OMAP: Make plat/fpga.h local to arch/arm/plat-omap

2012-10-04 Thread Tony Lindgren
There's no need to have this file in plat/fpga.h. We can
make it local to plat-omap replacing fpga_read/write
functions directly with readb/writeb as that's how
they are already defined in fpga.h.

Note that 2420 based H4 is also using the fpga, so let's
keep the led support around in plat-omap until we flip
over mach-omap2 to device tree.

Cc: Tomi Valkeinen tomi.valkei...@ti.com
Cc: Florian Tobias Schandinat florianschandi...@gmx.de
Cc: linux-fb...@vger.kernel.org
Cc: Felipe Balbi ba...@ti.com
Cc: linux-usb@vger.kernel.org
Signed-off-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap1/board-fsample.c |6 -
 arch/arm/mach-omap1/board-innovator.c   |   26 ++--
 arch/arm/mach-omap1/board-perseus2.c|6 -
 arch/arm/mach-omap1/common.h|1 
 arch/arm/mach-omap1/fpga.c  |2 
 arch/arm/mach-omap1/include/mach/omap1510.h |  113 
 arch/arm/mach-omap1/serial.c|1 
 arch/arm/plat-omap/debug-leds.c |2 
 arch/arm/plat-omap/fpga.h   |   74 ++
 arch/arm/plat-omap/include/plat/fpga.h  |  193 ---
 drivers/usb/host/ohci-omap.c|5 -
 drivers/video/omap/lcd_inn1510.c|7 +
 12 files changed, 216 insertions(+), 220 deletions(-)
 create mode 100644 arch/arm/plat-omap/fpga.h
 delete mode 100644 arch/arm/plat-omap/include/plat/fpga.h

diff --git a/arch/arm/mach-omap1/board-fsample.c 
b/arch/arm/mach-omap1/board-fsample.c
index 4b6de70..6f496df 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -30,7 +30,7 @@
 #include plat/tc.h
 #include mach/mux.h
 #include mach/flash.h
-#include plat/fpga.h
+#include ../plat-omap/fpga.h
 #include linux/platform_data/keypad-omap.h
 
 #include mach/hardware.h
@@ -123,9 +123,9 @@ static struct resource smc91x_resources[] = {
 
 static void __init fsample_init_smc91x(void)
 {
-   fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
+   __raw_writeb(1, H2P2_DBG_FPGA_LAN_RESET);
mdelay(50);
-   fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET)  ~1,
+   __raw_writeb(__raw_readb(H2P2_DBG_FPGA_LAN_RESET)  ~1,
   H2P2_DBG_FPGA_LAN_RESET);
mdelay(50);
 }
diff --git a/arch/arm/mach-omap1/board-innovator.c 
b/arch/arm/mach-omap1/board-innovator.c
index db5f7d2..5804da7 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -33,7 +33,7 @@
 
 #include mach/mux.h
 #include mach/flash.h
-#include plat/fpga.h
+#include ../plat-omap/fpga.h
 #include plat/tc.h
 #include linux/platform_data/keypad-omap.h
 #include plat/mmc.h
@@ -215,7 +215,7 @@ static struct platform_device *innovator1510_devices[] 
__initdata = {
 
 static int innovator_get_pendown_state(void)
 {
-   return !(fpga_read(OMAP1510_FPGA_TOUCHSCREEN)  (1  5));
+   return !(__raw_readb(OMAP1510_FPGA_TOUCHSCREEN)  (1  5));
 }
 
 static const struct ads7846_platform_data innovator1510_ts_info = {
@@ -279,7 +279,7 @@ static struct platform_device *innovator1610_devices[] 
__initdata = {
 static void __init innovator_init_smc91x(void)
 {
if (cpu_is_omap1510()) {
-   fpga_write(fpga_read(OMAP1510_FPGA_RST)  ~1,
+   __raw_writeb(__raw_readb(OMAP1510_FPGA_RST)  ~1,
   OMAP1510_FPGA_RST);
udelay(750);
} else {
@@ -335,10 +335,10 @@ static int mmc_set_power(struct device *dev, int slot, 
int power_on,
int vdd)
 {
if (power_on)
-   fpga_write(fpga_read(OMAP1510_FPGA_POWER) | (1  3),
+   __raw_writeb(__raw_readb(OMAP1510_FPGA_POWER) | (1  3),
OMAP1510_FPGA_POWER);
else
-   fpga_write(fpga_read(OMAP1510_FPGA_POWER)  ~(1  3),
+   __raw_writeb(__raw_readb(OMAP1510_FPGA_POWER)  ~(1  3),
OMAP1510_FPGA_POWER);
 
return 0;
@@ -390,14 +390,14 @@ static void __init innovator_init(void)
omap_cfg_reg(UART3_TX);
omap_cfg_reg(UART3_RX);
 
-   reg = fpga_read(OMAP1510_FPGA_POWER);
+   reg = __raw_readb(OMAP1510_FPGA_POWER);
reg |= OMAP1510_FPGA_PCR_COM1_EN;
-   fpga_write(reg, OMAP1510_FPGA_POWER);
+   __raw_writeb(reg, OMAP1510_FPGA_POWER);
udelay(10);
 
-   reg = fpga_read(OMAP1510_FPGA_POWER);
+   reg = __raw_readb(OMAP1510_FPGA_POWER);
reg |= OMAP1510_FPGA_PCR_COM2_EN;
-   fpga_write(reg, OMAP1510_FPGA_POWER);
+   __raw_writeb(reg, OMAP1510_FPGA_POWER);
udelay(10);
 
platform_add_devices(innovator1510_devices, 
ARRAY_SIZE(innovator1510_devices));
@@ -437,6 +437,7 @@ static void __init innovator_init(void)
  */
 static void __init innovator_map_io(void)
 {
+#ifdef CONFIG_ARCH_OMAP15XX

Re: [PATCH] EHCI: Update qTD next pointer in QH overlay region during unlink

2012-10-04 Thread Alan Stern
On Fri, 7 Sep 2012, Pavankumar Kondeti wrote:

 There is a possibility of QH overlay region having reference to a stale
 qTD pointer during unlink.
 
 Consider an endpoint having two pending qTD before unlink process begins.
 The endpoint's QH queue looks like this.
 
 qTD1 -- qTD2 -- Dummy
 
 To unlink qTD2, QH is removed from asynchronous list and Asynchronous
 Advance Doorbell is programmed.  The qTD1's next qTD pointer is set to
 qTD2'2 next qTD pointer and qTD2 is retired upon controller's doorbell
 interrupt.  If QH's current qTD pointer points to qTD1, transfer overlay
 region still have reference to qTD2. But qtD2 is just unlinked and freed.
 This may cause EHCI system error.  Fix this by updating qTD next pointer
 in QH overlay region with the qTD next pointer of the current qTD.

Pavan:

Your patch got me thinking.  The test we use is this:

if (cpu_to_hc32(ehci, qtd-qtd_dma) == qh-hw-hw_current) {

But it's possible (although highly unlikely) that this test could
succeed when it shouldn't.  That is, it might happen purely by
coincidence that the qTD at the start of the list had been reused, so
it's really a new TD at the same old address, and the old address is
still in the overlay region.

(To make this happen, you'd have to unlink an URB while it is running,
and the completion handler would have to submit a new URB and
immediately unlink it.  Then the next URB submitted might reuse the qTD
that was running originally.)

It would be better to keep track of whether or not the contents of the
overlay area in an idle QH are active and valid, since that's what we
really want to test here.  Can you read through this patch and verify
that it will do what it's supposed to do?

Thanks,

Alan Stern



Index: usb-3.6/drivers/usb/host/ehci.h
===
--- usb-3.6.orig/drivers/usb/host/ehci.h
+++ usb-3.6/drivers/usb/host/ehci.h
@@ -401,6 +401,7 @@ struct ehci_qh {
struct usb_device   *dev;   /* access to TT */
unsignedis_out:1;   /* bulk or intr OUT */
unsignedclearing_tt:1;  /* Clear-TT-Buf in progress */
+   unsignedoverlay_active:1;   /* no update needed */
 };
 
 /*-*/
Index: usb-3.6/drivers/usb/host/ehci-q.c
===
--- usb-3.6.orig/drivers/usb/host/ehci-q.c
+++ usb-3.6/drivers/usb/host/ehci-q.c
@@ -135,7 +135,7 @@ qh_refresh (struct ehci_hcd *ehci, struc
 * qtd is updated in qh_completions(). Update the QH
 * overlay here.
 */
-   if (cpu_to_hc32(ehci, qtd-qtd_dma) == qh-hw-hw_current) {
+   if (qh-overlay_active) {
qh-hw-hw_qtd_next = qtd-hw_next;
qtd = NULL;
}
@@ -456,9 +456,7 @@ qh_completions (struct ehci_hcd *ehci, s
continue;
 
/* qh unlinked; token in overlay may be most current */
-   if (state == QH_STATE_IDLE
-cpu_to_hc32(ehci, qtd-qtd_dma)
-   == hw-hw_current) {
+   if (state == QH_STATE_IDLE  qh-overlay_active) {
token = hc32_to_cpu(ehci, hw-hw_token);
 
/* An unlink may leave an incomplete
@@ -513,6 +511,15 @@ qh_completions (struct ehci_hcd *ehci, s
last-hw_next = qtd-hw_next;
}
 
+   /*
+* Conversely, if we're removing something at the head
+* of the queue then the QH's overlay area can no longer
+* be active and valid.
+*/
+   else {
+   qh-overlay_active = 0;
+   }
+
/* remove qtd; it's recycled after possible urb completion */
list_del (qtd-qtd_list);
last = qtd;
@@ -1243,6 +1250,8 @@ static void end_unlink_async(struct ehci
qh-unlink_next = NULL;
 
qh-qh_state = QH_STATE_IDLE;
+   qh-overlay_active = !!(qh-hw-hw_token 
+   cpu_to_hc32(ehci, QTD_STS_ACTIVE));
qh-qh_next.qh = NULL;
 
qh_completions(ehci, qh);
Index: usb-3.6/drivers/usb/host/ehci-sched.c
===
--- usb-3.6.orig/drivers/usb/host/ehci-sched.c
+++ usb-3.6/drivers/usb/host/ehci-sched.c
@@ -670,6 +670,8 @@ static void end_unlink_intr(struct ehci_
int rc;
 
qh-qh_state = QH_STATE_IDLE;
+   qh-overlay_active = !!(hw-hw_token 
+   cpu_to_hc32(ehci, QTD_STS_ACTIVE));
hw-hw_next = EHCI_LIST_END(ehci);
 
qh_completions(ehci, 

Re: FTDI USB-to-UART converters and tcdrain()

2012-10-04 Thread Greg KH
On Tue, Oct 02, 2012 at 05:56:30PM +0200, Jarkko Huijts wrote:
 Hello knowledgeable people,
 
 I have a question regarding tcdrain() and kernel driver
 drivers/usb/serial/ftdi_sio.c (for a family of USB-to-UART converter
 chips from FTDI). I'm using an FT232RL and kernel 2.6.38-16. (The driver
 code does not seem to have changed much between that version and 3.6.)
 
 My goal is to make sure all TX data has been sent over the wire in
 application code. This is what function tcdrain() is for according to
 the manual page and serial programming guides. It doesn't seem to do
 anything for the FT232RL chip, however.
 
 I found the following when digging around:
 - tcdrain() is implemented in libc and translated into ioctl TCSBRK with
 value 1. In Linux, this is apparently defined as wait until drained
 without sending an actual break over the UART.
 - I would expect this ioctl to arrive in function ftdi_ioctl() of the
 driver, but it doesn't. (I included a printk showing every ioctl it
 receives.)

No, the break callback in the ftdi driver should be called instead (the
ftdi_break_ctl() function).

 - It seems like the hardware can return whether its TX buffer is empty.
 This is stored in field transmit_empty of struct ftdi_private and can be
 retrieved by application code by doing ioctl TIOCSERGETLSR. I found an
 old thread in this mailing list (support for TIOCSERGETLSR in
 ftdi_sio, posted December 10, 2010), which seems to be the origin of
 this addition. Several other drivers under drivers/usb/serial seem to
 implement the same ioctl: io_edgeport.c, mos7720.c and mos7840.c.
 
 My questions are:
 - Can anyone confirm that the state of the chip's TX buffer (at least
 whether it is empty) can be retrieved from the chip? There is no
 publicly available datasheet about this kind of hardware details.

I don't have the datasheet, so I can't answer this for you, sorry.

 - Is tcdrain() supposed to ensure that all TX data has been sent for any
 serial device? If so, why is it not implemented for this device?

No one has implemented it to do so.  Other usb-serial drivers have
implemented this functionality, just not this one.  Perhaps because no
one has noticed before, or maybe the chip really can't do it.

Without the specs for the device itself, I can't really tell for sure.
If you do get ahold of the specs, let me know, and I'll be glad to work
to add this support to the driver, as I agree, it is something that
would be useful to a lot of people.

Sorry I can't be of more help,

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Mouse and keyboard freeze on Ivy Bridge platform

2012-10-04 Thread Sarah Sharp
On Thu, Oct 04, 2012 at 11:36:06PM +0200, Sébastien Dinot wrote:
 Alan Stern a écrit :
  The log file shows lots and lots of low-level communication errors.
  They could be caused by bad cabling or by bad USB hardware in your
  computer. It's unlikely that they were caused by the mouse or
  keyboard, because the log shows errors for both of them starting at
  exactly the same times.
 
 In my humble opinion, this issue is not caused by a bad USB hardware
 because I am encountering it with two different motherboards (MSI
 Z77A-G43 and ASUS P8Z77-V LX), both with an uptodate BIOS.
 
 May be it is caused by a bad cabling but my mouse and my keyboard worked
 fine with my previous PC. They are connected to USB2 ports in both
 cases. But to clear up this point, I will try new mouse and keyboard.
 
 A last question: if it is a cable failure, why does it disappear
 temporarily when I unload then reload the module? I do not have deep
 experience and knowledge of hardware, may be there is a rational
 explanation to it.
 
  You could try getting a USB-2 hub and attaching your mouse and
  keyboard through the hub. That might help ... or it might not.
 
 Sorry, I do not understand the aim of this operation. Could you explain
 me it?

Sometimes USB 2.0 hubs can handle more electrical noise from the host
controller, especially if they are externally powered by a wall-wort.
So introducing a USB 2.0 hub may fix the transfer errors caused by the
host.

BTW, do these Ivy Bridge systems have any (blue) USB 3.0 ports?  If so,
does your mouse and keyboard work under those ports?

Sarah Sharp
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: gadget: ncm: correct endianess conversion

2012-10-04 Thread Dmytro Milinevskyy

Signed-off-by: Dmytro Milinevskyy milinevs...@gmail.com
---
 drivers/usb/gadget/f_ncm.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/f_ncm.c b/drivers/usb/gadget/f_ncm.c
index b651b52..fce45ab 100644
--- a/drivers/usb/gadget/f_ncm.c
+++ b/drivers/usb/gadget/f_ncm.c
@@ -869,11 +869,11 @@ static struct sk_buff *ncm_wrap_ntb(struct gether *port,
struct sk_buff  *skb2;
int ncb_len = 0;
__le16  *tmp;
-   int div = ntb_parameters.wNdpInDivisor;
-   int rem = ntb_parameters.wNdpInPayloadRemainder;
-   int pad;
-   int ndp_align = ntb_parameters.wNdpInAlignment;
-   int ndp_pad;
+   int div = le16_to_cpu(ntb_parameters.wNdpInDivisor);
+   int rem = le16_to_cpu(ntb_parameters.wNdpInPayloadRemainder);
+   int pad;
+   int ndp_align = le16_to_cpu(ntb_parameters.wNdpInAlignment);
+   int ndp_pad;
unsignedmax_size = ncm-port.fixed_in_len;
struct ndp_parser_opts *opts = ncm-parser_opts;
unsignedcrc_len = ncm-is_crc ? sizeof(uint32_t) : 0;
-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: some question about xhci ep0 setting

2012-10-04 Thread Sarah Sharp
On Thu, Oct 04, 2012 at 01:47:44PM +0800, loody wrote:
 Hi all:
 from below out put slot context it shows ep0 consumer cycle bit is 1
 but why when we enqueue control transfer we purposely leave setup
 status cycle bit as 0.
 (below I purpose dump control trb content and 0xcf01c80c should be
 0x0841 instead of 0x0840, right?)
 
 [192016.504076] address trb: cf01c800: 01000680 0008 0008 0840
 [192016.505593] address trb: cf01c810: 30e1fdc0  0008 00010c05
 [192016.507129] address trb: cf01c820:    1021

We leave the setup status cycle bit as zero until we've written the
status phase to the ring.  This is to prevent the host from executing
the control transfer until it's fully written to the ring.  We do the
same thing for all transfer descriptors (TD) that have more than one
transfer request buffer (TRB).

BTW, if you're asking questions about the xHCI driver, you really should
put me on Cc.  Otherwise your mail might get lost in all the other
linux-usb mail I get.

Why are you asking all these questions about the driver?  What are you
trying to accomplish?

Sarah Sharp
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: MUSB regression in linux next at least for pandboard

2012-10-04 Thread Tony Lindgren
* Felipe Balbi ba...@ti.com [121004 11:04]:
 Hi,
 
 On Thu, Oct 04, 2012 at 10:31:08AM -0700, Tony Lindgren wrote:
  Hi Felipe  Kishon,
  
  Looks like musb is broken at least on pandaboard es
  in current linux next while it works with v3.6:
  
  [1.933074] musb-hdrc: version 6.0, ?dma?, otg (peripheral+host)
  [1.939422] unable to find transceiver of type USB2 PHYrouping on.  
  Total pages: 251648
  [1.945190] HS USB OTG: no transceiver configured
  [1.950134] musb-hdrc musb-hdrc.0: musb_init_controller failed with 
  status -19
  [1.958160] couldn't find an available UDC
  
  I do have CONFIG_OMAP_USB2 set.
  
  Note that we won't be able to flip omap4 over to be
  device tree only probably until v3.9 because of the
  bindings we're still missing from usability point of
  view. So this regression should be fixed.
 
 I see. Kishon, can you cook a patch adding platform_data until we
 actually move to DT-only for OMAP4 ?
 
  Also on the EHCI port, I've seen issues where unplugging
  the cable hangs kernel with an infinite loop. But that happens
  only occasionally, sorry does not seem to happen right
  now so no output to paste here. Or maybe this issue
  has already been fixed?
 
 Keshava, would you have time to look into this for this -rc cycle ?

Also, can you guys also please do a patch to move plat/usb.h to
include/linux/platform_data/usb-omap.h that only contains
platform data? The init functions should be in local usb.h under
arch/arm/*omap*/*. Then also please remove the cpu_is_omap usage
from drivers/mfd/omap-usb-host.c if not done already.

These are needed to make plat/cpu.h local to mach-omap*
for the ARM common zImage support.

Thanks,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 14/24] USB: ohci: merge ohci_finish_controller_resume with ohci_resume

2012-10-04 Thread Jingoo Han
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 flor...@openwrt.org

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

Acked-by: Jingoo Han jg1@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;
 + boolneed_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 */
 

Re: some question about xhci ep0 setting

2012-10-04 Thread loody
hi Sarah:

2012/10/5 Sarah Sharp sarah.a.sh...@linux.intel.com:
 On Thu, Oct 04, 2012 at 01:47:44PM +0800, loody wrote:
 Hi all:
 from below out put slot context it shows ep0 consumer cycle bit is 1
 but why when we enqueue control transfer we purposely leave setup
 status cycle bit as 0.
 (below I purpose dump control trb content and 0xcf01c80c should be
 0x0841 instead of 0x0840, right?)

 [192016.504076] address trb: cf01c800: 01000680 0008 0008 0840
 [192016.505593] address trb: cf01c810: 30e1fdc0  0008 00010c05
 [192016.507129] address trb: cf01c820:    1021

 We leave the setup status cycle bit as zero until we've written the
 status phase to the ring.  This is to prevent the host from executing
 the control transfer until it's fully written to the ring.  We do the
 same thing for all transfer descriptors (TD) that have more than one
 transfer request buffer (TRB).

 BTW, if you're asking questions about the xHCI driver, you really should
 put me on Cc.  Otherwise your mail might get lost in all the other
 linux-usb mail I get.

 Why are you asking all these questions about the driver?  What are you
 trying to accomplish?
Nice to meet U  ~^^~
I am trying to port xhci driver on my platform based on linux driver.
That is why I ask these questions.

-- 
Thanks for your help,
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: some question about xhci spec

2012-10-04 Thread loody
hi alan:

2012/10/4 Alan Stern st...@rowland.harvard.edu:
 On Thu, 4 Oct 2012, loody wrote:

 hi all:
 in xhci spec rev1.0 05/21/10 section 6.2.3.4, there is a line said
 For  SuperSpeed  endpoints  this  field  shall  be  set  to  the
 value  defined  in  the  bMaxBurst  field  of  the
 SuperSpeed Endpoint Companion Descriptor. Refer to section 8.6.8 of
 the USB3 Specification.

 but I cannot find section 8.6.8 in usb3 spec I download from usb.org.

 Does anyone can tell me where I can find this section?

 Section 9.6.7.


is that a typo in xhci spec?
I am just afraid I am not downloading the latest xhci spec.
Thanks for your help ^^
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html