Re: [PATCH v3 0/4] scsi: ufs ums-* esp_scsi: fix module reference counting

2015-01-12 Thread Christoph Hellwig
On Sun, Jan 11, 2015 at 10:50:02PM +0900, Akinobu Mita wrote:
 While accessing a scsi_device, the use count of the underlying LLDD module
 is incremented.  The module reference is retrieved through .module field of
 struct scsi_host_template.
 
 This mapping between scsi_device and underlying LLDD module works well
 except ufs, unusual usb storage drivers, and sub drivers for esp_scsi.
 These drivers consist with core driver and actual LLDDs, and
 scsi_host_template is defined in the core driver.  So the actual LLDDs can
 be unloaded even if the scsi_device is being accessed.
 
 This patch series first adds ability to adjust module reference for
 scsi host by LLDDs and then fixes actual LLDDs by adjusting module
 reference after scsi host allocation.

Why don't we move the module into the Scsi_Host only, and use
the same macro that passes THIS_MODULE trick you are using in
the sub drivers?  That seems to be a fairly common scheme in other
subsystems as well.
--
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 0/3] usb: udc: cleanup pullup operation

2015-01-12 Thread Peter Chen
This patch set cleans up udc drivers which define .pullup API, but
still call pullup operation at .udc_start or .udc_stop. In fact,
the related pullup operations are covered by udc core.

Peter Chen (3):
  usb: udc: pxa27x_udc: delete pullup operation at .udc_start and
.udc_stop
  usb: pxa27x_udc: delete pullup operation at .udc_start and .udc_stop
  usb: udc: mv_udc_core: delete pullup operation at .udc_start

 drivers/usb/gadget/udc/mv_udc_core.c | 3 ---
 drivers/usb/gadget/udc/pxa25x_udc.c  | 2 --
 drivers/usb/gadget/udc/pxa27x_udc.c  | 2 --
 3 files changed, 7 deletions(-)

-- 
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/2] usb: udc: add usb_udc_activation_handler

2015-01-12 Thread Peter Chen
During this API, the deactivation count will be update, and it
will try to connect or disconnect gadget. It can be used to
enable functions for gadget.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/gadget/udc/udc-core.c | 36 +++-
 include/linux/usb/gadget.h|  5 +
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/udc-core.c 
b/drivers/usb/gadget/udc/udc-core.c
index 9b72c46..a044207 100644
--- a/drivers/usb/gadget/udc/udc-core.c
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -37,6 +37,7 @@
  * @list - for use by the udc class driver
  * @vbus - for udcs who care about vbus status, this value is real vbus status;
  * for udcs who do not care about vbus status, this value is always true
+ * @deactivations - the deactivation count to connect or disconnect gadget
  *
  * This represents the internal data structure which is used by the UDC-class
  * to hold information about udc driver and gadget together.
@@ -47,6 +48,7 @@ struct usb_udc {
struct device   dev;
struct list_headlist;
boolvbus;
+   int deactivations;
 };
 
 static struct class *udc_class;
@@ -160,13 +162,45 @@ EXPORT_SYMBOL_GPL(usb_gadget_set_state);
 
 static void usb_udc_connect_control(struct usb_udc *udc)
 {
-   if (udc-vbus)
+   if (udc-vbus  !udc-deactivations)
usb_gadget_connect(udc-gadget);
else
usb_gadget_disconnect(udc-gadget);
 }
 
 /**
+ * usb_udc_activation_handler - updates udc's deactivation count and
+ * try to connect or disconnect
+ *
+ * @gadget: The gadget which the function is at
+ * @active: the function needs to be active or not
+ *
+ * The composite core calls it when it wants to activate or deactivate
+ * function.
+ */
+void usb_udc_activation_handler(struct usb_gadget *gadget, bool active)
+{
+   struct usb_udc  *udc = NULL;
+
+   mutex_lock(udc_lock);
+   list_for_each_entry(udc, udc_list, list)
+   if (udc-gadget == gadget)
+   goto found;
+   mutex_unlock(udc_lock);
+
+   return;
+
+found:
+   if (active)
+   udc-deactivations--;
+   else
+   udc-deactivations++;
+   usb_udc_connect_control(udc);
+   mutex_unlock(udc_lock);
+}
+EXPORT_SYMBOL_GPL(usb_udc_activation_handler);
+
+/**
  * usb_udc_vbus_handler - updates the udc core vbus status, and try to
  * connect or disconnect gadget
  * @gadget: The gadget which vbus change occurs
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 2be007a..4d1adea 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -1034,6 +1034,11 @@ extern void usb_udc_vbus_handler(struct usb_gadget 
*gadget, bool status);
 
 /*-*/
 
+/* utility to activate or deactive function */
+extern void usb_udc_activation_handler(struct usb_gadget *gadget, bool active);
+
+/*-*/
+
 /* utility wrapping a simple endpoint selection policy */
 
 extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
-- 
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/2] usb: udc: add usb_udc_vbus_handler

2015-01-12 Thread Peter Chen
This commit updates udc core vbus status, and try to connect
or disconnect gadget.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/gadget/udc/udc-core.c | 42 ++-
 include/linux/usb/gadget.h|  4 
 2 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/udc-core.c 
b/drivers/usb/gadget/udc/udc-core.c
index e31d574..9b72c46 100644
--- a/drivers/usb/gadget/udc/udc-core.c
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -35,6 +35,8 @@
  * @dev - the child device to the actual controller
  * @gadget - the gadget. For use by the class code
  * @list - for use by the udc class driver
+ * @vbus - for udcs who care about vbus status, this value is real vbus status;
+ * for udcs who do not care about vbus status, this value is always true
  *
  * This represents the internal data structure which is used by the UDC-class
  * to hold information about udc driver and gadget together.
@@ -44,6 +46,7 @@ struct usb_udc {
struct usb_gadget   *gadget;
struct device   dev;
struct list_headlist;
+   boolvbus;
 };
 
 static struct class *udc_class;
@@ -155,6 +158,42 @@ EXPORT_SYMBOL_GPL(usb_gadget_set_state);
 
 /* - */
 
+static void usb_udc_connect_control(struct usb_udc *udc)
+{
+   if (udc-vbus)
+   usb_gadget_connect(udc-gadget);
+   else
+   usb_gadget_disconnect(udc-gadget);
+}
+
+/**
+ * usb_udc_vbus_handler - updates the udc core vbus status, and try to
+ * connect or disconnect gadget
+ * @gadget: The gadget which vbus change occurs
+ * @status: The vbus status
+ *
+ * The udc driver calls it when it wants to connect or disconnect gadget
+ * according to vbus status.
+ */
+void usb_udc_vbus_handler(struct usb_gadget *gadget, bool status)
+{
+   struct usb_udc  *udc = NULL;
+
+   mutex_lock(udc_lock);
+   list_for_each_entry(udc, udc_list, list)
+   if (udc-gadget == gadget)
+   goto found;
+   mutex_unlock(udc_lock);
+
+   return;
+
+found:
+   udc-vbus = status;
+   usb_udc_connect_control(udc);
+   mutex_unlock(udc_lock);
+}
+EXPORT_SYMBOL_GPL(usb_udc_vbus_handler);
+
 /**
  * usb_gadget_udc_reset - notifies the udc core that bus reset occurs
  * @gadget: The gadget which bus reset occurs
@@ -287,6 +326,7 @@ int usb_add_gadget_udc_release(struct device *parent, 
struct usb_gadget *gadget,
goto err4;
 
usb_gadget_set_state(gadget, USB_STATE_NOTATTACHED);
+   udc-vbus = true;
 
mutex_unlock(udc_lock);
 
@@ -397,7 +437,7 @@ static int udc_bind_to_driver(struct usb_udc *udc, struct 
usb_gadget_driver *dri
driver-unbind(udc-gadget);
goto err1;
}
-   usb_gadget_connect(udc-gadget);
+   usb_udc_connect_control(udc);
 
kobject_uevent(udc-dev.kobj, KOBJ_CHANGE);
return 0;
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 70ddb39..2be007a 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -1027,6 +1027,10 @@ extern void usb_gadget_udc_reset(struct usb_gadget 
*gadget,
 extern void usb_gadget_giveback_request(struct usb_ep *ep,
struct usb_request *req);
 
+/*-*/
+
+/* utility to update vbus status for udc core, it may be scheduled */
+extern void usb_udc_vbus_handler(struct usb_gadget *gadget, bool status);
 
 /*-*/
 
-- 
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 0/2] usb: udc: Unify dp control

2015-01-12 Thread Peter Chen
Hi Felipe,

This is the follow-up: http://marc.info/?l=linux-usbm=140979297227434w=2.
Sorry for late.

In the first patch, it maintains flag 'vbus' as vbus status, and try to connect
or disconnect gadget according to vbus status.
In the second patch, it maintains count 'deactivations' for connect or 
disconnect
gadget according to function/user behavior.

If you agree with handing dp like above way, I will have two patchset, one for
udc driver for 'vbus' and another for function driver for 'deactivations'.

Peter Chen (2):
  usb: udc: add usb_udc_vbus_handler
  usb: udc: add usb_udc_activation_handler

 drivers/usb/gadget/udc/udc-core.c | 76 ++-
 include/linux/usb/gadget.h|  9 +
 2 files changed, 84 insertions(+), 1 deletion(-)

-- 
1.9.1

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


Re: [PATCH 1/2] Documentation: dt-bindings: Add aliases information for Exynos7 pin controllers

2015-01-12 Thread Linus Walleij
On Wed, Dec 10, 2014 at 9:39 AM, Vivek Gautam gautam.vi...@samsung.com wrote:

 Adding list of aliases for supported Exynos7 pin controller blocks.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Cc: Tomasz Figa tomasz.f...@gmail.com
 Cc: Linus Walleij linus.wall...@linaro.org

Patch applied.

Yours,
Linus Walleij
--
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 V3 2/2] pinctrl: exynos: Add BUS1 pin controller for exynos7

2015-01-12 Thread Linus Walleij
On Wed, Dec 10, 2014 at 9:39 AM, Vivek Gautam gautam.vi...@samsung.com wrote:

 USB and Power regulator on Exynos7 require gpios available
 in BUS1 pin controller block.
 So adding the BUS1 pinctrl support.

 Signed-off-by: Naveen Krishna Ch naveenkrishna...@gmail.com
 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Cc: Tomasz Figa tomasz.f...@gmail.com
 Cc: Linus Walleij linus.wall...@linaro.org
 ---

 Changes since V2:
  - Added documentation on alias for BUS1 pin controller block.

Patch applied with Tomasz ACK.

Yours,
Linus Walleij
--
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 v3 1/4] scsi: add ability to adjust module reference for scsi host

2015-01-12 Thread Hannes Reinecke
On 01/11/2015 02:50 PM, Akinobu Mita wrote:
 While accessing a scsi_device, the use count of the underlying LLDD module
 is incremented.  The module reference is retrieved through .module field of
 struct scsi_host_template.
 
 This mapping between scsi_device and underlying LLDD module works well
 except ufs, unusual usb storage drivers, and sub drivers for esp_scsi.
 These drivers consist with core driver and actual LLDDs, and
 scsi_host_template is defined in the core driver.  So the actual LLDDs can
 be unloaded even if the scsi_device is being accessed.
 
 This adds .module field in struct Scsi_Host and let the module reference
 be retrieved though it instead of struct scsi_host_template.  This allows
 the actual LLDDs adjust module reference.
 
 Signed-off-by: Akinobu Mita akinobu.m...@gmail.com
 Cc: Vinayak Holikatti vinholika...@gmail.com
 Cc: Dolev Raviv dra...@codeaurora.org
 Cc: Sujit Reddy Thumma sthu...@codeaurora.org
 Cc: Subhash Jadavani subha...@codeaurora.org
 Cc: Christoph Hellwig h...@lst.de
 Cc: James E.J. Bottomley jbottom...@parallels.com
 Cc: Matthew Dharm mdharm-...@one-eyed-alien.net
 Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
 Cc: Alan Stern st...@rowland.harvard.edu
 Cc: linux-usb@vger.kernel.org
 Cc: usb-stor...@lists.one-eyed-alien.net
 Cc: linux-s...@vger.kernel.org

Reviewed-by: Hannes Reinecke h...@suse.de

Cheers,

Hannes
-- 
Dr. Hannes ReineckezSeries  Storage
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
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 v3 0/2] usb: serial: silence non-critical unplug read errors

2015-01-12 Thread Johan Hovold
On Sun, Jan 11, 2015 at 05:42:05AM -0800, Jeremiah Mahler wrote:
 If a USB serial device (e.g. /dev/ttyUSB0) with an active program is
 unplugged, a bunch of -ENODEV and -EPROTO errors may be produced in the
 logs.  This patch set quiets these messages without changing the
 original behavior.

Both patches applied, 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


[PATCH 1/3] usb: udc: pxa27x_udc: delete pullup operation at .udc_start and .udc_stop

2015-01-12 Thread Peter Chen
UDC core has already done it before .udc_stop and after .udc_start.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/gadget/udc/pxa27x_udc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c 
b/drivers/usb/gadget/udc/pxa27x_udc.c
index c61a896..6a855fc 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -1809,7 +1809,6 @@ static int pxa27x_udc_start(struct usb_gadget *g,
 
/* first hook up the driver ... */
udc-driver = driver;
-   dplus_pullup(udc, 1);
 
if (!IS_ERR_OR_NULL(udc-transceiver)) {
retval = otg_set_peripheral(udc-transceiver-otg,
@@ -1862,7 +1861,6 @@ static int pxa27x_udc_stop(struct usb_gadget *g)
 
stop_activity(udc, NULL);
udc_disable(udc);
-   dplus_pullup(udc, 0);
 
udc-driver = NULL;
 
-- 
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/3] usb: pxa27x_udc: delete pullup operation at .udc_start and .udc_stop

2015-01-12 Thread Peter Chen
UDC core has already done it before .udc_stop and after .udc_start.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/gadget/udc/pxa25x_udc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c 
b/drivers/usb/gadget/udc/pxa25x_udc.c
index 8550b2d..f6cbe66 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.c
+++ b/drivers/usb/gadget/udc/pxa25x_udc.c
@@ -1272,7 +1272,6 @@ static int pxa25x_udc_start(struct usb_gadget *g,
goto bind_fail;
}
 
-   pullup(dev);
dump_state(dev);
return 0;
 bind_fail:
@@ -1339,7 +1338,6 @@ static int pxa25x_udc_stop(struct usb_gadget*g)
 
local_irq_disable();
dev-pullup = 0;
-   pullup(dev);
stop_activity(dev, NULL);
local_irq_enable();
 
-- 
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/3] usb: udc: mv_udc_core: delete pullup operation at .udc_start

2015-01-12 Thread Peter Chen
UDC core has already done it after .udc_start.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/gadget/udc/mv_udc_core.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/mv_udc_core.c 
b/drivers/usb/gadget/udc/mv_udc_core.c
index 253f3df..d32160d 100644
--- a/drivers/usb/gadget/udc/mv_udc_core.c
+++ b/drivers/usb/gadget/udc/mv_udc_core.c
@@ -1378,9 +1378,6 @@ static int mv_udc_start(struct usb_gadget *gadget,
}
}
 
-   /* pullup is always on */
-   mv_udc_pullup(udc-gadget, 1);
-
/* When boot with cable attached, there will be no vbus irq occurred */
if (udc-qwork)
queue_work(udc-qwork, udc-vbus_work);
-- 
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 v4 4/4] can: kvaser_usb: Retry first bulk transfer on -ETIMEDOUT

2015-01-12 Thread Ahmed S. Darwish
On Sun, Jan 11, 2015 at 09:51:10PM +0100, Marc Kleine-Budde wrote:
 On 01/11/2015 09:45 PM, Ahmed S. Darwish wrote:
  From: Ahmed S. Darwish ahmed.darw...@valeo.com
  
  (This is a draft patch, I'm not sure if this fixes the USB
  bug or only its psymptom. Feedback from the linux-usb folks
  is really appreciated.)
  
  When plugging the Kvaser USB/CAN dongle the first time, everything
  works as expected and all of the transfers from and to the USB
  device succeeds.
  
  Meanwhile, after unplugging the device and plugging it again, the
  first bulk transfer _always_ returns an -ETIMEDOUT. The following
  behaviour was observied:
  
  - Setting higher timeout values for the first bulk transfer never
solved the issue.
  
  - Unloading, then loading, our kvaser_usb module in question
__always__ solved the issue.
  
  - Checking first bulk transfer status, and retry the transfer
again in case of an -ETIMEDOUT also __always__ solved the issue.
This is what the patch below does.
  
  - In the testing done so far, this issue appears only on laptops
but never on PCs (possibly power related?)
  
  Signed-off-by: Ahmed S. Darwish ahmed.darw...@valeo.com
 
 Does this patch apply apply between 3 and 4? If not, please re-arrange
 the series. As this is a bug fix, patches 1, 2 and 4 will go via
 net/master, 3 will go via net-next/master.
 

Since no one complained earlier, I guess this issue only affects
USBCAN devices. That's why I've based it above patch #3: adding
USBCAN hardware support.

Nonetheless, it won't do any harm for the current Leaf-only
driver. So _if_ this is the correct fix, I will update the commit
log, refactor the check into a 'do { } while()' loop, and then
base it above the Leaf-only net/master fixes on patch #1, and #2.

Any feedback on the USB side of things?

Thanks,
Darwish
--
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 v4 4/4] can: kvaser_usb: Retry first bulk transfer on -ETIMEDOUT

2015-01-12 Thread Olivier Sobrie
Hello,

