Xmas Offer

2016-11-27 Thread Mrs Julie Leach
You are a recipient to Mrs Julie Leach Donation of $3 million USD. Contact ( 
julieleac...@gmail.com ) for claims.
--
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


dwc3: add support for hardware with multiple ports on USB2 hub enabled

2016-11-27 Thread Martin Blumenstingl
Hello,

while adding USB support on the Amlogic Meson GXL / GXM SoCs I have
come across something I did not know yet:
dwc3 has an internal USB2 hub (from what I can read in the code there
seem to be multiple USB3 ports supported as well).
When searching the web I did not come across any SoC that uses a
configuration with more than one port enabled.

On my Amlogic Meson GXM device (consumer device, no development board)
I see the following USB2 PHY register configuration (full register
dump from the kernel that was shipped with the device is attached):
GUSB2PHYCFG(0) = 0x40102500
GUSB2PHYCFG(1) = 0x40102540
GUSB2PHYCFG(2) = 0x40102540

Then vendor kernel sources (a 3.14 kernel) are adding the resets for
GUSB2PHYCFG([1-3]) in dwc3_core_soft_reset().
A mainline 4.9+(Meson GXL USB PHY patches + dwc3/xhci-plat DMA patches
from linux-usb) kernel works fine even with just applying the reset to
GUSB2PHYCFG(0).

That brings up two questions:
1. I guess it makes sense to adjust the upstream dwc3 to add the
resets for all available USB2 PHYs - is there a specific reason why
the current dwc3 driver does not do that (or is it simply because why
we find on Meson GXL/GXM is very exotic)?
2. would we also implement this for the USB3 "pipes" as well (without
being able to test this)?
3. from what I can see in the code we have to adjust dwc3_phy_setup()
and ulpi.c to add support for multiple ports, but how do we detect the
number of USB2 and USB3 ports (is this somewhere encoded in the
DWC3_GHWPARAMS registers)?

lsusb output is also attached, based on the PHY drivers for which the
patches can be found here: [0]


Best Regards,
Martin


[0] http://lists.infradead.org/pipermail/linux-amlogic/2016-November/001721.html


sys_kernel_debug_dwc3_regdump_vendor_kernel
Description: Binary data


lsusb-mainline-kernel
Description: Binary data


Re: dwc3: add support for hardware with multiple ports on USB2 hub enabled

2016-11-27 Thread Martin Blumenstingl
On Sun, Nov 27, 2016 at 2:02 PM, Martin Blumenstingl
 wrote:
> Hello,
>
> while adding USB support on the Amlogic Meson GXL / GXM SoCs I have
> come across something I did not know yet:
> dwc3 has an internal USB2 hub (from what I can read in the code there
> seem to be multiple USB3 ports supported as well).
> When searching the web I did not come across any SoC that uses a
> configuration with more than one port enabled.
>
> On my Amlogic Meson GXM device (consumer device, no development board)
> I see the following USB2 PHY register configuration (full register
> dump from the kernel that was shipped with the device is attached):
> GUSB2PHYCFG(0) = 0x40102500
> GUSB2PHYCFG(1) = 0x40102540
> GUSB2PHYCFG(2) = 0x40102540
>
> Then vendor kernel sources (a 3.14 kernel) are adding the resets for
> GUSB2PHYCFG([1-3]) in dwc3_core_soft_reset().
> A mainline 4.9+(Meson GXL USB PHY patches + dwc3/xhci-plat DMA patches
> from linux-usb) kernel works fine even with just applying the reset to
> GUSB2PHYCFG(0).
>
> That brings up two questions:
> 1. I guess it makes sense to adjust the upstream dwc3 to add the
> resets for all available USB2 PHYs - is there a specific reason why
> the current dwc3 driver does not do that (or is it simply because why
> we find on Meson GXL/GXM is very exotic)?
> 2. would we also implement this for the USB3 "pipes" as well (without
> being able to test this)?
> 3. from what I can see in the code we have to adjust dwc3_phy_setup()
> and ulpi.c to add support for multiple ports, but how do we detect the
> number of USB2 and USB3 ports (is this somewhere encoded in the
> DWC3_GHWPARAMS registers)?
>
> lsusb output is also attached, based on the PHY drivers for which the
> patches can be found here: [0]
>
>
> Best Regards,
> Martin
>
>
> [0] 
> http://lists.infradead.org/pipermail/linux-amlogic/2016-November/001721.html
re-sending due to a typo in Felipe Balbi's email address (sorry for that)
--
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] USB: EHCI: ehci-w90x900: remove unuseful functions

2016-11-27 Thread Alan Stern
On Thu, 24 Nov 2016 csmanjuvi...@gmail.com wrote:

