RE: dma-coherent and snooping set

2016-12-15 Thread Jerry Huang
Hi, Balbi,
> -Original Message-
> From: Felipe Balbi [mailto:felipe.ba...@linux.intel.com]
> Sent: Wednesday, December 14, 2016 7:35 PM
> To: Jerry Huang 
> Cc: linux-usb@vger.kernel.org
> Subject: Re: dma-coherent and snooping set
> 
> 
> Hi,
> 
> Jerry Huang  writes:
> > hi, Balbi,
> > sorry to disturb you.
> >
> > some NXP platforms need dma-coherent property.
> >
> > I want to add "dma-coherent" into usb node in DTS file like other
> > platform done (e.g.
> > arch/arm64/boot/dts/marvell/armada-cp110-slave.dtsi).
> >
> > Could you please give some comment about this?
> 
> well, just send a patch ;-)
> 
When I add the "dma-coherent" property in dwc3/usb3 node, controller can't 
detect the usb drive. So I will just add new property "snps,dma-snooping", and 
send out the patch for it.
--
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] USB3/DWC3: Enable undefined length INCR burst type

2016-12-15 Thread Jerry Huang

> -Original Message-
> From: Changming Huang [mailto:jerry.hu...@nxp.com]
> Sent: Tuesday, December 13, 2016 5:06 PM
> To: ba...@kernel.org; gre...@linuxfoundation.org
> Cc: linux-usb@vger.kernel.org; linux-ker...@vger.kernel.org; Jerry Huang
> ; Rajesh Bhagat 
> Subject: [PATCH] USB3/DWC3: Enable undefined length INCR burst type
> 
> While enabling undefined length INCR burst type and INCR16 burst type, get
> better write performance on NXP Layerscape platform:
> around 3% improvement (from 364MB/s to 375MB/s).
> 
> Signed-off-by: Changming Huang 
> Signed-off-by: Rajesh Bhagat 
> ---
>  drivers/usb/dwc3/core.c |6 ++
>  drivers/usb/dwc3/core.h |   13 +
>  2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index
> fea4469..0e11891 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -621,6 +621,12 @@ static int dwc3_core_init(struct dwc3 *dwc)
>   goto err0;
>   }
> 
> + /* Enable Undefined Length INCR Burst Type and Enable INCR16
> Burst */
> + reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
> + reg &= ~DWC3_GSBUSCFG0_INCRBRSTMASK;
> + reg |= DWC3_GSBUSCFG0_INCR16BRSTENA |
> DWC3_GSBUSCFG0_INCRBRSTENA;
> + dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
> +
>   /*
>* Write Linux Version Code to our GUID register so it's easy to figure
>* out which kernel version a bug was found.
> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index
> 6b60e42..8bfdb77 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -156,6 +156,19 @@
> 
>  /* Bit fields */
> 
> +/* Global SoC Bus Configuration Register 0 */
> +#define DWC3_GSBUSCFG0_DATABIGEND(1 << 11)
> +#define DWC3_GSBUSCFG0_DESCBIGEND(1 << 10)
> +#define DWC3_GSBUSCFG0_INCR256BRSTENA(1 << 7)
> +#define DWC3_GSBUSCFG0_INCR128BRSTENA(1 << 6)
> +#define DWC3_GSBUSCFG0_INCR64BRSTENA (1 << 5)
> +#define DWC3_GSBUSCFG0_INCR32BRSTENA (1 << 4)
> +#define DWC3_GSBUSCFG0_INCR16BRSTENA (1 << 3)
> +#define DWC3_GSBUSCFG0_INCR8BRSTENA  (1 << 2)
> +#define DWC3_GSBUSCFG0_INCR4BRSTENA  (1 << 1)
> +#define DWC3_GSBUSCFG0_INCRBRSTENA   (1 << 0)
> +#define DWC3_GSBUSCFG0_INCRBRSTMASK  0xff
> +
>  /* Global Debug Queue/FIFO Space Available Register */
>  #define DWC3_GDBGFIFOSPACE_NUM(n)((n) & 0x1f)
>  #define DWC3_GDBGFIFOSPACE_TYPE(n)   (((n) << 5) & 0x1e0)
> --
I will split this patch to two, one is for the performance tune, the other for 
macro definition in header file.
--
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: musb: debugfs: allow forcing host mode together with speed in testmode

2016-12-15 Thread Bin Liu
On Wed, Dec 14, 2016 at 08:23:45PM +0100, Pali Rohár wrote:
> Based on the musb ug, force_host bit is allowed to be set along with
> force_hs or force_fs bit.
> 
> It could help to implement forced host mode via testmode on Nokia N900.
> 
> Signed-off-by: Pali Rohár 
> ---
>  drivers/usb/musb/musb_debugfs.c |   44 
> +--
>  1 file changed, 28 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
> index 9b22d94..62c13a2 100644
> --- a/drivers/usb/musb/musb_debugfs.c
> +++ b/drivers/usb/musb/musb_debugfs.c
> @@ -147,28 +147,34 @@ static int musb_test_mode_show(struct seq_file *s, void 
> *unused)
>  
>   test = musb_readb(musb->mregs, MUSB_TESTMODE);
>  
> - if (test & MUSB_TEST_FORCE_HOST)
> + if (test & (MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS))

if (test & (MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS) ==
MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS)

or even simpler:

if (test == MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS)

since multiple tests at the same time are not allowed.

> + seq_printf(s, "force host full-speed\n");
> +
> + else if (test & (MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_HS))

else if (test == MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_HS)

Regards,
-Bin.
--
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: musb: fix compilation warning on unused function

2016-12-15 Thread Bin Liu
On Wed, Dec 07, 2016 at 10:58:44PM -0500, Jérémy Lefaure wrote:
> The function musb_run_resume_work is called only when CONFIG_PM is
> enabled. So this function should not be defined when CONFIG_PM is
> disabled. Otherwise the compiler issues a warning:
> 
> drivers/usb/musb/musb_core.c:2057:12: error: ‘musb_run_resume_work’ defined 
> but
> not used [-Werror=unused-function]
>  static int musb_run_resume_work(struct musb *musb)
> ^~~~
> 
> Signed-off-by: Jérémy Lefaure 

Applied. Thanks.

Regards,
-Bin.

> ---
> 
> I think that adding a preprocessor condition is a better way to fix this than
> moving the function into the scope of the existing condition to preserve the
> git history.
> 
>  drivers/usb/musb/musb_core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> index 9e22646..fca288bb 100644
> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
> @@ -2050,6 +2050,7 @@ struct musb_pending_work {
>   struct list_head node;
>  };
>  
> +#ifdef CONFIG_PM
>  /*
>   * Called from musb_runtime_resume(), musb_resume(), and
>   * musb_queue_resume_work(). Callers must take musb->lock.
> @@ -2077,6 +2078,7 @@ static int musb_run_resume_work(struct musb *musb)
>  
>   return error;
>  }
> +#endif
>  
>  /*
>   * Called to run work if device is active or else queue the work to happen
> -- 
> 2.10.2
> 
--
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 3/3] usb: musb: da8xx: Fix host mode suspend

2016-12-15 Thread Bin Liu
On Mon, Nov 28, 2016 at 05:26:21PM +0100, Alexandre Bailon wrote:
> On da8xx, VBUS is not maintained during suspend when musb is in host mode.
> On resume, all the connected devices will be disconnected and then will
> be enumerated again.
> This happens because MUSB_DEVCTL is cleared during suspend.
> MUSB_DEVCTL is clear twice: once by da8xx_musb_disable()
> and once musb_generic_disable().
> 
> Don't clear MUSB_DEVCTL in da8xx_musb_disable() and use the quirk
> MUSB_PRESERVE_DEVCTL to preseve MUSB_DEVCTL during suspend.
> 
> Signed-off-by: Alexandre Bailon 
> ---
>  drivers/usb/musb/da8xx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
> index 905f0d9..90f0c06 100644
> --- a/drivers/usb/musb/da8xx.c
> +++ b/drivers/usb/musb/da8xx.c
> @@ -125,7 +125,6 @@ static void da8xx_musb_disable(struct musb *musb)
>   musb_writel(reg_base, DA8XX_USB_INTR_MASK_CLEAR_REG,
>   DA8XX_INTR_USB_MASK |
>   DA8XX_INTR_TX_MASK | DA8XX_INTR_RX_MASK);
> - musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
>   musb_writel(reg_base, DA8XX_USB_END_OF_INTR_REG, 0);
>  }

This would be in a separate patch. I have cleaned it up as in [1].

>  
> @@ -458,7 +457,8 @@ static inline u8 get_vbus_power(struct device *dev)
>  }
>  
>  static const struct musb_platform_ops da8xx_ops = {
> - .quirks = MUSB_DMA_CPPI | MUSB_INDEXED_EP,
> + .quirks = MUSB_DMA_CPPI | MUSB_INDEXED_EP |
> +   MUSB_PRESERVE_DEVCTL,

MUSB_PRESERVE_SESSION would be a better name.

>   .init   = da8xx_musb_init,
>   .exit   = da8xx_musb_exit,
>  

[1] http://www.spinics.net/lists/linux-usb/msg150857.html

Regards,
-Bin.

--
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/3] usb: musb: Add a quirk to preserve MUSB_DEVCTL during suspend

2016-12-15 Thread Bin Liu
On Mon, Nov 28, 2016 at 05:26:20PM +0100, Alexandre Bailon wrote:
> On da8xx, VBUS is not maintained during suspend when musb is in host mode.
> On resume, all the connected devices will be disconnected and then will
> be enumerated again.
> This happens because MUSB_DEVCTL is cleared during suspend.
> Add a quirk to preserve MUSB_DEVCTL during a suspend.
> 
> Signed-off-by: Alexandre Bailon 
> ---
>  drivers/usb/musb/musb_core.c | 13 +++--
>  drivers/usb/musb/musb_core.h |  1 +
>  2 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> index 9e22646..7e2cd98 100644
> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
> @@ -1040,14 +1040,15 @@ static void musb_enable_interrupts(struct musb *musb)
>  
>  }
>  
> -static void musb_generic_disable(struct musb *musb)
> +static void musb_generic_disable(struct musb *musb, bool suspend)

I don't think I like it, so made a change [1] to remove this function,
since it only has two lines of code.

>  {
>   void __iomem*mbase = musb->mregs;
>  
>   musb_disable_interrupts(musb);
>  
>   /* off */
> - musb_writeb(mbase, MUSB_DEVCTL, 0);
> + if (!suspend || !(musb->io.quirks & MUSB_PRESERVE_DEVCTL))
> + musb_writeb(mbase, MUSB_DEVCTL, 0);