On Mon, Jan 12, 2015 at 05:14:07AM -0500, Ahmed S. Darwish wrote:
 On Sun, Jan 11, 2015 at 09:51:10PM +0100, Marc Kleine-Budde wrote:
  On 01/11/2015 09:45 PM, Ahmed S. Darwish wrote:
   From: Ahmed S. Darwish ahmed.darw...@valeo.com
   
   (This is a draft patch, I'm not sure if this fixes the USB
   bug or only its psymptom. Feedback from the linux-usb folks
   is really appreciated.)
   
   When plugging the Kvaser USB/CAN dongle the first time, everything
   works as expected and all of the transfers from and to the USB
   device succeeds.
   
   Meanwhile, after unplugging the device and plugging it again, the
   first bulk transfer _always_ returns an -ETIMEDOUT. The following
   behaviour was observied:
   
   - Setting higher timeout values for the first bulk transfer never
 solved the issue.
   
   - Unloading, then loading, our kvaser_usb module in question
 __always__ solved the issue.
   
   - Checking first bulk transfer status, and retry the transfer
 again in case of an -ETIMEDOUT also __always__ solved the issue.
 This is what the patch below does.
   
   - In the testing done so far, this issue appears only on laptops
 but never on PCs (possibly power related?)
   
   Signed-off-by: Ahmed S. Darwish ahmed.darw...@valeo.com
  
  Does this patch apply apply between 3 and 4? If not, please re-arrange
  the series. As this is a bug fix, patches 1, 2 and 4 will go via
  net/master, 3 will go via net-next/master.
  
 
 Since no one complained earlier, I guess this issue only affects
 USBCAN devices. That's why I've based it above patch #3: adding
 USBCAN hardware support.
 
 Nonetheless, it won't do any harm for the current Leaf-only
 driver. So _if_ this is the correct fix, I will update the commit
 log, refactor the check into a 'do { } while()' loop, and then
 base it above the Leaf-only net/master fixes on patch #1, and #2.
 
 Any feedback on the USB side of things?

Can you take a wireshark capture showing the problem?
It can maybe help people to figure out what happens.

What kind of usbcan device do you use?
Which firmware revision is loaded on the device?

Kr,

-- 
Olivier
--
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 v4 4/4] can: kvaser_usb: Retry first bulk transfer on -ETIMEDOUT

2015-01-12 Thread Ahmed S. Darwish
On Mon, Jan 12, 2015 at 02:33:30PM +0100, Olivier Sobrie wrote:
 Hello,
 
 On Mon, Jan 12, 2015 at 05:14:07AM -0500, Ahmed S. Darwish wrote:
  On Sun, Jan 11, 2015 at 09:51:10PM +0100, Marc Kleine-Budde wrote:
   On 01/11/2015 09:45 PM, Ahmed S. Darwish wrote:
From: Ahmed S. Darwish ahmed.darw...@valeo.com

(This is a draft patch, I'm not sure if this fixes the USB
bug or only its psymptom. Feedback from the linux-usb folks
is really appreciated.)

When plugging the Kvaser USB/CAN dongle the first time, everything
works as expected and all of the transfers from and to the USB
device succeeds.

Meanwhile, after unplugging the device and plugging it again, the
first bulk transfer _always_ returns an -ETIMEDOUT. The following
behaviour was observied:

- Setting higher timeout values for the first bulk transfer never
  solved the issue.

- Unloading, then loading, our kvaser_usb module in question
  __always__ solved the issue.

- Checking first bulk transfer status, and retry the transfer
  again in case of an -ETIMEDOUT also __always__ solved the issue.
  This is what the patch below does.

- In the testing done so far, this issue appears only on laptops
  but never on PCs (possibly power related?)

Signed-off-by: Ahmed S. Darwish ahmed.darw...@valeo.com
   
   Does this patch apply apply between 3 and 4? If not, please re-arrange
   the series. As this is a bug fix, patches 1, 2 and 4 will go via
   net/master, 3 will go via net-next/master.
   
  
  Since no one complained earlier, I guess this issue only affects
  USBCAN devices. That's why I've based it above patch #3: adding
  USBCAN hardware support.
  
  Nonetheless, it won't do any harm for the current Leaf-only
  driver. So _if_ this is the correct fix, I will update the commit
  log, refactor the check into a 'do { } while()' loop, and then
  base it above the Leaf-only net/master fixes on patch #1, and #2.
  
  Any feedback on the USB side of things?
 
 Can you take a wireshark capture showing the problem?
 It can maybe help people to figure out what happens.
 

Yeah, I'm planning on doing something similar.

 What kind of usbcan device do you use?

Kvaser USBcan II HS/LS

 Which firmware revision is loaded on the device?
 

The device reports firmware version 2.9.410.

Interesting. The changelog of their latest firmware states
that it fixed USB configuration issue during USB attach.
That might be the problem.

I have two devices here. I'll update the firmware only for
one of them and see what happens.

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


[PATCH v4 1/5] usb: atmel_usba_udc: Rework at91sam9rl errata handling

2015-01-12 Thread Boris Brezillon
at91sam9rl SoC has an erratum forcing us to toggle the BIAS on USB
suspend/resume events.

This specific handling was only activated when CONFIG_ARCH_AT91SAM9RL
was set, but commit bcf8c7e7703b (ARM: at91: remove at91sam9rl legacy
board support) removed this option.

Rework the toggle_bias implementation to attach it to the at91sam9rl-udc
compatible string.

Add new compatible strings to avoid executing at91sam9rl erratum handling
on other SoCs.

Reported-by: Paul Bolle pebo...@tiscali.nl
Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com
Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com
Acked-by: Nicolas Ferre nicolas.fe...@atmel.com
---

Changes since v3:
- rework commit message

 .../devicetree/bindings/usb/atmel-usb.txt  |  5 +-
 drivers/usb/gadget/udc/atmel_usba_udc.c| 78 --
 drivers/usb/gadget/udc/atmel_usba_udc.h|  5 ++
 3 files changed, 52 insertions(+), 36 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/atmel-usb.txt 
b/Documentation/devicetree/bindings/usb/atmel-usb.txt
index bcc..38fee0f 100644
--- a/Documentation/devicetree/bindings/usb/atmel-usb.txt
+++ b/Documentation/devicetree/bindings/usb/atmel-usb.txt
@@ -51,7 +51,10 @@ usb1: gadget@fffa4000 {
 Atmel High-Speed USB device controller
 
 Required properties:
- - compatible: Should be atmel,at91sam9rl-udc
+ - compatible: Should be one of the following
+  at91sam9rl-udc
+  at91sam9g45-udc
+  sama5d3-udc
  - reg: Address and length of the register set for the device
  - interrupts: Should contain usba interrupt
  - ep childnode: To specify the number of endpoints and their properties.
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index ce88237..36fd34b 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 #include linux/clk.h
+#include linux/clk/at91_pmc.h
 #include linux/module.h
 #include linux/init.h
 #include linux/interrupt.h
@@ -324,28 +325,12 @@ static int vbus_is_present(struct usba_udc *udc)
return 1;
 }
 
-#if defined(CONFIG_ARCH_AT91SAM9RL)
-
-#include linux/clk/at91_pmc.h
-
-static void toggle_bias(int is_on)
-{
-   unsigned int uckr = at91_pmc_read(AT91_CKGR_UCKR);
-
-   if (is_on)
-   at91_pmc_write(AT91_CKGR_UCKR, uckr | AT91_PMC_BIASEN);
-   else
-   at91_pmc_write(AT91_CKGR_UCKR, uckr  ~(AT91_PMC_BIASEN));
-}
-
-#else
-
-static void toggle_bias(int is_on)
+static void toggle_bias(struct usba_udc *udc, int is_on)
 {
+   if (udc-errata  udc-errata-toggle_bias)
+   udc-errata-toggle_bias(udc, is_on);
 }
 