> From: Manjunath Goudar 
> 
> The ehci_w90x900_probe function is not doing anything other than
> calling usb_w90x900_probe function so ehci_w90x900_probe function
> is unuseful that is why removed ehci_w90x900_probe functions and
> renamed usb_w90x900_probe function to ehci_w90x900_probe for proper
> naming.
> 
> The ehci_w90x900_remove function is also not doing anything other
> than calling usb_w90x900_remove that is why removed ehci_w90x900_remove
> function and renamed usb_w90x900_remove to ehci_w90x900_remove for proper
> naming.
> 
> This also removes warning of checkpatch.pl script.
> 
> Signed-off-by: Manjunath Goudar 
> Cc: Arnd Bergmann 
> Cc: Greg KH 
> Cc: Alan Stern 
> Cc: Wan ZongShun 
> Cc: linux-usb@vger.kernel.org
> Cc: linux-ker...@vger.kernel.org
> ---

Acked-by: Alan Stern 

>  drivers/usb/host/ehci-w90x900.c | 30 --
>  1 file changed, 8 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-w90x900.c b/drivers/usb/host/ehci-w90x900.c
> index e42a29e..63b9d0c 100644
> --- a/drivers/usb/host/ehci-w90x900.c
> +++ b/drivers/usb/host/ehci-w90x900.c
> @@ -33,8 +33,7 @@ static const char hcd_name[] = "ehci-w90x900 ";
>  
>  static struct hc_driver __read_mostly ehci_w90x900_hc_driver;
>  
> -static int usb_w90x900_probe(const struct hc_driver *driver,
> -   struct platform_device *pdev)
> +static int ehci_w90x900_probe(struct platform_device *pdev)
>  {
>   struct usb_hcd *hcd;
>   struct ehci_hcd *ehci;
> @@ -42,7 +41,8 @@ static int usb_w90x900_probe(const struct hc_driver *driver,
>   int retval = 0, irq;
>   unsigned long val;
>  
> - hcd = usb_create_hcd(driver, &pdev->dev, "w90x900 EHCI");
> + hcd = usb_create_hcd(&ehci_w90x900_hc_driver,
> + &pdev->dev, "w90x900 EHCI");
>   if (!hcd) {
>   retval = -ENOMEM;
>   goto err1;
> @@ -63,9 +63,9 @@ static int usb_w90x900_probe(const struct hc_driver *driver,
>   HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
>  
>   /* enable PHY 0,1,the regs only apply to w90p910
> - *  0xA4,0xA8 were offsets of PHY0 and PHY1 controller of
> - *  w90p910 IC relative to ehci->regs.
> - */
> +  *  0xA4,0xA8 were offsets of PHY0 and PHY1 controller of
> +  *  w90p910 IC relative to ehci->regs.
> +  */
>   val = __raw_readl(ehci->regs+PHY0_CTR);
>   val |= ENPHY;
>   __raw_writel(val, ehci->regs+PHY0_CTR);
> @@ -92,26 +92,12 @@ static int usb_w90x900_probe(const struct hc_driver 
> *driver,
>   return retval;
>  }
>  
> -static void usb_w90x900_remove(struct usb_hcd *hcd,
> - struct platform_device *pdev)
> -{
> - usb_remove_hcd(hcd);
> - usb_put_hcd(hcd);
> -}
> -
> -static int ehci_w90x900_probe(struct platform_device *pdev)
> -{
> - if (usb_disabled())
> - return -ENODEV;
> -
> - return usb_w90x900_probe(&ehci_w90x900_hc_driver, pdev);
> -}
> -
>  static int ehci_w90x900_remove(struct platform_device *pdev)
>  {
>   struct usb_hcd *hcd = platform_get_drvdata(pdev);
>  
> - usb_w90x900_remove(hcd, pdev);
> + usb_remove_hcd(hcd);
> + usb_put_hcd(hcd);
>  
>   return 0;
>  }

--
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 1/2] dt-bindings: usb: add DT binding for s3c2410 USB OHCI controller

2016-11-27 Thread Krzysztof Kozlowski
On Fri, Nov 25, 2016 at 12:47:28PM -0200, Sergio Prado wrote:
> Adds the device tree bindings description for Samsung S3C2410 and
> compatible USB OHCI controller.
> 
> Signed-off-by: Sergio Prado 
> ---
>  .../devicetree/bindings/usb/s3c2410-usb.txt| 22 
> ++
>  1 file changed, 22 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/usb/s3c2410-usb.txt
> 
> diff --git a/Documentation/devicetree/bindings/usb/s3c2410-usb.txt 
> b/Documentation/devicetree/bindings/usb/s3c2410-usb.txt
> new file mode 100644
> index ..e45b38ce2986
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/s3c2410-usb.txt
> @@ -0,0 +1,22 @@
> +Samsung S3C2410 and compatible SoC USB controller
> +
> +OHCI
> +
> +Required properties:
> + - compatible: should be "samsung,s3c2410-ohci" for USB host controller
> + - reg: address and lenght of the controller memory mapped region

s/lenght/length/

Acked-by: Krzysztof Kozlowski 

Best regards,
Krzysztof

> + - interrupts: interrupt number for the USB OHCI controller
> + - clocks: Should reference the bus and host clocks
> + - clock-names: Should contain two strings
> + "usb-bus-host" for the USB bus clock
> + "usb-host" for the USB host clock
> +
> +Example:
> +
> +usb0: ohci@4900 {
> + compatible = "samsung,s3c2410-ohci";
> + reg = <0x4900 0x100>;
> + interrupts = <0 0 26 3>;
> + clocks = <&clocks UCLK>, <&clocks HCLK_USBH>;
> + clock-names = "usb-bus-host", "usb-host";
> +};
> -- 
> 1.9.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 2/2] usb: ohci: s3c2410: allow probing from device tree

2016-11-27 Thread Krzysztof Kozlowski
On Fri, Nov 25, 2016 at 12:47:29PM -0200, Sergio Prado wrote:
> Allows configuring Samsung's s3c2410 USB OHCI controller using a
> devicetree.
> 
> Signed-off-by: Sergio Prado 
> ---
>  drivers/usb/host/ohci-s3c2410.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
> index 7a1919ca543a..d8e03a801f2e 100644
> --- a/drivers/usb/host/ohci-s3c2410.c
> +++ b/drivers/usb/host/ohci-s3c2410.c
> @@ -457,6 +457,13 @@ static int ohci_hcd_s3c2410_drv_resume(struct device 
> *dev)
>   .resume = ohci_hcd_s3c2410_drv_resume,
>  };
>  
> +static const struct of_device_id ohci_hcd_s3c2410_dt_ids[] = {
> + { .compatible = "samsung,s3c2410-ohci" },
> + { /* sentinel */ }
> +};
> +

A nit, usually MODULE_DEVICE_TABLE comes right after the table, without
a blank line.

Beside that:
Acked-by: Krzysztof Kozlowski 

Best regards,
Krzysztof

> +MODULE_DEVICE_TABLE(of, ohci_hcd_s3c2410_dt_ids);
> +
>  static struct platform_driver ohci_hcd_s3c2410_driver = {
>   .probe  = ohci_hcd_s3c2410_drv_probe,
>   .remove = ohci_hcd_s3c2410_drv_remove,
> @@ -464,6 +471,7 @@ static int ohci_hcd_s3c2410_drv_resume(struct device *dev)
>   .driver = {
>   .name   = "s3c2410-ohci",
>   .pm = &ohci_hcd_s3c2410_pm_ops,
> + .of_match_table = ohci_hcd_s3c2410_dt_ids,
>   },
>  };
>  
> -- 
> 1.9.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


[PATCH] xhci fix for Intel Apollo Lake

2016-11-27 Thread wan . ahmad . zainie . wan . mohamad
From: Wan Ahmad Zainie 

Hi.

Intel Apollo Lake also requires the XHCI_PME_STUCK_QUIRK. Without it, xhci
is preventing the system from entering S0ix.

This patch is tested on Leaf Hill platform.

Thank you.

Best regards,
Zainie

Wan Ahmad Zainie (1):
  usb: xhci: apply XHCI_PME_STUCK_QUIRK to Intel Apollo Lake

 drivers/usb/host/xhci-pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
1.9.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


[PATCH] usb: xhci: apply XHCI_PME_STUCK_QUIRK to Intel Apollo Lake

2016-11-27 Thread wan . ahmad . zainie . wan . mohamad
From: Wan Ahmad Zainie 

Intel Apollo Lake also requires XHCI_PME_STUCK_QUIRK.
Adding its PCI ID to quirk.

Signed-off-by: Wan Ahmad Zainie 
---
 drivers/usb/host/xhci-pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index e96ae80..954abfd 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -165,7 +165,8 @@ static void xhci_pci_quirks(struct device *dev, struct 
xhci_hcd *xhci)
 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI ||
 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ||
 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI ||
-pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI)) {
+pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI ||
+pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) {
xhci->quirks |= XHCI_PME_STUCK_QUIRK;
}
if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
-- 
1.9.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