So now you can move this quirk check into musb_suspend(),

>  }
>  
>  /*
> @@ -1106,7 +1107,7 @@ void musb_stop(struct musb *musb)
>  {
>   /* stop IRQs, timers, ... */
>   musb_platform_disable(musb);
> - musb_generic_disable(musb);
> + musb_generic_disable(musb, false);
>   musb_dbg(musb, "HDRC disabled");
>  
>   /* FIXME
> @@ -2310,7 +2311,7 @@ musb_init_controller(struct device *dev, int nIrq, void 
> __iomem *ctrl)
>  
>   /* be sure interrupts are disabled before connecting ISR */
>   musb_platform_disable(musb);
> - musb_generic_disable(musb);
> + musb_generic_disable(musb, false);
>  
>   /* Init IRQ workqueue before request_irq */
>   INIT_DELAYED_WORK(>irq_work, musb_irq_work);
> @@ -2486,7 +2487,7 @@ static int musb_remove(struct platform_device *pdev)
>   musb_gadget_cleanup(musb);
>   spin_lock_irqsave(>lock, flags);
>   musb_platform_disable(musb);
> - musb_generic_disable(musb);
> + musb_generic_disable(musb, false);
>   spin_unlock_irqrestore(>lock, flags);
>   musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
>   pm_runtime_dont_use_autosuspend(musb->controller);
> @@ -2663,7 +2664,7 @@ static int musb_suspend(struct device *dev)
>   unsigned long   flags;
>  
>   musb_platform_disable(musb);
> - musb_generic_disable(musb);
> + musb_generic_disable(musb, true);
>   WARN_ON(!list_empty(>pending_list));

and all the changes above are no longer needed. Can you please revise
this patch based on [1]?

>  
>   spin_lock_irqsave(>lock, flags);
> diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
> index a611e2f..22961ef 100644
> --- a/drivers/usb/musb/musb_core.h
> +++ b/drivers/usb/musb/musb_core.h
> @@ -172,6 +172,7 @@ struct musb_io;
>   */
>  struct musb_platform_ops {
>  
> +#define MUSB_PRESERVE_DEVCTL BIT(7)

Does it miss a TAB before BIT to align with follows?

>  #define MUSB_DMA_UX500   BIT(6)
>  #define MUSB_DMA_CPPI41  BIT(5)
>  #define MUSB_DMA_CPPIBIT(4)
> -- 
> 2.7.3
>

[1] http://www.spinics.net/lists/linux-usb/msg150856.html

Regards,
-Bin.

--
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 0/3] usb: musb: da8xx: Add support of suspend / resume

2016-12-15 Thread Bin Liu
On Mon, Nov 28, 2016 at 05:26:18PM +0100, Alexandre Bailon wrote:
> There is no suspend / resume support for da8xx.
> Add the PM methods to da8xx glue.
> In addition, introduce a new quirk to not clear the devctl register.
> Clearing devctl will power off vbus on da8xx platform
> (when it is host mode) and then devices will be disconnected on resume.
> 
> The quirk name (MUSB_PRESERVE_DEVCTL) doesn't seem good to me,
> so if anyone have better name, I will be happy to rename it.

Writting 0 to MUSB_DEVCTL register is basically to clear bit 0 to turn
off the session, so I think MUSB_PRESERVE_SESSION would be a better
name.

Regards,
-Bin.

> I think there is other ways to fix the VBUS issue but adding a quirk
> make the required changes harmless to other platform.
> 
> Alexandre Bailon (3):
>   usb: musb: da8xx: Add support of suspend / resume
>   usb: musb: Add a quirk to preserve MUSB_DEVCTL during suspend
>   usb: musb: da8xx: Fix host mode suspend
> 
>  drivers/usb/musb/da8xx.c | 33 +++--
>  drivers/usb/musb/musb_core.c | 13 +++--
>  drivers/usb/musb/musb_core.h |  1 +
>  3 files changed, 39 insertions(+), 8 deletions(-)
> 
> -- 
> 2.7.3
> 
> --
> 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
--
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: ohci-at91: use descriptor-based gpio APIs correctly

2016-12-15 Thread Peter Rosin
The devm_gpiod_get_optional function does not want the -gpio suffix.
The descriptor based APIs handle active high/low automatically.
The vbus gpios are output, request enable while getting the gpio.
Don't try to get any vbus gpios for ports outside num-ports.

WTF? Big sigh.

Fixes: 054d4b7b577d ("usb: ohci-at91: Use descriptor-based gpio APIs")
Signed-off-by: Peter Rosin 
---
 drivers/usb/host/ohci-at91.c | 20 
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 1b2e09c32c6b..789fc342b553 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -43,7 +43,6 @@ struct at91_usbh_data {
struct gpio_desc *overcurrent_pin[AT91_MAX_USBH_PORTS];
u8 ports;   /* number of ports on root hub 
*/
u8 overcurrent_supported;
-   u8 vbus_pin_active_low[AT91_MAX_USBH_PORTS];
u8 overcurrent_status[AT91_MAX_USBH_PORTS];
u8 overcurrent_changed[AT91_MAX_USBH_PORTS];
 };
@@ -268,8 +267,7 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data 
*pdata, int port, int
if (!valid_port(port))
return;
 
-   gpiod_set_value(pdata->vbus_pin[port],
-   pdata->vbus_pin_active_low[port] ^ enable);
+   gpiod_set_value(pdata->vbus_pin[port], enable);
 }
 
 static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
@@ -277,8 +275,7 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data 
*pdata, int port)
if (!valid_port(port))
return -EINVAL;
 
