Re: [PATCH v4 2/3] usb: dwc3: Implement interrupt moderation

2016-11-15 Thread Felipe Balbi

Hi,

John Youn  writes:
> Implement interrupt moderation which allows the interrupt rate to be
> throttled. To enable this feature the dwc->imod_interval must be set to
> 1 or greater. This value specifies the minimum inter-interrupt interval,
> in 250 ns increments. A value of 0 disables interrupt moderation.
>
> This applies for DWC_usb3 version 3.00a and higher and for DWC_usb31
> version 1.20a and higher.
>
> Signed-off-by: John Youn 
> ---
>  drivers/usb/dwc3/core.c   | 16 
>  drivers/usb/dwc3/core.h   | 15 +++
>  drivers/usb/dwc3/gadget.c | 16 
>  3 files changed, 47 insertions(+)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 87d0cfb..889dbab 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -982,12 +982,28 @@ static void dwc3_get_properties(struct dwc3 *dwc)
>   dwc->hird_threshold = hird_threshold
>   | (dwc->is_utmi_l1_suspend << 4);
>  
> + dwc->imod_interval = 0;
> +}
> +
> +/* check whether the core supports IMOD */
> +bool dwc3_has_imod(struct dwc3 *dwc)
> +{
> + return ((dwc3_is_usb3(dwc) &&
> +  dwc->revision >= DWC3_REVISION_300A) ||
> + (dwc3_is_usb31(dwc) &&
> +  dwc->revision >= DWC3_USB31_REVISION_120A));
>  }
>  
>  static void dwc3_check_params(struct dwc3 *dwc)
>  {
>   struct device *dev = dwc->dev;
>  
> + /* Check for proper value of imod_interval */
> + if (dwc->imod_interval && !dwc3_has_imod(dwc)) {
> + dev_warn(dwc->dev, "Interrupt moderation not supported\n");
> + dwc->imod_interval = 0;
> + }
> +
>   /* Check the maximum_speed parameter */
>   switch (dwc->maximum_speed) {
>   case USB_SPEED_LOW:
> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> index bf63756..ef81fa5 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -67,6 +67,7 @@
>  #define DWC3_DEVICE_EVENT_OVERFLOW   11
>  
>  #define DWC3_GEVNTCOUNT_MASK 0xfffc
> +#define DWC3_GEVNTCOUNT_EHB  (1 << 31)
>  #define DWC3_GSNPSID_MASK0x
>  #define DWC3_GSNPSREV_MASK   0x
>  
> @@ -149,6 +150,8 @@
>  #define DWC3_DEPCMDPAR0  0x08
>  #define DWC3_DEPCMD  0x0c
>  
> +#define DWC3_DEV_IMOD(n) (0xca00 + (n * 0x4))
> +
>  /* OTG Registers */
>  #define DWC3_OCFG0xcc00
>  #define DWC3_OCTL0xcc04
> @@ -465,6 +468,11 @@
>  #define DWC3_DEPCMD_TYPE_BULK2
>  #define DWC3_DEPCMD_TYPE_INTR3
>  
> +#define DWC3_DEV_IMOD_COUNT_SHIFT16
> +#define DWC3_DEV_IMOD_COUNT_MASK (0x << 16)
> +#define DWC3_DEV_IMOD_INTERVAL_SHIFT 0
> +#define DWC3_DEV_IMOD_INTERVAL_MASK  (0x << 0)
> +
>  /* Structures */
>  
>  struct dwc3_trb;
> @@ -846,6 +854,8 @@ struct dwc3_scratchpad_array {
>   *   1   - -3.5dB de-emphasis
>   *   2   - No de-emphasis
>   *   3   - Reserved
> + * @imod_interval: set the interrupt moderation interval in 250ns
> + * increments or 0 to disable.
>   */
>  struct dwc3 {
>   struct usb_ctrlrequest  *ctrl_req;
> @@ -933,6 +943,7 @@ struct dwc3 {
>   */
>  #define DWC3_REVISION_IS_DWC31   0x8000
>  #define DWC3_USB31_REVISION_110A (0x3131302a | DWC3_REVISION_IS_DWC31)
> +#define DWC3_USB31_REVISION_120A (0x3132302a | DWC3_REVISION_IS_DWC31)
>  
>   enum dwc3_ep0_next  ep0_next_event;
>   enum dwc3_ep0_state ep0state;
> @@ -991,6 +1002,8 @@ struct dwc3 {
>  
>   unsignedtx_de_emphasis_quirk:1;
>   unsignedtx_de_emphasis:2;
> +
> + u16 imod_interval;
>  };
>  
>  /* 
> -- */
> @@ -1162,6 +1175,8 @@ static inline bool dwc3_is_usb31(struct dwc3 *dwc)
>   return !!(dwc->revision & DWC3_REVISION_IS_DWC31);
>  }
>  
> +bool dwc3_has_imod(struct dwc3 *dwc);
> +
>  #if IS_ENABLED(CONFIG_USB_DWC3_HOST) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)
>  int dwc3_host_init(struct dwc3 *dwc);
>  void dwc3_host_exit(struct dwc3 *dwc);
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index baa2c64..0973167 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1685,6 +1685,17 @@ static int __dwc3_gadget_start(struct dwc3 *dwc)
>   int ret = 0;
>   u32 reg;
>  
> + /*
> +  * Use IMOD if enabled via dwc->imod_interval. Otherwise, if
> +  * the core supports IMOD, disable it.
> +  */
> + if (dwc->imod_interval) {
> + dwc3_writel(dwc->regs, DWC3_DEV_IMOD(0), dwc->imod_interval);
> + dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), DWC3_GEVNTCOUNT_EHB);

is this safe? You're doing this after request_threaded_irq(). Sure, IRQs
are still masked, but couldn't clear events that would get fired as soon
as we unmask events?

> + } else if (dwc3_has_imod(d

Re: crash by cdc_acm driver in kernels 4.8-rc1/5

2016-11-15 Thread Oliver Neukum
On Tue, 2016-11-15 at 01:16 +0100, Wim Osterholt wrote:

Hi,

> Whell, yes.
> The only thing that appears you'll have to do is unset 'CONFIG_SMP'.

OK. I haven't tested that, nor would I ever considered it.
 
> My machines didn't have the luxury of multicore processors (until recently),
> so there never has been any reason to deliberately switch these options on!
> 
> In the process of searching, many options may have changed. The crash/OOPS
> has now mitigated into just a WARNING with a call trace.
> (Or it could be a totally different bug?)
> After the call trace the device is working normally and a shutdown
> completes to the end now.
> That is with the config given here:
> http://webserver.djo.tudelft.nl/.config-4.9-rc4.OK (CONFIG_SMP=y)
> http://webserver.djo.tudelft.nl/WARNING-4.9-rc4(call trace for C_S unset)
> 
> Tests on other machines with (slightly) different configs all seem to
> confirm that the problems are gone when CONFIG_SMP is set.

OK, something extremely strange is going on. And I think it is time to get
the big hammer out. I made an extremely stupid debugging patch. Could
you test with it?

Regards
Oliver

From d9c67172611257c262a19e9d3d4d9e6b9a69e88c Mon Sep 17 00:00:00 2001
From: Oliver Neukum 
Date: Tue, 8 Nov 2016 16:12:11 +0100
Subject: [PATCH] acm: insane debugging

extremnely stupid debugging patch

Signed-off-by: Oliver Neukum 
---
 drivers/usb/class/cdc-acm.c | 49 +++--
 1 file changed, 43 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 0f3f62e..a460e46 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1329,68 +1329,103 @@ made_compressed_probe:
 	if (acm == NULL)
 		goto alloc_fail;
 
+printk(KERN_ERR"Check point  1\n");
 	minor = acm_alloc_minor(acm);
 	if (minor < 0)
 		goto alloc_fail1;
-
+printk(KERN_ERR"Check point  2\n");
 	ctrlsize = usb_endpoint_maxp(epctrl);
+printk(KERN_ERR"Check point  3\n");
 	readsize = usb_endpoint_maxp(epread) *
 (quirks == SINGLE_RX_URB ? 1 : 2);
+printk(KERN_ERR"Check point  4\n");
 	acm->combined_interfaces = combined_interfaces;
+printk(KERN_ERR"Check point  5\n");
 	acm->writesize = usb_endpoint_maxp(epwrite) * 20;
+printk(KERN_ERR"Check point  6\n");
 	acm->control = control_interface;
+printk(KERN_ERR"Check point  7\n");
 	acm->data = data_interface;
+printk(KERN_ERR"Check point  8\n");
 	acm->minor = minor;
+printk(KERN_ERR"Check point  9\n");
 	acm->dev = usb_dev;
+printk(KERN_ERR"Check point  10\n");
 	if (h.usb_cdc_acm_descriptor)
 		acm->ctrl_caps = h.usb_cdc_acm_descriptor->bmCapabilities;
+printk(KERN_ERR"Check point  11\n");
 	if (quirks & NO_CAP_LINE)
 		acm->ctrl_caps &= ~USB_CDC_CAP_LINE;
+printk(KERN_ERR"Check point  12\n");
 	acm->ctrlsize = ctrlsize;
+printk(KERN_ERR"Check point  13\n");
 	acm->readsize = readsize;
+printk(KERN_ERR"Check point  14\n");
 	acm->rx_buflimit = num_rx_buf;
+printk(KERN_ERR"Check point  15\n");
 	INIT_WORK(&acm->work, acm_softint);
+printk(KERN_ERR"Check point  16\n");
 	init_waitqueue_head(&acm->wioctl);
+printk(KERN_ERR"Check point  17\n");
 	spin_lock_init(&acm->write_lock);
+printk(KERN_ERR"Check point  18\n");
 	spin_lock_init(&acm->read_lock);
+printk(KERN_ERR"Check point  19\n");
 	mutex_init(&acm->mutex);
+printk(KERN_ERR"Check point  20\n");
 	acm->is_int_ep = usb_endpoint_xfer_int(epread);
+printk(KERN_ERR"Check point  21\n");
 	if (acm->is_int_ep)
 		acm->bInterval = epread->bInterval;
+printk(KERN_ERR"Check point  22\n");
 	tty_port_init(&acm->port);
+printk(KERN_ERR"Check point  23\n");
 	acm->port.ops = &acm_port_ops;
+printk(KERN_ERR"Check point  24\n");
 	init_usb_anchor(&acm->delayed);
+printk(KERN_ERR"Check point  25\n");
 	acm->quirks = quirks;
+printk(KERN_ERR"Check point  26\n");
 
 	buf = usb_alloc_coherent(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma);
 	if (!buf)
 		goto alloc_fail2;
 	acm->ctrl_buffer = buf;
+printk(KERN_ERR"Check point  27\n");
 
 	if (acm_write_buffers_alloc(acm) < 0)
 		goto alloc_fail4;
+printk(KERN_ERR"Check point  28\n");
 
 	acm->ctrlurb = usb_alloc_urb(0, GFP_KERNEL);
 	if (!acm->ctrlurb)
 		goto alloc_fail5;
+printk(KERN_ERR"Check point  29\n");
 
 	for (i = 0; i < num_rx_buf; i++) {
 		struct acm_rb *rb = &(acm->read_buffers[i]);
 		struct urb *urb;
+printk(KERN_ERR"Check point  30, buffer %d\n", i);
 
 		rb->base = usb_alloc_coherent(acm->dev, readsize, GFP_KERNEL,
 &rb->dma);
 		if (!rb->base)
 			goto alloc_fail6;
+printk(KERN_ERR"Check point  31, buffer %d\n", i);
 		rb->index = i;
+printk(KERN_ERR"Check point  32, buffer %d\n", i);
 		rb->instance = acm;
+printk(KERN_ERR"Check point  33, buffer %d\n", i);
 
 		urb = usb_alloc_urb(0, GFP_KERNEL);
 		if (!urb)
 			goto alloc_fail6;
+printk(KERN_ERR"Check point  34, buffer %d\n", i);
 
 		urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+printk(KERN_ERR"Check point  35, buffer %d\n", i);
 		urb->transfer_dma = rb->dma;
+printk(

Re: [PATCH] usb: dwc3: core: Disable USB2.0 phy suspend when dwc3 acts as host role

2016-11-15 Thread Felipe Balbi

Hi,

Baolin Wang  writes:
> When dwc3 controller acts as host role with attaching slow speed device
> (like mouse or keypad). Then if we plugged out the slow speed device,
> it will timeout to run the deconfiguration endpoint command to drop the
> endpoint's resources. Some xHCI command timeout log as below when
> disconnecting one slow device:
>
> [   99.807739] c0 xhci-hcd.0.auto: Port Status Change Event for port 1
> [   99.814699] c0 xhci-hcd.0.auto: resume root hub
> [   99.819992] c0 xhci-hcd.0.auto: handle_port_status: starting port
>  polling.
> [   99.827808] c0 xhci-hcd.0.auto: get port status, actual port 0 status
>  = 0x202a0
> [   99.835903] c0 xhci-hcd.0.auto: Get port status returned 0x10100
> [   99.850052] c0 xhci-hcd.0.auto: clear port connect change, actual
>  port 0 status  = 0x2a0
> [   99.859313] c0 xhci-hcd.0.auto: Cancel URB ffc01ed6cd00, dev 1,
>  ep 0x81, starting at offset 0xc406d210
> [   99.869645] c0 xhci-hcd.0.auto: // Ding dong!
> [   99.874776] c0 xhci-hcd.0.auto: Stopped on Transfer TRB
> [   99.880713] c0 xhci-hcd.0.auto: Removing canceled TD starting at
>  0xc406d210 (dma).
> [   99.889012] c0 xhci-hcd.0.auto: Finding endpoint context
> [   99.895069] c0 xhci-hcd.0.auto: Cycle state = 0x1
> [   99.900519] c0 xhci-hcd.0.auto: New dequeue segment =
>  ffc1112f0880 (virtual)
> [   99.908655] c0 xhci-hcd.0.auto: New dequeue pointer = 0xc406d220 (DMA)
> [   99.915927] c0 xhci-hcd.0.auto: Set TR Deq Ptr cmd, new deq seg =
>  ffc1112f0880 (0xc406d000 dma),
>  new deq ptr = ff8002175220
>  (0xc406d220 dma), new cycle = 1
> [   99.931242] c0 xhci-hcd.0.auto: // Ding dong!
> [   99.936360] c0 xhci-hcd.0.auto: Successful Set TR Deq Ptr cmd,
>  deq = @c406d220
> [   99.944458] c0 xhci-hcd.0.auto: xhci_hub_status_data: stopping port
>  polling.
> [  100.047619] c0 xhci-hcd.0.auto: xhci_drop_endpoint called for udev
>  ffc01ae08800
> [  100.057002] c0 xhci-hcd.0.auto: drop ep 0x81, slot id 1, new drop
>  flags = 0x8, new add flags = 0x0
> [  100.067878] c0 xhci-hcd.0.auto: xhci_check_bandwidth called for udev
>  ffc01ae08800
> [  100.076868] c0 xhci-hcd.0.auto: New Input Control Context:
>
> ..
>
> [  100.427252] c0 xhci-hcd.0.auto: // Ding dong!
> [  105.430728] c0 xhci-hcd.0.auto: Command timeout
> [  105.436029] c0 xhci-hcd.0.auto: Abort command ring
> [  113.558223] c0 xhci-hcd.0.auto: Command completion event does not match
>  command
> [  113.569778] c0 xhci-hcd.0.auto: Timeout while waiting for configure
>  endpoint command
>
> The reason is it will suspend USB phy to disable phy clock when
> disconnecting the slow USB decice, that will hang on the xHCI commands
> executing which depends on the phy clock.
>
> Thus we should disable USB2.0 phy suspend feature when dwc3 acts as host
> role.
>
> Signed-off-by: Baolin Wang 
> ---
>  drivers/usb/dwc3/core.c |   14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 9a4a5e4..0b646cf 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -565,6 +565,20 @@ static int dwc3_phy_setup(struct dwc3 *dwc)
>   if (dwc->revision > DWC3_REVISION_194A)
>   reg |= DWC3_GUSB2PHYCFG_SUSPHY;
>  
> + /*
> +  * When dwc3 controller acts as host role with attaching one slow speed
> +  * device (like mouse or keypad). Then if we plugged out the slow speed
> +  * device, it will timeout to run the deconfiguration endpoint command.
> +  * The reason is it will suspend USB phy to disable phy clock when
> +  * disconnecting slow speed decice, which will affect the xHCI commands
> +  * executing.
> +  *
> +  * Thus we should disable USB 2.0 phy suspend feature when dwc3 acts as
> +  * host role.
> +  */
> + if (dwc->dr_mode == USB_DR_MODE_HOST || dwc->dr_mode == USB_DR_MODE_OTG)
> + reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;

which version of the core you're using? Recent version (since 1.94A,
IIRC) can manage core suspend automatically. Also, this patch of yours
will cause a power consumption regression.

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH v4 4/4] ARM: dts: da850: Add the usb otg device node

2016-11-15 Thread Sekhar Nori
On Thursday 03 November 2016 09:29 PM, Alexandre Bailon wrote:
> This adds the device tree node for the usb otg
> controller present in the da850 family of SoC's.
> This also enables the otg usb controller for the lcdk board.
> 
> Signed-off-by: Alexandre Bailon 
> ---
>  arch/arm/boot/dts/da850-lcdk.dts |  8 
>  arch/arm/boot/dts/da850.dtsi | 15 +++
>  2 files changed, 23 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/da850-lcdk.dts 
> b/arch/arm/boot/dts/da850-lcdk.dts
> index 7b8ab21..9f5040c 100644
> --- a/arch/arm/boot/dts/da850-lcdk.dts
> +++ b/arch/arm/boot/dts/da850-lcdk.dts
> @@ -158,6 +158,14 @@
>   rx-num-evt = <32>;
>  };
>  
> +&usb_phy {
> + status = "okay";
> + };

As mentioned by David already, this node needs to be removed. Please
rebase this on top of latest linux-davinci/master when ready for merging
(driver changes accepted).

> +
> +&usb0 {
> + status = "okay";
> +};
> +
>  &aemif {
>   pinctrl-names = "default";
>   pinctrl-0 = <&nand_pins>;
> diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
> index f79e1b9..322a31a 100644
> --- a/arch/arm/boot/dts/da850.dtsi
> +++ b/arch/arm/boot/dts/da850.dtsi
> @@ -372,6 +372,21 @@
>   >;
>   status = "disabled";
>   };
> + usb_phy: usb-phy {
> + compatible = "ti,da830-usb-phy";
> + #phy-cells = <1>;
> + status = "disabled";
> + };
> + usb0: usb@20 {
> + compatible = "ti,da830-musb";
> + reg = <0x20 0x1>;
> + interrupts = <58>;
> + interrupt-names = "mc";
> + dr_mode = "otg";
> + phys = <&usb_phy 0>;
> + phy-names = "usb-phy";
> + status = "disabled";
> + };

Can you separate out the soc specific changes from board changes? Please
place the usb0 node above the mdio node. I am trying to get to a rough
ordering based on reg property.

Thanks,
Sekhar

--
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] cdc-acm: reindent log messages

2016-11-15 Thread Greg KH
On Wed, Nov 09, 2016 at 12:53:25PM +0100, Ladislav Michl wrote:
> Signed-off-by: Ladislav Michl 
> ---
>  drivers/usb/class/cdc-acm.c | 35 +--
>  1 file changed, 17 insertions(+), 18 deletions(-)

I can't take patches without any changelog text :(

And please cc: Oliver and me if you want us to notice the patches,
otherwise they can easily get lost in the noise...

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


[PATCH v3 1/1] usb: chipidea: move the lock initialization to core file

2016-11-15 Thread Peter Chen
This can fix below dump when the lock is accessed at host
mode due to it is not initialized.

[   46.119638] INFO: trying to register non-static key.
[   46.124643] the code is fine but needs lockdep annotation.
[   46.130144] turning off the locking correctness validator.
[   46.135659] CPU: 0 PID: 690 Comm: cat Not tainted 4.9.0-rc3-00079-g4b75f1d 
#1210
[   46.143075] Hardware name: Freescale i.MX6 SoloX (Device Tree)
[   46.148923] Backtrace:
[   46.151448] [] (dump_backtrace) from [] 
(show_stack+0x18/0x1c)
[   46.159038]  r7:edf52000
[   46.161412]  r6:6193
[   46.163967]  r5:
[   46.165035]  r4:c0e25c2c

[   46.169109] [] (show_stack) from [] 
(dump_stack+0xb4/0xe8)
[   46.176362] [] (dump_stack) from [] 
(register_lock_class+0x4fc/0x56c)
[   46.184554]  r10:c0e25d24
[   46.187014]  r9:edf53e70
[   46.189569]  r8:c1642444
[   46.190637]  r7:ee9da024
[   46.193191]  r6:
[   46.194258]  r5:
[   46.196812]  r4:
[   46.199185]  r3:0001

[   46.203259] [] (register_lock_class) from [] 
(__lock_acquire+0x80/0x10f0)
[   46.211797]  r10:c0e25d24
[   46.214257]  r9:edf53e70
[   46.216813]  r8:ee9da024
[   46.217880]  r7:c1642444
[   46.220435]  r6:edcd1800
[   46.221502]  r5:6193
[   46.224057]  r4:

[   46.227953] [] (__lock_acquire) from [] 
(lock_acquire+0x74/0x94)
[   46.235710]  r10:0001
[   46.238169]  r9:edf53e70
[   46.240723]  r8:edf53f80
[   46.241790]  r7:0001
[   46.244344]  r6:0001
[   46.245412]  r5:6193
[   46.247966]  r4:

[   46.251866] [] (lock_acquire) from [] 
(_raw_spin_lock_irqsave+0x40/0x54)
[   46.260319]  r7:ee1c6a00
[   46.262691]  r6:c062a570
[   46.265247]  r5:2113
[   46.266314]  r4:ee9da014

[   46.270393] [] (_raw_spin_lock_irqsave) from [] 
(ci_port_test_show+0x2c/0x70)
[   46.279280]  r6:eebd2000
[   46.281652]  r5:ee9da010
[   46.284207]  r4:ee9da014

[   46.286810] [] (ci_port_test_show) from [] 
(seq_read+0x1ac/0x4f8)
[   46.294655]  r9:edf53e70
[   46.297028]  r8:edf53f80
[   46.299583]  r7:ee1c6a00
[   46.300650]  r6:0001
[   46.303205]  r5:
[   46.304273]  r4:eebd2000
[   46.306850] [] (seq_read) from [] 
(full_proxy_read+0x54/0x6c)
[   46.314348]  r10:
[   46.316808]  r9:c0a6ad30
[   46.319363]  r8:edf53f80
[   46.320430]  r7:0002
[   46.322986]  r6:b6de3000
[   46.324053]  r5:ee1c6a00
[   46.326607]  r4:c0248b58

[   46.330505] [] (full_proxy_read) from [] 
(__vfs_read+0x34/0x118)
[   46.338262]  r9:edf52000
[   46.340635]  r8:c0107fc4
[   46.343190]  r7:0002
[   46.344257]  r6:edf53f80
[   46.346812]  r5:c039e810
[   46.347879]  r4:ee1c6a00
[   46.350447] [] (__vfs_read) from [] (vfs_read+0x8c/0x11c)
[   46.357597]  r9:edf52000
[   46.359969]  r8:c0107fc4
[   46.362524]  r7:edf53f80
[   46.363592]  r6:b6de3000
[   46.366147]  r5:ee1c6a00
[   46.367214]  r4:0002
[   46.369782] [] (vfs_read) from [] (SyS_read+0x4c/0xa8)
[   46.376672]  r8:c0107fc4
[   46.379045]  r7:0002
[   46.381600]  r6:b6de3000
[   46.382667]  r5:ee1c6a00
[   46.385222]  r4:ee1c6a00

[   46.387817] [] (SyS_read) from [] 
(ret_fast_syscall+0x0/0x1c)
[   46.395314]  r7:0003
[   46.397687]  r6:b6de3000
[   46.400243]  r5:0002
[   46.401310]  r4:0002

Cc: 
Fixes: 26c696c678c4 ("USB: Chipidea: rename struct
ci13xxx variables from udc to ci")
Signed-off-by: Peter Chen 
---
Changes for v3:
- Delete the wrong kernel version for stable tree, and using real "Fixes"
  instead.

Changes for v2:
- Clean up dump message by using dmesg output instead of console output.

 drivers/usb/chipidea/core.c | 1 +
 drivers/usb/chipidea/udc.c  | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index a7d2c68..c5e7f3d 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -873,6 +873,7 @@ static int ci_hdrc_probe(struct platform_device *pdev)
if (!ci)
return -ENOMEM;
 
+   spin_lock_init(&ci->lock);
ci->dev = dev;
ci->platdata = dev_get_platdata(dev);
ci->imx28_write_fix = !!(ci->platdata->flags &
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 1e0ffad..e7bd064 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1886,8 +1886,6 @@ static int udc_start(struct ci_hdrc *ci)
struct usb_otg_caps *otg_caps = &ci->platdata->ci_otg_caps;
int retval = 0;
 
-   spin_lock_init(&ci->lock);
-
ci->gadget.ops  = &usb_gadget_ops;
ci->gadget.speed= USB_SPEED_UNKNOWN;
ci->gadget.max_speed= USB_SPEED_HIGH;
-- 
2.7.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: [PATCH v2 1/1] usb: chipidea: move the lock initialization to core file

2016-11-15 Thread Greg KH
On Tue, Nov 15, 2016 at 11:32:02AM +0200, Felipe Balbi wrote:
> 
> Hi,
> 
> Peter Chen  writes:
> > On Tue, Nov 15, 2016 at 07:58:16AM +0100, Greg KH wrote:
> >> On Tue, Nov 15, 2016 at 02:02:47PM +0800, Peter Chen wrote:
> >> > This can fix below dump when the lock is accessed at host
> >> > mode due to it is not initialized.
> >> > 
> >> > [   46.119638] INFO: trying to register non-static key.
> >> > [   46.124643] the code is fine but needs lockdep annotation.
> >> > [   46.130144] turning off the locking correctness validator.
> >> > [   46.135659] CPU: 0 PID: 690 Comm: cat Not tainted 
> >> > 4.9.0-rc3-00079-g4b75f1d #1210
> >> > [   46.143075] Hardware name: Freescale i.MX6 SoloX (Device Tree)
> >> > [   46.148923] Backtrace:
> >> > [   46.151448] [] (dump_backtrace) from [] 
> >> > (show_stack+0x18/0x1c)
> >> > [   46.159038]  r7:edf52000
> >> > [   46.161412]  r6:6193
> >> > [   46.163967]  r5:
> >> > [   46.165035]  r4:c0e25c2c
> >> > 
> >> > [   46.169109] [] (show_stack) from [] 
> >> > (dump_stack+0xb4/0xe8)
> >> > [   46.176362] [] (dump_stack) from [] 
> >> > (register_lock_class+0x4fc/0x56c)
> >> > [   46.184554]  r10:c0e25d24
> >> > [   46.187014]  r9:edf53e70
> >> > [   46.189569]  r8:c1642444
> >> > [   46.190637]  r7:ee9da024
> >> > [   46.193191]  r6:
> >> > [   46.194258]  r5:
> >> > [   46.196812]  r4:
> >> > [   46.199185]  r3:0001
> >> > 
> >> > [   46.203259] [] (register_lock_class) from [] 
> >> > (__lock_acquire+0x80/0x10f0)
> >> > [   46.211797]  r10:c0e25d24
> >> > [   46.214257]  r9:edf53e70
> >> > [   46.216813]  r8:ee9da024
> >> > [   46.217880]  r7:c1642444
> >> > [   46.220435]  r6:edcd1800
> >> > [   46.221502]  r5:6193
> >> > [   46.224057]  r4:
> >> > 
> >> > [   46.227953] [] (__lock_acquire) from [] 
> >> > (lock_acquire+0x74/0x94)
> >> > [   46.235710]  r10:0001
> >> > [   46.238169]  r9:edf53e70
> >> > [   46.240723]  r8:edf53f80
> >> > [   46.241790]  r7:0001
> >> > [   46.244344]  r6:0001
> >> > [   46.245412]  r5:6193
> >> > [   46.247966]  r4:
> >> > 
> >> > [   46.251866] [] (lock_acquire) from [] 
> >> > (_raw_spin_lock_irqsave+0x40/0x54)
> >> > [   46.260319]  r7:ee1c6a00
> >> > [   46.262691]  r6:c062a570
> >> > [   46.265247]  r5:2113
> >> > [   46.266314]  r4:ee9da014
> >> > 
> >> > [   46.270393] [] (_raw_spin_lock_irqsave) from [] 
> >> > (ci_port_test_show+0x2c/0x70)
> >> > [   46.279280]  r6:eebd2000
> >> > [   46.281652]  r5:ee9da010
> >> > [   46.284207]  r4:ee9da014
> >> > 
> >> > [   46.286810] [] (ci_port_test_show) from [] 
> >> > (seq_read+0x1ac/0x4f8)
> >> > [   46.294655]  r9:edf53e70
> >> > [   46.297028]  r8:edf53f80
> >> > [   46.299583]  r7:ee1c6a00
> >> > [   46.300650]  r6:0001
> >> > [   46.303205]  r5:
> >> > [   46.304273]  r4:eebd2000
> >> > [   46.306850] [] (seq_read) from [] 
> >> > (full_proxy_read+0x54/0x6c)
> >> > [   46.314348]  r10:
> >> > [   46.316808]  r9:c0a6ad30
> >> > [   46.319363]  r8:edf53f80
> >> > [   46.320430]  r7:0002
> >> > [   46.322986]  r6:b6de3000
> >> > [   46.324053]  r5:ee1c6a00
> >> > [   46.326607]  r4:c0248b58
> >> > 
> >> > [   46.330505] [] (full_proxy_read) from [] 
> >> > (__vfs_read+0x34/0x118)
> >> > [   46.338262]  r9:edf52000
> >> > [   46.340635]  r8:c0107fc4
> >> > [   46.343190]  r7:0002
> >> > [   46.344257]  r6:edf53f80
> >> > [   46.346812]  r5:c039e810
> >> > [   46.347879]  r4:ee1c6a00
> >> > [   46.350447] [] (__vfs_read) from [] 
> >> > (vfs_read+0x8c/0x11c)
> >> > [   46.357597]  r9:edf52000
> >> > [   46.359969]  r8:c0107fc4
> >> > [   46.362524]  r7:edf53f80
> >> > [   46.363592]  r6:b6de3000
> >> > [   46.366147]  r5:ee1c6a00
> >> > [   46.367214]  r4:0002
> >> > [   46.369782] [] (vfs_read) from [] 
> >> > (SyS_read+0x4c/0xa8)
> >> > [   46.376672]  r8:c0107fc4
> >> > [   46.379045]  r7:0002
> >> > [   46.381600]  r6:b6de3000
> >> > [   46.382667]  r5:ee1c6a00
> >> > [   46.385222]  r4:ee1c6a00
> >> > 
> >> > [   46.387817] [] (SyS_read) from [] 
> >> > (ret_fast_syscall+0x0/0x1c)
> >> > [   46.395314]  r7:0003
> >> > [   46.397687]  r6:b6de3000
> >> > [   46.400243]  r5:0002
> >> > [   46.401310]  r4:0002
> >> > 
> >> > Cc:  #v4.1+
> >> 
> >> Any idea what commit caused the problem?
> >> 
> >
> > This issue has been existed from this driver has written, and the
> > structure refined later, this patch can be applied after that
> > (4 years ago), I think v4.1 is the last stable tree it can be
> > applied.
> 
> from a quick read, it looks to me like commit 
> e443b333629f82ca0da91a05ca638050943bbedd is the first one where this
> would be reproducible. That would be v3.5, IIRC.
> 
> We still have a few longterm kernels before v4.1 which might wanna use
> this commit.

Thanks for digging this up.

Peter, please redo this patch with the Fixes: tag in it.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body 

Re: [PATCH v2 1/1] usb: chipidea: move the lock initialization to core file

2016-11-15 Thread Peter Chen
On Tue, Nov 15, 2016 at 11:32:02AM +0200, Felipe Balbi wrote:
> 
> Hi,
> 
> Peter Chen  writes:
> > On Tue, Nov 15, 2016 at 07:58:16AM +0100, Greg KH wrote:
> >> On Tue, Nov 15, 2016 at 02:02:47PM +0800, Peter Chen wrote:
> >> > This can fix below dump when the lock is accessed at host
> >> > mode due to it is not initialized.
> >> > 
> >> > [   46.119638] INFO: trying to register non-static key.
> >> > [   46.124643] the code is fine but needs lockdep annotation.
> >> > [   46.130144] turning off the locking correctness validator.
> >> > [   46.135659] CPU: 0 PID: 690 Comm: cat Not tainted 
> >> > 4.9.0-rc3-00079-g4b75f1d #1210
> >> > [   46.143075] Hardware name: Freescale i.MX6 SoloX (Device Tree)
> >> > [   46.148923] Backtrace:
> >> > [   46.151448] [] (dump_backtrace) from [] 
> >> > (show_stack+0x18/0x1c)
> >> > [   46.159038]  r7:edf52000
> >> > [   46.161412]  r6:6193
> >> > [   46.163967]  r5:
> >> > [   46.165035]  r4:c0e25c2c
> >> > 
> >> > [   46.169109] [] (show_stack) from [] 
> >> > (dump_stack+0xb4/0xe8)
> >> > [   46.176362] [] (dump_stack) from [] 
> >> > (register_lock_class+0x4fc/0x56c)
> >> > [   46.184554]  r10:c0e25d24
> >> > [   46.187014]  r9:edf53e70
> >> > [   46.189569]  r8:c1642444
> >> > [   46.190637]  r7:ee9da024
> >> > [   46.193191]  r6:
> >> > [   46.194258]  r5:
> >> > [   46.196812]  r4:
> >> > [   46.199185]  r3:0001
> >> > 
> >> > [   46.203259] [] (register_lock_class) from [] 
> >> > (__lock_acquire+0x80/0x10f0)
> >> > [   46.211797]  r10:c0e25d24
> >> > [   46.214257]  r9:edf53e70
> >> > [   46.216813]  r8:ee9da024
> >> > [   46.217880]  r7:c1642444
> >> > [   46.220435]  r6:edcd1800
> >> > [   46.221502]  r5:6193
> >> > [   46.224057]  r4:
> >> > 
> >> > [   46.227953] [] (__lock_acquire) from [] 
> >> > (lock_acquire+0x74/0x94)
> >> > [   46.235710]  r10:0001
> >> > [   46.238169]  r9:edf53e70
> >> > [   46.240723]  r8:edf53f80
> >> > [   46.241790]  r7:0001
> >> > [   46.244344]  r6:0001
> >> > [   46.245412]  r5:6193
> >> > [   46.247966]  r4:
> >> > 
> >> > [   46.251866] [] (lock_acquire) from [] 
> >> > (_raw_spin_lock_irqsave+0x40/0x54)
> >> > [   46.260319]  r7:ee1c6a00
> >> > [   46.262691]  r6:c062a570
> >> > [   46.265247]  r5:2113
> >> > [   46.266314]  r4:ee9da014
> >> > 
> >> > [   46.270393] [] (_raw_spin_lock_irqsave) from [] 
> >> > (ci_port_test_show+0x2c/0x70)
> >> > [   46.279280]  r6:eebd2000
> >> > [   46.281652]  r5:ee9da010
> >> > [   46.284207]  r4:ee9da014
> >> > 
> >> > [   46.286810] [] (ci_port_test_show) from [] 
> >> > (seq_read+0x1ac/0x4f8)
> >> > [   46.294655]  r9:edf53e70
> >> > [   46.297028]  r8:edf53f80
> >> > [   46.299583]  r7:ee1c6a00
> >> > [   46.300650]  r6:0001
> >> > [   46.303205]  r5:
> >> > [   46.304273]  r4:eebd2000
> >> > [   46.306850] [] (seq_read) from [] 
> >> > (full_proxy_read+0x54/0x6c)
> >> > [   46.314348]  r10:
> >> > [   46.316808]  r9:c0a6ad30
> >> > [   46.319363]  r8:edf53f80
> >> > [   46.320430]  r7:0002
> >> > [   46.322986]  r6:b6de3000
> >> > [   46.324053]  r5:ee1c6a00
> >> > [   46.326607]  r4:c0248b58
> >> > 
> >> > [   46.330505] [] (full_proxy_read) from [] 
> >> > (__vfs_read+0x34/0x118)
> >> > [   46.338262]  r9:edf52000
> >> > [   46.340635]  r8:c0107fc4
> >> > [   46.343190]  r7:0002
> >> > [   46.344257]  r6:edf53f80
> >> > [   46.346812]  r5:c039e810
> >> > [   46.347879]  r4:ee1c6a00
> >> > [   46.350447] [] (__vfs_read) from [] 
> >> > (vfs_read+0x8c/0x11c)
> >> > [   46.357597]  r9:edf52000
> >> > [   46.359969]  r8:c0107fc4
> >> > [   46.362524]  r7:edf53f80
> >> > [   46.363592]  r6:b6de3000
> >> > [   46.366147]  r5:ee1c6a00
> >> > [   46.367214]  r4:0002
> >> > [   46.369782] [] (vfs_read) from [] 
> >> > (SyS_read+0x4c/0xa8)
> >> > [   46.376672]  r8:c0107fc4
> >> > [   46.379045]  r7:0002
> >> > [   46.381600]  r6:b6de3000
> >> > [   46.382667]  r5:ee1c6a00
> >> > [   46.385222]  r4:ee1c6a00
> >> > 
> >> > [   46.387817] [] (SyS_read) from [] 
> >> > (ret_fast_syscall+0x0/0x1c)
> >> > [   46.395314]  r7:0003
> >> > [   46.397687]  r6:b6de3000
> >> > [   46.400243]  r5:0002
> >> > [   46.401310]  r4:0002
> >> > 
> >> > Cc:  #v4.1+
> >> 
> >> Any idea what commit caused the problem?
> >> 
> >
> > This issue has been existed from this driver has written, and the
> > structure refined later, this patch can be applied after that
> > (4 years ago), I think v4.1 is the last stable tree it can be
> > applied.
> 
> from a quick read, it looks to me like commit 
> e443b333629f82ca0da91a05ca638050943bbedd is the first one where this
> would be reproducible. That would be v3.5, IIRC.
> 
> We still have a few longterm kernels before v4.1 which might wanna use
> this commit.
> 

Thanks, although the first one should be
26c696c678c4ce180599330999e895cded0f625b, I got the wrong kernel version
for it, I will fix it with v3.

-- 

Best Regards,
Peter Chen
--
To unsu

[PATCH] usb: dwc3: core: Disable USB2.0 phy suspend when dwc3 acts as host role

2016-11-15 Thread Baolin Wang
When dwc3 controller acts as host role with attaching slow speed device
(like mouse or keypad). Then if we plugged out the slow speed device,
it will timeout to run the deconfiguration endpoint command to drop the
endpoint's resources. Some xHCI command timeout log as below when
disconnecting one slow device:

[   99.807739] c0 xhci-hcd.0.auto: Port Status Change Event for port 1
[   99.814699] c0 xhci-hcd.0.auto: resume root hub
[   99.819992] c0 xhci-hcd.0.auto: handle_port_status: starting port
   polling.
[   99.827808] c0 xhci-hcd.0.auto: get port status, actual port 0 status
   = 0x202a0
[   99.835903] c0 xhci-hcd.0.auto: Get port status returned 0x10100
[   99.850052] c0 xhci-hcd.0.auto: clear port connect change, actual
   port 0 status  = 0x2a0
[   99.859313] c0 xhci-hcd.0.auto: Cancel URB ffc01ed6cd00, dev 1,
   ep 0x81, starting at offset 0xc406d210
[   99.869645] c0 xhci-hcd.0.auto: // Ding dong!
[   99.874776] c0 xhci-hcd.0.auto: Stopped on Transfer TRB
[   99.880713] c0 xhci-hcd.0.auto: Removing canceled TD starting at
   0xc406d210 (dma).
[   99.889012] c0 xhci-hcd.0.auto: Finding endpoint context
[   99.895069] c0 xhci-hcd.0.auto: Cycle state = 0x1
[   99.900519] c0 xhci-hcd.0.auto: New dequeue segment =
   ffc1112f0880 (virtual)
[   99.908655] c0 xhci-hcd.0.auto: New dequeue pointer = 0xc406d220 (DMA)
[   99.915927] c0 xhci-hcd.0.auto: Set TR Deq Ptr cmd, new deq seg =
   ffc1112f0880 (0xc406d000 dma),
   new deq ptr = ff8002175220
   (0xc406d220 dma), new cycle = 1
[   99.931242] c0 xhci-hcd.0.auto: // Ding dong!
[   99.936360] c0 xhci-hcd.0.auto: Successful Set TR Deq Ptr cmd,
   deq = @c406d220
[   99.944458] c0 xhci-hcd.0.auto: xhci_hub_status_data: stopping port
   polling.
[  100.047619] c0 xhci-hcd.0.auto: xhci_drop_endpoint called for udev
   ffc01ae08800
[  100.057002] c0 xhci-hcd.0.auto: drop ep 0x81, slot id 1, new drop
   flags = 0x8, new add flags = 0x0
[  100.067878] c0 xhci-hcd.0.auto: xhci_check_bandwidth called for udev
   ffc01ae08800
[  100.076868] c0 xhci-hcd.0.auto: New Input Control Context:

..

[  100.427252] c0 xhci-hcd.0.auto: // Ding dong!
[  105.430728] c0 xhci-hcd.0.auto: Command timeout
[  105.436029] c0 xhci-hcd.0.auto: Abort command ring
[  113.558223] c0 xhci-hcd.0.auto: Command completion event does not match
   command
[  113.569778] c0 xhci-hcd.0.auto: Timeout while waiting for configure
   endpoint command

The reason is it will suspend USB phy to disable phy clock when
disconnecting the slow USB decice, that will hang on the xHCI commands
executing which depends on the phy clock.

Thus we should disable USB2.0 phy suspend feature when dwc3 acts as host
role.

Signed-off-by: Baolin Wang 
---
 drivers/usb/dwc3/core.c |   14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 9a4a5e4..0b646cf 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -565,6 +565,20 @@ static int dwc3_phy_setup(struct dwc3 *dwc)
if (dwc->revision > DWC3_REVISION_194A)
reg |= DWC3_GUSB2PHYCFG_SUSPHY;
 
+   /*
+* When dwc3 controller acts as host role with attaching one slow speed
+* device (like mouse or keypad). Then if we plugged out the slow speed
+* device, it will timeout to run the deconfiguration endpoint command.
+* The reason is it will suspend USB phy to disable phy clock when
+* disconnecting slow speed decice, which will affect the xHCI commands
+* executing.
+*
+* Thus we should disable USB 2.0 phy suspend feature when dwc3 acts as
+* host role.
+*/
+   if (dwc->dr_mode == USB_DR_MODE_HOST || dwc->dr_mode == USB_DR_MODE_OTG)
+   reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
+
if (dwc->dis_u2_susphy_quirk)
reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
 
-- 
1.7.9.5

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


Re: [PATCH v2 1/1] usb: chipidea: move the lock initialization to core file

2016-11-15 Thread Felipe Balbi

Hi,

Peter Chen  writes:
> On Tue, Nov 15, 2016 at 07:58:16AM +0100, Greg KH wrote:
>> On Tue, Nov 15, 2016 at 02:02:47PM +0800, Peter Chen wrote:
>> > This can fix below dump when the lock is accessed at host
>> > mode due to it is not initialized.
>> > 
>> > [   46.119638] INFO: trying to register non-static key.
>> > [   46.124643] the code is fine but needs lockdep annotation.
>> > [   46.130144] turning off the locking correctness validator.
>> > [   46.135659] CPU: 0 PID: 690 Comm: cat Not tainted 
>> > 4.9.0-rc3-00079-g4b75f1d #1210
>> > [   46.143075] Hardware name: Freescale i.MX6 SoloX (Device Tree)
>> > [   46.148923] Backtrace:
>> > [   46.151448] [] (dump_backtrace) from [] 
>> > (show_stack+0x18/0x1c)
>> > [   46.159038]  r7:edf52000
>> > [   46.161412]  r6:6193
>> > [   46.163967]  r5:
>> > [   46.165035]  r4:c0e25c2c
>> > 
>> > [   46.169109] [] (show_stack) from [] 
>> > (dump_stack+0xb4/0xe8)
>> > [   46.176362] [] (dump_stack) from [] 
>> > (register_lock_class+0x4fc/0x56c)
>> > [   46.184554]  r10:c0e25d24
>> > [   46.187014]  r9:edf53e70
>> > [   46.189569]  r8:c1642444
>> > [   46.190637]  r7:ee9da024
>> > [   46.193191]  r6:
>> > [   46.194258]  r5:
>> > [   46.196812]  r4:
>> > [   46.199185]  r3:0001
>> > 
>> > [   46.203259] [] (register_lock_class) from [] 
>> > (__lock_acquire+0x80/0x10f0)
>> > [   46.211797]  r10:c0e25d24
>> > [   46.214257]  r9:edf53e70
>> > [   46.216813]  r8:ee9da024
>> > [   46.217880]  r7:c1642444
>> > [   46.220435]  r6:edcd1800
>> > [   46.221502]  r5:6193
>> > [   46.224057]  r4:
>> > 
>> > [   46.227953] [] (__lock_acquire) from [] 
>> > (lock_acquire+0x74/0x94)
>> > [   46.235710]  r10:0001
>> > [   46.238169]  r9:edf53e70
>> > [   46.240723]  r8:edf53f80
>> > [   46.241790]  r7:0001
>> > [   46.244344]  r6:0001
>> > [   46.245412]  r5:6193
>> > [   46.247966]  r4:
>> > 
>> > [   46.251866] [] (lock_acquire) from [] 
>> > (_raw_spin_lock_irqsave+0x40/0x54)
>> > [   46.260319]  r7:ee1c6a00
>> > [   46.262691]  r6:c062a570
>> > [   46.265247]  r5:2113
>> > [   46.266314]  r4:ee9da014
>> > 
>> > [   46.270393] [] (_raw_spin_lock_irqsave) from [] 
>> > (ci_port_test_show+0x2c/0x70)
>> > [   46.279280]  r6:eebd2000
>> > [   46.281652]  r5:ee9da010
>> > [   46.284207]  r4:ee9da014
>> > 
>> > [   46.286810] [] (ci_port_test_show) from [] 
>> > (seq_read+0x1ac/0x4f8)
>> > [   46.294655]  r9:edf53e70
>> > [   46.297028]  r8:edf53f80
>> > [   46.299583]  r7:ee1c6a00
>> > [   46.300650]  r6:0001
>> > [   46.303205]  r5:
>> > [   46.304273]  r4:eebd2000
>> > [   46.306850] [] (seq_read) from [] 
>> > (full_proxy_read+0x54/0x6c)
>> > [   46.314348]  r10:
>> > [   46.316808]  r9:c0a6ad30
>> > [   46.319363]  r8:edf53f80
>> > [   46.320430]  r7:0002
>> > [   46.322986]  r6:b6de3000
>> > [   46.324053]  r5:ee1c6a00
>> > [   46.326607]  r4:c0248b58
>> > 
>> > [   46.330505] [] (full_proxy_read) from [] 
>> > (__vfs_read+0x34/0x118)
>> > [   46.338262]  r9:edf52000
>> > [   46.340635]  r8:c0107fc4
>> > [   46.343190]  r7:0002
>> > [   46.344257]  r6:edf53f80
>> > [   46.346812]  r5:c039e810
>> > [   46.347879]  r4:ee1c6a00
>> > [   46.350447] [] (__vfs_read) from [] 
>> > (vfs_read+0x8c/0x11c)
>> > [   46.357597]  r9:edf52000
>> > [   46.359969]  r8:c0107fc4
>> > [   46.362524]  r7:edf53f80
>> > [   46.363592]  r6:b6de3000
>> > [   46.366147]  r5:ee1c6a00
>> > [   46.367214]  r4:0002
>> > [   46.369782] [] (vfs_read) from [] 
>> > (SyS_read+0x4c/0xa8)
>> > [   46.376672]  r8:c0107fc4
>> > [   46.379045]  r7:0002
>> > [   46.381600]  r6:b6de3000
>> > [   46.382667]  r5:ee1c6a00
>> > [   46.385222]  r4:ee1c6a00
>> > 
>> > [   46.387817] [] (SyS_read) from [] 
>> > (ret_fast_syscall+0x0/0x1c)
>> > [   46.395314]  r7:0003
>> > [   46.397687]  r6:b6de3000
>> > [   46.400243]  r5:0002
>> > [   46.401310]  r4:0002
>> > 
>> > Cc:  #v4.1+
>> 
>> Any idea what commit caused the problem?
>> 
>
> This issue has been existed from this driver has written, and the
> structure refined later, this patch can be applied after that
> (4 years ago), I think v4.1 is the last stable tree it can be
> applied.

from a quick read, it looks to me like commit 
e443b333629f82ca0da91a05ca638050943bbedd is the first one where this
would be reproducible. That would be v3.5, IIRC.

We still have a few longterm kernels before v4.1 which might wanna use
this commit.

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATHCv10 1/2] usb: USB Type-C connector class

2016-11-15 Thread Guenter Roeck

On 11/14/2016 11:07 PM, Greg KH wrote:

On Mon, Nov 14, 2016 at 12:46:50PM -0800, Guenter Roeck wrote:

On Mon, Nov 14, 2016 at 02:32:35PM +0200, Heikki Krogerus wrote:

Hi Greg,

On Mon, Nov 14, 2016 at 10:51:48AM +0100, Greg KH wrote:

On Mon, Sep 19, 2016 at 02:16:56PM +0300, Heikki Krogerus wrote:

The purpose of USB Type-C connector class is to provide
unified interface for the user space to get the status and
basic information about USB Type-C connectors on a system,
control over data role swapping, and when the port supports
USB Power Delivery, also control over power role swapping
and Alternate Modes.

Reviewed-by: Guenter Roeck 
Tested-by: Guenter Roeck 
Signed-off-by: Heikki Krogerus 
---
 Documentation/ABI/testing/sysfs-class-typec |  218 ++
 Documentation/usb/typec.txt |  103 +++
 MAINTAINERS |9 +
 drivers/usb/Kconfig |2 +
 drivers/usb/Makefile|2 +
 drivers/usb/typec/Kconfig   |7 +
 drivers/usb/typec/Makefile  |1 +
 drivers/usb/typec/typec.c   | 1075 +++
 include/linux/usb/typec.h   |  252 +++
 9 files changed, 1669 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-class-typec
 create mode 100644 Documentation/usb/typec.txt
 create mode 100644 drivers/usb/typec/Kconfig
 create mode 100644 drivers/usb/typec/Makefile
 create mode 100644 drivers/usb/typec/typec.c
 create mode 100644 include/linux/usb/typec.h



[ ... ]


+
+int typec_connect(struct typec_port *port, struct typec_connection *con)
+{
+   int ret;
+
+   if (!con->partner && !con->cable)
+   return -EINVAL;
+
+   port->connected = 1;
+   port->data_role = con->data_role;
+   port->pwr_role = con->pwr_role;
+   port->vconn_role = con->vconn_role;
+   port->pwr_opmode = con->pwr_opmode;
+
+   kobject_uevent(&port->dev.kobj, KOBJ_CHANGE);


This worries me.  Who is listening for it?  What will you do with it?
Shouldn't you just poll on an attribute file instead?


Oliver! Did you need this or can we remove it?

I remember I removed the "connected" attribute because you did not see
any use for it at one point. I don't remember the reason exactly why?



The Android team tells me that they are currently using the udev events
to track port role changes, and to detect presence of port partner.

Also, there are plans to track changes on usbc*cable to differentiate
between cable attach vs. device being attached on the remote end.

What is the problem with using kobject_uevent() and thus presumably
udev events ?


It's not a "normal" thing to do and is pretty "heavy" to do.  What does
userspace do with that change event?  Does it read specific attributes?
What causes the event to happen in the kernel, is it really just a
change in the specific object, or do new ones get added/removed?

In short, document the heck out of this please so people know how to use
it, and what is happening when the event happens.



Badhri,

can you clarify which events you are using in detail, and what for ?

Thanks,
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] dma: cpp41: Fix handling of error path

2016-11-15 Thread Sekhar Nori
On Saturday 12 November 2016 12:58 AM, Tony Lindgren wrote:
> If we return early on pm_runtime_get() error, we need to also call
> pm_runtime_put_noidle() as pointed out in a musb related thread
> by Johan Hovold . This is to keep the PM runtime
> use counts happy.
> 
> Fixes: fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support")
> Cc: Johan Hovold 
> Signed-off-by: Tony Lindgren 
> ---
>  drivers/dma/cppi41.c | 11 +--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
> --- a/drivers/dma/cppi41.c
> +++ b/drivers/dma/cppi41.c
> @@ -366,8 +366,11 @@ static int cppi41_dma_alloc_chan_resources(struct 
> dma_chan *chan)
>   int error;
>  
>   error = pm_runtime_get_sync(cdd->ddev.dev);
> - if (error < 0)
> + if (error < 0) {
> + pm_runtime_put_noidle(cdd->ddev.dev);
> +

If pm_runtime_get_sync() fails due to callback error, then
rpm_callback() sets dev.power.runtime_error to an error value which gets
cleared by an explicit call to pm_runtime_set_suspended().

This will tell the framework that the status of device is suspended.
Else, the failure will be sticky and on subsequent attempts,
rpm_resume() will keep returning early instead of trying to resume the
device again.

This is as far as I can gather from code. So, I believe the recovery
path should be:

if (error < 0) {
pm_runtime_set_suspended(cdd->ddev.dev);
pm_runtime_put_noidle(cdd->ddev.dev);

...

Thanks,
Sekhar
--
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: host: xhci: Remove unused 'addr_64' variable in xhci_hcd structure

2016-11-15 Thread Baolin Wang
Since the 'addr_64' variable as legacy is unused now, then remove it from
xhci_hcd structure.

Signed-off-by: Baolin Wang 
---
 drivers/usb/host/xhci.h |1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 3e5922d..9dbaacf 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1547,7 +1547,6 @@ struct xhci_hcd {
u8  max_ports;
u8  isoc_threshold;
int event_ring_max;
-   int addr_64;
/* 4KB min, 128MB max */
int page_size;
/* Valid values are 12 to 20, inclusive */
-- 
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


<    1   2