[GIT PULL] usb: chipidea changes for v4.10-rc1

2016-11-27 Thread Peter Chen
The following changes since commit bb2d387c4d90f5b400b94a0fcb5aaef31dfc0789:

  USB: cdc-acm: use get_icount tty operation (2016-11-10 13:16:57 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git/ 
tags/usb-ci-v4.10-rc1

for you to fetch changes up to 3be3251db0887f721f9c110e1966900922fc4ff4:

  usb: chipidea: imx: Disable internal 60Mhz clock with ULPI PHY (2016-11-14 
10:03:40 +0800)


- Adding ULPI PHY support for imx53
- Properly mark little endian descriptors for udc


Fabien Lahoudere (2):
  usb: chipidea: imx: configure imx for ULPI phy
  usb: chipidea: imx: Disable internal 60Mhz clock with ULPI PHY

Stephen Boyd (1):
  usb: chipidea: Properly mark little endian descriptors

 drivers/usb/chipidea/ci_hdrc_imx.c |  4 ++
 drivers/usb/chipidea/ci_hdrc_imx.h |  1 +
 drivers/usb/chipidea/udc.c |  6 +--
 drivers/usb/chipidea/udc.h | 12 +++---
 drivers/usb/chipidea/usbmisc_imx.c | 86 +++---
 5 files changed, 86 insertions(+), 23 deletions(-)

-- 

Best Regards,
Peter Chen
--
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 v2] fsl/usb: Workarourd for USB erratum-A005697