-   return gpiod_get_value(pdata->vbus_pin[port]) ^
-  pdata->vbus_pin_active_low[port];
+   return gpiod_get_value(pdata->vbus_pin[port]);
 }
 
 /*
@@ -535,18 +532,17 @@ static int ohci_hcd_at91_drv_probe(struct platform_device 
*pdev)
pdata->ports = ports;
 
at91_for_each_port(i) {
+   if (i >= pdata->ports)
+   break;
+
pdata->vbus_pin[i] = devm_gpiod_get_optional(>dev,
-"atmel,vbus-gpio",
-GPIOD_IN);
+"atmel,vbus",
+GPIOD_OUT_HIGH);
if (IS_ERR(pdata->vbus_pin[i])) {
err = PTR_ERR(pdata->vbus_pin[i]);
dev_err(>dev, "unable to claim gpio \"vbus\": 
%d\n", err);
continue;
}
-
-   pdata->vbus_pin_active_low[i] = 
gpiod_get_value(pdata->vbus_pin[i]);
-
-   ohci_at91_usb_set_power(pdata, i, 1);
}
 
at91_for_each_port(i) {
@@ -555,7 +551,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device 
*pdev)
 
pdata->overcurrent_pin[i] =
devm_gpiod_get_optional(>dev,
-   "atmel,oc-gpio", GPIOD_IN);
+   "atmel,oc", GPIOD_IN);
if (IS_ERR(pdata->overcurrent_pin[i])) {
err = PTR_ERR(pdata->overcurrent_pin[i]);
dev_err(>dev, "unable to claim gpio 
\"overcurrent\": %d\n", err);
-- 
2.1.4

--
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: [usb-audio] 4.4.38: Zoom H2n hangs xhci

2016-12-15 Thread Sami Farin
On Thu, Dec 15, 2016 at 11:11:30 -0800, Greg KH wrote:
> On Thu, Dec 15, 2016 at 08:22:44PM +0200, Sami Farin wrote:
> > Sandybridge system on Asus P8Z68-V PRO GEN3 motherboard.
> > 
> > H2n connected to HP ZR24w's hub.  When H2n is used as microphone:
> > (H2n is now disconnected but it didn't make any diff.)
> 
> Can you try 4.9 and see if you still have the same issue?

With 4.9.0:

[  383.705179] usb 4-2.1: USB disconnect, device number 4
[  395.119190] usb 4-2.1: new full-speed USB device number 6 using xhci_hcd
[  395.215948] usb 4-2.1: New USB device found, idVendor=1686, idProduct=0045
[  395.215952] usb 4-2.1: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[  395.215954] usb 4-2.1: Product: H2n
[  395.215956] usb 4-2.1: Manufacturer: ZOOM Corporation
[  395.215957] usb 4-2.1: SerialNumber: 
[  395.287902] usbcore: registered new interface driver snd-usb-audio
[  396.307560] usb 4-2.1: timeout: still 3 active urbs on EP #1
[  397.307014] usb 4-2.1: timeout: still 3 active urbs on EP #1

during these 30 s my USB mouse and keyb were dead

[  425.845052] xhci_hcd :06:00.0: Stopped the command ring failed, maybe 
the host is dead
[  425.845069] xhci_hcd :06:00.0: Abort command ring failed
[  425.845072] xhci_hcd :06:00.0: HC died; cleaning up
[  425.845113] xhci_hcd :06:00.0: Timeout while waiting for configure 
endpoint command
[  425.845115] usb 4-2: USB disconnect, device number 2
[  425.845116] usb 4-2.1: USB disconnect, device number 6
[  425.845117] usb 4-2.1: Not enough bandwidth for altsetting 0
[  426.846838] usb 4-2.1: timeout: still 3 active urbs on EP #1
[  615.354808] INFO: task kworker/1:9:6167 blocked for more than 120 seconds.
[  615.354811]   Not tainted 4.9.0+ #78
[  615.354812] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this 
message.
[  615.354814] kworker/1:9 D0  6167  2 0x
[  615.354832] Workqueue: usb_hub_wq hub_event [usbcore]
[  615.354835]   957c5f099398 957c5f099380 
957c4cdf6900
[  615.354839]  957c47391500 b1f740f1b9b8 849456e7 
c031d060
[  615.354843]  0296 957c5f099398 957c46ca6900 
957c47391500
[  615.354846] Call Trace:
[  615.354858]  [] ? __schedule+0x227/0x8f0
[  615.354859]  [] schedule+0x38/0x90
[  615.354863]  [] usb_kill_urb.part.4+0x49/0x80 [usbcore]
[  615.354865]  [] ? wake_atomic_t_function+0x50/0x50
[  615.354868]  [] usb_kill_urb+0x1c/0x20 [usbcore]
[  615.354872]  [] usb_hcd_flush_endpoint+0xa8/0x170 [usbcore]
[  615.354875]  [] usb_disable_endpoint+0x95/0xa0 [usbcore]
[  615.354879]  [] usb_disable_interface+0x40/0x60 [usbcore]
[  615.354883]  [] usb_unbind_interface+0x106/0x260 [usbcore]
[  615.354885]  [] __device_release_driver+0x9c/0x150
[  615.354886]  [] device_release_driver+0x20/0x30
[  615.354887]  [] bus_remove_device+0x113/0x190
[  615.354888]  [] device_del+0x12d/0x250
[  615.354892]  [] usb_disable_device+0x84/0x270 [usbcore]
[  615.354895]  [] usb_disconnect+0x8f/0x2b0 [usbcore]
[  615.354898]  [] usb_disconnect+0x1de/0x2b0 [usbcore]
[  615.354902]  [] ? hub_event+0x67/0x15a0 [usbcore]
[  615.354905]  [] hub_quiesce+0x43/0x90 [usbcore]
[  615.354908]  [] hub_event+0xdf/0x15a0 [usbcore]
[  615.354909]  [] ? __lock_acquire.isra.15+0x5d/0x930
[  615.354910]  [] ? process_one_work+0x1d9/0x5b0
[  615.354911]  [] process_one_work+0x263/0x5b0
[  615.354912]  [] ? process_one_work+0x1d9/0x5b0
[  615.354913]  [] worker_thread+0x43/0x4e0
[  615.354913]  [] ? process_one_work+0x5b0/0x5b0
[  615.354914]  [] kthread+0xe0/0x100
[  615.354915]  [] ? kthread_park+0x60/0x60
[  615.354917]  [] ret_from_fork+0x25/0x30
[  615.354917] 
   Showing all locks held in the system:
[  615.354919] 2 locks held by khungtaskd/347:
[  615.354919]  #0:  (rcu_read_lock){..}, at: [] 
watchdog+0x9e/0x410
[  615.354923]  #1:  (tasklist_lock){..}, at: [] 
debug_show_all_locks+0x3d/0x1a0
[  615.354929] 6 locks held by kworker/1:9/6167:
[  615.354929]  #0:  ("usb_hub_wq"){..}, at: [] 
process_one_work+0x1d9/0x5b0
[  615.354931]  #1:  ((>events)){..}, at: [] 
process_one_work+0x1d9/0x5b0
[  615.354933]  #2:  (>mutex){..}, at: [] 
hub_event+0x67/0x15a0 [usbcore]
[  615.354937]  #3:  (>mutex){..}, at: [] 
usb_disconnect+0x4e/0x2b0 [usbcore]
[  615.354941]  #4:  (>mutex){..}, at: [] 
usb_disconnect+0x4e/0x2b0 [usbcore]
[  615.354945]  #5:  (>mutex){..}, at: [] 
device_release_driver+0x18/0x30
[  615.354960] 2 locks held by bash/7362:
[  615.354960]  #0:  (>ldisc_sem){..}, at: [] 
ldsem_down_read+0xe/0x10
[  615.354962]  #1:  (>atomic_read_lock){..}, at: 
[] n_tty_read+0xb0/0x8b0
[  615.354964] 2 locks held by bash/7466:
[  615.354965]  #0:  (>ldisc_sem){..}, at: [] 
ldsem_down_read+0xe/0x10
[  615.354966]  #1:  (>atomic_read_lock){..}, at: 
[] n_tty_read+0xb0/0x8b0
[  615.354968] 2 locks held by bash/24708:
[  615.354969]  #0:  (>ldisc_sem){..}, at: [] 

Re: [usb-audio] 4.4.38: Zoom H2n hangs xhci

2016-12-15 Thread Sami Farin
With earlier kernels H2n didn't work when connected to OTHER USB ports
than HP's hub, but now it's the other way around.

When I connect H2n directly to computer's front panel (USB 3), audio
recording works and I don't get any warnings.

On Thu, Dec 15, 2016 at 11:11:30 -0800, Greg KH wrote:
> On Thu, Dec 15, 2016 at 08:22:44PM +0200, Sami Farin wrote:
> > Sandybridge system on Asus P8Z68-V PRO GEN3 motherboard.
> > 
> > H2n connected to HP ZR24w's hub.  When H2n is used as microphone:
> > (H2n is now disconnected but it didn't make any diff.)
> 
> Can you try 4.9 and see if you still have the same issue?
> 
> thanks,
> 
> greg k-h

-- 
Do what you love because life is too short for anything else.
https://samifar.in/

--
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/5] usb: musb: remove musb_generic_disable function

2016-12-15 Thread Liu [EP], Bin

> On Dec 15, 2016, at 3:05 PM, Liu [EP], Bin  wrote:
> 
> musb_generic_disable() only has two lines of code. So remove it and let
> the callers directly call thoese two lines.

s/thoese/those/

> 
> Signed-off-by: Bin Liu 
> ---
> drivers/usb/musb/musb_core.c | 26 ++
> 1 file changed, 10 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> index 73adbedd5ea1..523af36e4c84 100644
> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
> @@ -1040,16 +1040,6 @@ static void musb_enable_interrupts(struct musb *musb)
> 
> }
> 
> -static void musb_generic_disable(struct musb *musb)
> -{
> -void __iomem*mbase = musb->mregs;
> -
> -musb_disable_interrupts(musb);
> -
> -/* off */
> -musb_writeb(mbase, MUSB_DEVCTL, 0);
> -}
> -
> /*
>  * Program the HDRC to start (enable interrupts, dma, etc.).
>  */
> @@ -1106,8 +1096,8 @@ void musb_stop(struct musb *musb)
> {
>/* stop IRQs, timers, ... */
>musb_platform_disable(musb);
> -musb_generic_disable(musb);
> -musb_dbg(musb, "HDRC disabled");
> +musb_disable_interrupts(musb);
> +musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
> 
>/* FIXME
> *  - mark host and/or peripheral drivers unusable/inactive
> @@ -2310,7 +2300,8 @@ static void musb_deassert_reset(struct work_struct 
> *work)
> 
>/* be sure interrupts are disabled before connecting ISR */
>musb_platform_disable(musb);
> -musb_generic_disable(musb);
> +musb_disable_interrupts(musb);
> +musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
> 
>/* Init IRQ workqueue before request_irq */
>INIT_DELAYED_WORK(>irq_work, musb_irq_work);
> @@ -2485,11 +2476,13 @@ static int musb_remove(struct platform_device *pdev)
>pm_runtime_get_sync(musb->controller);
>musb_host_cleanup(musb);
>musb_gadget_cleanup(musb);
> +
>spin_lock_irqsave(>lock, flags);
>musb_platform_disable(musb);
> -musb_generic_disable(musb);
> -spin_unlock_irqrestore(>lock, flags);
> +musb_disable_interrupts(musb);
>musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
> +spin_unlock_irqrestore(>lock, flags);
> +
>pm_runtime_dont_use_autosuspend(musb->controller);
>pm_runtime_put_sync(musb->controller);
>pm_runtime_disable(musb->controller);
> @@ -2664,7 +2657,8 @@ static int musb_suspend(struct device *dev)
>unsigned longflags;
> 
>musb_platform_disable(musb);
> -musb_generic_disable(musb);
> +musb_disable_interrupts(musb);
> +musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
>WARN_ON(!list_empty(>pending_list));
> 
>spin_lock_irqsave(>lock, flags);
> -- 
> 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 v2 1/1] Increase USB transfer limit