-#endif /* CONFIG_ARCH_AT91SAM9RL */
-
 static void next_fifo_transaction(struct usba_ep *ep, struct usba_request *req)
 {
unsigned int transaction_len;
@@ -1620,7 +1605,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
DBG(DBG_INT, irq, status=%#08x\n, status);
 
if (status  USBA_DET_SUSPEND) {
-   toggle_bias(0);
+   toggle_bias(udc, 0);
usba_writel(udc, INT_CLR, USBA_DET_SUSPEND);
DBG(DBG_BUS, Suspend detected\n);
if (udc-gadget.speed != USB_SPEED_UNKNOWN
@@ -1632,7 +1617,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
}
 
if (status  USBA_WAKE_UP) {
-   toggle_bias(1);
+   toggle_bias(udc, 1);
usba_writel(udc, INT_CLR, USBA_WAKE_UP);
DBG(DBG_BUS, Wake Up CPU detected\n);
}
@@ -1736,13 +1721,13 @@ static irqreturn_t usba_vbus_irq(int irq, void *devid)
vbus = vbus_is_present(udc);
if (vbus != udc-vbus_prev) {
if (vbus) {
-   toggle_bias(1);
+   toggle_bias(udc, 1);
usba_writel(udc, CTRL, USBA_ENABLE_MASK);
usba_writel(udc, INT_ENB, USBA_END_OF_RESET);
} else {
udc-gadget.speed = USB_SPEED_UNKNOWN;
reset_all_endpoints(udc);
-   toggle_bias(0);
+   toggle_bias(udc, 0);
usba_writel(udc, CTRL, USBA_DISABLE_MASK);
if (udc-driver-disconnect) {
spin_unlock(udc-lock);
@@ -1788,7 +1773,7 @@ static int atmel_usba_start(struct usb_gadget *gadget,
/* If Vbus is present, enable the controller and wait for reset */
spin_lock_irqsave(udc-lock, flags);
if (vbus_is_present(udc)  udc-vbus_prev == 0) {
-   toggle_bias(1);
+   toggle_bias(udc, 1);
usba_writel(udc, CTRL, USBA_ENABLE_MASK);
usba_writel(udc, INT_ENB, USBA_END_OF_RESET);
}
@@ -1811,7 +1796,7 @@ static int atmel_usba_stop(struct usb_gadget *gadget)
   

[PATCH resend v3] USB: host: Introduce flag to enable use of 64-bit dma_mask for ehci-platform

2015-01-12 Thread Andreas Herrmann

ehci-octeon driver used a 64-bit dma_mask. With removal of ehci-octeon
and usage of ehci-platform ehci dma_mask is now limited to 32 bits
(coerced in ehci_platform_probe).

Provide a flag in ehci platform data to allow use of 64 bits for
dma_mask.

Cc: David Daney david.da...@cavium.com
Cc: Alex Smith alex.sm...@imgtec.com
Signed-off-by: Andreas Herrmann andreas.herrm...@caviumnetworks.com
Tested-by: Aaro Koskinen aaro.koski...@iki.fi
Acked-by: Alan Stern st...@rowland.harvard.edu
---
 arch/mips/cavium-octeon/octeon-platform.c |4 +---
 drivers/usb/host/ehci-platform.c  |3 ++-
 include/linux/usb/ehci_pdriver.h  |1 +
 3 files changed, 4 insertions(+), 4 deletions(-)


Patch rebased on usb-testing as of v3.19-rc2-21-g1d97869.


Thanks,

Andreas


diff --git a/arch/mips/cavium-octeon/octeon-platform.c 
b/arch/mips/cavium-octeon/octeon-platform.c
index eea60b6..12410a2 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -310,6 +310,7 @@ static struct usb_ehci_pdata octeon_ehci_pdata = {
 #ifdef __BIG_ENDIAN
.big_endian_mmio= 1,
 #endif
+   .dma_mask_64= 1,
.power_on   = octeon_ehci_power_on,
.power_off  = octeon_ehci_power_off,
 };
@@ -331,8 +332,6 @@ static void __init octeon_ehci_hw_start(struct device *dev)
octeon2_usb_clocks_stop();
 }
 
-static u64 octeon_ehci_dma_mask = DMA_BIT_MASK(64);
-
 static int __init octeon_ehci_device_init(void)
 {
struct platform_device *pd;
@@ -347,7 +346,6 @@ static int __init octeon_ehci_device_init(void)
if (!pd)
return 0;
 
-   pd-dev.dma_mask = octeon_ehci_dma_mask;
pd-dev.platform_data = octeon_ehci_pdata;
octeon_ehci_hw_start(pd-dev);
 
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index 28aae64..63f2622 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -155,7 +155,8 @@ static int ehci_platform_probe(struct platform_device *dev)
if (!pdata)
pdata = ehci_platform_defaults;
 
-   err = dma_coerce_mask_and_coherent(dev-dev, DMA_BIT_MASK(32));
+   err = dma_coerce_mask_and_coherent(dev-dev,
+   pdata-dma_mask_64 ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32));
if (err)
return err;
 
diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h
index 6287b39..db0431b 100644
--- a/include/linux/usb/ehci_pdriver.h
+++ b/include/linux/usb/ehci_pdriver.h
@@ -48,6 +48,7 @@ struct usb_ehci_pdata {
unsignedbig_endian_mmio:1;
unsignedno_io_watchdog:1;
unsignedreset_on_resume:1;
+   unsigneddma_mask_64:1;
 
/* Turn on all power and clocks */
int (*power_on)(struct platform_device *pdev);
-- 
1.7.9.5

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


Re: [PATCH v3 00/30] usb: updates for dwc2 gadget driver

2015-01-12 Thread Robert Baldyga
On 01/09/2015 01:38 PM, Mian Yousaf Kaukab wrote:
 Hi,
 This patchset consists of various bug fixes and feature enhancements for the
 dwc2 gadget driver. All the patches are verified on dwc2 v3.0a with dedicated
 fifos. Main focus of testing was with dma enabled. Although basic testing
 without dma was also done.
 
 It is based on testing/next branch in Felipe's git and
 
 Tested-by: Dinh Nguyen dingu...@opensource.altera.com
 


I still see problem described here [1] but it seems to be unrelated to
this patch series. Tested with USB functions present in mainline kernel
it works well.

Tested-by: Robert Baldyga r.bald...@samsung.com

[1] https://lkml.org/lkml/2014/12/22/185

Thanks,
Robert Baldyga

 
 History:
 v3:
  - Fixed comment from Sergei Shtylyov
  - Updated usb: dwc2: gadget: don't process XferCompl on setup packet to
apply the check on endpoint 0 only.
  - Fixed regression in usb: dwc2: gadget: manage ep0 state in software for
dwc2 ip v2.93a, found by Dinh Nguyen.
 
 v2:
  - Rebased to Felipe's testing/next with https://lkml.org/lkml/2014/12/16/135
applied on top.
  - Fixed comments from  Robert Baldyga
  - Some cosmetic changes
  - Replaced usb: dwc2: gadget: process setup packet on transfer complete
with
usb: dwc2: gadget: don't process XferCompl on setup packet
  - Updated usb: dwc2: gadget: provide gadget handle to the phy
so that otg_set_peripheral is called in both udc_start and udc_stop.
 
 v1:
  - Addressed comments from Sergei Shtylyov
 
 Gregory Herrero (13):
   usb: dwc2: gadget: register gadget handle to the phy
   usb: dwc2: gadget: write correct value in ahbcfg register
   usb: dwc2: gadget: don't erase gahbcfg register when enabling dma
   usb: dwc2: gadget: add device tree property to enable dma
   Documentation: dt-bindings: add dt binding info for dwc2 g-use-dma
   usb: dwc2: gadget: configure fifos from device tree
   Documentation: dt-bindings: add dt binding info for dwc2 fifo resizing
   usb: dwc2: gadget: don't block after fifo flush timeout
   usb: dwc2: gadget: add vbus_session support
   usb: dwc2: gadget: reset fifo_map when initializing fifos
   usb: dwc2: gadget: fix pullup handling
   usb: dwc2: gadget: add vbus_draw support
   usb: dwc2: gadget: force gadget initialization in dev mode
 
 Mian Yousaf Kaukab (17):
   usb: dwc2: gadget: mask fifo empty irq with dma
   usb: dwc2: gadget: don't process XferCompl on setup packet
   usb: dwc2: gadget: don't embed ep0 buffers
   usb: dwc2: gadget: fix error path in dwc2_gadget_init
   usb: dwc2: gadget: add bi-directional endpoint support
   usb: dwc2: gadget: check interrupts for all endpoints
   usb: dwc2: gadget: remove unused members from hsotg_req
   usb: dwc2: gadget: fix debug loop limits
   usb: dwc2: gadget: consider all tx fifos
   usb: dwc2: gadget: kill requests after disabling ep
   usb: dwc2: gadget: manage ep0 state in software
   usb: dwc2: gadget: fix zero length packet transfers
   usb: dwc2: gadget: dont warn if endpoint is not enabled
   usb: dwc2: gadget: rename sent_zlp to send_zlp
   usb: dwc2: gadget: pick smallest acceptable fifo
   usb: dwc2: gadget: fix fifo allocation leak
   usb: dwc2: gadget: report disconnection after reset
 
  Documentation/devicetree/bindings/usb/dwc2.txt |   4 +
  drivers/usb/dwc2/core.h|  46 +-
  drivers/usb/dwc2/gadget.c  | 792 
 -
  drivers/usb/dwc2/hw.h  |   1 +
  4 files changed, 556 insertions(+), 287 deletions(-)
 

--
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/5] usb: atmel_usba_udc: Rework at91sam9rl errata handling

2015-01-12 Thread Boris Brezillon
at91sam9rl SoC has an erratum forcing us to toggle the BIAS on USB
suspend/resume events.

This specific handling is only activated when CONFIG_ARCH_AT91SAM9RL is
set and this option is only set when building a non-DT kernel, which is
problematic since non-DT support for at91sam9rl SoC has been removed.

Rework the toggle_bias implementation to attach it to the at91sam9rl-udc
compatible string.

Add new compatible strings to avoid executing at91sam9rl erratum handling
on other SoCs.

Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com
Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com
---
 .../devicetree/bindings/usb/atmel-usb.txt  |  5 +-
 drivers/usb/gadget/udc/atmel_usba_udc.c| 78 --
 drivers/usb/gadget/udc/atmel_usba_udc.h|  5 ++
 3 files changed, 52 insertions(+), 36 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/atmel-usb.txt 
b/Documentation/devicetree/bindings/usb/atmel-usb.txt
index bcc..38fee0f 100644
--- a/Documentation/devicetree/bindings/usb/atmel-usb.txt
+++ b/Documentation/devicetree/bindings/usb/atmel-usb.txt
@@ -51,7 +51,10 @@ usb1: gadget@fffa4000 {
 Atmel High-Speed USB device controller
 
 Required properties:
- - compatible: Should be atmel,at91sam9rl-udc
+ - compatible: Should be one of the following
+  at91sam9rl-udc
+  at91sam9g45-udc
+  sama5d3-udc
  - reg: Address and length of the register set for the device
  - interrupts: Should contain usba interrupt
  - ep childnode: To specify the number of endpoints and their properties.
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index ce88237..36fd34b 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 #include linux/clk.h
+#include linux/clk/at91_pmc.h
 #include linux/module.h
 #include linux/init.h
 #include linux/interrupt.h
@@ -324,28 +325,12 @@ static int vbus_is_present(struct usba_udc *udc)
return 1;
 }
 
-#if defined(CONFIG_ARCH_AT91SAM9RL)
-
-#include linux/clk/at91_pmc.h
-
-static void toggle_bias(int is_on)
-{
-   unsigned int uckr = at91_pmc_read(AT91_CKGR_UCKR);
-
-   if (is_on)
-   at91_pmc_write(AT91_CKGR_UCKR, uckr | AT91_PMC_BIASEN);
-   else
-   at91_pmc_write(AT91_CKGR_UCKR, uckr  ~(AT91_PMC_BIASEN));
-}
-
-#else
-
-static void toggle_bias(int is_on)
+static void toggle_bias(struct usba_udc *udc, int is_on)
 {
+   if (udc-errata  udc-errata-toggle_bias)
+   udc-errata-toggle_bias(udc, is_on);
 }
 
-#endif /* CONFIG_ARCH_AT91SAM9RL */
-
 static void next_fifo_transaction(struct usba_ep *ep, struct usba_request *req)
 {
unsigned int transaction_len;
@@ -1620,7 +1605,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
DBG(DBG_INT, irq, status=%#08x\n, status);
 
if (status  USBA_DET_SUSPEND) {
-   toggle_bias(0);
+   toggle_bias(udc, 0);
usba_writel(udc, INT_CLR, USBA_DET_SUSPEND);
DBG(DBG_BUS, Suspend detected\n);
if (udc-gadget.speed != USB_SPEED_UNKNOWN
@@ -1632,7 +1617,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
}
 
if (status  USBA_WAKE_UP) {
-   toggle_bias(1);
+   toggle_bias(udc, 1);
usba_writel(udc, INT_CLR, USBA_WAKE_UP);
DBG(DBG_BUS, Wake Up CPU detected\n);
}
@@ -1736,13 +1721,13 @@ static irqreturn_t usba_vbus_irq(int irq, void *devid)
vbus = vbus_is_present(udc);
if (vbus != udc-vbus_prev) {
if (vbus) {
-   toggle_bias(1);
+   toggle_bias(udc, 1);
usba_writel(udc, CTRL, USBA_ENABLE_MASK);
usba_writel(udc, INT_ENB, USBA_END_OF_RESET);
} else {
udc-gadget.speed = USB_SPEED_UNKNOWN;
reset_all_endpoints(udc);
-   toggle_bias(0);
+   toggle_bias(udc, 0);
usba_writel(udc, CTRL, USBA_DISABLE_MASK);
if (udc-driver-disconnect) {
spin_unlock(udc-lock);
@@ -1788,7 +1773,7 @@ static int atmel_usba_start(struct usb_gadget *gadget,
/* If Vbus is present, enable the controller and wait for reset */
spin_lock_irqsave(udc-lock, flags);
if (vbus_is_present(udc)  udc-vbus_prev == 0) {
-   toggle_bias(1);
+   toggle_bias(udc, 1);
usba_writel(udc, CTRL, USBA_ENABLE_MASK);
usba_writel(udc, INT_ENB, USBA_END_OF_RESET);
}
@@ -1811,7 +1796,7 @@ static int atmel_usba_stop(struct usb_gadget *gadget)
spin_unlock_irqrestore(udc-lock, flags);
 
/* This will also disable the DP pullup 

Re: [PATCH v4 4/4] can: kvaser_usb: Retry first bulk transfer on -ETIMEDOUT

2015-01-12 Thread Marc Kleine-Budde
On 01/12/2015 11:14 AM, Ahmed S. Darwish wrote:
 On Sun, Jan 11, 2015 at 09:51:10PM +0100, Marc Kleine-Budde wrote:
 On 01/11/2015 09:45 PM, Ahmed S. Darwish wrote:
 From: Ahmed S. Darwish ahmed.darw...@valeo.com

 (This is a draft patch, I'm not sure if this fixes the USB
 bug or only its psymptom. Feedback from the linux-usb folks
 is really appreciated.)

 When plugging the Kvaser USB/CAN dongle the first time, everything
 works as expected and all of the transfers from and to the USB
 device succeeds.

 Meanwhile, after unplugging the device and plugging it again, the
 first bulk transfer _always_ returns an -ETIMEDOUT. The following
 behaviour was observied:

 - Setting higher timeout values for the first bulk transfer never
   solved the issue.

 - Unloading, then loading, our kvaser_usb module in question
   __always__ solved the issue.

 - Checking first bulk transfer status, and retry the transfer
   again in case of an -ETIMEDOUT also __always__ solved the issue.
   This is what the patch below does.

 - In the testing done so far, this issue appears only on laptops
   but never on PCs (possibly power related?)

 Signed-off-by: Ahmed S. Darwish ahmed.darw...@valeo.com

 Does this patch apply apply between 3 and 4? If not, please re-arrange
 the series. As this is a bug fix, patches 1, 2 and 4 will go via
 net/master, 3 will go via net-next/master.
 
 Since no one complained earlier, I guess this issue only affects
 USBCAN devices. That's why I've based it above patch #3: adding
 USBCAN hardware support.
 
 Nonetheless, it won't do any harm for the current Leaf-only
 driver. So _if_ this is the correct fix, I will update the commit
 log, refactor the check into a 'do { } while()' loop, and then
 base it above the Leaf-only net/master fixes on patch #1, and #2.
 
 Any feedback on the USB side of things?

Maybe you have to change the subject of this patch to be more visible on
the USB list and/or add the right USB people on Cc.

Marc

-- 
Pengutronix e.K.  | Marc Kleine-Budde   |
Industrial Linux Solutions| Phone: +49-231-2826-924 |
Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



signature.asc
Description: OpenPGP digital signature


Re: [PATCH 0/3] usb: udc: cleanup pullup operation

2015-01-12 Thread Alexander Shishkin
Peter Chen peter.c...@freescale.com writes:

 This patch set cleans up udc drivers which define .pullup API, but
 still call pullup operation at .udc_start or .udc_stop. In fact,
 the related pullup operations are covered by udc core.

Oh, this driver is still around? Are we going to obsolete it with
chipidea someday?

Regards,
--
Alex
--
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 v3 00/30] usb: updates for dwc2 gadget driver

2015-01-12 Thread Kaukab, Yousaf
Hi Robert,

 -Original Message-
 From: Robert Baldyga [mailto:r.bald...@samsung.com]
 Sent: Monday, January 12, 2015 11:00 AM
 To: Kaukab, Yousaf; linux-usb@vger.kernel.org; ba...@ti.com
 Cc: Herrero, Gregory; pa...@synopsys.com;
 sergei.shtyl...@cogentembedded.com; dingu...@opensource.altera.com
 Subject: Re: [PATCH v3 00/30] usb: updates for dwc2 gadget driver
 
 On 01/09/2015 01:38 PM, Mian Yousaf Kaukab wrote:
  Hi,
  This patchset consists of various bug fixes and feature enhancements
  for the
  dwc2 gadget driver. All the patches are verified on dwc2 v3.0a with
  dedicated fifos. Main focus of testing was with dma enabled. Although
  basic testing without dma was also done.
 
  It is based on testing/next branch in Felipe's git and
 
  Tested-by: Dinh Nguyen dingu...@opensource.altera.com
 
 
 
 I still see problem described here [1] but it seems to be unrelated to this 
 patch
 series. Tested with USB functions present in mainline kernel it works well.
 
 Tested-by: Robert Baldyga r.bald...@samsung.com

Thank you for testing this patchset. Can you please provide the version of dwc2 
ip on which you tested?
 
 [1] https://lkml.org/lkml/2014/12/22/185
 
 Thanks,
 Robert Baldyga

BR,
Yousaf
--
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/kaweth: use GFP_ATOMIC under spin_lock in usb_start_wait_urb()

2015-01-12 Thread Oliver Neukum
On Sat, 2015-01-10 at 02:16 +0300, Alexey Khoroshilov wrote:
 Commit e4c7f259c5be (USB: kaweth.c: use GFP_ATOMIC under spin_lock)
 makes sure that kaweth_internal_control_msg() allocates memory with
 GFP_ATOMIC,
 but kaweth_internal_control_msg() also calls usb_start_wait_urb()
 that still allocates memory with GFP_NOIO.
 
 The patch fixes usb_start_wait_urb() as well.
 
 Found by Linux Driver Verification project (linuxtesting.org).
 
 Signed-off-by: Alexey Khoroshilov khoroshi...@ispras.ru

Acked-by: Oliver Neukum oli...@neukum.org

--
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 4/5] usb: atmel_usba_udc: Mask status with enabled irqs

2015-01-12 Thread Boris Brezillon
Avoid interpreting useless status flags when we're not waiting for such
events by masking the status variable with the interrupt enabled register
value.

Reported-by: Patrice VILCHEZ patrice.vilc...@atmel.com
Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com
Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 55c8dde..bc3a532 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1612,12 +1612,14 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
 
spin_lock(udc-lock);
 
-   status = usba_readl(udc, INT_STA);
+   status = usba_readl(udc, INT_STA)  usba_readl(udc, INT_ENB);
DBG(DBG_INT, irq, status=%#08x\n, status);
 
if (status  USBA_DET_SUSPEND) {
toggle_bias(udc, 0);
usba_writel(udc, INT_CLR, USBA_DET_SUSPEND);
+   usba_writel(udc, INT_ENB,
+   usba_readl(udc, INT_ENB) | USBA_WAKE_UP);
udc-bias_pulse_needed = true;
DBG(DBG_BUS, Suspend detected\n);
if (udc-gadget.speed != USB_SPEED_UNKNOWN
@@ -1631,6 +1633,8 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
if (status  USBA_WAKE_UP) {
toggle_bias(udc, 1);
usba_writel(udc, INT_CLR, USBA_WAKE_UP);
+   usba_writel(udc, INT_ENB,
+   usba_readl(udc, INT_ENB)  ~USBA_WAKE_UP);
DBG(DBG_BUS, Wake Up CPU detected\n);
}
 
-- 
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 v3 0/5] usb: atmel_usba_udc: Rework errata handling

2015-01-12 Thread Boris Brezillon
Hello,

Here is a set of patches porting existing at91sam9rl erratum handling to
DT and adding new code to handle at91sam9g45/9x5 erratum.
It also adds several compatible strings to differentiate those errata.

These patches should be backported to 3.17 and 3.18 stable releases but
they do not apply cleanly on those stable branches.
I'll send a backport of this series once it is merged in mainline.

Regards,

Boris

Changes since v2:
- remove UTF8 character in commit message of patch 2

Changes since v1:
- cache INT_ENB value to speedup INT_ENB read operations

Boris Brezillon (5):
  usb: atmel_usba_udc: Rework at91sam9rl errata handling
  usb: atmel_usba_udc: Add at91sam9g45 and at91sam9x5 errata handling
  ARM: at91/dt: update udc compatible strings
  usb: atmel_usba_udc: Mask status with enabled irqs
  usb: gadget: atmel_usba: Cache INT_ENB register value

 .../devicetree/bindings/usb/atmel-usb.txt  |   5 +-
 arch/arm/boot/dts/at91sam9g45.dtsi |   2 +-
 arch/arm/boot/dts/at91sam9x5.dtsi  |   2 +-
 arch/arm/boot/dts/sama5d3.dtsi |   2 +-
 arch/arm/boot/dts/sama5d4.dtsi |   2 +-
 drivers/usb/gadget/udc/atmel_usba_udc.c| 146 +
 drivers/usb/gadget/udc/atmel_usba_udc.h|   9 ++
 7 files changed, 111 insertions(+), 57 deletions(-)

-- 
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 v3 2/5] usb: atmel_usba_udc: Add at91sam9g45 and at91sam9x5 errata handling

2015-01-12 Thread Boris Brezillon
at91sam9g45 and at91sam9x5 SoCs have an hardware bug forcing us to
generate a pulse on the BIAS signal on USB end of reset and
USB end of resume events.

Reported-by: Patrice VILCHEZ patrice.vilc...@atmel.com
Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com
Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 28 +++-
 drivers/usb/gadget/udc/atmel_usba_udc.h |  2 ++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 36fd34b..55c8dde 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -331,6 +331,17 @@ static void toggle_bias(struct usba_udc *udc, int is_on)
udc-errata-toggle_bias(udc, is_on);
 }
 
+static void generate_bias_pulse(struct usba_udc *udc)
+{
+   if (!udc-bias_pulse_needed)
+   return;
+
+   if (udc-errata  udc-errata-pulse_bias)
+   udc-errata-pulse_bias(udc);
+
+   udc-bias_pulse_needed = false;
+}
+
 static void next_fifo_transaction(struct usba_ep *ep, struct usba_request *req)
 {
unsigned int transaction_len;
@@ -1607,6 +1618,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
if (status  USBA_DET_SUSPEND) {
toggle_bias(udc, 0);
usba_writel(udc, INT_CLR, USBA_DET_SUSPEND);
+   udc-bias_pulse_needed = true;
DBG(DBG_BUS, Suspend detected\n);
if (udc-gadget.speed != USB_SPEED_UNKNOWN
 udc-driver  udc-driver-suspend) {
@@ -1624,6 +1636,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
 
if (status  USBA_END_OF_RESUME) {
usba_writel(udc, INT_CLR, USBA_END_OF_RESUME);
+   generate_bias_pulse(udc);
DBG(DBG_BUS, Resume detected\n);
if (udc-gadget.speed != USB_SPEED_UNKNOWN
 udc-driver  udc-driver-resume) {
@@ -1659,6 +1672,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
struct usba_ep *ep0;
 
usba_writel(udc, INT_CLR, USBA_END_OF_RESET);
+   generate_bias_pulse(udc);
reset_all_endpoints(udc);
 
if (udc-gadget.speed != USB_SPEED_UNKNOWN  udc-driver) {
@@ -1818,13 +1832,25 @@ static void at91sam9rl_toggle_bias(struct usba_udc 
*udc, int is_on)
at91_pmc_write(AT91_CKGR_UCKR, uckr  ~(AT91_PMC_BIASEN));
 }
 
+static void at91sam9g45_pulse_bias(struct usba_udc *udc)
+{
+   unsigned int uckr = at91_pmc_read(AT91_CKGR_UCKR);
+
+   at91_pmc_write(AT91_CKGR_UCKR, uckr  ~(AT91_PMC_BIASEN));
+   at91_pmc_write(AT91_CKGR_UCKR, uckr | AT91_PMC_BIASEN);
+}
+
 static const struct usba_udc_errata at91sam9rl_errata = {
.toggle_bias = at91sam9rl_toggle_bias,
 };
 
+static const struct usba_udc_errata at91sam9g45_errata = {
+   .pulse_bias = at91sam9g45_pulse_bias,
+};
+
 static const struct of_device_id atmel_udc_dt_ids[] = {
{ .compatible = atmel,at91sam9rl-udc, .data = at91sam9rl_errata },
-   { .compatible = atmel,at91sam9g45-udc },
+   { .compatible = atmel,at91sam9g45-udc, .data = at91sam9g45_errata },
{ .compatible = atmel,sama5d3-udc },
{ /* sentinel */ }
 };
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h 
b/drivers/usb/gadget/udc/atmel_usba_udc.h
index 456899e..72b3537 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.h
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.h
@@ -306,6 +306,7 @@ struct usba_request {
 
 struct usba_udc_errata {
void (*toggle_bias)(struct usba_udc *udc, int is_on);
+   void (*pulse_bias)(struct usba_udc *udc);
 };
 
 struct usba_udc {
@@ -326,6 +327,7 @@ struct usba_udc {
struct clk *pclk;
struct clk *hclk;
struct usba_ep *usba_ep;
+   bool bias_pulse_needed;
 
u16 devstatus;
 
-- 
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 v3 3/5] ARM: at91/dt: update udc compatible strings

2015-01-12 Thread Boris Brezillon
at91sam9g45, at91sam9x5 and sama5 SoCs should not use
atmel,at91sam9rl-udc for their USB device compatible property since
this compatible is attached to a specific hardware bug fix.

Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com
Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com
---
 arch/arm/boot/dts/at91sam9g45.dtsi | 2 +-
 arch/arm/boot/dts/at91sam9x5.dtsi  | 2 +-
 arch/arm/boot/dts/sama5d3.dtsi | 2 +-
 arch/arm/boot/dts/sama5d4.dtsi | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi 
b/arch/arm/boot/dts/at91sam9g45.dtsi
index 2a8da8a..acd90eb 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -1144,7 +1144,7 @@
usb2: gadget@fff78000 {
#address-cells = 1;
#size-cells = 0;
-   compatible = atmel,at91sam9rl-udc;
+   compatible = atmel,at91sam9g45-udc;
reg = 0x0060 0x8
   0xfff78000 0x400;
interrupts = 27 IRQ_TYPE_LEVEL_HIGH 0;
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi 
b/arch/arm/boot/dts/at91sam9x5.dtsi
index bbb3ba6..d213147 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -1057,7 +1057,7 @@
usb2: gadget@f803c000 {
#address-cells = 1;
#size-cells = 0;
-   compatible = atmel,at91sam9rl-udc;
+   compatible = atmel,at91sam9g45-udc;
reg = 0x0050 0x8
   0xf803c000 0x400;
interrupts = 23 IRQ_TYPE_LEVEL_HIGH 0;
diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index 5f4144d..2b407a4 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -1264,7 +1264,7 @@
usb0: gadget@0050 {
#address-cells = 1;
#size-cells = 0;
-   compatible = atmel,at91sam9rl-udc;
+   compatible = atmel,sama5d3-udc;
reg = 0x0050 0x10
   0xf803 0x4000;
interrupts = 33 IRQ_TYPE_LEVEL_HIGH 2;
diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
index 1b0f30c..52dce24 100644
--- a/arch/arm/boot/dts/sama5d4.dtsi
+++ b/arch/arm/boot/dts/sama5d4.dtsi
@@ -112,7 +112,7 @@
usb0: gadget@0040 {
#address-cells = 1;
#size-cells = 0;
-   compatible = atmel,at91sam9rl-udc;
+   compatible = atmel,sama5d3-udc;
reg = 0x0040 0x10
   0xfc02c000 0x4000;
interrupts = 47 IRQ_TYPE_LEVEL_HIGH 2;
-- 
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 1/2] usb: udc: add usb_udc_vbus_handler

2015-01-12 Thread Alexander Shishkin
Peter Chen peter.c...@freescale.com writes:

 + mutex_lock(udc_lock);
 + list_for_each_entry(udc, udc_list, list)
 + if (udc-gadget == gadget)
 + goto found;
 + mutex_unlock(udc_lock);

Not entirely specific to this patchset, but this search pattern is
copied verbatim in udc-core.c like 5 times. Maybe it makes sense to make
it a separate function?

Regards,
--
Alex
--
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] uas: Add no-report-opcodes quirk for Simpletech devices with id 4971:8017

2015-01-12 Thread Hans de Goede
Like some other uas devices these devices hang when a report-opcodes scsi
command is send to them.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1124119
Cc: sta...@vger.kernel.org # 3.16
Signed-off-by: Hans de Goede hdego...@redhat.com
---
 drivers/usb/storage/unusual_uas.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/storage/unusual_uas.h 
b/drivers/usb/storage/unusual_uas.h
index 9ec4561..da3d98c 100644
--- a/drivers/usb/storage/unusual_uas.h
+++ b/drivers/usb/storage/unusual_uas.h
@@ -130,3 +130,10 @@ UNUSUAL_DEV(0x4971, 0x1012, 0x, 0x,
External HDD,
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_IGNORE_UAS),
+
+/* Reported-by: Richard Henderson r...@redhat.com */
+UNUSUAL_DEV(0x4971, 0x8017, 0x, 0x,
+   SimpleTech,
+   External HDD,
+   USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+   US_FL_NO_REPORT_OPCODES),
-- 
2.1.0

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


Re: [PATCH v3 1/5] usb: atmel_usba_udc: Rework at91sam9rl errata handling

2015-01-12 Thread Boris Brezillon
Hi Paul,

On Mon, 12 Jan 2015 13:15:58 +0100
Paul Bolle pebo...@tiscali.nl wrote:

 On Mon, 2015-01-12 at 11:57 +0100, Boris Brezillon wrote:
  at91sam9rl SoC has an erratum forcing us to toggle the BIAS on USB
  suspend/resume events.
  
  This specific handling is only activated when CONFIG_ARCH_AT91SAM9RL is
  set and this option is only set when building a non-DT kernel, which is
  problematic since non-DT support for at91sam9rl SoC has been removed.
 
 This sentence is not entirely correct. Commit bcf8c7e7703b (ARM: at91:
 remove at91sam9rl legacy board support) actually removed the Kconfig
 symbol ARCH_AT91SAM9RL entirely. So the check for CONFIG_ARCH_AT91SAM9RL
 has been pointless since (next-20141110 and) v3.19-rc1. See my report at
 https://lkml.org/lkml/2014/11/10/232 .

I'll rework my commit message.

 
 (I stumbled on this patch because I contemplated sending a patch to
 simply remove the check for CONFIG_ARCH_AT91SAM9RL and the currently
 useless function toggle_bias.)

Sorry, I forgot to add you in Cc of this series :-(, I'll do it it for
the future iterations.

Best Regards,

Boris

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.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: [PATCH v3 1/5] usb: atmel_usba_udc: Rework at91sam9rl errata handling

2015-01-12 Thread Paul Bolle
On Mon, 2015-01-12 at 11:57 +0100, Boris Brezillon wrote:
 at91sam9rl SoC has an erratum forcing us to toggle the BIAS on USB
 suspend/resume events.
 
 This specific handling is only activated when CONFIG_ARCH_AT91SAM9RL is
 set and this option is only set when building a non-DT kernel, which is
 problematic since non-DT support for at91sam9rl SoC has been removed.

This sentence is not entirely correct. Commit bcf8c7e7703b (ARM: at91:
remove at91sam9rl legacy board support) actually removed the Kconfig
symbol ARCH_AT91SAM9RL entirely. So the check for CONFIG_ARCH_AT91SAM9RL
has been pointless since (next-20141110 and) v3.19-rc1. See my report at
https://lkml.org/lkml/2014/11/10/232 .

(I stumbled on this patch because I contemplated sending a patch to
simply remove the check for CONFIG_ARCH_AT91SAM9RL and the currently
useless function toggle_bias.)

 Rework the toggle_bias implementation to attach it to the at91sam9rl-udc
 compatible string.
 
 Add new compatible strings to avoid executing at91sam9rl erratum handling
 on other SoCs.
 
 Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com
 Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com


Paul Bolle

--
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/3] usb: dwc3: pci: code cleanup

2015-01-12 Thread Heikki Krogerus
Removing a few items that are not needed anymore and
adding separate function for quirks.

Signed-off-by: Heikki Krogerus heikki.kroge...@linux.intel.com
Cc: Huang Rui ray.hu...@amd.com
---
 drivers/usb/dwc3/dwc3-pci.c | 96 -
 1 file changed, 42 insertions(+), 54 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 30d553f..8d95056 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -33,28 +33,50 @@
 #define PCI_DEVICE_ID_INTEL_SPTLP  0x9d30
 #define PCI_DEVICE_ID_INTEL_SPTH   0xa130
 
-struct dwc3_pci {
-   struct device   *dev;
-   struct platform_device  *dwc3;
-};
+static int dwc3_pci_quirks(struct pci_dev *pdev)
+{
+   if (pdev-vendor == PCI_VENDOR_ID_AMD 
+   pdev-device == PCI_DEVICE_ID_AMD_NL_USB) {
+   struct dwc3_platform_data pdata;
+
+   memset(pdata, 0, sizeof(pdata));
+
+   pdata.has_lpm_erratum = true;
+   pdata.lpm_nyet_threshold = 0xf;
+
+   pdata.u2exit_lfps_quirk = true;
+   pdata.u2ss_inp3_quirk = true;
+   pdata.req_p1p2p3_quirk = true;
+   pdata.del_p1p2p3_quirk = true;
+   pdata.del_phy_power_chg_quirk = true;
+   pdata.lfps_filter_quirk = true;
+   pdata.rx_detect_poll_quirk = true;
+
+   pdata.tx_de_emphasis_quirk = true;
+   pdata.tx_de_emphasis = 1;
+
+   /*
+* FIXME these quirks should be removed when AMD NL
+* taps out
+*/
+   pdata.disable_scramble_quirk = true;
+   pdata.dis_u3_susphy_quirk = true;
+   pdata.dis_u2_susphy_quirk = true;
+
+   return platform_device_add_data(pci_get_drvdata(pdev), pdata,
+   sizeof(pdata));
+   }
+
+   return 0;
+}
 
 static int dwc3_pci_probe(struct pci_dev *pci,
const struct pci_device_id *id)
 {
struct resource res[2];
struct platform_device  *dwc3;
-   struct dwc3_pci *glue;
int ret;
struct device   *dev = pci-dev;
-   struct dwc3_platform_data dwc3_pdata;
-
-   memset(dwc3_pdata, 0x00, sizeof(dwc3_pdata));
-
-   glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL);
-   if (!glue)
-   return -ENOMEM;
-
-   glue-dev = dev;
 
ret = pcim_enable_device(pci);
if (ret) {
@@ -81,68 +103,34 @@ static int dwc3_pci_probe(struct pci_dev *pci,
res[1].name = dwc_usb3;
res[1].flags= IORESOURCE_IRQ;
 
-   if (pci-vendor == PCI_VENDOR_ID_AMD 
-   pci-device == PCI_DEVICE_ID_AMD_NL_USB) {
-   dwc3_pdata.has_lpm_erratum = true;
-   dwc3_pdata.lpm_nyet_threshold = 0xf;
-
-   dwc3_pdata.u2exit_lfps_quirk = true;
-   dwc3_pdata.u2ss_inp3_quirk = true;
-   dwc3_pdata.req_p1p2p3_quirk = true;
-   dwc3_pdata.del_p1p2p3_quirk = true;
-   dwc3_pdata.del_phy_power_chg_quirk = true;
-   dwc3_pdata.lfps_filter_quirk = true;
-   dwc3_pdata.rx_detect_poll_quirk = true;
-
-   dwc3_pdata.tx_de_emphasis_quirk = true;
-   dwc3_pdata.tx_de_emphasis = 1;
-
-   /*
-* FIXME these quirks should be removed when AMD NL
-* taps out
-*/
-   dwc3_pdata.disable_scramble_quirk = true;
-   dwc3_pdata.dis_u3_susphy_quirk = true;
-   dwc3_pdata.dis_u2_susphy_quirk = true;
-   }
-
ret = platform_device_add_resources(dwc3, res, ARRAY_SIZE(res));
if (ret) {
dev_err(dev, couldn't add resources to dwc3 device\n);
return ret;
}
 
-   pci_set_drvdata(pci, glue);
-
-   ret = platform_device_add_data(dwc3, dwc3_pdata, sizeof(dwc3_pdata));
+   pci_set_drvdata(pci, dwc3);
+   ret = dwc3_pci_quirks(pci);
if (ret)
-   goto err3;
-
-   dma_set_coherent_mask(dwc3-dev, dev-coherent_dma_mask);
+   goto err;
 
-   dwc3-dev.dma_mask = dev-dma_mask;
-   dwc3-dev.dma_parms = dev-dma_parms;
dwc3-dev.parent = dev;
-   glue-dwc3 = dwc3;
 
ret = platform_device_add(dwc3);
if (ret) {
dev_err(dev, failed to register dwc3 device\n);
-   goto err3;
+   goto err;
}
 
return 0;
-
-err3:
+err:
platform_device_put(dwc3);
return ret;
 }
 
 static void dwc3_pci_remove(struct pci_dev *pci)
 {
-   struct dwc3_pci *glue = pci_get_drvdata(pci);
-
-   platform_device_unregister(glue-dwc3);
+   platform_device_unregister(pci_get_drvdata(pci));
 }
 
 static const struct pci_device_id dwc3_pci_id_table[] = {
-- 
2.1.4

--
To unsubscribe from 

[PATCH 0/3] usb: dwc3: pci: cleanup

2015-01-12 Thread Heikki Krogerus

Heikki Krogerus (3):
  usb: dwc3: pci: remove registration of NOP PHYs
  usb: dwc3: pci: rely on default PM callbacks from PCI driver utility
  usb: dwc3: pci: code cleanup

 drivers/usb/dwc3/dwc3-pci.c | 178 
 1 file changed, 32 insertions(+), 146 deletions(-)

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



[PATCH 2/3] usb: dwc3: pci: rely on default PM callbacks from PCI driver utility

2015-01-12 Thread Heikki Krogerus
There is nothing specific being done in the suspend and
resume callbacks that is not already taken care of in PCI
driver core, so dropping the functions.

Signed-off-by: Heikki Krogerus heikki.kroge...@linux.intel.com
---
 drivers/usb/dwc3/dwc3-pci.c | 34 --
 1 file changed, 34 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 7699da2..30d553f 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -160,45 +160,11 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
 };
 MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table);
 
-#ifdef CONFIG_PM_SLEEP
-static int dwc3_pci_suspend(struct device *dev)
-{
-   struct pci_dev  *pci = to_pci_dev(dev);
-
-   pci_disable_device(pci);
-
-   return 0;
-}
-
-static int dwc3_pci_resume(struct device *dev)
-{
-   struct pci_dev  *pci = to_pci_dev(dev);
-   int ret;
-
-   ret = pci_enable_device(pci);
-   if (ret) {
-   dev_err(dev, can't re-enable device -- %d\n, ret);
-   return ret;
-   }
-
-   pci_set_master(pci);
-
-   return 0;
-}
-#endif /* CONFIG_PM_SLEEP */
-
-static const struct dev_pm_ops dwc3_pci_dev_pm_ops = {
-   SET_SYSTEM_SLEEP_PM_OPS(dwc3_pci_suspend, dwc3_pci_resume)
-};
-
 static struct pci_driver dwc3_pci_driver = {
.name   = dwc3-pci,
.id_table   = dwc3_pci_id_table,
.probe  = dwc3_pci_probe,
.remove = dwc3_pci_remove,
-   .driver = {
-   .pm = dwc3_pci_dev_pm_ops,
-   },
 };
 
 MODULE_AUTHOR(Felipe Balbi ba...@ti.com);
-- 
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


[PATCH 1/3] usb: dwc3: pci: remove registration of NOP PHYs

2015-01-12 Thread Heikki Krogerus
None of the PCI platforms need the NOP transceivers, and
since we can now live without the PHYs, removing
registration of the platform devices for them.

Signed-off-by: Heikki Krogerus heikki.kroge...@linux.intel.com
---
 drivers/usb/dwc3/dwc3-pci.c | 68 -
 1 file changed, 68 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index b642a2f..7699da2 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -22,9 +22,6 @@
 #include linux/pci.h
 #include linux/platform_device.h
 
-#include linux/usb/otg.h
-#include linux/usb/usb_phy_generic.h
-
 #include platform_data.h
 
 /* FIXME define these in linux/pci_ids.h */
@@ -39,65 +36,8 @@
 struct dwc3_pci {
struct device   *dev;
struct platform_device  *dwc3;
-   struct platform_device  *usb2_phy;
-   struct platform_device  *usb3_phy;
 };
 
-static int dwc3_pci_register_phys(struct dwc3_pci *glue)
-{
-   struct usb_phy_generic_platform_data pdata;
-   struct platform_device  *pdev;
-   int ret;
-
-   memset(pdata, 0x00, sizeof(pdata));
-
-   pdev = platform_device_alloc(usb_phy_generic, 0);
-   if (!pdev)
-   return -ENOMEM;
-
-   glue-usb2_phy = pdev;
-   pdata.type = USB_PHY_TYPE_USB2;
-   pdata.gpio_reset = -1;
-
-   ret = platform_device_add_data(glue-usb2_phy, pdata, sizeof(pdata));
-   if (ret)
-   goto err1;
-
-   pdev = platform_device_alloc(usb_phy_generic, 1);
-   if (!pdev) {
-   ret = -ENOMEM;
-   goto err1;
-   }
-
-   glue-usb3_phy = pdev;
-   pdata.type = USB_PHY_TYPE_USB3;
-
-   ret = platform_device_add_data(glue-usb3_phy, pdata, sizeof(pdata));
-   if (ret)
-   goto err2;
-
-   ret = platform_device_add(glue-usb2_phy);
-   if (ret)
-   goto err2;
-
-   ret = platform_device_add(glue-usb3_phy);
-   if (ret)
-   goto err3;
-
-   return 0;
-
-err3:
-   platform_device_del(glue-usb2_phy);
-
-err2:
-   platform_device_put(glue-usb3_phy);
-
-err1:
-   platform_device_put(glue-usb2_phy);
-
-   return ret;
-}
-
 static int dwc3_pci_probe(struct pci_dev *pci,
const struct pci_device_id *id)
 {
@@ -124,12 +64,6 @@ static int dwc3_pci_probe(struct pci_dev *pci,
 
pci_set_master(pci);
 
-   ret = dwc3_pci_register_phys(glue);
-   if (ret) {
-   dev_err(dev, couldn't register PHYs\n);
-   return ret;
-   }
-
dwc3 = platform_device_alloc(dwc3, PLATFORM_DEVID_AUTO);
if (!dwc3) {
dev_err(dev, couldn't allocate dwc3 device\n);
@@ -209,8 +143,6 @@ static void dwc3_pci_remove(struct pci_dev *pci)
struct dwc3_pci *glue = pci_get_drvdata(pci);
 
platform_device_unregister(glue-dwc3);
-   platform_device_unregister(glue-usb2_phy);
-   platform_device_unregister(glue-usb3_phy);
 }
 
 static const struct pci_device_id dwc3_pci_id_table[] = {
-- 
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: [PATCH v3 00/30] usb: updates for dwc2 gadget driver

2015-01-12 Thread Robert Baldyga
On 01/12/2015 01:03 PM, Kaukab, Yousaf wrote:
 Hi Robert,
 
 -Original Message-
 From: Robert Baldyga [mailto:r.bald...@samsung.com]
 Sent: Monday, January 12, 2015 11:00 AM
 To: Kaukab, Yousaf; linux-usb@vger.kernel.org; ba...@ti.com
 Cc: Herrero, Gregory; pa...@synopsys.com;
 sergei.shtyl...@cogentembedded.com; dingu...@opensource.altera.com
 Subject: Re: [PATCH v3 00/30] usb: updates for dwc2 gadget driver

 On 01/09/2015 01:38 PM, Mian Yousaf Kaukab wrote:
 Hi,
 This patchset consists of various bug fixes and feature enhancements
 for the
 dwc2 gadget driver. All the patches are verified on dwc2 v3.0a with
 dedicated fifos. Main focus of testing was with dma enabled. Although
 basic testing without dma was also done.

 It is based on testing/next branch in Felipe's git and

 Tested-by: Dinh Nguyen dingu...@opensource.altera.com



 I still see problem described here [1] but it seems to be unrelated to this 
 patch
 series. Tested with USB functions present in mainline kernel it works well.

 Tested-by: Robert Baldyga r.bald...@samsung.com
 
 Thank you for testing this patchset. Can you please provide the version of 
 dwc2 ip on which you tested?

Version of my dwc2 is 2.81a.

Thanks,
Robert Baldyga
--
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 v3 3/5] ARM: at91/dt: update udc compatible strings

2015-01-12 Thread Felipe Balbi
On Mon, Jan 12, 2015 at 08:18:16PM +0100, Boris Brezillon wrote:
 Hi Felipe,
 
 On Mon, 12 Jan 2015 12:23:49 -0600
 Felipe Balbi ba...@ti.com wrote:
 
  On Mon, Jan 12, 2015 at 11:57:56AM +0100, Boris Brezillon wrote:
   at91sam9g45, at91sam9x5 and sama5 SoCs should not use
   atmel,at91sam9rl-udc for their USB device compatible property since
   this compatible is attached to a specific hardware bug fix.
   
   Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com
   Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com
  
  WARNING: DT compatible string atmel,at91sam9g45-udc appears un-documented 
  -- check ./Documentation/devicetree/bindings/
  #177: FILE: drivers/usb/gadget/udc/atmel_usba_udc.c:1827:
  +   { .compatible = atmel,at91sam9g45-udc },
  
  WARNING: DT compatible string atmel,sama5d3-udc appears un-documented -- 
  check ./Documentation/devicetree/bindings/
  #178: FILE: drivers/usb/gadget/udc/atmel_usba_udc.c:1828:
  +   { .compatible = atmel,sama5d3-udc },
  
  please fix and resend. Also, when resending, could you add Nicolas'
  Acked-by since he's already given it ?
 
 Actually these compatible strings are documented in the first patch
 (where they were introduced), but I'll send a v4 with Nicolas' ack.

heh, checkpatch stupidity :-) My bad.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v3 3/5] ARM: at91/dt: update udc compatible strings

2015-01-12 Thread Boris Brezillon
Hi Felipe,

On Mon, 12 Jan 2015 12:23:49 -0600
Felipe Balbi ba...@ti.com wrote:

 On Mon, Jan 12, 2015 at 11:57:56AM +0100, Boris Brezillon wrote:
  at91sam9g45, at91sam9x5 and sama5 SoCs should not use
  atmel,at91sam9rl-udc for their USB device compatible property since
  this compatible is attached to a specific hardware bug fix.
  
  Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com
  Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com
 
 WARNING: DT compatible string atmel,at91sam9g45-udc appears un-documented 
 -- check ./Documentation/devicetree/bindings/
 #177: FILE: drivers/usb/gadget/udc/atmel_usba_udc.c:1827:
 +   { .compatible = atmel,at91sam9g45-udc },
 
 WARNING: DT compatible string atmel,sama5d3-udc appears un-documented -- 
 check ./Documentation/devicetree/bindings/
 #178: FILE: drivers/usb/gadget/udc/atmel_usba_udc.c:1828:
 +   { .compatible = atmel,sama5d3-udc },
 
 please fix and resend. Also, when resending, could you add Nicolas'
 Acked-by since he's already given it ?

Actually these compatible strings are documented in the first patch
(where they were introduced), but I'll send a v4 with Nicolas' ack.

Thanks,

Boris



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.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: [PATCH v3 3/5] ARM: at91/dt: update udc compatible strings

2015-01-12 Thread Boris Brezillon
On Mon, 12 Jan 2015 13:31:26 -0600
Felipe Balbi ba...@ti.com wrote:

 On Mon, Jan 12, 2015 at 08:18:16PM +0100, Boris Brezillon wrote:
  Hi Felipe,
  
  On Mon, 12 Jan 2015 12:23:49 -0600
  Felipe Balbi ba...@ti.com wrote:
  
   On Mon, Jan 12, 2015 at 11:57:56AM +0100, Boris Brezillon wrote:
at91sam9g45, at91sam9x5 and sama5 SoCs should not use
atmel,at91sam9rl-udc for their USB device compatible property since
this compatible is attached to a specific hardware bug fix.

Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com
Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com
   
   WARNING: DT compatible string atmel,at91sam9g45-udc appears 
   un-documented -- check ./Documentation/devicetree/bindings/
   #177: FILE: drivers/usb/gadget/udc/atmel_usba_udc.c:1827:
   +   { .compatible = atmel,at91sam9g45-udc },
   
   WARNING: DT compatible string atmel,sama5d3-udc appears un-documented 
   -- check ./Documentation/devicetree/bindings/
   #178: FILE: drivers/usb/gadget/udc/atmel_usba_udc.c:1828:
   +   { .compatible = atmel,sama5d3-udc },
   
   please fix and resend. Also, when resending, could you add Nicolas'
   Acked-by since he's already given it ?
  
  Actually these compatible strings are documented in the first patch
  (where they were introduced), but I'll send a v4 with Nicolas' ack.
 
 heh, checkpatch stupidity :-) My bad.
 

You took v3 of the first patch instead of v4.
Don't know if you can replace it (anyway, that's not such a big deal
since the only change is the commit message)...


-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.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: [PATCH v3 00/30] usb: updates for dwc2 gadget driver

2015-01-12 Thread Paul Zimmerman
 From: Mian Yousaf Kaukab [mailto:yousaf.kau...@intel.com]
 Sent: Friday, January 09, 2015 4:39 AM
 
 Hi,
 This patchset consists of various bug fixes and feature enhancements for the
 dwc2 gadget driver. All the patches are verified on dwc2 v3.0a with dedicated
 fifos. Main focus of testing was with dma enabled. Although basic testing
 without dma was also done.
 
 It is based on testing/next branch in Felipe's git and
 
 Tested-by: Dinh Nguyen dingu...@opensource.altera.com
 
 Thank you,
 
 Best regards,
 Yousaf
 
 History:
 v3:
  - Fixed comment from Sergei Shtylyov
  - Updated usb: dwc2: gadget: don't process XferCompl on setup packet to
apply the check on endpoint 0 only.
  - Fixed regression in usb: dwc2: gadget: manage ep0 state in software for
dwc2 ip v2.93a, found by Dinh Nguyen.
 
 v2:
  - Rebased to Felipe's testing/next with https://lkml.org/lkml/2014/12/16/135
applied on top.
  - Fixed comments from  Robert Baldyga
  - Some cosmetic changes
  - Replaced usb: dwc2: gadget: process setup packet on transfer complete
with
usb: dwc2: gadget: don't process XferCompl on setup packet
  - Updated usb: dwc2: gadget: provide gadget handle to the phy
so that otg_set_peripheral is called in both udc_start and udc_stop.
 
 v1:
  - Addressed comments from Sergei Shtylyov
 
 Gregory Herrero (13):
   usb: dwc2: gadget: register gadget handle to the phy
   usb: dwc2: gadget: write correct value in ahbcfg register
   usb: dwc2: gadget: don't erase gahbcfg register when enabling dma
   usb: dwc2: gadget: add device tree property to enable dma
   Documentation: dt-bindings: add dt binding info for dwc2 g-use-dma
   usb: dwc2: gadget: configure fifos from device tree
   Documentation: dt-bindings: add dt binding info for dwc2 fifo resizing
   usb: dwc2: gadget: don't block after fifo flush timeout
   usb: dwc2: gadget: add vbus_session support
   usb: dwc2: gadget: reset fifo_map when initializing fifos
   usb: dwc2: gadget: fix pullup handling
   usb: dwc2: gadget: add vbus_draw support
   usb: dwc2: gadget: force gadget initialization in dev mode
 
 Mian Yousaf Kaukab (17):
   usb: dwc2: gadget: mask fifo empty irq with dma
   usb: dwc2: gadget: don't process XferCompl on setup packet
   usb: dwc2: gadget: don't embed ep0 buffers
   usb: dwc2: gadget: fix error path in dwc2_gadget_init
   usb: dwc2: gadget: add bi-directional endpoint support
   usb: dwc2: gadget: check interrupts for all endpoints
   usb: dwc2: gadget: remove unused members from hsotg_req
   usb: dwc2: gadget: fix debug loop limits
   usb: dwc2: gadget: consider all tx fifos
   usb: dwc2: gadget: kill requests after disabling ep
   usb: dwc2: gadget: manage ep0 state in software
   usb: dwc2: gadget: fix zero length packet transfers
   usb: dwc2: gadget: dont warn if endpoint is not enabled
   usb: dwc2: gadget: rename sent_zlp to send_zlp
   usb: dwc2: gadget: pick smallest acceptable fifo
   usb: dwc2: gadget: fix fifo allocation leak
   usb: dwc2: gadget: report disconnection after reset
 
  Documentation/devicetree/bindings/usb/dwc2.txt |   4 +
  drivers/usb/dwc2/core.h|  46 +-
  drivers/usb/dwc2/gadget.c  | 792 
 -
  drivers/usb/dwc2/hw.h  |   1 +
  4 files changed, 556 insertions(+), 287 deletions(-)
 
 --
 1.9.1

For the entire series:

Acked-by: Paul Zimmerman pa...@synopsys.com

Robert Baldyga r.bald...@samsung.com has also given his tested-by.

Felipe, can you please queue this series for 3.20? Thanks.

-- 
Paul

--
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 v3 00/30] usb: updates for dwc2 gadget driver

2015-01-12 Thread Felipe Balbi
Hi,

On Mon, Jan 12, 2015 at 09:20:15PM +, Paul Zimmerman wrote:
  From: Mian Yousaf Kaukab [mailto:yousaf.kau...@intel.com]
  Sent: Friday, January 09, 2015 4:39 AM
  
  Hi,
  This patchset consists of various bug fixes and feature enhancements for the
  dwc2 gadget driver. All the patches are verified on dwc2 v3.0a with 
  dedicated
  fifos. Main focus of testing was with dma enabled. Although basic testing
  without dma was also done.
  
  It is based on testing/next branch in Felipe's git and
  
  Tested-by: Dinh Nguyen dingu...@opensource.altera.com
  
  Thank you,
  
  Best regards,
  Yousaf
  
  History:
  v3:
   - Fixed comment from Sergei Shtylyov
   - Updated usb: dwc2: gadget: don't process XferCompl on setup packet to
 apply the check on endpoint 0 only.
   - Fixed regression in usb: dwc2: gadget: manage ep0 state in software for
 dwc2 ip v2.93a, found by Dinh Nguyen.
  
  v2:
   - Rebased to Felipe's testing/next with 
  https://lkml.org/lkml/2014/12/16/135
 applied on top.
   - Fixed comments from  Robert Baldyga
   - Some cosmetic changes
   - Replaced usb: dwc2: gadget: process setup packet on transfer complete
 with
 usb: dwc2: gadget: don't process XferCompl on setup packet
   - Updated usb: dwc2: gadget: provide gadget handle to the phy
 so that otg_set_peripheral is called in both udc_start and udc_stop.
  
  v1:
   - Addressed comments from Sergei Shtylyov
  
  Gregory Herrero (13):
usb: dwc2: gadget: register gadget handle to the phy
usb: dwc2: gadget: write correct value in ahbcfg register
usb: dwc2: gadget: don't erase gahbcfg register when enabling dma
usb: dwc2: gadget: add device tree property to enable dma
Documentation: dt-bindings: add dt binding info for dwc2 g-use-dma
usb: dwc2: gadget: configure fifos from device tree
Documentation: dt-bindings: add dt binding info for dwc2 fifo resizing
usb: dwc2: gadget: don't block after fifo flush timeout
usb: dwc2: gadget: add vbus_session support
usb: dwc2: gadget: reset fifo_map when initializing fifos
usb: dwc2: gadget: fix pullup handling
usb: dwc2: gadget: add vbus_draw support
usb: dwc2: gadget: force gadget initialization in dev mode
  
  Mian Yousaf Kaukab (17):
usb: dwc2: gadget: mask fifo empty irq with dma
usb: dwc2: gadget: don't process XferCompl on setup packet
usb: dwc2: gadget: don't embed ep0 buffers
usb: dwc2: gadget: fix error path in dwc2_gadget_init
usb: dwc2: gadget: add bi-directional endpoint support
usb: dwc2: gadget: check interrupts for all endpoints
usb: dwc2: gadget: remove unused members from hsotg_req
usb: dwc2: gadget: fix debug loop limits
usb: dwc2: gadget: consider all tx fifos
usb: dwc2: gadget: kill requests after disabling ep
usb: dwc2: gadget: manage ep0 state in software
usb: dwc2: gadget: fix zero length packet transfers
usb: dwc2: gadget: dont warn if endpoint is not enabled
usb: dwc2: gadget: rename sent_zlp to send_zlp
usb: dwc2: gadget: pick smallest acceptable fifo
usb: dwc2: gadget: fix fifo allocation leak
usb: dwc2: gadget: report disconnection after reset
  
   Documentation/devicetree/bindings/usb/dwc2.txt |   4 +
   drivers/usb/dwc2/core.h|  46 +-
   drivers/usb/dwc2/gadget.c  | 792 
  -
   drivers/usb/dwc2/hw.h  |   1 +
   4 files changed, 556 insertions(+), 287 deletions(-)
  
  --
  1.9.1
 
 For the entire series:
 
 Acked-by: Paul Zimmerman pa...@synopsys.com
 
 Robert Baldyga r.bald...@samsung.com has also given his tested-by.
 
 Felipe, can you please queue this series for 3.20? Thanks.

doing that now.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH net-next v2 0/2 RESEND] r8152: adjust r8152_submit_rx

2015-01-12 Thread David Miller
From: Hayes Wang hayesw...@realtek.com
Date: Fri, 9 Jan 2015 10:26:34 +0800

 v2:
 Replace the patch #1 with call rtl_start_rx after netif_carrier_on.
 
 For patch #2, replace checking tp-speed with netif_carrier_ok.
 
 v1:
 Avoid r8152_submit_rx() from submitting rx during unexpected
 moment. This could reduce the time of stopping rx.
 
 For patch #1, the tp-speed should be updated early. Then,
 the patch #2 could use it to check the current linking status.

Series applied, thanks.
--
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 05/11] usb: gadget: at91_udc: Remove non-DT handling code

2015-01-12 Thread Felipe Balbi
On Wed, Dec 03, 2014 at 12:32:04PM +0100, Boris Brezillon wrote:
 Since non-DT board support has been removed from the at91 architecture we
 can safely remove non-DT handling code.
 
 Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com

doesn't apply cleanly:

checking file drivers/usb/gadget/udc/Kconfig
checking file drivers/usb/gadget/udc/at91_udc.c
Hunk #1 succeeded at 1710 (offset 13 lines).
Hunk #2 succeeded at 1722 (offset 13 lines).
Hunk #3 succeeded at 1958 (offset 13 lines).
Hunk #4 FAILED at 1960.
1 out of 4 hunks FAILED

please rebase on testing/next which I just pushed.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 2/3] usb: gadget: uac1: struct gaudio is useless for struct f_uac1_opts

2015-01-12 Thread Felipe Balbi
Hi,

On Fri, Jan 09, 2015 at 03:09:09PM +0800, Peter Chen wrote:
 On Mon, Dec 1, 2014 at 4:09 PM, Peter Chen peter.c...@freescale.com wrote:
  Since we call gaudio_cleanup at f_audio_free, the f_uac1_opts
  doesn't need to use gaudio any more.
 
  Signed-off-by: Peter Chen peter.c...@freescale.com
  ---
   drivers/usb/gadget/function/f_uac1.c | 1 -
   drivers/usb/gadget/function/u_uac1.h | 1 -
   2 files changed, 2 deletions(-)
 
  diff --git a/drivers/usb/gadget/function/f_uac1.c 
  b/drivers/usb/gadget/function/f_uac1.c
  index e971584..0827731 100644
  --- a/drivers/usb/gadget/function/f_uac1.c
  +++ b/drivers/usb/gadget/function/f_uac1.c
  @@ -669,7 +669,6 @@ f_audio_bind(struct usb_configuration *c, struct 
  usb_function *f)
 
  audio_opts = container_of(f-fi, struct f_uac1_opts, func_inst);
  audio-card.gadget = c-cdev-gadget;
  -   audio_opts-card = audio-card;
  /* set up ASLA audio devices */
  if (!audio_opts-bound) {
  status = gaudio_setup(audio-card);
  diff --git a/drivers/usb/gadget/function/u_uac1.h 
  b/drivers/usb/gadget/function/u_uac1.h
  index f8b17fe..fe386df 100644
  --- a/drivers/usb/gadget/function/u_uac1.h
  +++ b/drivers/usb/gadget/function/u_uac1.h
  @@ -70,7 +70,6 @@ struct f_uac1_opts {
  unsignedfn_play_alloc:1;
  unsignedfn_cap_alloc:1;
  unsignedfn_cntl_alloc:1;
  -   struct gaudio   *card;
  struct mutexlock;
  int refcnt;
   };
  --
  1.9.1
 
 
 Hi Felipe,
 
 I see Patch 1/3 is in your testing/fixes, but Patch 2/3 and Patch 3/3
 are not at your testing/next.
 Would you have plan to queue them?

Thanks for letting me know, somehow they got lost. Now in my
testing/next.

cheers

-- 
balbi


signature.asc
Description: Digital signature


RE: dwc2: problems with IN requests completion in linux-next

2015-01-12 Thread Paul Zimmerman
 From: Robert Baldyga [mailto:r.bald...@samsung.com]
 Sent: Monday, December 22, 2014 6:13 AM
 
 I have recently noticed problem with DWC2 driver in latest linux-next. I
 use it in gadget only mode at Samsung platform (Odroid U3) but I believe
 the bug can be reproduced at another platforms.
 
 While running FFS example (tools/usb/ffs-aio-example/simple/) the
 communication breaks after few seconds. It's because one of IN requests
 enqueued in DWC2 driver do not complete. At USB analyzer I see that USB
 device started to transmit data from this request, but it ended incomplete.
 
 I bisected kernel tree, and I got following patches are reason of break.
 
 941fcce usb: dwc2: Update the gadget driver to use common dwc2_hsotg
 structure
 11b usb: dwc2: Move gadget probe function into platform code
 bcc0607 usb: dwc2: convert to use dev_pm_ops API
 510ffaa usb: dwc2: Initialize the USB core for peripheral mode
 db8178c usb: dwc2: Update common interrupt handler to call gadget
 interrupt handler
 8d736d8 usb: dwc2: gadget: Do not fail probe if there isn't a clock node
 
 Patch 941fcce breaks DWC2 driver at my platform and it starts to work
 from 8d736d8 but it has described bug.
 
 I will try to localize reason of this issue.

Hi Robert,

I think the most likely suspect would be db8178c, since the rest appear
to be init-time things. It seems to revert cleanly, can you try
reverting just that patch and see if it helps?

-- 
Paul



Re: [PATCH] usb/kaweth: use GFP_ATOMIC under spin_lock in usb_start_wait_urb()

2015-01-12 Thread David Miller
From: Alexey Khoroshilov khoroshi...@ispras.ru
Date: Sat, 10 Jan 2015 02:16:22 +0300

 Commit e4c7f259c5be (USB: kaweth.c: use GFP_ATOMIC under spin_lock)
 makes sure that kaweth_internal_control_msg() allocates memory with 
 GFP_ATOMIC,
 but kaweth_internal_control_msg() also calls usb_start_wait_urb()
 that still allocates memory with GFP_NOIO.
 
 The patch fixes usb_start_wait_urb() as well.
 
 Found by Linux Driver Verification project (linuxtesting.org).
 
 Signed-off-by: Alexey Khoroshilov khoroshi...@ispras.ru

Applied, thanks.
--
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 2/3] usb: phy: add lubbock phy driver

2015-01-12 Thread Felipe Balbi
On Sun, Jan 11, 2015 at 10:44:59PM +0400, Dmitry Eremin-Solenikov wrote:
 Hello,
 
 2015-01-08 19:58 GMT+03:00 Felipe Balbi ba...@ti.com:
  On Sun, Nov 30, 2014 at 01:02:04AM +0300, Dmitry Eremin-Solenikov wrote:
  Extract lubbock-specific code from pxa25x_udc driver. As a bonus, phy
  driver determines connector/VBUS status by reading CPLD register. Also
  it uses a work to call into udc stack, instead of pinging vbus session
  right from irq handler.
 
  Signed-off-by: Dmitry Eremin-Solenikov dbarysh...@gmail.com
  ---
   drivers/usb/phy/Kconfig   |  10 ++
   drivers/usb/phy/Makefile  |   1 +
 
  new phy drivers under drivers/phy only, sorry.
 
 Hmm. How do drivers/phy drivers coordinate with usb gadget subsystem?
 I see none of them calling usb_gadget_vbus_connect/disconnect().

I'll leave that to Kishon, since he wrote drivers/phy. Kishon, any
hints?

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 05/11] usb: gadget: at91_udc: Remove non-DT handling code

2015-01-12 Thread Alexandre Belloni
Hi Felipe,

I've rebased that patch series but it depends on another one (the mfd:
syscon: part of memory: add Atmel EBI (External Bus Interface) driver)
that is not taken yet so applying it now will break the build. I still
hope to get it merged for 3.20 and I'll resend it as soon as possible.


On 12/01/2015 at 15:39:05 -0600, Felipe Balbi wrote :
 On Wed, Dec 03, 2014 at 12:32:04PM +0100, Boris Brezillon wrote:
  Since non-DT board support has been removed from the at91 architecture we
  can safely remove non-DT handling code.
  
  Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com
 
 doesn't apply cleanly:
 
 checking file drivers/usb/gadget/udc/Kconfig
 checking file drivers/usb/gadget/udc/at91_udc.c
 Hunk #1 succeeded at 1710 (offset 13 lines).
 Hunk #2 succeeded at 1722 (offset 13 lines).
 Hunk #3 succeeded at 1958 (offset 13 lines).
 Hunk #4 FAILED at 1960.
 1 out of 4 hunks FAILED
 
 please rebase on testing/next which I just pushed.
 
 -- 
 balbi



-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.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: New maintainer for dwc2

2015-01-12 Thread Paul Zimmerman
 From: gre...@linuxfoundation.org [mailto:gre...@linuxfoundation.org]
 Sent: Monday, January 12, 2015 5:02 PM
 
 On Mon, Jan 12, 2015 at 11:14:54PM +, Paul Zimmerman wrote:
  Hi everyone,
 
  I will be leaving Synopsys on Friday, Jan 16th, so the dwc2 driver
  will need a new maintainer.
 
  I am recommending John Youn johny...@synopsys.com as the new
  maintainer.
 
  On the plus side, John has quite a bit of experience with the dwc2
  controller, and has previous experience submitting kernel patches (for
  the xhci and dwc3 drivers). And being a Synopsys employee, he will have
  access to internal resources for support.
 
  On the minus side, John has not worked directly with the in-kernel dwc2
  driver until very recently, and has not done maintainer work before.
 
  If no one has any objections, I will submit a patch to MAINTAINERS in a
  couple of days making John the new dwc2 maintainer.
 
 I don't have any objections.  John will still be sending patches to
 Felipe through email, and not directly to me, right?

Yes, that is correct.

-- 
Paul

--
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: New maintainer for dwc2

2015-01-12 Thread Felipe Balbi
On Tue, Jan 13, 2015 at 01:17:48AM +, Paul Zimmerman wrote:
  From: gre...@linuxfoundation.org [mailto:gre...@linuxfoundation.org]
  Sent: Monday, January 12, 2015 5:02 PM
  
  On Mon, Jan 12, 2015 at 11:14:54PM +, Paul Zimmerman wrote:
   Hi everyone,
  
   I will be leaving Synopsys on Friday, Jan 16th, so the dwc2 driver
   will need a new maintainer.
  
   I am recommending John Youn johny...@synopsys.com as the new
   maintainer.
  
   On the plus side, John has quite a bit of experience with the dwc2
   controller, and has previous experience submitting kernel patches (for
   the xhci and dwc3 drivers). And being a Synopsys employee, he will have
   access to internal resources for support.
  
   On the minus side, John has not worked directly with the in-kernel dwc2
   driver until very recently, and has not done maintainer work before.
  
   If no one has any objections, I will submit a patch to MAINTAINERS in a
   couple of days making John the new dwc2 maintainer.
  
  I don't have any objections.  John will still be sending patches to
  Felipe through email, and not directly to me, right?
 
 Yes, that is correct.

right, that will not change and we already had a preliminary email
discussion privately a few weeks back. I have no objection on Paul's
recommendation either.

Thanks for all the help, Paul, over the last 2 years or so.

regards

-- 
balbi


signature.asc
Description: Digital signature


Re: New maintainer for dwc2

2015-01-12 Thread gre...@linuxfoundation.org
On Mon, Jan 12, 2015 at 11:14:54PM +, Paul Zimmerman wrote:
 Hi everyone,
 
 I will be leaving Synopsys on Friday, Jan 16th, so the dwc2 driver
 will need a new maintainer.
 
 I am recommending John Youn johny...@synopsys.com as the new
 maintainer.
 
 On the plus side, John has quite a bit of experience with the dwc2
 controller, and has previous experience submitting kernel patches (for
 the xhci and dwc3 drivers). And being a Synopsys employee, he will have
 access to internal resources for support.
 
 On the minus side, John has not worked directly with the in-kernel dwc2
 driver until very recently, and has not done maintainer work before.
 
 If no one has any objections, I will submit a patch to MAINTAINERS in a
 couple of days making John the new dwc2 maintainer.

I don't have any objections.  John will still be sending patches to
Felipe through email, and not directly to me, right?

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 v7 3/5] usb: dwc2: add generic PHY framework support for dwc2 usb controler platform driver.

2015-01-12 Thread Paul Zimmerman
 From: Paul Zimmerman
 Sent: Saturday, January 10, 2015 3:52 PM
 
  From: Yunzhi Li [mailto:l...@rock-chips.com]
  Sent: Saturday, January 10, 2015 8:07 AM
 
  在 2015/1/9 10:15, Paul Zimmerman 写道:
   [...]
/*
   - * Attempt to find a generic PHY, then look for an old style
   - * USB PHY, finally fall back to pdata
   + * If platform probe couldn't find a generic PHY or an old style
   + * USB PHY, fall back to pdata
 */
   -phy = devm_phy_get(dev, usb2-phy);
   -if (IS_ERR(phy)) {
   -uphy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
   -if (IS_ERR(uphy)) {
   -/* Fallback for pdata */
   -plat = dev_get_platdata(dev);
   -if (!plat) {
   -dev_err(dev,
   -no platform data or transceiver 
   defined\n);
   -return -EPROBE_DEFER;
   -}
   -hsotg-plat = plat;
   -} else
   -hsotg-uphy = uphy;
   -} else {
   -hsotg-phy = phy;
   +if (IS_ERR_OR_NULL(hsotg-phy)  IS_ERR_OR_NULL(hsotg-uphy)) {
   +plat = dev_get_platdata(dev);
   +if (!plat) {
   +dev_err(dev,
   +no platform data or transceiver defined\n);
   +return -EPROBE_DEFER;
   Hi Yunzhi,
  
   Testing Felipe's testing/next branch on an Altera SOCFPGA platform,
   the driver never loads because it always returns -EPROBE_DEFER here.
   Apparently the SOCFPGA platform does not have any platform data
   defined, because dev_get_platdata() always returns NULL.
  
   If I remove the -EPROBE_DEFER return and have it continue on, the
   driver works. Reverting the patch also makes it work.
  
  When I debug this problem, I checked socfpga.dtsi, there is a
  usbphy node defined for each
  dwc2 controller, so I think when running dwc2_driver_probe() uphy =
  devm_usb_get_phy()
  should get a valid usbphy pointer and hsotg-uphy will not be NULL or
  ERROR, then in dwc2_gadget_init()
  it will not return -EPROBE_DEFER. I have no idea about why you meet
  -EPROBE_DEFER, could you please tell
  me what's the return value of devm_usb_get_phy() on your socfpga board ?
 
 I'm away from the hardware right now, but I just found this in a saved
 boot log:
 
 [1.097268] usb_phy_generic soc:usbphy@0: Error requesting RESET GPIO
 [1.097285] usb_phy_generic: probe of soc:usbphy@0 failed with error -2
 
 So that probably explains it. I'll dig into this some more on Monday.

The patch below fixes it. And it seems like the right thing to me,
since GPIOs should be optional for a generic phy, I would think. But
my device tree foo is very weak, so I'm not sure.

CCing Robert, who touched the generic phy code last. Robert, what do
you think?

-- 
Paul


diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
index dd05254..9a826ff 100644
--- a/drivers/usb/phy/phy-generic.c
+++ b/drivers/usb/phy/phy-generic.c
@@ -218,10 +218,10 @@ int usb_phy_gen_create_phy(struct device *dev, struct 
usb_phy_generic *nop,
clk_rate = 0;
 
needs_vcc = of_property_read_bool(node, vcc-supply);
-   nop-gpiod_reset = devm_gpiod_get(dev, reset-gpios);
+   nop-gpiod_reset = devm_gpiod_get_optional(dev, reset-gpios);
err = PTR_ERR(nop-gpiod_reset);
if (!err) {
-   nop-gpiod_vbus = devm_gpiod_get(dev,
+   nop-gpiod_vbus = devm_gpiod_get_optional(dev,
 vbus-detect-gpio);
err = PTR_ERR(nop-gpiod_vbus);
}
-- 



Re: [PATCH 0/3] usb: udc: cleanup pullup operation

2015-01-12 Thread Peter Chen
On Mon, Jan 12, 2015 at 01:01:49PM +0200, Alexander Shishkin wrote:
 Peter Chen peter.c...@freescale.com writes:
 
  This patch set cleans up udc drivers which define .pullup API, but
  still call pullup operation at .udc_start or .udc_stop. In fact,
  the related pullup operations are covered by udc core.
 
 Oh, this driver is still around? Are we going to obsolete it with
 chipidea someday?
 

Yes, after udc core knows vbus status, all pull up/down dp operations
will move out from other places except for .pullup API.

-- 

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


Re: [PATCH v3 0/5] usb: atmel_usba_udc: Rework errata handling

2015-01-12 Thread Bo Shen

Hi Boris,

On 01/12/2015 06:57 PM, Boris Brezillon wrote:

Hello,

Here is a set of patches porting existing at91sam9rl erratum handling to
DT and adding new code to handle at91sam9g45/9x5 erratum.
It also adds several compatible strings to differentiate those errata.

These patches should be backported to 3.17 and 3.18 stable releases but
they do not apply cleanly on those stable branches.
I'll send a backport of this series once it is merged in mainline.

Regards,

Boris

Changes since v2:
- remove UTF8 character in commit message of patch 2

Changes since v1:
- cache INT_ENB value to speedup INT_ENB read operations


For the whole series, test OK on at91sam9m10g45ek board with mass 
storage gadget, test OK on sama5d36ek with serial gadget.


Tested-by: Bo Shen voice.s...@atmel.com


Boris Brezillon (5):
   usb: atmel_usba_udc: Rework at91sam9rl errata handling
   usb: atmel_usba_udc: Add at91sam9g45 and at91sam9x5 errata handling
   ARM: at91/dt: update udc compatible strings
   usb: atmel_usba_udc: Mask status with enabled irqs
   usb: gadget: atmel_usba: Cache INT_ENB register value

  .../devicetree/bindings/usb/atmel-usb.txt  |   5 +-
  arch/arm/boot/dts/at91sam9g45.dtsi |   2 +-
  arch/arm/boot/dts/at91sam9x5.dtsi  |   2 +-
  arch/arm/boot/dts/sama5d3.dtsi |   2 +-
  arch/arm/boot/dts/sama5d4.dtsi |   2 +-
  drivers/usb/gadget/udc/atmel_usba_udc.c| 146 +
  drivers/usb/gadget/udc/atmel_usba_udc.h|   9 ++
  7 files changed, 111 insertions(+), 57 deletions(-)



Best Regards,
Bo Shen
--
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


New maintainer for dwc2

2015-01-12 Thread Paul Zimmerman
Hi everyone,

I will be leaving Synopsys on Friday, Jan 16th, so the dwc2 driver
will need a new maintainer.

I am recommending John Youn johny...@synopsys.com as the new
maintainer.

On the plus side, John has quite a bit of experience with the dwc2
controller, and has previous experience submitting kernel patches (for
the xhci and dwc3 drivers). And being a Synopsys employee, he will have
access to internal resources for support.

On the minus side, John has not worked directly with the in-kernel dwc2
driver until very recently, and has not done maintainer work before.

If no one has any objections, I will submit a patch to MAINTAINERS in a
couple of days making John the new dwc2 maintainer.

-- 
Paul

--
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: dwc3: pci: code cleanup

2015-01-12 Thread Huang Rui
On Mon, Jan 12, 2015 at 02:20:14PM +0200, Heikki Krogerus wrote:
 Removing a few items that are not needed anymore and
 adding separate function for quirks.
 
 Signed-off-by: Heikki Krogerus heikki.kroge...@linux.intel.com
 Cc: Huang Rui ray.hu...@amd.com

Looks good for me.

Acked-by: Huang Rui ray.hu...@amd.com

Thanks,
Rui

 ---
  drivers/usb/dwc3/dwc3-pci.c | 96 
 -
  1 file changed, 42 insertions(+), 54 deletions(-)
 
 diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
 index 30d553f..8d95056 100644
 --- a/drivers/usb/dwc3/dwc3-pci.c
 +++ b/drivers/usb/dwc3/dwc3-pci.c
 @@ -33,28 +33,50 @@
  #define PCI_DEVICE_ID_INTEL_SPTLP0x9d30
  #define PCI_DEVICE_ID_INTEL_SPTH 0xa130
  
 -struct dwc3_pci {
 - struct device   *dev;
 - struct platform_device  *dwc3;
 -};
 +static int dwc3_pci_quirks(struct pci_dev *pdev)
 +{
 + if (pdev-vendor == PCI_VENDOR_ID_AMD 
 + pdev-device == PCI_DEVICE_ID_AMD_NL_USB) {
 + struct dwc3_platform_data pdata;
 +
 + memset(pdata, 0, sizeof(pdata));
 +
 + pdata.has_lpm_erratum = true;
 + pdata.lpm_nyet_threshold = 0xf;
 +
 + pdata.u2exit_lfps_quirk = true;
 + pdata.u2ss_inp3_quirk = true;
 + pdata.req_p1p2p3_quirk = true;
 + pdata.del_p1p2p3_quirk = true;
 + pdata.del_phy_power_chg_quirk = true;
 + pdata.lfps_filter_quirk = true;
 + pdata.rx_detect_poll_quirk = true;
 +
 + pdata.tx_de_emphasis_quirk = true;
 + pdata.tx_de_emphasis = 1;
 +
 + /*
 +  * FIXME these quirks should be removed when AMD NL
 +  * taps out
 +  */
 + pdata.disable_scramble_quirk = true;
 + pdata.dis_u3_susphy_quirk = true;
 + pdata.dis_u2_susphy_quirk = true;
 +
 + return platform_device_add_data(pci_get_drvdata(pdev), pdata,
 + sizeof(pdata));
 + }
 +
 + return 0;
 +}
  
  static int dwc3_pci_probe(struct pci_dev *pci,
   const struct pci_device_id *id)
  {
   struct resource res[2];
   struct platform_device  *dwc3;
 - struct dwc3_pci *glue;
   int ret;
   struct device   *dev = pci-dev;
 - struct dwc3_platform_data dwc3_pdata;
 -
 - memset(dwc3_pdata, 0x00, sizeof(dwc3_pdata));
 -
 - glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL);
 - if (!glue)
 - return -ENOMEM;
 -
 - glue-dev = dev;
  
   ret = pcim_enable_device(pci);
   if (ret) {
 @@ -81,68 +103,34 @@ static int dwc3_pci_probe(struct pci_dev *pci,
   res[1].name = dwc_usb3;
   res[1].flags= IORESOURCE_IRQ;
  
 - if (pci-vendor == PCI_VENDOR_ID_AMD 
 - pci-device == PCI_DEVICE_ID_AMD_NL_USB) {
 - dwc3_pdata.has_lpm_erratum = true;
 - dwc3_pdata.lpm_nyet_threshold = 0xf;
 -
 - dwc3_pdata.u2exit_lfps_quirk = true;
 - dwc3_pdata.u2ss_inp3_quirk = true;
 - dwc3_pdata.req_p1p2p3_quirk = true;
 - dwc3_pdata.del_p1p2p3_quirk = true;
 - dwc3_pdata.del_phy_power_chg_quirk = true;
 - dwc3_pdata.lfps_filter_quirk = true;
 - dwc3_pdata.rx_detect_poll_quirk = true;
 -
 - dwc3_pdata.tx_de_emphasis_quirk = true;
 - dwc3_pdata.tx_de_emphasis = 1;
 -
 - /*
 -  * FIXME these quirks should be removed when AMD NL
 -  * taps out
 -  */
 - dwc3_pdata.disable_scramble_quirk = true;
 - dwc3_pdata.dis_u3_susphy_quirk = true;
 - dwc3_pdata.dis_u2_susphy_quirk = true;
 - }
 -
   ret = platform_device_add_resources(dwc3, res, ARRAY_SIZE(res));
   if (ret) {
   dev_err(dev, couldn't add resources to dwc3 device\n);
   return ret;
   }
  
 - pci_set_drvdata(pci, glue);
 -
 - ret = platform_device_add_data(dwc3, dwc3_pdata, sizeof(dwc3_pdata));
 + pci_set_drvdata(pci, dwc3);
 + ret = dwc3_pci_quirks(pci);
   if (ret)
 - goto err3;
 -
 - dma_set_coherent_mask(dwc3-dev, dev-coherent_dma_mask);
 + goto err;
  
 - dwc3-dev.dma_mask = dev-dma_mask;
 - dwc3-dev.dma_parms = dev-dma_parms;
   dwc3-dev.parent = dev;
 - glue-dwc3 = dwc3;
  
   ret = platform_device_add(dwc3);
   if (ret) {
   dev_err(dev, failed to register dwc3 device\n);
 - goto err3;
 + goto err;
   }
  
   return 0;
 -
 -err3:
 +err:
   platform_device_put(dwc3);
   return ret;
  }
  
  static void dwc3_pci_remove(struct pci_dev *pci)
  {
 - struct dwc3_pci *glue = pci_get_drvdata(pci);
 -
 - platform_device_unregister(glue-dwc3);
 + platform_device_unregister(pci_get_drvdata(pci));

Re: [PATCH 2/4] usb: dwc3: gadget: Stop TRB preparation after limit is reached

2015-01-12 Thread Amit Virdi

On 1/13/2015 12:04 AM, Felipe Balbi wrote:

Hi,

On Tue, Jan 06, 2015 at 11:44:23AM +0530, Amit Virdi wrote:

I can certainly provide the dwc3 specific kernel bootup logs, full
regdump and any loglevel you want me to, if that helps


Yeah, if you can provide those, then that'll help me verifying. Full
logs from boot to failure point with VERBOSE_DEBUG enabled (considering
you're not running on anything recent).



Okay. I'll provide full verbose logs, along with the register dump,
when I'm back to the office next week, for the working and non-working
case, but how - as attachment or as inline?


Either way will do but I have a feeling mailing list attachment size
will bite you, so maybe it's best to make a tarball of both logs and
send that as attachment. Compressed text will be very small.



Attached are the dwc3 verbose logs and register dump without and with the
fixes in this patchset.


Sorry for the long delay, it has been a bit hectic.



It's okay!


I can see from your logs that we end up with a Transfer Not Ready
(Transfer Active) event and endpoint has BUSY flag set. I also see that
you're queueing 31 requests and all of them will use 2 TRBs, so we
clearly go over our TRB table.

This fix is, indeed, necessary but we need to improve commit log a bit
so it's extremely clear what the error is. Later, we can improve how we
handle requests in this driver, but that is outside of the scope of your
patchset.

Please improve commit log and resend your series so it can be applied.



Alright! I'll improve the commit messages and, also, cc stable list 
while resending the patches. As I see, you have already picked patches 
[3/4] and [4/4]. So, I'll resend only [1/4] and [2/4]



cheers



Thank you for your patience and kind understanding.
--
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 HID Gadget Support for Intel Edison

2015-01-12 Thread Chris McClimans
The upstream sources for platform/intel-mid aren't in any public git
repos and are distributed
as a tarball. I  have been unable to find any platform/intel-mid
specific mailing lists, so
I created my own repos and tickets to track my progress. I haven't
done much work in the
kernel, but I'm trying to learn. If there are more appropriate or
effective ways to approach Intel,
the Linux (usb) community, or a solution... please let me know. :)

On Fri, Jan 9, 2015 at 1:16 AM, Andrzej Pietrasiewicz
andrze...@samsung.com wrote:
 In the very same file there is an example platform driver; well, at least
 the most important hid-specific parts of it. You must add the usual
 module boilerplate code and in module's init do platform_device_register(),
 while in module's exit do platform_device_unregister().

This ticket tracks my progress as I attempt to understand what parts
of platform/intel-mid to edit.
https://github.com/instantinfrastructure/edison-src/issues/1
I'm currently trying to figure out what all the *_init functions do
hoping I can find where to place the module boilerplate
platform_device_[un]register functions.
I found some references to folks just adding directly to
drivers/usb/gadget/hid.c
https://github.com/instantinfrastructure/linux-yocto-3.10/commit/4a7c648b3d0cf96ccaf6b6fd133577293984ca45
but I still get errors:

# modprobe g_hid
[11677.348746] Device 'hidg.0' does not have a release() function, it
is broken and must be fixed.
modprobe: ERROR: could not insert 'g_hid': No such device

 You might also want to have a look at a configfs-composed gadget

configfs looks awesome! Having just been added to 3.19.0-rc series,
I'm not sure I could get it that kernel to work on the Edison.
There are quite a few differences in platform/intel-mid  in 3.10.17 w/
the intel patches and the vanilla 3.19.0-rc series.
I've tried reaching out to someone from the platform/intel-mid team at
Intel, but have as of yet been unsuccessful.

I also looked at gadgetfs but get failed to start errors:

```
root@edison:~# mkdir /dev/gadget
root@edison:~# rmmod g_multi
root@edison:~# mount -t gadgetfs gadetfs /dev/gadget
[   54.781038] nop dwc3-device.1: failed to start (null): -120
root@edison:~# ls /dev/gadget
dwc3-gadget
root@edison:~# ls /dev/gadget/dwc3-gadget/
ls: /dev/gadget/dwc3-gadget/: Not a directory
root@edison:~# dmesg | tail -10
[   44.184839] g_multi gadget: unbind function 'acm'/f5d7f840
[   44.184862] g_multi gadget: unbind function 'Mass Storage Function'/f5c8c380
[   44.184878] g_multi gadget: unbind
[   44.184947]  lun0: close backing file
[   44.284976] gs_close: ttyGS0 (f5453400,f5e8c300) ...
[   44.285005] gs_close: ttyGS0 (f5453400,f5e8c300) done!
[   44.286415] usb0: stop stats: rx/tx 0/20, errs 0/0
[   54.779953] gadgetfs: USB Gadget filesystem, version 24 Aug 2004
[   54.781010] udc dwc3-device.1: registering UDC driver [(null)]
[   54.781038] nop dwc3-device.1: failed to start (null): -120
root@edison:~# uname -a
Linux edison 3.10.17-poky-edison+ #6 SMP PREEMPT Fri Jan 9 19:27:34
UTC 2015 i686 GNU/Linux
```

= Upstream sources and the resultant repos 
The edison-src build system and platform/intel-mid patch (Yocto derived BSP from
  https://downloadcenter.intel.com/Detail_Desc.aspx?DwnldID=24389)

* https://github.com/instantinfrastructure/edison-src)

The yocto-3.10.17 sources with the patch applied
(https://github.com/instantinfrastructure/edison-src/blob/master/device-software/meta-edison/recipes-kernel/linux/files/upstream_to_edison.patch)

* https://github.com/instantinfrastructure/linux-yocto-3.10
--
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/4] usb: gadget: u_uac1: fix build issue

2015-01-12 Thread Peter Chen
 
 See below error message:
   CC [M]  drivers/gpu/drm/nouveau/core/subdev/vm/nv50.o
   CC [M]  drivers/staging/lustre/lnet/selftest/module.o
 drivers/usb/gadget/function/f_uac1.c: In function ‘f_audio_free_inst’:
 drivers/usb/gadget/function/f_uac1.c:904:21: error: ‘struct f_uac1_opts’ has
 no member named ‘card’
   gaudio_cleanup(opts-card);
  ^
 make[4]: *** [drivers/usb/gadget/function/f_uac1.o] Error 1
 make[3]: *** [drivers/usb/gadget/function] Error 2
 make[2]: *** [drivers/usb/gadget] Error 2
 make[2]: *** Waiting for unfinished jobs
   CC [M]  drivers/staging/lustre/lnet/selftest/ping_test.o
 
 Signed-off-by: Huang Rui ray.hu...@amd.com
 Cc: Peter Chen peter.c...@freescale.com
 ---
 

Oh, my three patches have dependencies, it needs to rebase Felipe's fixes tree 
to fix this problem.

commit 4fde6204df052bb89ba3d915ed6ed9f306f3cfa1
Author: Peter Chen peter.c...@freescale.com
Date:   Mon Dec 1 16:09:27 2014 +0800

usb: gadget: f_uac1: access freed memory at f_audio_free_inst



Peter

 



Re: [PATCH v2 2/3] usb: phy: add lubbock phy driver

2015-01-12 Thread Kishon Vijay Abraham I
Hi,

On Tuesday 13 January 2015 03:21 AM, Felipe Balbi wrote:
 On Sun, Jan 11, 2015 at 10:44:59PM +0400, Dmitry Eremin-Solenikov wrote:
 Hello,

 2015-01-08 19:58 GMT+03:00 Felipe Balbi ba...@ti.com:
 On Sun, Nov 30, 2014 at 01:02:04AM +0300, Dmitry Eremin-Solenikov wrote:
 Extract lubbock-specific code from pxa25x_udc driver. As a bonus, phy
 driver determines connector/VBUS status by reading CPLD register. Also
 it uses a work to call into udc stack, instead of pinging vbus session
 right from irq handler.

 Signed-off-by: Dmitry Eremin-Solenikov dbarysh...@gmail.com
 ---
  drivers/usb/phy/Kconfig   |  10 ++
  drivers/usb/phy/Makefile  |   1 +

 new phy drivers under drivers/phy only, sorry.

 Hmm. How do drivers/phy drivers coordinate with usb gadget subsystem?
 I see none of them calling usb_gadget_vbus_connect/disconnect().
 
 I'll leave that to Kishon, since he wrote drivers/phy. Kishon, any
 hints?

Extcon framework can be used to detect the connector status. So the PHY driver
should register with the extcon framework if it has the capability to determine
the connector status and the gadget driver should register with the extcon
framework if it has to receive the connector status.

I'm not sure if we should be adding these extcon APIs inside the PHY framework
itself as all PHYs might not have the capability to detect the connector status.

Thanks
Kishon
--
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: dwc3: pci: cleanup

2015-01-12 Thread Huang Rui
Hi Felipe,

On Mon, Jan 12, 2015 at 10:52:53AM -0600, Felipe Balbi wrote:
 Hi Huang,
 
 On Mon, Jan 12, 2015 at 02:20:11PM +0200, Heikki Krogerus wrote:
  
  Heikki Krogerus (3):
usb: dwc3: pci: remove registration of NOP PHYs
usb: dwc3: pci: rely on default PM callbacks from PCI driver utility
usb: dwc3: pci: code cleanup
 
 Can you test this series from Heikki and provide your Tested-by ?
 

Sure, looks like heikki's patch set didn't based on testing/next
branch. But no matter, I already applied them to my local machine and
they work well.

Tested-by: Huang Rui ray.hu...@amd.com

Felipe, I found a build error at your testing/next branch, and will
send a patch to fix it, please have a look. :)

Thanks,
Rui
--
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 RESEND 1/2] usb: dwc3: gadget: Fix TRB preparation during SG

2015-01-12 Thread Amit Virdi
When scatter gather (SG) is used, multiple TRBs are prepared from one DWC3
request (dwc3_request). So while preparing TRBs, the 'last' flag should be set
only when it is the last TRB being prepared from the last dwc3_request entry.

The current implementation uses list_is_last to check if the dwc3_request is the
last entry from the request_list. However, list_is_last returns false for the
last entry too. This is because, while preparing the first TRB from a request,
the function dwc3_prepare_one_trb modifies the request's next and prev pointers
while moving the URB to req_queued. Hence, list_is_last always returns false no
matter what.

The correct way is not to access the modified pointers of dwc3_request but to
use list_empty macro instead.

Fixes: e5ba5ec833aa4a76980b512d6a6779643516b850 (usb: dwc3: gadget: fix scatter
gather implementation

Signed-off-by: Amit Virdi amit.vi...@st.com
Cc: sta...@vger.kernel.org # v3.9+
---
 drivers/usb/dwc3/gadget.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 4e2593993fae..cb8939134c32 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -879,8 +879,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool 
starting)
 
if (i == (request-num_mapped_sgs - 1) ||
sg_is_last(s)) {
-   if (list_is_last(req-list,
-   dep-request_list))
+   if (list_empty(dep-request_list))
last_one = true;
chain = false;
}
-- 
1.8.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


[PATCH RESEND 2/2] usb: dwc3: gadget: Stop TRB preparation after limit is reached

2015-01-12 Thread Amit Virdi
DWC3 gadget sets up a pool of 32 TRBs for each EP during initialization. This
means, the max TRBs that can be submitted for an EP is fixed to 32. Since the
request queue for an EP is a linked list, any number of requests can be queued
to it by the gadget layer.  However, the dwc3 driver must not submit TRBs more
than the pool it has created for. This limit wasn't respected when SG was used
resulting in submitting more than the max TRBs, eventually leading to
non-transfer of the TRBs submitted over the max limit.

Root cause:
When SG is used, there are two loops iterating to prepare TRBs:
 - Outer loop over the request_list
 - Inner loop over the SG list
The code was missing break to get out of the outer loop.

Signed-off-by: Amit Virdi amit.vi...@st.com
Cc: sta...@vger.kernel.org # v3.9+
---
 drivers/usb/dwc3/gadget.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index cb8939134c32..6c5e344822b9 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -897,6 +897,9 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool 
starting)
if (last_one)
break;
}
+
+   if (last_one)
+   break;
} else {
dma = req-request.dma;
length = req-request.length;
-- 
1.8.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


[PATCH RESEND 0/2] usb: dwc3: gadget: Bug fixes

2015-01-12 Thread Amit Virdi
This is a re-submission of patches [1/4] and [2/4] from:
http://www.spinics.net/lists/linux-usb/msg118841.html

Commit log of both these patches has been modified for aided clarity. These
patches have been rebased on Balbi's testing/next.

Patches [3/4] and [4/4] were accepted as they were. 

Amit Virdi (2):
  usb: dwc3: gadget: Fix TRB preparation during SG
  usb: dwc3: gadget: Stop TRB preparation after limit is reached

 drivers/usb/dwc3/gadget.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

-- 
1.8.0

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


Re: [PATCH 1/4] usb: gadget: u_uac1: fix build issue

2015-01-12 Thread Huang Rui
On Tue, Jan 13, 2015 at 06:51:40AM +, Peter Chen wrote:
  
  See below error message:
CC [M]  drivers/gpu/drm/nouveau/core/subdev/vm/nv50.o
CC [M]  drivers/staging/lustre/lnet/selftest/module.o
  drivers/usb/gadget/function/f_uac1.c: In function ‘f_audio_free_inst’:
  drivers/usb/gadget/function/f_uac1.c:904:21: error: ‘struct f_uac1_opts’ has
  no member named ‘card’
gaudio_cleanup(opts-card);
   ^
  make[4]: *** [drivers/usb/gadget/function/f_uac1.o] Error 1
  make[3]: *** [drivers/usb/gadget/function] Error 2
  make[2]: *** [drivers/usb/gadget] Error 2
  make[2]: *** Waiting for unfinished jobs
CC [M]  drivers/staging/lustre/lnet/selftest/ping_test.o
  
  Signed-off-by: Huang Rui ray.hu...@amd.com
  Cc: Peter Chen peter.c...@freescale.com
  ---
  
 
 Oh, my three patches have dependencies, it needs to rebase Felipe's fixes 
 tree to fix this problem.
 
 commit 4fde6204df052bb89ba3d915ed6ed9f306f3cfa1
 Author: Peter Chen peter.c...@freescale.com
 Date:   Mon Dec 1 16:09:27 2014 +0800
 
 usb: gadget: f_uac1: access freed memory at f_audio_free_inst
 
 
 
 Peter
 

I see, that's OK. :)

Thanks,
Rui
--
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/4] usb: gadget: u_uac1: fix build issue

2015-01-12 Thread Huang Rui
Since gaudio member is removed at f_uac1_opts, it also needs to remove the
cleanup call of gaudio member at f_uac1_opts when the usb function instance
is freed.

See below error message:
  CC [M]  drivers/gpu/drm/nouveau/core/subdev/vm/nv50.o
  CC [M]  drivers/staging/lustre/lnet/selftest/module.o
drivers/usb/gadget/function/f_uac1.c: In function ‘f_audio_free_inst’:
drivers/usb/gadget/function/f_uac1.c:904:21: error: ‘struct f_uac1_opts’ has no 
member named ‘card’
  gaudio_cleanup(opts-card);
 ^
make[4]: *** [drivers/usb/gadget/function/f_uac1.o] Error 1
make[3]: *** [drivers/usb/gadget/function] Error 2
make[2]: *** [drivers/usb/gadget] Error 2
make[2]: *** Waiting for unfinished jobs
  CC [M]  drivers/staging/lustre/lnet/selftest/ping_test.o

Signed-off-by: Huang Rui ray.hu...@amd.com
Cc: Peter Chen peter.c...@freescale.com
---

Felipe,

As mentioned at previous mail, this fix is for your current testing/next
branch.

Thanks,
Rui

---

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

diff --git a/drivers/usb/gadget/function/f_uac1.c 
b/drivers/usb/gadget/function/f_uac1.c
index 9cf2252..3196e34 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -901,7 +901,7 @@ static void f_audio_free_inst(struct usb_function_instance 
*f)
struct f_uac1_opts *opts;
 
opts = container_of(f, struct f_uac1_opts, func_inst);
-   gaudio_cleanup(opts-card);
+
if (opts-fn_play_alloc)
kfree(opts-fn_play);
if (opts-fn_cap_alloc)
-- 
1.9.1

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


[GIT PULL] USB fixes for v3.19-rc5

2015-01-12 Thread Felipe Balbi
Hi Greg,

Looks like this will be my last pull request for v3.19. Please consider merging
on top of your usb-linus branch.

Note that there will be a conflict when merging on that branch, the solution is
to use the version from my tree as that's more correct. Here's how the related
code should look like:

devm_usb_ge_phy_by_phandle():

[ ... ]

195 phy = __of_usb_find_phy(node);
196 if (IS_ERR(phy)) {
197 devres_free(ptr);
198 goto err1;
199 }
200 
201 if (!try_module_get(phy-dev-driver-owner)) {
202 phy = ERR_PTR(-ENODEV);
203 devres_free(ptr);
204 goto err1;
205 }

[ ... ]

cheers

The following changes since commit 6785a1034461c2d2c205215f63a50a740896e55b:

  usb: gadget: udc: atmel: fix possible IN hang issue (2014-12-22 10:41:15 
-0600)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 
tags/fixes-for-v3.19-rc5

for you to fetch changes up to 5fb694f96e7c19e66b1c55124b98812e32e3efa5:

  usb: gadget: udc: atmel: fix possible oops when unloading module (2015-01-09 
18:15:11 -0600)


usb: fixes for v3.19-rc5

Just three fixes this time. An oops fix in ep_write() from gadgetfs,
another oops for the Atmel UDC when unloading a gadget driver and
the fix for PHY deferred probing.

Signed-off-by: Felipe Balbi ba...@ti.com


Dan Carpenter (1):
  usb: gadget: gadgetfs: fix an oops in ep_write()

Songjun Wu (1):
  usb: gadget: udc: atmel: fix possible oops when unloading module

Thierry Reding (1):
  usb: phy: Restore deferred probing path

 drivers/usb/gadget/legacy/inode.c   |  1 +
 drivers/usb/gadget/udc/atmel_usba_udc.c | 12 +++-
 drivers/usb/phy/phy.c   | 14 ++
 3 files changed, 22 insertions(+), 5 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] usb: udc: add usb_udc_vbus_handler

2015-01-12 Thread Felipe Balbi
On Mon, Jan 12, 2015 at 01:55:28PM +0200, Alexander Shishkin wrote:
 Peter Chen peter.c...@freescale.com writes:
 
  +   mutex_lock(udc_lock);
  +   list_for_each_entry(udc, udc_list, list)
  +   if (udc-gadget == gadget)
  +   goto found;
  +   mutex_unlock(udc_lock);
 
 Not entirely specific to this patchset, but this search pattern is
 copied verbatim in udc-core.c like 5 times. Maybe it makes sense to make
 it a separate function?

yeah, might be better to do that as patch 1 in this series.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 0/3] usb: udc: cleanup pullup operation

2015-01-12 Thread Felipe Balbi
On Mon, Jan 12, 2015 at 01:01:49PM +0200, Alexander Shishkin wrote:
 Peter Chen peter.c...@freescale.com writes:
 
  This patch set cleans up udc drivers which define .pullup API, but
  still call pullup operation at .udc_start or .udc_stop. In fact,
  the related pullup operations are covered by udc core.
 
 Oh, this driver is still around? Are we going to obsolete it with
 chipidea someday?

yeah, we will. I'm not taking any big changes to this driver anymore.
Fixes should be fine, but nothing new.

cheers

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v3 3/5] ARM: at91/dt: update udc compatible strings

2015-01-12 Thread Felipe Balbi
On Mon, Jan 12, 2015 at 11:57:56AM +0100, Boris Brezillon wrote:
 at91sam9g45, at91sam9x5 and sama5 SoCs should not use
 atmel,at91sam9rl-udc for their USB device compatible property since
 this compatible is attached to a specific hardware bug fix.
 
 Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com
 Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com

WARNING: DT compatible string atmel,at91sam9g45-udc appears un-documented -- 
check ./Documentation/devicetree/bindings/
#177: FILE: drivers/usb/gadget/udc/atmel_usba_udc.c:1827:
+   { .compatible = atmel,at91sam9g45-udc },

WARNING: DT compatible string atmel,sama5d3-udc appears un-documented -- 
check ./Documentation/devicetree/bindings/
#178: FILE: drivers/usb/gadget/udc/atmel_usba_udc.c:1828:
+   { .compatible = atmel,sama5d3-udc },

please fix and resend. Also, when resending, could you add Nicolas'
Acked-by since he's already given it ?

Thanks

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 3/3] usb: dwc3: add a quirk for device disconnection issue in Synopsis dwc3 core

2015-01-12 Thread Felipe Balbi
On Mon, Jan 12, 2015 at 06:29:43PM +0100, Paul Bolle wrote:
 On Mon, 2015-01-12 at 11:20 -0600, Felipe Balbi wrote:
  On Sun, Jan 11, 2015 at 11:19:55PM +0800, Sneeker Yeh wrote:
   in case i express unclearly i also put a pdf:
   https://drive.google.com/file/d/0B18MmcvvKjNNbDF6eEdHSzZCazA/view
   
   This issue is defined by a two-way race at disconnect, between
   1) class driver interrupt endpoint resheduling attempts if the ISR gave an
   ep error event due to device detach (it would try 3 times)
   2) Disconnect interrupt on PORTSC_CSC, which is cleared by hub thread
   asynchronously
   3) The hardware IP was configured in silicon with
  - DWC_USB3_SUSPEND_ON_DISCONNECT_EN=1 (this is an IP configuration
  
  yeah, aparently this is another configuration which is not exposed on
  HWPARAMS registers. Paul, can you confirm for us ? I couldn't find it on
  Databook on any of the HWPARAMS registers.
 
 I guess you meant to ask Pawel, because I know nothing at all about all
 that! 

No, it was Paul Zimmerman :-)

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 3/3] usb: dwc3: add a quirk for device disconnection issue in Synopsis dwc3 core

2015-01-12 Thread Felipe Balbi
Hi,

On Sun, Jan 11, 2015 at 11:19:55PM +0800, Sneeker Yeh wrote:
enable the quirk only for you. Isn't there a better way of enabling the
quirk based off of revision detection couple with a look on GHWPARAMS*
registers ?
   
What's tricking me is this claim that only config-free PHYs would be
affected, why ?
   
  
   i'm still struggling now to try to get more information about this.
   some security policy inside Fujitsu make me unable to access full
   information of this errata today.
  
   Someday after i get enough information,
   i shall take your suggestion here that seems better to incur quirk
   dynamically via GHWPARAMS,
   and then send it here again.
 
  ok, hopefully you'll find a way ;-)
 
  I got some update information here finally~
 in case i express unclearly i also put a pdf:
 https://drive.google.com/file/d/0B18MmcvvKjNNbDF6eEdHSzZCazA/view
 
 This issue is defined by a two-way race at disconnect, between
 1) class driver interrupt endpoint resheduling attempts if the ISR gave an
 ep error event due to device detach (it would try 3 times)
 2) Disconnect interrupt on PORTSC_CSC, which is cleared by hub thread
 asynchronously
 3) The hardware IP was configured in silicon with
- DWC_USB3_SUSPEND_ON_DISCONNECT_EN=1 (this is an IP configuration

yeah, aparently this is another configuration which is not exposed on
HWPARAMS registers. Paul, can you confirm for us ? I couldn't find it on
Databook on any of the HWPARAMS registers.

 port whose state cannot be checked from software)
- Synopsys IP version is  3.00a

heh, so pretty much everybody :-)

The IP will auto-suspend itself on device detach with some
 phy-specific interval after CSC is cleared by 2)
 
 If 2) and 3) complete before 1), the interrupts it expects will not be
 generated by the autosuspended IP, leading to a deadlock. Even later
 disconnection procedure would detect that corresponding urb is still
 in-progress and issue a ep stop command, auto-suspended IP still won't
 respond to that command.
 
 this defect would result in this when device detached:
 ---
 [   99.603544] usb 4-1: USB disconnect, device number 2
 [  104.615254] xhci-hcd xhci-hcd.0.auto: xHCI host not responding to stop
 endpoint command.
 [  104.623362] xhci-hcd xhci-hcd.0.auto: Assuming host is dying, halting
 host.
 [  104.653261] xhci-hcd xhci-hcd.0.auto: Host not halted after 16000
 microseconds.
 [  104.660584] xhci-hcd xhci-hcd.0.auto: Non-responsive xHCI host is not
 halting.
 [  104.667817] xhci-hcd xhci-hcd.0.auto: Completing active URBs anyway.
 [  104.674198] xhci-hcd xhci-hcd.0.auto: HC died; cleaning up
 
 As a result, when device detached, we desired to postpone PORTCSC clear
 behind disable slot. it's found that all executed ep command related to
 disconnetion, are executed before disable slot.