2016-11-27 Thread Jerry Huang
Thanks a lot  for you look into this patch, I will fixed these typos.


Best Regards
Jerry Huang


-Original Message-
From: Sergei Shtylyov [mailto:sergei.shtyl...@cogentembedded.com] 
Sent: Friday, November 25, 2016 9:12 PM
To: Jerry Huang ; st...@rowland.harvard.edu; 
gre...@linuxfoundation.org
Cc: Ramneek Mehresh ; julia.law...@lip6.fr; Sriram 
Dash ; linux-usb@vger.kernel.org; 
linux-ker...@vger.kernel.org
Subject: Re: [PATCH v2] fsl/usb: Workarourd for USB erratum-A005697

Hello.

On 11/25/2016 06:24 AM, Changming Huang wrote:

> The EHCI specification states the following in the SUSP bit description:
> In the Suspend state, the port is senstive to resume detection.

Sensitive.

> Note that the bit status does not change untile the port is suspended 
> and

Until.

> that there may be a delay in susupending a port if there is a 
> transaction

Suspending.

> currently in progress on the USB.
>
> However, in NXP USBDR controller, the PORTSCx[SUSP] bit changes 
> immediately when the application sets it and not when the port is actually 
> suspended.
>
> So the application must wait for at least 10 milliseconds after a port 
> indicates that it is suspended, to make sure this port has entered 
> suspended state before initiating this port resume using the Force 
> Port Resume bit. This bit is for NXP controller, not EHCI compatible.
>
> Signed-off-by: Changming Huang 
> Signed-off-by: Ramneek Mehresh 

[...]

> diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c 
> index 74f62d6..81e2310 100644
> --- a/drivers/usb/host/ehci-hub.c
> +++ b/drivers/usb/host/ehci-hub.c
> @@ -310,6 +310,13 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
>   }
>   spin_unlock_irq(&ehci->lock);
>
> + if (changed && ehci_has_fsl_susp_errata(ehci))
> + /* Wait for at least 10 millisecondes to ensure the controller

Milliseconds.

> +  * enter the suspend status before initiating a port resume
> +  * using the Fore Port Resume bit (Not-EHCI compatible).

Maybe force?
s/Not/non/ also.

> +  */
> + usleep_range(1, 2);
> +
>   if ((changed && ehci->has_tdi_phy_lpm) || fs_idle_delay) {
>   /*
>* Wait for HCD to enter low-power mode or for the bus
[...]
> @@ -703,10 +704,15 @@ struct ehci_tt {  #if defined(CONFIG_PPC_85xx)
>  /* Some Freescale processors have an erratum (USB A-005275) in which
>   * incoming packets get corrupted in HS mode
> + * Some Freescale processors have an erratum (USB A-005697) in which
> + * we need to wait for 10ms for bus to fo into suspend mode after

Fo?

[...]

MBR, Sergei

N�r��yb�X��ǧv�^�)޺{.n�+{��^n�r���z���h�&���G���h�(�階�ݢj"���m��z�ޖ���f���h���~�m�

Re: [PATCH v2] usb: xhci: Remove unuseful 'return' and 'break' statement

2016-11-27 Thread Baolin Wang
Hi Mathias,

On 24 November 2016 at 19:16, Baolin Wang  wrote:
> Since these 'return' statements are not generally useful in void
> function, remove them. Also remove one unuseful 'break' statement
> in xhci_setup_addressable_virt_dev() function.
>
> Signed-off-by: Baolin Wang 
> ---
> Changes since v1:
>  - Add description of removing 'break' statement in commitlog.
> ---

Could you apply this patch if there are no other comments? Thanks.

-- 
Baolin.wang
Best Regards
--
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 v4 1/2] usb: host: plat: Enable xhci plat runtime PM

2016-11-27 Thread Baolin Wang
Enable the xhci plat runtime PM for parent device to suspend/resume xhci.
Also call pm_runtime_get_noresume() in probe() function in case the parent
device doesn't call suspend/resume callback by runtime PM now.

Signed-off-by: Baolin Wang 
---
Changes since v3:
 - Fix kbuild error.

Changes since v2:
 - Add pm_runtime_get_noresume() in probe() function.
 - Add pm_runtime_set_suspended()/pm_runtime_put_noidle() in remove() function.

Changes since v1:
 - No updates.
---
 drivers/usb/host/xhci-plat.c |   41 -
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index ed56bf9..5805c6a 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -246,6 +246,10 @@ static int xhci_plat_probe(struct platform_device *pdev)
if (ret)
goto dealloc_usb2_hcd;
 
+   pm_runtime_get_noresume(&pdev->dev);
+   pm_runtime_set_active(&pdev->dev);
+   pm_runtime_enable(&pdev->dev);
+
return 0;
 
 
@@ -274,6 +278,10 @@ static int xhci_plat_remove(struct platform_device *dev)
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
struct clk *clk = xhci->clk;
 
+   pm_runtime_set_suspended(&dev->dev);
+   pm_runtime_put_noidle(&dev->dev);
+   pm_runtime_disable(&dev->dev);
+
usb_remove_hcd(xhci->shared_hcd);
usb_phy_shutdown(hcd->usb_phy);
 
@@ -311,14 +319,37 @@ static int xhci_plat_resume(struct device *dev)
 
return xhci_resume(xhci, 0);
 }
+#endif /* CONFIG_PM_SLEEP */
+
+#ifdef CONFIG_PM
+static int xhci_plat_runtime_suspend(struct device *dev)
+{
+   struct usb_hcd  *hcd = dev_get_drvdata(dev);
+   struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+
+   return xhci_suspend(xhci, device_may_wakeup(dev));
+}
+
+static int xhci_plat_runtime_resume(struct device *dev)
+{
+   struct usb_hcd  *hcd = dev_get_drvdata(dev);
+   struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+
+   return xhci_resume(xhci, 0);
+}
+
+static int xhci_plat_runtime_idle(struct device *dev)
+{
+   return 0;
+}
+#endif /* CONFIG_PM */
 
 static const struct dev_pm_ops xhci_plat_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(xhci_plat_suspend, xhci_plat_resume)
+
+   SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend, xhci_plat_runtime_resume,
+  xhci_plat_runtime_idle)
 };
-#define DEV_PM_OPS (&xhci_plat_pm_ops)
-#else
-#define DEV_PM_OPS NULL
-#endif /* CONFIG_PM */
 
 static const struct acpi_device_id usb_xhci_acpi_match[] = {
/* XHCI-compliant USB Controller */
@@ -332,7 +363,7 @@ static int xhci_plat_resume(struct device *dev)
.remove = xhci_plat_remove,
.driver = {
.name = "xhci-hcd",
-   .pm = DEV_PM_OPS,
+   .pm = &xhci_plat_pm_ops,
.of_match_table = of_match_ptr(usb_xhci_of_match),
.acpi_match_table = ACPI_PTR(usb_xhci_acpi_match),
},
-- 
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 v4 2/2] usb: dwc3: core: Support the dwc3 host suspend/resume

2016-11-27 Thread Baolin Wang
For some mobile devices with strict power management, we also want to suspend
the host when the slave is detached for power saving. Thus we add the host
suspend/resume functions to support this requirement.

Signed-off-by: Baolin Wang 
---
Changes since v3:
 - No updates.

Changes since v2:
 - Remove pm_children_suspended() and other unused macros.

 Changes since v1:
   - Add pm_runtime.h head file to avoid kbuild error.
---
 drivers/usb/dwc3/Kconfig |7 +++
 drivers/usb/dwc3/core.c  |   26 +-
 drivers/usb/dwc3/core.h  |   15 +++
 drivers/usb/dwc3/host.c  |   37 +
 4 files changed, 84 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index a45b4f1..47bb2f3 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -47,6 +47,13 @@ config USB_DWC3_DUAL_ROLE
 
 endchoice
 