2016-12-15 Thread Alan Stern
On Thu, 15 Dec 2016, Mateusz Berezecki wrote:

> > Il giorno 15 dic 2016, alle ore 06:51, Alan Stern 
> >  ha scritto:
> > 
> > Hmmm, this is the third patch labelled v2 that you have mailed.  In the 
> > future, be more careful about your version numbering.
> 
> Ok. Maybe I misunderstood versioning of patches. I thought of
> versions numbering the concept/approach rather than the actual
> revision of the patch. Should they all have been sent with an
> incremented number ?

Yes, they should.  The number refers to the actual revision of the 
patch.  The only situation where the number might not change is if you 
submitted the exact same patch more than once -- for example, if the 
patch was part of a series you were resubmitting because some of the 
other patches in the series had been updated.  (Some people would 
increment the version number even then.)

> > This all looks good.
> > 
> > Acked-by: Alan Stern 
> 
> Cool. Thanks for help and feedback!

You're welcome.

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 4/5] usb: musb: am35x: remove redundant code

2016-12-15 Thread Bin Liu
The session is cleared in the core whenever musb_platform_disable() is
called, so clearing it in the glue driver *_musb_disable() is redundant.

Signed-off-by: Bin Liu 
---
 drivers/usb/musb/am35x.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index 50ca8052bc8e..02fbb4fe3745 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -121,7 +121,6 @@ static void am35x_musb_disable(struct musb *musb)
musb_writel(reg_base, CORE_INTR_MASK_CLEAR_REG, AM35X_INTR_USB_MASK);
musb_writel(reg_base, EP_INTR_MASK_CLEAR_REG,
 AM35X_TX_INTR_MASK | AM35X_RX_INTR_MASK);
-   musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
musb_writel(reg_base, USB_END_OF_INTR_REG, 0);
 }
 
-- 
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 5/5] usb: musb: davinci: remove redundant code

2016-12-15 Thread Bin Liu
The session is cleared in the core whenever musb_platform_disable() is
called, so clearing it in the glue driver *_musb_disable() is redundant.

Signed-off-by: Bin Liu 
---
 drivers/usb/musb/davinci.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index cee61a51645e..52b491d3d5d8 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -133,7 +133,6 @@ static void davinci_musb_disable(struct musb *musb)
  DAVINCI_USB_USBINT_MASK
| DAVINCI_USB_TXINT_MASK
| DAVINCI_USB_RXINT_MASK);
-   musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
musb_writel(musb->ctrl_base, DAVINCI_USB_EOI_REG, 0);
 
if (is_dma_capable() && !dma_off)
-- 
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 1/5] usb: musb: remove musb_generic_disable function

2016-12-15 Thread Bin Liu
musb_generic_disable() only has two lines of code. So remove it and let
the callers directly call thoese two lines.

Signed-off-by: Bin Liu 
---
 drivers/usb/musb/musb_core.c | 26 ++
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 73adbedd5ea1..523af36e4c84 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1040,16 +1040,6 @@ static void musb_enable_interrupts(struct musb *musb)
 
 }
 
-static void musb_generic_disable(struct musb *musb)
-{
-   void __iomem*mbase = musb->mregs;
-
-   musb_disable_interrupts(musb);
-
-   /* off */
-   musb_writeb(mbase, MUSB_DEVCTL, 0);
-}
-
 /*
  * Program the HDRC to start (enable interrupts, dma, etc.).
  */
@@ -1106,8 +1096,8 @@ void musb_stop(struct musb *musb)
 {
/* stop IRQs, timers, ... */
musb_platform_disable(musb);
-   musb_generic_disable(musb);
-   musb_dbg(musb, "HDRC disabled");
+   musb_disable_interrupts(musb);
+   musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
 
/* FIXME
 *  - mark host and/or peripheral drivers unusable/inactive
@@ -2310,7 +2300,8 @@ static void musb_deassert_reset(struct work_struct *work)
 
/* be sure interrupts are disabled before connecting ISR */
musb_platform_disable(musb);
-   musb_generic_disable(musb);
+   musb_disable_interrupts(musb);
+   musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
 
/* Init IRQ workqueue before request_irq */
INIT_DELAYED_WORK(>irq_work, musb_irq_work);
@@ -2485,11 +2476,13 @@ static int musb_remove(struct platform_device *pdev)
pm_runtime_get_sync(musb->controller);
musb_host_cleanup(musb);
musb_gadget_cleanup(musb);
+
spin_lock_irqsave(>lock, flags);
musb_platform_disable(musb);
-   musb_generic_disable(musb);
-   spin_unlock_irqrestore(>lock, flags);
+   musb_disable_interrupts(musb);
musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
+   spin_unlock_irqrestore(>lock, flags);
+
pm_runtime_dont_use_autosuspend(musb->controller);
pm_runtime_put_sync(musb->controller);
pm_runtime_disable(musb->controller);
@@ -2664,7 +2657,8 @@ static int musb_suspend(struct device *dev)
unsigned long   flags;
 
musb_platform_disable(musb);
-   musb_generic_disable(musb);
+   musb_disable_interrupts(musb);
+   musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
WARN_ON(!list_empty(>pending_list));
 
spin_lock_irqsave(>lock, flags);
-- 
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 3/5] usb: musb: da8xx: remove redundant code

2016-12-15 Thread Bin Liu
The session is cleared in the core whenever musb_platform_disable() is
called, so clearing it in the glue driver *_musb_disable() is redundant.

Signed-off-by: Bin Liu 
---
 drivers/usb/musb/da8xx.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index e89708d839e5..26766a523352 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -125,7 +125,6 @@ static void da8xx_musb_disable(struct musb *musb)
musb_writel(reg_base, DA8XX_USB_INTR_MASK_CLEAR_REG,
DA8XX_INTR_USB_MASK |
DA8XX_INTR_TX_MASK | DA8XX_INTR_RX_MASK);
-   musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
musb_writel(reg_base, DA8XX_USB_END_OF_INTR_REG, 0);
 }
 
-- 
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 2/5] usb: musb: dsps: remove redundant code

2016-12-15 Thread Bin Liu
The session is cleared in the core whenever musb_platform_disable() is
called, so clearing it in the glue driver *_musb_disable() is redundant.