Now this is all great information and they should all be part of your
commit log and probably a big comment should be added to code as well.

Thanks for going after all these details, now let's figure out a way to
pass dwc3 revision to xhci, or maybe we pass just a flag for the quirk,
something like:

if (dwc-revision  3.00a  dwc-has_suspend_on_disconnect)
xhci_pdata.delay_portcsc_clear = true;

or something similar to that.

cheers

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 3/3] usb: dwc3: add a quirk for device disconnection issue in Synopsis dwc3 core

2015-01-12 Thread Paul Bolle
On Mon, 2015-01-12 at 11:20 -0600, Felipe Balbi wrote:
 On Sun, Jan 11, 2015 at 11:19:55PM +0800, Sneeker Yeh wrote:
  in case i express unclearly i also put a pdf:
  https://drive.google.com/file/d/0B18MmcvvKjNNbDF6eEdHSzZCazA/view
  
  This issue is defined by a two-way race at disconnect, between
  1) class driver interrupt endpoint resheduling attempts if the ISR gave an
  ep error event due to device detach (it would try 3 times)
  2) Disconnect interrupt on PORTSC_CSC, which is cleared by hub thread
  asynchronously
  3) The hardware IP was configured in silicon with
 - DWC_USB3_SUSPEND_ON_DISCONNECT_EN=1 (this is an IP configuration
 
 yeah, aparently this is another configuration which is not exposed on
 HWPARAMS registers. Paul, can you confirm for us ? I couldn't find it on
 Databook on any of the HWPARAMS registers.

I guess you meant to ask Pawel, because I know nothing at all about all
that! 

Thanks,


Paul Bolle

--
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: dwc3: pci: cleanup

2015-01-12 Thread Felipe Balbi
Hi Huang,

On Mon, Jan 12, 2015 at 02:20:11PM +0200, Heikki Krogerus wrote:
 
 Heikki Krogerus (3):
   usb: dwc3: pci: remove registration of NOP PHYs
   usb: dwc3: pci: rely on default PM callbacks from PCI driver utility
   usb: dwc3: pci: code cleanup

Can you test this series from Heikki and provide your Tested-by ?

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH] usb-storage/SCSI: blacklist FUA on JMicron 152d:2566 USB-SATA controller