+config USB_DWC3_HOST_SUSPEND
+   bool "Choose if the DWC3 host (xhci) can be suspend/resume"
+   depends on USB_DWC3_HOST=y || USB_DWC3_DUAL_ROLE=y
+   help
+ We can suspend the host when the slave is detached for power saving,
+ and resume the host when one slave is attached.
+
 comment "Platform Glue Driver Support"
 
 config USB_DWC3_OMAP
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 9a4a5e4..7ad4bc3 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1091,6 +1091,7 @@ static int dwc3_probe(struct platform_device *pdev)
pm_runtime_use_autosuspend(dev);
pm_runtime_set_autosuspend_delay(dev, DWC3_DEFAULT_AUTOSUSPEND_DELAY);
pm_runtime_enable(dev);
+   pm_suspend_ignore_children(dev, true);
ret = pm_runtime_get_sync(dev);
if (ret < 0)
goto err1;
@@ -1215,15 +1216,27 @@ static int dwc3_remove(struct platform_device *pdev)
 static int dwc3_suspend_common(struct dwc3 *dwc)
 {
unsigned long   flags;
+   int ret;
 
switch (dwc->dr_mode) {
case USB_DR_MODE_PERIPHERAL:
+   spin_lock_irqsave(&dwc->lock, flags);
+   dwc3_gadget_suspend(dwc);
+   spin_unlock_irqrestore(&dwc->lock, flags);
+   break;
case USB_DR_MODE_OTG:
+   ret = dwc3_host_suspend(dwc);
+   if (ret)
+   return ret;
+
spin_lock_irqsave(&dwc->lock, flags);
dwc3_gadget_suspend(dwc);
spin_unlock_irqrestore(&dwc->lock, flags);
break;
case USB_DR_MODE_HOST:
+   ret = dwc3_host_suspend(dwc);
+   if (ret)
+   return ret;
default:
/* do nothing */
break;
@@ -1245,12 +1258,23 @@ static int dwc3_resume_common(struct dwc3 *dwc)
 
switch (dwc->dr_mode) {
case USB_DR_MODE_PERIPHERAL:
+   spin_lock_irqsave(&dwc->lock, flags);
+   dwc3_gadget_resume(dwc);
+   spin_unlock_irqrestore(&dwc->lock, flags);
+   break;
case USB_DR_MODE_OTG:
+   ret = dwc3_host_resume(dwc);
+   if (ret)
+   return ret;
+
spin_lock_irqsave(&dwc->lock, flags);
dwc3_gadget_resume(dwc);
spin_unlock_irqrestore(&dwc->lock, flags);
-   /* FALLTHROUGH */
+   break;
case USB_DR_MODE_HOST:
+   ret = dwc3_host_resume(dwc);
+   if (ret)
+   return ret;
default:
/* do nothing */
break;
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index b585a30..db41908 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -1226,4 +1226,19 @@ static inline void dwc3_ulpi_exit(struct dwc3 *dwc)
 { }
 #endif
 
+#if IS_ENABLED(CONFIG_USB_DWC3_HOST_SUSPEND)
+int dwc3_host_suspend(struct dwc3 *dwc);
+int dwc3_host_resume(struct dwc3 *dwc);
+#else
+static inline int dwc3_host_suspend(struct dwc3 *dwc)
+{
+   return 0;
+}
+
+static inline int dwc3_host_resume(struct dwc3 *dwc)
+{
+   return 0;
+}
+#endif
+
 #endif /* __DRIVERS_USB_DWC3_CORE_H */
diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index ed82464..8e5309d6 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -16,6 +16,7 @@
  */
 
 #include 
+#include 
 
 #include "core.h"
 
@@ -130,3 +131,39 @@ void dwc3_host_exit(struct dwc3 *dwc)
  dev_name(&dwc->xhci->dev));
platform_device_unregister(dwc->xhci);
 }
+
+#ifdef CONFIG_USB_DWC3_HOST_SUSPEND
+int dwc3_host_suspend(struct dwc3 *dwc)
+{
+   struct device *xhci = &dwc->xhci->dev;
+   int ret;
+
+   /*
+* Note: if we get the -EBUSY, which means the xHCI children devices are
+* not in suspend state yet, the glue layer need to wait for a while and
+* try to suspend xHCI device again.
+

Re: [PATCH v18 0/4] Introduce usb charger framework to deal with the usb gadget power negotation

2016-11-27 Thread Baolin Wang
On 25 November 2016 at 21:00, Mark Brown  wrote:
> On Tue, Nov 22, 2016 at 09:40:07AM +1100, NeilBrown wrote:
>
>> I agree that the question of where the responsibility for information
>> aggregation lies is open for discussion. If fact all details on how
>> things should work are always open for discussion.
>> I don't agree that this is the main different between our positions,
>> though I can see how you might get that impression.
>
>> You could even fix them so they look *exactly* like the notifiers that
>> Baolin is proposing.  This is my key point.  It is not the end result
>> that I particularly object to (though I do object to some details).  It
>
> Ah, OK.  This really hadn't been at all clear - both Baolin and I had
> the impression that the it was both that were blockers for you.  What
> were the details here?
>
>> is the process of getting to the end result that I don't like.  If the
>> current system doesn't work and something different is needed, then the
>> correct thing to do is to transform the existing system into something
>> new that works better.  This should be a clear series of steps.  Each
>
> Sometimes there's something to be said for working out what we want
> things to look like before setting out to make these gradual
> refactorings and sometimes the refactorings are just more pain than
> they're worth, especially when they go across subsystems.  In this case
> I do worry about the cross subsystem aspect causing hassle, it may be
> more practical to do anything that represents an interface change by
> adding the new interface, converting the users to it and then removing
> the old interface.
>
> At the very least the series should grow to incorporate conversion of
> the existing users though.  Baolin, I think this does need adding to the
> series but probably best to think about how to do it - some of Neil's
> suggestions for incremental steps do seem like they should be useful
> for organizing things here, probably we can get some things that can be
> done internally within individual drivers merged while everything else
> is under discussion.

OK. I will think about how to incorporate conversion of the existing
users according to Neil's suggestion.

>
>> But I think here my key point got lost too, in part because it was hard
>> to refer to an actual instance.
>> My point was that in the present patch set, the "usb charger" is given
>> a name which is dependant on discovery order, and only supports
>> lookup-by-name.  This cannot work.
>
> There's two bits here: one is the way names are assigned and the other
> is the lookup by name.  I agree that the lookup by name isn't
> particularly useful as things stand, that could just be dropped until
> some naming mechanism is added.  We'd be more likely to use phandles in
> DT systems, I don't know what ACPI systems would look like but I guess
> it'd be something similar.
>
>> If they supported lookup by phy-name or lookup-by-active (i.e. "find me
>> any usb-charger which has power available"), or look up by some other
>> attribute, then discover-order naming could work.  But the only
>> lookup-mechanism is by-name, and the names aren't reliably stable.  So
>> the name/lookup system proposed cannot possibly do anything useful
>> with more than one usb_charger.
>
> Baolin, I think adding a DT binding and lookup mechanism makes sense
> here - do you agree?

Yes, I agree. But 'usb charger' is one virtual device and we described
nothing in DT about 'usb charger'. But as you and Neil said, we need
one usful method to look up the USB charger. I will think about that.
Thanks.

-- 
Baolin.wang
Best Regards
--
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 v2] usb: xhci: Remove unuseful 'return' and 'break' statement

2016-11-27 Thread Greg KH
On Mon, Nov 28, 2016 at 02:29:25PM +0800, Baolin Wang wrote:
> Hi Mathias,
> 
> On 24 November 2016 at 19:16, Baolin Wang  wrote:
> > Since these 'return' statements are not generally useful in void
> > function, remove them. Also remove one unuseful 'break' statement
> > in xhci_setup_addressable_virt_dev() function.
> >
> > Signed-off-by: Baolin Wang 
> > ---
> > Changes since v1:
> >  - Add description of removing 'break' statement in commitlog.
> > ---
> 
> Could you apply this patch if there are no other comments? Thanks.

Less than a week response for a simple cleanup patch?  Why the rush and
pressure?  Relax, this really isn't an important 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: [PATCH] usb: xhci: apply XHCI_PME_STUCK_QUIRK to Intel Apollo Lake

2016-11-27 Thread Greg KH
On Mon, Nov 28, 2016 at 09:53:52AM +0800, 
wan.ahmad.zainie.wan.moha...@intel.com wrote:
> From: Wan Ahmad Zainie 
> 
> Intel Apollo Lake also requires XHCI_PME_STUCK_QUIRK.
> Adding its PCI ID to quirk.
> 
> Signed-off-by: Wan Ahmad Zainie 
> ---
>  drivers/usb/host/xhci-pci.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index e96ae80..954abfd 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -165,7 +165,8 @@ static void xhci_pci_quirks(struct device *dev, struct 
> xhci_hcd *xhci)
>pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI ||
>pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ||
>pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI ||
> -  pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI)) {
> +  pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI ||
> +  pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) {
>   xhci->quirks |= XHCI_PME_STUCK_QUIRK;

When is Intel going to fix this?  Why don't we just blacklist all intel
hosts :(

--
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 v2] usb: xhci: Remove unuseful 'return' and 'break' statement

2016-11-27 Thread Baolin Wang
On 28 November 2016 at 15:21, Greg KH  wrote:
> On Mon, Nov 28, 2016 at 02:29:25PM +0800, Baolin Wang wrote:
>> Hi Mathias,
>>
>> On 24 November 2016 at 19:16, Baolin Wang  wrote:
>> > Since these 'return' statements are not generally useful in void
>> > function, remove them. Also remove one unuseful 'break' statement
>> > in xhci_setup_addressable_virt_dev() function.
>> >
>> > Signed-off-by: Baolin Wang 
>> > ---
>> > Changes since v1:
>> >  - Add description of removing 'break' statement in commitlog.
>> > ---
>>
>> Could you apply this patch if there are no other comments? Thanks.
>
> Less than a week response for a simple cleanup patch?  Why the rush and
> pressure?  Relax, this really isn't an important patch...

I am sorry for the pressure, I just thought it is one simple cleanup
patch. It is okay for me to wait for.

-- 
Baolin.wang
Best Regards
--
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: [GIT PULL] usb: chipidea changes for v4.10-rc1

2016-11-27 Thread Greg Kroah-Hartman
On Mon, Nov 28, 2016 at 10:16:33AM +0800, Peter Chen wrote:
> The following changes since commit bb2d387c4d90f5b400b94a0fcb5aaef31dfc0789:
> 
>   USB: cdc-acm: use get_icount tty operation (2016-11-10 13:16:57 +0100)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git/ 
> tags/usb-ci-v4.10-rc1

Pulled and pushed out, thanks.

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: [PATCH v2] fsl/usb: Workarourd for USB erratum-A005697

2016-11-27 Thread Jerry Huang
Thanks a lot, Alan,
I will send the v3 with your suggestion.

Best Regards
Jerry Huang


-Original Message-
From: Alan Stern [mailto:st...@rowland.harvard.edu] 
Sent: Friday, November 25, 2016 11:14 PM
To: Jerry Huang 
Cc: gre...@linuxfoundation.org; Ramneek Mehresh ; 
julia.law...@lip6.fr; Sriram Dash ; 
linux-usb@vger.kernel.org; linux-ker...@vger.kernel.org
Subject: Re: [PATCH v2] fsl/usb: Workarourd for USB erratum-A005697

On Fri, 25 Nov 2016, Changming Huang wrote:

> The EHCI specification states the following in the SUSP bit description:
> In the Suspend state, the port is senstive to resume detection.
> Note that the bit status does not change untile the port is suspended 
> and that there may be a delay in susupending a port if there is a 
> transaction currently in progress on the USB.
> 
> However, in NXP USBDR controller, the PORTSCx[SUSP] bit changes 
> immediately when the application sets it and not when the port is actually 
> suspended.
> 
> So the application must wait for at least 10 milliseconds after a port 
> indicates that it is suspended, to make sure this port has entered 
> suspended state before initiating this port resume using the Force 
> Port Resume bit. This bit is for NXP controller, not EHCI compatible.
> 
> Signed-off-by: Changming Huang 
> Signed-off-by: Ramneek Mehresh 
> ---
> Change in v2:
> - move sleep out of spin-lock and add more comment for this workaround

This patch is incomplete.

> --- a/drivers/usb/host/ehci-hub.c
> +++ b/drivers/usb/host/ehci-hub.c
> @@ -310,6 +310,13 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
>   }
>   spin_unlock_irq(&ehci->lock);
>  
> + if (changed && ehci_has_fsl_susp_errata(ehci))
> + /* Wait for at least 10 millisecondes to ensure the controller
> +  * enter the suspend status before initiating a port resume
> +  * using the Fore Port Resume bit (Not-EHCI compatible).
> +  */

The proper style for multi-line comments is:

/*
 * Wait for ...
 * ...
 */

Also, "Force" is misspelled.

> + usleep_range(1, 2);
> +
>   if ((changed && ehci->has_tdi_phy_lpm) || fs_idle_delay) {
>   /*
>* Wait for HCD to enter low-power mode or for the bus

The patch does not change the code around line 1190 in the original
file:

/* After above check the port must be connected.
 * Set appropriate bit thus could put phy into low power
 * mode if we have tdi_phy_lpm feature
 */
temp &= ~PORT_WKCONN_E;
temp |= PORT_WKDISC_E | PORT_WKOC_E;
ehci_writel(ehci, temp | PORT_SUSPEND, status_reg);

This code sets the PORT_SUSPEND bit but does not have a 10-ms delay.  
You need to add a delay here.

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