Signed-off-by: Bin Liu 
---
 drivers/usb/musb/musb_dsps.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 9f125e179acd..ceb646be20d9 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -186,7 +186,6 @@ static void dsps_musb_disable(struct musb *musb)
musb_writel(reg_base, wrp->epintr_clear,
 wrp->txep_bitmap | wrp->rxep_bitmap);
del_timer_sync(>timer);
-   musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
 }
 
 /* Caller must take musb->lock */
-- 
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: [usb-audio] 4.4.38: Zoom H2n hangs xhci

2016-12-15 Thread Greg KH
On Thu, Dec 15, 2016 at 08:22:44PM +0200, Sami Farin wrote:
> Sandybridge system on Asus P8Z68-V PRO GEN3 motherboard.
> 
> H2n connected to HP ZR24w's hub.  When H2n is used as microphone:
> (H2n is now disconnected but it didn't make any diff.)

Can you try 4.9 and see if you still have the same issue?

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 1/1] Increase USB transfer limit

2016-12-15 Thread Greg KH
On Thu, Dec 15, 2016 at 10:41:47AM -0800, Mateusz Berezecki wrote:
> 
> 
> > Il giorno 15 dic 2016, alle ore 03:52, Greg KH  
> > ha scritto:
> > 
> >> On Wed, Dec 14, 2016 at 09:11:08PM -0800, Mateusz Berezecki wrote:
> >> Promote a variable keeping track of USB transfer memory usage to a
> >> wider data type and allow for higher bandwidth transfers from a large
> >> number of USB devices connected to a single host.
> >> 
> >> Signed-off-by: Mateusz Berezecki 
> >> ---
> >> drivers/usb/core/devio.c | 43 ---
> >> 1 file changed, 16 insertions(+), 27 deletions(-)
> > 
> > What changed from v1? Please always put that below the --- line.
> 
> Sorry, I wasn't quite sure how handle this.

Documentation/SubmittingPatches should describe how to do this.  Please
do so on your next submission so I know what patch to apply.

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 1/1] Increase USB transfer limit

2016-12-15 Thread Mateusz Berezecki


> Il giorno 15 dic 2016, alle ore 06:51, Alan Stern  
> ha scritto:
> 
> Hmmm, this is the third patch labelled v2 that you have mailed.  In the 
> future, be more careful about your version numbering.

Ok. Maybe I misunderstood versioning of patches. I thought of versions 
numbering the concept/approach rather than the actual revision of the patch. 
Should they all have been sent with an incremented number ?

> 
>> On Wed, 14 Dec 2016, Mateusz Berezecki wrote:
>> 
>> Promote a variable keeping track of USB transfer memory usage to a
>> wider data type and allow for higher bandwidth transfers from a large
>> number of USB devices connected to a single host.
>> 
>> Signed-off-by: Mateusz Berezecki 
>> ---
>> drivers/usb/core/devio.c | 43 ---
>> 1 file changed, 16 insertions(+), 27 deletions(-)
>> 
>> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
>> index 4016dae..52747b6 100644
>> --- a/drivers/usb/core/devio.c
>> +++ b/drivers/usb/core/devio.c
>> @@ -134,42 +134,35 @@ enum snoop_when {
>> #define USB_DEVICE_DEVMKDEV(USB_DEVICE_MAJOR, 0)
>> 
>> /* Limit on the total amount of memory we can allocate for transfers */
>> -static unsigned usbfs_memory_mb = 16;
>> +static u32 usbfs_memory_mb = 16;
>> module_param(usbfs_memory_mb, uint, 0644);
>> MODULE_PARM_DESC(usbfs_memory_mb,
>>"maximum MB allowed for usbfs buffers (0 = no limit)");
>> 
>> -/* Hard limit, necessary to avoid arithmetic overflow */
>> -#define USBFS_XFER_MAX(UINT_MAX / 2 - 100)
>> -
>> -static atomic_t usbfs_memory_usage;/* Total memory currently allocated 
>> */
>> +static atomic64_t usbfs_memory_usage;/* Total memory currently 
>> allocated */
>> 
>> /* Check whether it's okay to allocate more memory for a transfer */
>> -static int usbfs_increase_memory_usage(unsigned amount)
>> +static int usbfs_increase_memory_usage(u64 amount)
>> {
>> -unsigned lim;
>> +u64 lim;
>> 
>> -/*
>> - * Convert usbfs_memory_mb to bytes, avoiding overflows.
>> - * 0 means use the hard limit (effectively unlimited).
>> - */
>>lim = ACCESS_ONCE(usbfs_memory_mb);
>> -if (lim == 0 || lim > (USBFS_XFER_MAX >> 20))
>> -lim = USBFS_XFER_MAX;
>> -else
>> -lim <<= 20;
>> +lim <<= 20;
>> 
>> -atomic_add(amount, _memory_usage);
>> -if (atomic_read(_memory_usage) <= lim)
>> -return 0;
>> -atomic_sub(amount, _memory_usage);
>> -return -ENOMEM;
>> +atomic64_add(amount, _memory_usage);
>> +
>> +if (lim > 0 && atomic64_read(_memory_usage) > lim) {
>> +atomic64_sub(amount, _memory_usage);
>> +return -ENOMEM;
>> +}
>> +
>> +return 0;
>> }
>> 
>> /* Memory for a transfer is being deallocated */
>> -static void usbfs_decrease_memory_usage(unsigned amount)
>> +static void usbfs_decrease_memory_usage(u64 amount)
>> {
>> -atomic_sub(amount, _memory_usage);
>> +atomic64_sub(amount, _memory_usage);
>> }
>> 
>> static int connected(struct usb_dev_state *ps)
>> @@ -1191,7 +1184,7 @@ static int proc_bulk(struct usb_dev_state *ps, void 
>> __user *arg)
>>if (!usb_maxpacket(dev, pipe, !(bulk.ep & USB_DIR_IN)))
>>return -EINVAL;
>>len1 = bulk.len;
>> -if (len1 >= USBFS_XFER_MAX)
>> +if (len1 >= (INT_MAX - sizeof(struct urb)))
>>return -EINVAL;
>>ret = usbfs_increase_memory_usage(len1 + sizeof(struct urb));
>>if (ret)
>> @@ -1584,10 +1577,6 @@ static int proc_do_submiturb(struct usb_dev_state 
>> *ps, struct usbdevfs_urb *uurb
>>return -EINVAL;
>>}
>> 
>> -if (uurb->buffer_length >= USBFS_XFER_MAX) {
>> -ret = -EINVAL;
>> -goto error;
>> -}
>>if (uurb->buffer_length > 0 &&
>>!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
>>uurb->buffer, uurb->buffer_length)) {
>> 
> 
> This all looks good.
> 
> Acked-by: Alan Stern 

Cool. Thanks for help and feedback!

Mateusz 


--
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 1/1] Increase USB transfer limit

2016-12-15 Thread Mateusz Berezecki


> Il giorno 15 dic 2016, alle ore 03:52, Greg KH  
> ha scritto:
> 
>> On Wed, Dec 14, 2016 at 09:11:08PM -0800, Mateusz Berezecki wrote:
>> Promote a variable keeping track of USB transfer memory usage to a
>> wider data type and allow for higher bandwidth transfers from a large
>> number of USB devices connected to a single host.
>> 
>> Signed-off-by: Mateusz Berezecki 
>> ---
>> drivers/usb/core/devio.c | 43 ---
>> 1 file changed, 16 insertions(+), 27 deletions(-)
> 
> What changed from v1? Please always put that below the --- line.

Sorry, I wasn't quite sure how handle this.

What changed is a concept and correctness. Previously, I kept a constant that 
was no longer needed as the variable can't overflow anymore and the constant 
was used for overflow checks. 

Thanks
Mateusz

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


[usb-audio] 4.4.38: Zoom H2n hangs xhci

2016-12-15 Thread Sami Farin
Sandybridge system on Asus P8Z68-V PRO GEN3 motherboard.