2015-01-12 Thread Dmitry Nezhevenko
It looks like FUA support is broken on JMicron 152d:2566 bridge:

[223159.885704] sd 7:0:0:0: [sdc] Write Protect is off
[223159.885706] sd 7:0:0:0: [sdc] Mode Sense: 47 00 10 08
[223159.885942] sd 7:0:0:0: [sdc] Write cache: enabled, read cache: enabled, 
supports DPO and FUA

[223283.691677] sd 7:0:0:0: [sdc]
[223283.691680] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[223283.691681] sd 7:0:0:0: [sdc]
[223283.691682] Sense Key : Illegal Request [current]
[223283.691684] sd 7:0:0:0: [sdc]
[223283.691685] Add. Sense: Invalid field in cdb
[223283.691686] sd 7:0:0:0: [sdc] CDB:
[223283.691687] Write(10): 2a 08 15 d0 83 0d 00 00 01 00
[223283.691690] blk_update_request: critical target error, dev sdc, sector 
2927892584

This patch adds blacklist flag so that sd will not use FUA

Signed-off-by: Dmitry Nezhevenko d...@dion.org.ua
Cc: Phil Dibowitz p...@ipom.com
Cc: Alan Stern st...@rowland.harvard.edu
---
 drivers/usb/storage/unusual_devs.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/storage/unusual_devs.h 