H2n connected to HP ZR24w's hub.  When H2n is used as microphone:
(H2n is now disconnected but it didn't make any diff.)

Dec 15 19:53:45 n kernel: usb 5-2.1: new full-speed USB device number 4 using 
xhci_hcd
Dec 15 19:53:45 n kernel: usb 5-2.1: New USB device found, idVendor=1686, 
idProduct=0045
Dec 15 19:53:45 n kernel: usb 5-2.1: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
Dec 15 19:53:45 n kernel: usb 5-2.1: Product: H2n
Dec 15 19:53:45 n kernel: usb 5-2.1: Manufacturer: ZOOM Corporation
Dec 15 19:53:45 n kernel: usb 5-2.1: SerialNumber: 
Dec 15 19:53:45 n mtp-probe: checking bus 5, device 4: 
"/sys/devices/pci:00/:00:1c.4/:06:00.0/usb5/5-2/5-2.1"
Dec 15 19:53:45 n mtp-probe: bus: 5, device: 4 was not an MTP device
Dec 15 19:53:45 n kernel: usbcore: registered new interface driver snd-usb-audio
Dec 15 19:53:46 n kernel: usb 5-2.1: timeout: still 3 active urbs on EP #1
Dec 15 19:53:47 n kernel: usb 5-2.1: timeout: still 3 active urbs on EP #1
Dec 15 19:53:50 n kernel: xhci_hcd :06:00.0: xHCI host not responding to 
stop endpoint command.
Dec 15 19:53:50 n kernel: xhci_hcd :06:00.0: Assuming host is dying, 
halting host.
Dec 15 19:53:50 n kernel: xhci_hcd :06:00.0: HC died; cleaning up
Dec 15 19:53:50 n kernel: usb 5-2: USB disconnect, device number 2
Dec 15 19:53:50 n kernel: usb 5-2.1: USB disconnect, device number 4
Dec 15 19:56:30 n kernel: INFO: task pulseaudio:7968 blocked for more than 120 
seconds.
Dec 15 19:56:30 n kernel:  Not tainted 4.4.38+ #75
Dec 15 19:56:30 n kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" 
disables this message.
Dec 15 19:56:30 n kernel: pulseaudio  D 8803d266bb48 0  7968  1 
0x
Dec 15 19:56:30 n kernel: 8803d266bb48  88041f096b58 
88040cdce680
Dec 15 19:56:30 n kernel: 8800c9725200 8803d266c000 8801567c4de8 
8801567c4de0
Dec 15 19:56:30 n kernel:  8800c9725200 8803d266bb60 
b18d2457
Dec 15 19:56:30 n kernel: Call Trace:
Dec 15 19:56:30 n kernel: [] schedule+0x37/0x80
Dec 15 19:56:30 n kernel: [] schedule_timeout+0x21d/0x280
Dec 15 19:56:30 n kernel: [] ? wait_for_common+0x26/0x160
Dec 15 19:56:30 n kernel: [] wait_for_common+0xad/0x160
Dec 15 19:56:30 n kernel: [] ? wake_up_q+0x70/0x70
Dec 15 19:56:30 n kernel: [] wait_for_completion+0x18/0x20
Dec 15 19:56:30 n kernel: [] 
xhci_configure_endpoint+0xc4/0x4f0 [xhci_hcd]
Dec 15 19:56:30 n kernel: [] xhci_check_bandwidth+0x19e/0x380 
[xhci_hcd]
Dec 15 19:56:30 n kernel: [] 
usb_hcd_alloc_bandwidth+0x277/0x310 [usbcore]
Dec 15 19:56:30 n kernel: [] usb_set_interface+0xc1/0x380 
[usbcore]
Dec 15 19:56:30 n kernel: [] 
snd_usb_pcm_close.isra.7+0x84/0xa0 [snd_usb_audio]
Dec 15 19:56:30 n kernel: [] snd_usb_playback_close+0xf/0x20 
[snd_usb_audio]
Dec 15 19:56:30 n kernel: [] 
snd_pcm_release_substream.part.20+0x42/0xa0 [snd_pcm]
Dec 15 19:56:30 n kernel: [] snd_pcm_release+0xa4/0xb0 
[snd_pcm]
Dec 15 19:56:30 n kernel: [] __fput+0x97/0x1f0
Dec 15 19:56:30 n kernel: [] fput+0x9/0x10
Dec 15 19:56:30 n kernel: [] task_work_run+0x7e/0xa0
Dec 15 19:56:30 n kernel: [] exit_to_usermode_loop+0xa3/0xb0
Dec 15 19:56:30 n kernel: [] syscall_return_slowpath+0x53/0x60
Dec 15 19:56:30 n kernel: [] int_ret_from_sys_call+0x25/0x8f
Dec 15 19:56:30 n kernel: 2 locks held by pulseaudio/7968:
Dec 15 19:56:30 n kernel: #0:  (>open_mutex){..}, at: 
[] snd_pcm_release+0x38/0xb0 [snd_pcm]
Dec 15 19:56:30 n kernel: #1:  (hcd->bandwidth_mutex){..}, at: 
[] usb_set_interface+0x6e/0x380 [usbcore]
Dec 15 19:56:30 n kernel: INFO: task kworker/2:1:16880 blocked for more than 
120 seconds.
Dec 15 19:56:30 n kernel:  Not tainted 4.4.38+ #75
Dec 15 19:56:30 n kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" 
disables this message.
Dec 15 19:56:30 n kernel: kworker/2:1 D 8801125a7a40 0 16880  2 
0x
Dec 15 19:56:30 n kernel: Workqueue: usb_hub_wq hub_event [usbcore]
Dec 15 19:56:30 n kernel: 8801125a7a40 c0a5e600 88041f116b58 
88040cde8000
Dec 15 19:56:30 n kernel: 8800c9d43d80 8801125a8000 880109f55800 
880106f54000
Dec 15 19:56:30 n kernel: c0a5e678 8803824ec800 8801125a7a58 
b18d2457
Dec 15 19:56:30 n kernel: Call Trace:
Dec 15 19:56:30 n kernel: [] schedule+0x37/0x80
Dec 15 19:56:30 n kernel: [] usb_audio_disconnect+0x1c7/0x230 
[snd_usb_audio]
Dec 15 19:56:30 n kernel: [] ? 
wake_atomic_t_function+0x50/0x50
Dec 15 19:56:30 n kernel: [] usb_unbind_interface+0x82/0x260 
[usbcore]
Dec 15 19:56:30 n kernel: [] 
__device_release_driver+0x9c/0x140
Dec 15 19:56:30 n kernel: [] device_release_driver+0x20/0x30
Dec 15 19:56:30 n kernel: [] bus_remove_device+0x113/0x190
Dec 15 19:56:30 n kernel: [] device_del+0x135/0x240
Dec 15 19:56:30 n kernel: [] usb_disable_device+0x84/0x270 
[usbcore]
Dec 15 19:56:30 n kernel: [] 

Re: [PATCH 10/13] USB: serial: ch341: fix baud rate and line-control handling

2016-12-15 Thread Johan Hovold
On Wed, Dec 14, 2016 at 04:28:07PM +0100, Johan Hovold wrote:
> Some CH341 devices appear to require the use of the init vendor command
> to set the baud rate and line-control register. Specifically, while
> using direct register updates for speed and LCR seem to update those
> settings correctly, not using the init command causes received data to
> be buffered until a full endpoint-size packet (32 bytes) have been
> received (i.e. the init command has some undocumented side-effect we
> need).

Turns out it is bit 7 in the divisor register which needs to be set in
order for CH341A to not buffer incoming data this way. If set, direct
register updates works also for these devices.

This bit is only set since 4e46c410e050 ("USB: serial: ch341:
reinitialize chip on reconfiguration") (in -next), which switched to
using the init-vendor command.

So it seems we could use a common implementation after all...

> On the other hand, some CH340 devices have been reported to require the
> use of direct register manipulations to set the line speed, while not
> suffering from the above mentioned buffering effect.

But I still want to understand what is really going one here before
proceeding.

Russel, I may send you a couple further diagnostics patches for that,
but I'd still be interesting in learning whether this patch worked for
you.

> Let's use the init vendor command only for CH341 devices to be able to
> support also such (quirky?) CH340 devices.

Thanks,
Johan
--
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: [RFC PATCH] usb: host: xhci: plat: add support for otg_set_host() call

2016-12-15 Thread Manish Narani
Thanks Greg. I have send another patch with changes as per your suggestions. 
Please review it and let me know if you have any concerns.

- Manish

-Original Message-
From: Greg KH [mailto:gre...@linuxfoundation.org]
Sent: Thursday, December 15, 2016 2:29 AM
To: Manish Narani 
Cc: mathias.ny...@intel.com; linux-usb@vger.kernel.org; 
linux-ker...@vger.kernel.org; Anurag Kumar Vulisha ; 
Punnaiah Choudary Kalluri ; Anirudha Sarangi 
; Manish Narani 
Subject: Re: [RFC PATCH] usb: host: xhci: plat: add support for otg_set_host() 
call

On Thu, Dec 15, 2016 at 12:25:08AM +0530, Manish Narani wrote:
> This patch will add support for OTG host initialization. This will
> help OTG drivers to populate their host subsystem.
>
> Signed-off-by: Manish Narani 
> ---
>  drivers/usb/host/xhci-plat.c |   35 +++
>  1 files changed, 35 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/usb/host/xhci-plat.c
> b/drivers/usb/host/xhci-plat.c index ddfab30..b4cadbd 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -20,6 +20,10 @@
>  #include 
>  #include 
>
> +#ifdef CONFIG_USB_OTG
> +#include 
> +#endif

never use a #ifdef in a .c file if at all possible.  Here you don't need it at 
all.

> +
>  #include "xhci.h"
>  #include "xhci-plat.h"
>  #include "xhci-mvebu.h"
> @@ -255,6 +259,24 @@ static int xhci_plat_probe(struct platform_device *pdev)
>   if (ret)
>   goto dealloc_usb2_hcd;
>
> +#ifdef CONFIG_USB_OTG
> + hcd->usb_phy = usb_get_phy(USB_PHY_TYPE_USB3);
> + if (!IS_ERR_OR_NULL(hcd->usb_phy) && hcd->usb_phy->otg) {
> + dev_dbg(>dev, "%s otg support available\n", __func__);
> + ret = otg_set_host(hcd->usb_phy->otg, >self);
> + if (ret) {
> + dev_err(>dev, "%s otg_set_host failed\n",
> + __func__);
> + usb_put_phy(hcd->usb_phy);
> + hcd->usb_phy = NULL;
> + goto dealloc_usb2_hcd;
> + }
> + } else {
> + usb_put_phy(hcd->usb_phy);
> + hcd->usb_phy = NULL;
> + }
> +#endif

Can't you wrap this in a function to get rid of this #ifdef mess?

> +
>   return 0;
>
>
> @@ -283,6 +305,19 @@ static int xhci_plat_remove(struct platform_device *dev)
>   struct xhci_hcd *xhci = hcd_to_xhci(hcd);
>   struct clk *clk = xhci->clk;
>
> +#ifdef CONFIG_USB_OTG
> + if (hcd->usb_phy) {
> + if (!IS_ERR(hcd->usb_phy)) {
> + if (hcd->usb_phy->otg)
> + otg_set_host(hcd->usb_phy->otg, NULL);
> + usb_put_phy(hcd->usb_phy);
> + }
> + hcd->usb_phy = NULL;
> + if (xhci->shared_hcd)
> + xhci->shared_hcd->usb_phy = NULL;
> + }
> +#endif

same here.

thanks,

greg k-h


This email and any attachments are intended for the sole use of the named 
recipient(s) and contain(s) confidential information that may be proprietary, 
privileged or copyrighted under applicable law. If you are not the intended 
recipient, do not read, copy, or forward this email message or any attachments. 
Delete this email message and any attachments immediately.

--
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: serial: f81534: Detect errors from f81534_logic_to_phy_port()

2016-12-15 Thread Johan Hovold
On Wed, Dec 14, 2016 at 12:18:53PM +0100, Geert Uytterhoeven wrote:
> With gcc 4.1.2:
> 
> drivers/usb/serial/f81534.c: In function ‘f81534_port_probe’:
> drivers/usb/serial/f81534.c:1250: warning: comparison is always false due 
> to limited range of data type
> 
> f81534_logic_to_phy_port() may return a negative error value, which is
> ignored by assigning it to u8 f81534_port_private.phy_num.

Thanks for fixing this.

> Use an intermediate variable of type int to fix this.
> While at it, forward the actual error code instead of converting it to
> -ENODEV.
>
> Fixes: 0c9bd6004d258d46 ("USB: serial: add Fintek F81532/534 driver")
> Signed-off-by: Geert Uytterhoeven 
> ---
>  drivers/usb/serial/f81534.c | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/serial/f81534.c b/drivers/usb/serial/f81534.c
> index 8282a6a18fee83f6..2acad268f9d15f43 100644
> --- a/drivers/usb/serial/f81534.c
> +++ b/drivers/usb/serial/f81534.c
> @@ -1237,6 +1237,7 @@ static int f81534_attach(struct usb_serial *serial)
>  static int f81534_port_probe(struct usb_serial_port *port)
>  {
>   struct f81534_port_private *port_priv;
> + int ret;
>  
>   port_priv = devm_kzalloc(>dev, sizeof(*port_priv), GFP_KERNEL);
>   if (!port_priv)
> @@ -1246,10 +1247,14 @@ static int f81534_port_probe(struct usb_serial_port 
> *port)
>   mutex_init(_priv->mcr_mutex);
>  
>   /* Assign logic-to-phy mapping */
> - port_priv->phy_num = f81534_logic_to_phy_port(port->serial, port);
> - if (port_priv->phy_num < 0 || port_priv->phy_num >= F81534_NUM_PORT)
> + ret = f81534_logic_to_phy_port(port->serial, port);
> + if (ret < 0)
> + return ret;
> +
> + if (ret >= F81534_NUM_PORT)
>   return -ENODEV;

How about dropping the redundant >= F81534_NUM_PORT test as well as the
helper function will never return anything that large?

>  
> + port_priv->phy_num = ret;
>   usb_set_serial_port_data(port, port_priv);
>   dev_dbg(>dev, "%s: port_number: %d, phy_num: %d\n", __func__,
>   port->port_number, port_priv->phy_num);

Thanks,
Johan
--
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: [PATCHv13 2/3] usb: USB Type-C connector class

2016-12-15 Thread Guenter Roeck

On 12/15/2016 03:50 AM, Heikki Krogerus wrote:

On Wed, Dec 07, 2016 at 02:52:31PM +0200, Heikki Krogerus wrote:

Hi Oliver,

On Wed, Dec 07, 2016 at 10:46:48AM +0100, Oliver Neukum wrote:

On Fri, 2016-12-02 at 10:04 -0800, Guenter Roeck wrote:

Hi,


At least for my part I very much concentrated on making sure that
the user space ABI as well as the port driver API are sane and usable.


Rightly so, as this part cannot be changed once included in a kernel
release.
So, can we agree that that part at least is ready to go?


I at least have no plans on doing any changes to the ABI. The API will
change.


I have received (off-list) some questions related to this. There are a
few things that people would like to still change after all.

1) Should we use "source" and "sink" instead of "device" and "host"
with the prefer_role attribute after all? I was uncomfortable with
that when we talked about it last time because the terms kept changing
with every new Type-C specification version. But I guess "source" and
"sink" would make sense in the end. This has been requested by several
guys now.

2) Can we change the way we list the supported roles? They are now
comma separated, but can we use new line instead:

% cat supported_data_roles
host
device
%

3) Instead of the "supports_usb_power_delivery" attribute file which
we have for the ports and partners, it seem it would be more
interesting to know the supported USB Power Delivery Specification
version for some, and also USB Type-C Specification version in
separate attribute file. So basically we would have
"usb_power_delivery_version" and "usb_typec_version" attributes
instead or "supports_usb_power_delivery".


So would these changes be OK still at this point to everybody?



Ok with me.

Guenter

--
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 1/1] Increase USB transfer limit

2016-12-15 Thread Alan Stern
Hmmm, this is the third patch labelled v2 that you have mailed.  In the 
future, be more careful about your version numbering.

On Wed, 14 Dec 2016, Mateusz Berezecki wrote:

> Promote a variable keeping track of USB transfer memory usage to a
> wider data type and allow for higher bandwidth transfers from a large
> number of USB devices connected to a single host.
> 
> Signed-off-by: Mateusz Berezecki 
> ---
>  drivers/usb/core/devio.c | 43 ---
>  1 file changed, 16 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index 4016dae..52747b6 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -134,42 +134,35 @@ enum snoop_when {
>  #define USB_DEVICE_DEV   MKDEV(USB_DEVICE_MAJOR, 0)
>  
>  /* Limit on the total amount of memory we can allocate for transfers */
> -static unsigned usbfs_memory_mb = 16;
> +static u32 usbfs_memory_mb = 16;
>  module_param(usbfs_memory_mb, uint, 0644);
>  MODULE_PARM_DESC(usbfs_memory_mb,
>   "maximum MB allowed for usbfs buffers (0 = no limit)");
>  
> -/* Hard limit, necessary to avoid arithmetic overflow */
> -#define USBFS_XFER_MAX   (UINT_MAX / 2 - 100)
> -
> -static atomic_t usbfs_memory_usage;  /* Total memory currently allocated */
> +static atomic64_t usbfs_memory_usage;/* Total memory currently 
> allocated */
>  
>  /* Check whether it's okay to allocate more memory for a transfer */
> -static int usbfs_increase_memory_usage(unsigned amount)
> +static int usbfs_increase_memory_usage(u64 amount)
>  {
> - unsigned lim;
> + u64 lim;
>  
> - /*
> -  * Convert usbfs_memory_mb to bytes, avoiding overflows.
> -  * 0 means use the hard limit (effectively unlimited).
> -  */
>   lim = ACCESS_ONCE(usbfs_memory_mb);
> - if (lim == 0 || lim > (USBFS_XFER_MAX >> 20))
> - lim = USBFS_XFER_MAX;
> - else
> - lim <<= 20;
> + lim <<= 20;
>  
> - atomic_add(amount, _memory_usage);
> - if (atomic_read(_memory_usage) <= lim)
> - return 0;
> - atomic_sub(amount, _memory_usage);
> - return -ENOMEM;
> + atomic64_add(amount, _memory_usage);
> +
> + if (lim > 0 && atomic64_read(_memory_usage) > lim) {
> + atomic64_sub(amount, _memory_usage);
> + return -ENOMEM;
> + }
> +
> + return 0;
>  }
>  
>  /* Memory for a transfer is being deallocated */
> -static void usbfs_decrease_memory_usage(unsigned amount)
> +static void usbfs_decrease_memory_usage(u64 amount)
>  {
> - atomic_sub(amount, _memory_usage);
> + atomic64_sub(amount, _memory_usage);
>  }
>  
>  static int connected(struct usb_dev_state *ps)
> @@ -1191,7 +1184,7 @@ static int proc_bulk(struct usb_dev_state *ps, void 
> __user *arg)
>   if (!usb_maxpacket(dev, pipe, !(bulk.ep & USB_DIR_IN)))
>   return -EINVAL;
>   len1 = bulk.len;
> - if (len1 >= USBFS_XFER_MAX)
> + if (len1 >= (INT_MAX - sizeof(struct urb)))
>   return -EINVAL;
>   ret = usbfs_increase_memory_usage(len1 + sizeof(struct urb));
>   if (ret)
> @@ -1584,10 +1577,6 @@ static int proc_do_submiturb(struct usb_dev_state *ps, 
> struct usbdevfs_urb *uurb
>   return -EINVAL;
>   }
>  
> - if (uurb->buffer_length >= USBFS_XFER_MAX) {
> - ret = -EINVAL;
> - goto error;
> - }
>   if (uurb->buffer_length > 0 &&
>   !access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
>   uurb->buffer, uurb->buffer_length)) {
> 

This all looks good.

Acked-by: Alan Stern 

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


[2/2] usb: gadget: f_fs: Fix ExtCompat descriptor validation

2016-12-15 Thread Vincent Pelletier
Reserved1 is documented as expected to be set to 0, but this test fails
when it it set to 0. Reverse the condition.

Signed-off-by: Vincent Pelletier 
---
 drivers/usb/gadget/function/f_fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_fs.c 
b/drivers/usb/gadget/function/f_fs.c
index 2654c4f3c243..a4c2417ca3e3 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -2252,7 +2252,7 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type 
type,
 
if (len < sizeof(*d) ||
d->bFirstInterfaceNumber >= ffs->interfaces_count ||
-   !d->Reserved1)
+   d->Reserved1)
return -EINVAL;
for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i)
if (d->Reserved2[i])
-- 
2.11.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