b/drivers/usb/storage/unusual_devs.h
index 11c7a96..8adb530 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1995,6 +1995,13 @@ UNUSUAL_DEV(  0x152d, 0x2329, 0x0100, 0x0100,
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ),
 
+/* Reported by Dmitry Nezhevenko d...@dion.org.ua */
+UNUSUAL_DEV(  0x152d, 0x2566, 0x0114, 0x0114,
+   JMicron,
+   USB to ATA/ATAPI Bridge,
+   USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+   US_FL_BROKEN_FUA ),
+
 /* Entrega Technologies U1-SC25 (later Xircom PortGear PGSCSI)
  * and Mac USB Dock USB-SCSI */
 UNUSUAL_DEV(  0x1645, 0x0007, 0x0100, 0x0133,

-- 
WBR, Dmitry
--
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/4] usb: dwc3: gadget: Stop TRB preparation after limit is reached

2015-01-12 Thread Felipe Balbi
Hi,

On Tue, Jan 06, 2015 at 11:44:23AM +0530, Amit Virdi wrote:
 I can certainly provide the dwc3 specific kernel bootup logs, full
 regdump and any loglevel you want me to, if that helps
 
 Yeah, if you can provide those, then that'll help me verifying. Full
 logs from boot to failure point with VERBOSE_DEBUG enabled (considering
 you're not running on anything recent).
 
 
 Okay. I'll provide full verbose logs, along with the register dump,
 when I'm back to the office next week, for the working and non-working
 case, but how - as attachment or as inline?
 
 Either way will do but I have a feeling mailing list attachment size
 will bite you, so maybe it's best to make a tarball of both logs and
 send that as attachment. Compressed text will be very small.
 
 
 Attached are the dwc3 verbose logs and register dump without and with the
 fixes in this patchset.

Sorry for the long delay, it has been a bit hectic.

I can see from your logs that we end up with a Transfer Not Ready
(Transfer Active) event and endpoint has BUSY flag set. I also see that
you're queueing 31 requests and all of them will use 2 TRBs, so we
clearly go over our TRB table.

This fix is, indeed, necessary but we need to improve commit log a bit
so it's extremely clear what the error is. Later, we can improve how we
handle requests in this driver, but that is outside of the scope of your
patchset.

Please improve commit log and resend your series so it can be applied.

cheers

-- 
balbi


signature.asc
Description: Digital signature


Re: [GIT PULL] USB fixes for v3.19-rc5

2015-01-12 Thread Greg KH
On Mon, Jan 12, 2015 at 12:07:20PM -0600, Felipe Balbi wrote:
 Hi Greg,
 
 Looks like this will be my last pull request for v3.19. Please consider 
 merging
 on top of your usb-linus branch.
 
 Note that there will be a conflict when merging on that branch, the solution 
 is
 to use the version from my tree as that's more correct. Here's how the related
 code should look like:
 
 devm_usb_ge_phy_by_phandle():
 
 [ ... ]
 
 195 phy = __of_usb_find_phy(node);
 196 if (IS_ERR(phy)) {
 197 devres_free(ptr);
 198 goto err1;
 199 }
 200 
 201 if (!try_module_get(phy-dev-driver-owner)) {
 202 phy = ERR_PTR(-ENODEV);
 203 devres_free(ptr);
 204 goto err1;
 205 }
 
 [ ... ]
 
 cheers
 
 The following changes since commit 6785a1034461c2d2c205215f63a50a740896e55b:
 
   usb: gadget: udc: atmel: fix possible IN hang issue (2014-12-22 10:41:15 
 -0600)
 
 are available in the git repository at:
 
   git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 
 tags/fixes-for-v3.19-rc5

Pulled and pushed out.

thanks,

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