[1/2] usb: gadget: f_fs: Document eventfd effect on descriptor format.

2016-12-15 Thread Vincent Pelletier
When FUNCTIONFS_EVENTFD flag is set, __ffs_data_got_descs reads a 32bits,
little-endian value right after the fixed structure header, and passes it
to eventfd_ctx_fdget. Document this.

Also, rephrase a comment to be affirmative about the role of string
descriptor at index 0. Ref: USB 2.0 spec paragraph "9.6.7 String", and
also checked to still be current in USB 3.0 spec paragraph "9.6.9 String".

Signed-off-by: Vincent Pelletier 
---
 drivers/usb/gadget/function/f_fs.c  | 4 ++--
 include/uapi/linux/usb/functionfs.h | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/f_fs.c 
b/drivers/usb/gadget/function/f_fs.c
index 17989b72cdae..2654c4f3c243 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -2091,8 +2091,8 @@ static int __ffs_data_do_entity(enum ffs_entity_type type,
 
case FFS_STRING:
/*
-* Strings are indexed from 1 (0 is magic ;) reserved
-* for languages list or some such)
+* Strings are indexed from 1 (0 is reserved
+* for languages list)
 */
if (*valuep > helper->ffs->strings_count)
helper->ffs->strings_count = *valuep;
diff --git a/include/uapi/linux/usb/functionfs.h 
b/include/uapi/linux/usb/functionfs.h
index acc63697a0cc..b2a31a55a612 100644
--- a/include/uapi/linux/usb/functionfs.h
+++ b/include/uapi/linux/usb/functionfs.h
@@ -93,6 +93,7 @@ struct usb_ext_prop_desc {
  * |   0 | magic | LE32 | FUNCTIONFS_DESCRIPTORS_MAGIC_V2  |
  * |   4 | length| LE32 | length of the whole data chunk   |
  * |   8 | flags | LE32 | combination of functionfs_flags  |
+ * | | eventfd   | LE32 | eventfd file descriptor  |
  * | | fs_count  | LE32 | number of full-speed descriptors |
  * | | hs_count  | LE32 | number of high-speed descriptors |
  * | | ss_count  | LE32 | number of super-speed descriptors|
-- 
2.11.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


[no subject]

2016-12-15 Thread Ryan
 auth 12a8a74f subscribe linux-usb ryanphilip...@googlemail.com
--
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: [PATCHv13 2/3] usb: USB Type-C connector class

2016-12-15 Thread Oliver Neukum
On Thu, 2016-12-15 at 13:50 +0200, Heikki Krogerus wrote:

> 1) Should we use "source" and "sink" instead of "device" and "host"
> with the prefer_role attribute after all? I was uncomfortable with
> that when we talked about it last time because the terms kept changing
> with every new Type-C specification version. But I guess "source" and
> "sink" would make sense in the end. This has been requested by several
> guys now.
> 
> 2) Can we change the way we list the supported roles? They are now
> comma separated, but can we use new line instead:
> 
> % cat supported_data_roles
> host
> device
> %
> 
> 3) Instead of the "supports_usb_power_delivery" attribute file which
> we have for the ports and partners, it seem it would be more
> interesting to know the supported USB Power Delivery Specification
> version for some, and also USB Type-C Specification version in
> separate attribute file. So basically we would have
> "usb_power_delivery_version" and "usb_typec_version" attributes
> instead or "supports_usb_power_delivery".
> 
> 
> So would these changes be OK still at this point to everybody?

Hi,

they are all right with me.

Regards
Oliver


--
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 1/1] Increase USB transfer limit

2016-12-15 Thread Greg KH
On Wed, Dec 14, 2016 at 09:11:08PM -0800, Mateusz Berezecki wrote:
> Promote a variable keeping track of USB transfer memory usage to a
> wider data type and allow for higher bandwidth transfers from a large
> number of USB devices connected to a single host.
> 
> Signed-off-by: Mateusz Berezecki 
> ---
>  drivers/usb/core/devio.c | 43 ---
>  1 file changed, 16 insertions(+), 27 deletions(-)

What changed from v1? Please always put that below the --- line.

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: [PATCHv13 2/3] usb: USB Type-C connector class

2016-12-15 Thread Heikki Krogerus
On Wed, Dec 07, 2016 at 02:52:31PM +0200, Heikki Krogerus wrote:
> Hi Oliver,
> 
> On Wed, Dec 07, 2016 at 10:46:48AM +0100, Oliver Neukum wrote:
> > On Fri, 2016-12-02 at 10:04 -0800, Guenter Roeck wrote:
> > 
> > Hi,
> > 
> > > At least for my part I very much concentrated on making sure that
> > > the user space ABI as well as the port driver API are sane and usable.
> > 
> > Rightly so, as this part cannot be changed once included in a kernel
> > release.
> > So, can we agree that that part at least is ready to go?
> 
> I at least have no plans on doing any changes to the ABI. The API will
> change.

I have received (off-list) some questions related to this. There are a
few things that people would like to still change after all.

1) Should we use "source" and "sink" instead of "device" and "host"
with the prefer_role attribute after all? I was uncomfortable with
that when we talked about it last time because the terms kept changing
with every new Type-C specification version. But I guess "source" and
"sink" would make sense in the end. This has been requested by several
guys now.

2) Can we change the way we list the supported roles? They are now
comma separated, but can we use new line instead:

% cat supported_data_roles
host
device
%

3) Instead of the "supports_usb_power_delivery" attribute file which
we have for the ports and partners, it seem it would be more
interesting to know the supported USB Power Delivery Specification
version for some, and also USB Type-C Specification version in
separate attribute file. So basically we would have
"usb_power_delivery_version" and "usb_typec_version" attributes
instead or "supports_usb_power_delivery".


So would these changes be OK still at this point to everybody?


Thanks,

-- 
heikki
--
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