Re: [Umap2][7/11][160a:3184] NULL pointer dereference

2016-09-23 Thread Malcolm Priestley



On 22/09/16 20:50, Malcolm Priestley wrote:



On 22/09/16 15:25, Oliver Neukum wrote:

On Thu, 2016-09-22 at 14:46 +0300, Binyamin Sharet wrote:


-- Binyamin


I compiled the kernel without BPF and still got an issue (attached)
How can I verify the BPF is not enabled/part of the kernel?

-- Binyamin


Could you test the attached patch?

ieee80211_free_hw frees the priv.

usb_set_intfdata is set to hw_>priv, If vt6656_disconnect is called
there is a null check.

I was wrong ieee80211_free_hw does not null the ieee80211_hw->priv offset.

I have replicated this bug with the hardware.

This patch fixes the bug.

Good catch.

Regards


Malcolm
--
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 v6 1/1] USB: serial: cp210x: Adding GPIO support for CP2105

2016-09-23 Thread Martyn Welch
This patch adds support for the GPIO found on the CP2105. Unlike the GPIO
provided by some of the other devices supported by the cp210x driver, the
GPIO on the CP2015 is muxed on pins otherwise used for serial control
lines. The GPIO have been configured in 2 separate banks as the choice to
configure the pins for GPIO is made separately for pins shared with each
of the 2 serial ports this device provides, though the choice is made for
all pins associated with that port in one go. The choice of whether to use
the pins for GPIO or serial is made by adding configuration to a one-time
programable PROM in the chip and can not be changed at runtime. The device
defaults to GPIO.

This device supports either push-pull or open-drain modes, it doesn't
provide an explicit input mode, though the state of the GPIO can be read
when used in open-drain mode. Like with pin use, the mode is configured in
the one-time programable PROM and can't be changed at runtime.

Signed-off-by: Martyn Welch 
---

V2: - Doesn't break build when gpiolib isn't selected.

V3: - Tracking GPIO state so pins no longer get their state changed should
  the pin be in open-drain mode and be pulled down externally whilst
  another pin is set.
- Reworked buffers and moved to byte accesses to remove the
  questionable buffer size logic and byte swapping.
- Added error reporting.
- Removed incorrect/pointless comments.
- Renamed tmp variable to make use clearer.

V4: - Fixed memory leak in cp210x_gpio_get error path.

V5: - Determining shared GPIO based on device type.
- Reordered vendor specific values by value.
- Use interface device for gpio messages.
- Remove unnecessary empty lines.
- Using kzalloc rather than kcalloc.
- Added locking to port_priv->output_state.
- Added dummy cp2105_shared_gpio_init for !CONFIG_GPIOLIB.
- Removed unnecessary masking on u8.
- Added support for use of GPIO pin as RS485 traffic indication or
  activity LEDs.
- Use correct dev for GPIO device.
- Set can_sleep.
- Roll in initial configuration state support.
- Print error message & continue if GPIO fails.
- Simplified ifdef'ing.

V6: - Remove unused define.
- Renamed cp210x_dev_private, cp210x_serial_private.
- Moved GPIO variables to cp210x_serial_private.
- Renamed PARTNUM defines.
- Switched to using bitops for GPIO mode bits.
- Moved vendor-specific defiles to end of defines.
- Added helpers for vendor requests.
- Using structs rather than byte arrays for sent and recieved values.
- Exposing total number of GPIOs and refusing requests for pins not
  configured as GPIO, removing gpio_map in process.
- Added checks for allocation failures.
- Using same label for both banks of GPIO.
- Moved GPIO into to attach function.

 drivers/usb/serial/cp210x.c | 354 +++-
 1 file changed, 351 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 4d6a5c6..4c6b0cb 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -23,6 +23,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #define DRIVER_DESC "Silicon Labs CP210x RS232 serial adaptor driver"
 
@@ -44,6 +47,8 @@ static int cp210x_tiocmset(struct tty_struct *, unsigned int, 
unsigned int);
 static int cp210x_tiocmset_port(struct usb_serial_port *port,
unsigned int, unsigned int);
 static void cp210x_break_ctl(struct tty_struct *, int);
+static int cp210x_attach(struct usb_serial *);
+static void cp210x_release(struct usb_serial *);
 static int cp210x_port_probe(struct usb_serial_port *);
 static int cp210x_port_remove(struct usb_serial_port *);
 static void cp210x_dtr_rts(struct usb_serial_port *p, int on);
@@ -207,6 +212,15 @@ static const struct usb_device_id id_table[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table);
 
+struct cp210x_serial_private {
+#ifdef CONFIG_GPIOLIB
+   struct usb_serial   *serial;
+   struct gpio_chipgc;
+   u8  config;
+#endif
+   u8  partnum;
+};
+
 struct cp210x_port_private {
__u8bInterfaceNumber;
boolhas_swapped_line_ctl;
@@ -228,6 +242,8 @@ static struct usb_serial_driver cp210x_device = {
.tx_empty   = cp210x_tx_empty,
.tiocmget   = cp210x_tiocmget,
.tiocmset   = cp210x_tiocmset,
+   .attach = cp210x_attach,
+   .release= cp210x_release,
.port_probe = cp210x_port_probe,
.port_remove= cp210x_port_remove,
.dtr_rts= cp210x_dtr_rts
@@ -270,6 +286,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
 #define CP210X_SET_CHARS   0x19
 #define CP210X_GET_BAUDRATE0x1D
 #define 

[PATCH] Net Driver: Add Cypress GX3 VID=04b4 PID=3610.

2016-09-23 Thread chris.roth
From: Chris Roth 

From: Allan Chou 

Add support for Cypress GX3 SuperSpeed to Gigabit Ethernet
Bridge Controller (Vendor=04b4 ProdID=3610).

Patch verified on x64 linux kernel 4.7.4 system with the
Kensington SD4600P USB-C Universal Dock with Power, which uses the
Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller.

A similar patch was signed-off and tested-by Allan Chou
 on 2015-12-01.

Allan verified his similar patch on x86 Linux kernel 4.1.6 system
with Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller.

Tested-by: Allan Chou 
Tested-by: Chris Roth 

Signed-off-by: Allan Chou 
Signed-off-by: Chris Roth 
---
 drivers/net/usb/ax88179_178a.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index e6338c1..8a6675d 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -1656,6 +1656,19 @@ static const struct driver_info ax88178a_info = {
.tx_fixup = ax88179_tx_fixup,
 };
 
+static const struct driver_info cypress_GX3_info = {
+   .description = "Cypress GX3 SuperSpeed to Gigabit Ethernet Controller",
+   .bind = ax88179_bind,
+   .unbind = ax88179_unbind,
+   .status = ax88179_status,
+   .link_reset = ax88179_link_reset,
+   .reset = ax88179_reset,
+   .stop = ax88179_stop,
+   .flags = FLAG_ETHER | FLAG_FRAMING_AX,
+   .rx_fixup = ax88179_rx_fixup,
+   .tx_fixup = ax88179_tx_fixup,
+};
+
 static const struct driver_info dlink_dub1312_info = {
.description = "D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter",
.bind = ax88179_bind,
@@ -1718,6 +1731,10 @@ static const struct usb_device_id products[] = {
USB_DEVICE(0x0b95, 0x178a),
.driver_info = (unsigned long)_info,
 }, {
+   /* Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller */
+   USB_DEVICE(0x04b4, 0x3610),
+   .driver_info = (unsigned long)_GX3_info,
+}, {
/* D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter */
USB_DEVICE(0x2001, 0x4a00),
.driver_info = (unsigned long)_dub1312_info,
-- 
2.7.4

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


Re: [PATCH v5 2/2] usb: chipidea: imx: Add binding to disable USB 60Mhz clock

2016-09-23 Thread Rob Herring
On Wed, Sep 21, 2016 at 11:07:07AM +0200, Fabien Lahoudere wrote:
> This binding allow to disable the internal 60Mhz clock for USB host2 or
> host3.
> 
> Signed-off-by: Fabien Lahoudere 
> ---
>  Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt |  1 +
>  drivers/usb/chipidea/ci_hdrc_imx.c |  2 ++
>  drivers/usb/chipidea/ci_hdrc_imx.h |  1 +
>  drivers/usb/chipidea/usbmisc_imx.c | 13 +
>  4 files changed, 17 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt 
> b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> index 0e03344..f83da66 100644
> --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> @@ -84,6 +84,7 @@ i.mx specific properties
>  - over-current-active-high: over current signal polarity is high active,
>typically over current signal polarity is low active.
>  - external-vbus-divider: enables off-chip resistor divider for Vbus
> +- disable-int60ck: disable internal 60MHz clock for usb host2 or host3 on 
> imx53

Doesn't this depend on something else like the type of phy connected? If 
not, when can you do this or not?

Rob
--
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] Net Driver: Add Cypress GX3 VID=04b4 PID=3610.

2016-09-23 Thread Greg KH
On Fri, Sep 23, 2016 at 12:24:50PM -0600, chris.r...@usask.ca wrote:
> From: Chris Roth 
> 
> Add support for Cypress GX3 SuperSpeed to Gigabit Ethernet
> Bridge Controller (Vendor=04b4 ProdID=3610).
> 
> Patch verified on x64 linux kernel 4.7.4 system with the
> Kensington SD4600P USB-C Universal Dock with Power, which uses the
> Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller.
> 
> A similar patch was signed-off and tested-by Allan Chou
>  on 2015-12-01.

Then you should put a "From: " line at the top of this patch that looks
like:
From: Allan Chou 
at the top of the patch and then a blank line, and put the signed-off-by
back in the patch as well, with yours below it.  The file
Documentation/SubmittingPatches should show you how to do this.

Can you try again?

thanks,

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


[PATCH] Net Driver: Add Cypress GX3 VID=04b4 PID=3610.

2016-09-23 Thread chris.roth
From: Chris Roth 

Add support for Cypress GX3 SuperSpeed to Gigabit Ethernet
Bridge Controller (Vendor=04b4 ProdID=3610).

Patch verified on x64 linux kernel 4.7.4 system with the
Kensington SD4600P USB-C Universal Dock with Power, which uses the
Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller.

A similar patch was signed-off and tested-by Allan Chou
 on 2015-12-01.

Allan verified his similar patch on x86 Linux kernel 4.1.6 system
with Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller.

Signed-off-by: Chris Roth 
---
 drivers/net/usb/ax88179_178a.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index e6338c1..8a6675d 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -1656,6 +1656,19 @@ static const struct driver_info ax88178a_info = {
.tx_fixup = ax88179_tx_fixup,
 };
 
+static const struct driver_info cypress_GX3_info = {
+   .description = "Cypress GX3 SuperSpeed to Gigabit Ethernet Controller",
+   .bind = ax88179_bind,
+   .unbind = ax88179_unbind,
+   .status = ax88179_status,
+   .link_reset = ax88179_link_reset,
+   .reset = ax88179_reset,
+   .stop = ax88179_stop,
+   .flags = FLAG_ETHER | FLAG_FRAMING_AX,
+   .rx_fixup = ax88179_rx_fixup,
+   .tx_fixup = ax88179_tx_fixup,
+};
+
 static const struct driver_info dlink_dub1312_info = {
.description = "D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter",
.bind = ax88179_bind,
@@ -1718,6 +1731,10 @@ static const struct usb_device_id products[] = {
USB_DEVICE(0x0b95, 0x178a),
.driver_info = (unsigned long)_info,
 }, {
+   /* Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller */
+   USB_DEVICE(0x04b4, 0x3610),
+   .driver_info = (unsigned long)_GX3_info,
+}, {
/* D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter */
USB_DEVICE(0x2001, 0x4a00),
.driver_info = (unsigned long)_dub1312_info,
-- 
2.7.4

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


[PATCH] USB: serial: cp210x: Add ID for a Juniper console

2016-09-23 Thread Kyle Jones
Signed-off-by: Kyle Jones 
---
Bus 004 Device 002: ID 10c4:8470 Cygnal Integrated Products, Inc.
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   1.10
  bDeviceClass0
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize064
  idVendor   0x10c4 Cygnal Integrated Products, Inc.
  idProduct  0x8470
  bcdDevice1.01
  iManufacturer   1 Silicon Labs
  iProduct2 Juniper Networks BX Series System Console
  iSerial 3
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   32
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  0
bmAttributes 0xc0
  Self Powered
MaxPower   50mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   2
  bInterfaceClass   255 Vendor Specific Class
  bInterfaceSubClass  0
  bInterfaceProtocol  0
  iInterface  2 Juniper Networks BX Series System Console
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81  EP 1 IN
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0040  1x 64 bytes
bInterval   0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01  EP 1 OUT
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0040  1x 64 bytes
bInterval   0
---
 drivers/usb/serial/cp210x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 4d6a5c6..54a4de0 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -118,6 +118,7 @@ static const struct usb_device_id id_table[] = {
{ USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */
{ USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 
GSM/GPRS Modem */
{ USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */
+   { USB_DEVICE(0x10C4, 0x8470) }, /* Juniper Networks BX Series System 
Console */
{ USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */
{ USB_DEVICE(0x10C4, 0x84B6) }, /* Starizona Hyperion */
{ USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */
-- 
2.10.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] usb: xhci: mark xhci_unmap_td_bounce_buffer() static

2016-09-23 Thread Arnd Bergmann
On Friday, September 23, 2016 5:08:37 PM CEST Greg KH wrote:
> On Fri, Sep 23, 2016 at 09:46:13PM +0800, Baoyou Xie wrote:
> > We get 1 warning when building kernel with W=1:
> > drivers/usb/host/xhci-ring.c:608:6: warning: no previous prototype for 
> > 'xhci_unmap_td_bounce_buffer' [-Wmissing-prototypes]
> > 
> > In fact, this function is only used in the file in which it is
> > declared and don't need a declaration, but can be made static.
> > so this patch marks this function with 'static'.
> 
> Any reason you aren't using sparse for all of these 'static' functions
> you are finding?  It should be easier than using 'W=1'.

It was my idea, I suggest to Baoyou to enable the warning standalone
and fix all instances he finds, so we can eventually enable it by default
for everyone. Once that is in place, we won't even need to use sparse
any more. I suspect it will take a while before all of his patches are
merged upstream, but IIRC he has sent almost all the ones needed for
an arm "allmodconfig" build now, and a lot have been accepted.

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


Re: [PATCH] usb: xhci: mark xhci_unmap_td_bounce_buffer() static

2016-09-23 Thread Greg KH
On Fri, Sep 23, 2016 at 09:46:13PM +0800, Baoyou Xie wrote:
> We get 1 warning when building kernel with W=1:
> drivers/usb/host/xhci-ring.c:608:6: warning: no previous prototype for 
> 'xhci_unmap_td_bounce_buffer' [-Wmissing-prototypes]
> 
> In fact, this function is only used in the file in which it is
> declared and don't need a declaration, but can be made static.
> so this patch marks this function with 'static'.

Any reason you aren't using sparse for all of these 'static' functions
you are finding?  It should be easier than using 'W=1'.

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] usb: gadget: udc: atmel: fix endpoint name

2016-09-23 Thread Greg Kroah-Hartman
On Fri, Sep 23, 2016 at 04:20:45PM +0200, Nicolas Ferre wrote:
> Le 16/09/2016 à 10:36, Nicolas Ferre a écrit :
> > Le 15/09/2016 à 17:07, Alexandre Belloni a écrit :
> >> Since commit c32b5bcfa3c4 ("ARM: dts: at91: Fix USB endpoint nodes"),
> >> atmel_usba_udc fails with:
> >>
> >> [ cut here ]
> >> WARNING: CPU: 0 PID: 0 at include/linux/usb/gadget.h:405
> >> ecm_do_notify+0x188/0x1a0
> >> Modules linked in:
> >> CPU: 0 PID: 0 Comm: swapper Not tainted 4.7.0+ #15
> >> Hardware name: Atmel SAMA5
> >> [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
> >> [] (show_stack) from [] (__warn+0xe4/0xfc)
> >> [] (__warn) from [] (warn_slowpath_null+0x20/0x28)
> >> [] (warn_slowpath_null) from [] 
> >> (ecm_do_notify+0x188/0x1a0)
> >> [] (ecm_do_notify) from [] (ecm_set_alt+0x74/0x1ac)
> >> [] (ecm_set_alt) from [] (composite_setup+0xfc0/0x19f8)
> >> [] (composite_setup) from [] (usba_udc_irq+0x8f4/0xd9c)
> >> [] (usba_udc_irq) from [] 
> >> (handle_irq_event_percpu+0x9c/0x158)
> >> [] (handle_irq_event_percpu) from [] 
> >> (handle_irq_event+0x28/0x3c)
> >> [] (handle_irq_event) from [] 
> >> (handle_fasteoi_irq+0xa0/0x168)
> >> [] (handle_fasteoi_irq) from [] 
> >> (generic_handle_irq+0x24/0x34)
> >> [] (generic_handle_irq) from [] 
> >> (__handle_domain_irq+0x54/0xa8)
> >> [] (__handle_domain_irq) from [] (__irq_svc+0x54/0x70)
> >> [] (__irq_svc) from [] (arch_cpu_idle+0x38/0x3c)
> >> [] (arch_cpu_idle) from [] 
> >> (cpu_startup_entry+0x9c/0xdc)
> >> [] (cpu_startup_entry) from [] 
> >> (start_kernel+0x354/0x360)
> >> [] (start_kernel) from [<20008078>] (0x20008078)
> >> ---[ end trace e7cf9dcebf4815a6 ]---
> >>
> >> Fixes: c32b5bcfa3c4 ("ARM: dts: at91: Fix USB endpoint nodes")
> >> Reported-by: Richard Genoud 
> >> Signed-off-by: Alexandre Belloni 
> > 
> > Acked-by: Nicolas Ferre 
> > 
> > Felipe, Greg,
> > It is clearly a regression and material for 4.8-fixes. But I do know
> > that we are very late in the process :-(
> > Please do what you can to make it progress before 4.8-final but I'm
> > truly aware of the challenge.
> 
> Any chance that we can have it (aka ping)?

It's Felipe's area, not mine :)
--
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


From Mrs. Perahta Orlantha

2016-09-23 Thread Mrs. Perahta Orlantha
Please, kindly view my attachment file 


Dear beloved Perahta Orlantha.doc
Description: MS-Word document


Re: [RFC/PATCH] usb: misc: Add a driver for TC7USB40MU

2016-09-23 Thread Rob Herring
On Wed, Sep 14, 2016 at 01:55:02AM -0700, Stephen Boyd wrote:
> Quoting Stephen Boyd (2016-09-13 18:42:46)
> > On the db410c 96boards platform we have a TC7USB40MU[1] on the
> > board to mux the D+/D- lines from the SoC between a micro usb
> > "device" port and a USB hub for "host" roles. Upon a role switch,
> > we need to change this mux to forward the D+/D- lines to either
> > the port or the hub. Therefore, introduce a driver for this
> > device that intercepts extcon USB_HOST events and logically
> > asserts a gpio to mux the "host" D+/D- lines when a host cable is
> > attached. When the cable goes away, it will logically deassert
> > the gpio and mux the "device" lines.
> > 
> > [1] 
> > https://toshiba.semicon-storage.com/ap-en/product/logic/bus-switch/detail.TC7USB40MU.html
> > 
> > Cc: MyungJoo Ham 
> > Cc: Chanwoo Choi 
> > Cc: 
> > Signed-off-by: Stephen Boyd 
> > ---
> > 
> > Should I make the extcon part optional? I could see a case where there are 
> > two
> > "OTG" ports connected to the mux (or two hubs), and for some reason the
> > software may want to mux between them at runtime. If we mandate an extcon,
> > that won't be possible to support. Perhaps it would be better to have
> > the node, but connect it to the usb controller with a phandle (maybe 
> > of_graph
> > endpoints would be useful too) so that when the controller wants to mux over
> > a port it can do so.

I've mentioned my opinion on extcon before. The first clue that it needs 
work is a Linux subsystem name is used for the binding. 

> Here's some dts mock-up on top of the db410c for the of_graph stuff. I
> haven't written any code around it, but the idea is to allow the binding
> to specify how the mux is connected to upstream and downstream D+/D-
> lines. This way, we can do some dt parsing of the endpoints and their
> parent nodes to figure out if the mux needs to be set high or low to use
> a device connector or a usb hub based on if the id cable is present.
> Maybe I'm over thinking things though and we could just have a DT
> property for that.

I think the connector nodes are on the right track, but of-graph doesn't 
work here because we already have a way to describe USB buses in DT. 
Following that, would something like this work for you? The vbus-supply 
and id-gpios are just examples and may not always be there like if the 
hub controls each port's vbus directly.

usb-controller@1234 {
usb-switch@0 {
compatible = "toshiba,tc7usb40mu";
hub@0 {
compatible = "some-hub";
port@0 {
compatible = "usb-A-connector"
vbus-supply = ...;
};
port@1 {
compatible = "usb-A-connector"
vbus-supply = ...;
};

};
connector@1 {
compatible = "usb-ub-connector";
vbus-supply = ...;
id-gpios = <>;
};
};
};

Rob
--
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: gadget: udc: atmel: fix endpoint name

2016-09-23 Thread Nicolas Ferre
Le 16/09/2016 à 10:36, Nicolas Ferre a écrit :
> Le 15/09/2016 à 17:07, Alexandre Belloni a écrit :
>> Since commit c32b5bcfa3c4 ("ARM: dts: at91: Fix USB endpoint nodes"),
>> atmel_usba_udc fails with:
>>
>> [ cut here ]
>> WARNING: CPU: 0 PID: 0 at include/linux/usb/gadget.h:405
>> ecm_do_notify+0x188/0x1a0
>> Modules linked in:
>> CPU: 0 PID: 0 Comm: swapper Not tainted 4.7.0+ #15
>> Hardware name: Atmel SAMA5
>> [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
>> [] (show_stack) from [] (__warn+0xe4/0xfc)
>> [] (__warn) from [] (warn_slowpath_null+0x20/0x28)
>> [] (warn_slowpath_null) from [] 
>> (ecm_do_notify+0x188/0x1a0)
>> [] (ecm_do_notify) from [] (ecm_set_alt+0x74/0x1ac)
>> [] (ecm_set_alt) from [] (composite_setup+0xfc0/0x19f8)
>> [] (composite_setup) from [] (usba_udc_irq+0x8f4/0xd9c)
>> [] (usba_udc_irq) from [] 
>> (handle_irq_event_percpu+0x9c/0x158)
>> [] (handle_irq_event_percpu) from [] 
>> (handle_irq_event+0x28/0x3c)
>> [] (handle_irq_event) from [] 
>> (handle_fasteoi_irq+0xa0/0x168)
>> [] (handle_fasteoi_irq) from [] 
>> (generic_handle_irq+0x24/0x34)
>> [] (generic_handle_irq) from [] 
>> (__handle_domain_irq+0x54/0xa8)
>> [] (__handle_domain_irq) from [] (__irq_svc+0x54/0x70)
>> [] (__irq_svc) from [] (arch_cpu_idle+0x38/0x3c)
>> [] (arch_cpu_idle) from [] (cpu_startup_entry+0x9c/0xdc)
>> [] (cpu_startup_entry) from [] (start_kernel+0x354/0x360)
>> [] (start_kernel) from [<20008078>] (0x20008078)
>> ---[ end trace e7cf9dcebf4815a6 ]---
>>
>> Fixes: c32b5bcfa3c4 ("ARM: dts: at91: Fix USB endpoint nodes")
>> Reported-by: Richard Genoud 
>> Signed-off-by: Alexandre Belloni 
> 
> Acked-by: Nicolas Ferre 
> 
> Felipe, Greg,
> It is clearly a regression and material for 4.8-fixes. But I do know
> that we are very late in the process :-(
> Please do what you can to make it progress before 4.8-final but I'm
> truly aware of the challenge.

Any chance that we can have it (aka ping)?

Bye,

> Thanks to Richard for finding this and Alexandre for the quick correction.
> 
> Bye,
> 
>> ---
>>  drivers/usb/gadget/udc/atmel_usba_udc.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
>> b/drivers/usb/gadget/udc/atmel_usba_udc.c
>> index bb1f6c8f0f01..45bc997d0711 100644
>> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
>> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
>> @@ -1978,7 +1978,7 @@ static struct usba_ep * atmel_udc_of_init(struct 
>> platform_device *pdev,
>>  dev_err(>dev, "of_probe: name error(%d)\n", ret);
>>  goto err;
>>  }
>> -ep->ep.name = name;
>> +ep->ep.name = kasprintf(GFP_KERNEL, "ep%d", ep->index);
>>  
>>  ep->ep_regs = udc->regs + USBA_EPT_BASE(i);
>>  ep->dma_regs = udc->regs + USBA_DMA_BASE(i);
>>
> 
> 


-- 
Nicolas Ferre
--
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] musb: sunxi: Remove custom babble handling

2016-09-23 Thread Bin Liu
On Fri, Sep 23, 2016 at 04:42:26PM +0300, Hans de Goede wrote:
> Hi,
> 
> On 09/22/2016 05:30 PM, Bin Liu wrote:
> >Hi,
> >
> >On Thu, Sep 22, 2016 at 05:03:39PM +0300, Hans de Goede wrote:
> >>Hi,
> >>
> >>On 09/22/2016 04:54 PM, Bin Liu wrote:
> >>>Hi,
> >>>
> >>>On Thu, Sep 22, 2016 at 02:19:00PM +0300, Hans de Goede wrote:
> The musb-core now a days always treats babble errors in host mode
> >>>
> >>>I don't think this statement is accurate. You might want to change it to
> >>>"The musb core already handles babble interrupt" or something else.
> >>
> >>It is accurate if you look in the history at drivers/usb/musb
> >>commits around 15-03-10 you will see 2 relevant commits:
> >>
> >>https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/usb/musb?id=b4dc38fd45b63e3da2bc98db5d283a15a637a2fa
> >>
> >>"usb: musb: core: simplify musb_recover_work()"
> >>
> >>This commits introduces calling musb_root_disconnect(musb)
> >>on babble errors, that was not happening before which is why
> >
> >That is true, but calling musb_root_disconnect() is just one step of the
> >recovery in musb core, not all.
> >
> >The statement of "treats babble errors in host mode as disconnects"
> >implies all the babble handling is just disconnect, which is not
> >accurate.
> 
> Ok, I'll send out a v3 with an improved commit msg.

Thanks.

If Kishon gives his Acked-by, I will take all the 3 patches. Or
I can just take the 2 musb patches into my tree.

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


[PATCH] usb: xhci: mark xhci_unmap_td_bounce_buffer() static

2016-09-23 Thread Baoyou Xie
We get 1 warning when building kernel with W=1:
drivers/usb/host/xhci-ring.c:608:6: warning: no previous prototype for 
'xhci_unmap_td_bounce_buffer' [-Wmissing-prototypes]

In fact, this function is only used in the file in which it is
declared and don't need a declaration, but can be made static.
so this patch marks this function with 'static'.

Signed-off-by: Baoyou Xie 
---
 drivers/usb/host/xhci-ring.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 797137e..9cf70c9 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -605,8 +605,9 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci,
}
 }
 
-void xhci_unmap_td_bounce_buffer(struct xhci_hcd *xhci, struct xhci_ring *ring,
-struct xhci_td *td)
+static void
+xhci_unmap_td_bounce_buffer(struct xhci_hcd *xhci, struct xhci_ring *ring,
+   struct xhci_td *td)
 {
struct device *dev = xhci_to_hcd(xhci)->self.controller;
struct xhci_segment *seg = td->bounce_seg;
-- 
2.7.4

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


[PATCH] usb: core: hcd: add missing header dependencies

2016-09-23 Thread Baoyou Xie
We get 1 warning when building kernel with W=1:
drivers/usb/core/hcd.c:2390:5: warning: no previous prototype for 
'usb_bus_start_enum' [-Wmissing-prototypes]

In fact, these functions are declared in linux/usb/otg.h, so this patch
adds the missing header dependencies.

Signed-off-by: Baoyou Xie 
---
 drivers/usb/core/hcd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 746c47d..479e223 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "usb.h"
 
-- 
2.7.4

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


Re: [PATCH v2 2/3] musb: sunxi: Remove custom babble handling

2016-09-23 Thread Hans de Goede

Hi,

On 09/22/2016 05:30 PM, Bin Liu wrote:

Hi,

On Thu, Sep 22, 2016 at 05:03:39PM +0300, Hans de Goede wrote:

Hi,

On 09/22/2016 04:54 PM, Bin Liu wrote:

Hi,

On Thu, Sep 22, 2016 at 02:19:00PM +0300, Hans de Goede wrote:

The musb-core now a days always treats babble errors in host mode


I don't think this statement is accurate. You might want to change it to
"The musb core already handles babble interrupt" or something else.


It is accurate if you look in the history at drivers/usb/musb
commits around 15-03-10 you will see 2 relevant commits:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/usb/musb?id=b4dc38fd45b63e3da2bc98db5d283a15a637a2fa

"usb: musb: core: simplify musb_recover_work()"

This commits introduces calling musb_root_disconnect(musb)
on babble errors, that was not happening before which is why


That is true, but calling musb_root_disconnect() is just one step of the
recovery in musb core, not all.

The statement of "treats babble errors in host mode as disconnects"
implies all the babble handling is just disconnect, which is not
accurate.


Ok, I'll send out a v3 with an improved commit msg.


BTY, "babble errors in host mode" is also redundant. babble implies
host mode.


Regards,

Hans






Regards,
-Bin.

I added the custom babble error handling. to the sunxi glue.

And:

"usb: musb: core: always try to recover from babble"

Where the title says it all.

Take these together and I believe that my commit msg:

"The musb-core now a days always treats babble errors in host mode
as disconnects, so there is no need for the sunxi specific handling
of this anymore."

Is quite accurate.

Regards,

Hans




Signed-off-by: Hans de Goede 
---
Changes in v2:
-This is a new patch in v2 of this patch series
---
drivers/usb/musb/sunxi.c | 10 --
1 file changed, 10 deletions(-)

diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c
index 1408245..82eba92 100644
--- a/drivers/usb/musb/sunxi.c
+++ b/drivers/usb/musb/sunxi.c
@@ -186,16 +186,6 @@ static irqreturn_t sunxi_musb_interrupt(int irq, void 
*__hci)
if (musb->int_usb)
writeb(musb->int_usb, musb->mregs + SUNXI_MUSB_INTRUSB);

-   /*
-* sunxi musb often signals babble on low / full speed device
-* disconnect, without ever raising MUSB_INTR_DISCONNECT, since
-* normally babble never happens treat it as disconnect.
-*/
-   if ((musb->int_usb & MUSB_INTR_BABBLE) && is_host_active(musb)) {
-   musb->int_usb &= ~MUSB_INTR_BABBLE;
-   musb->int_usb |= MUSB_INTR_DISCONNECT;
-   }
-
if ((musb->int_usb & MUSB_INTR_RESET) && !is_host_active(musb)) {
/* ep0 FADDR must be 0 when (re)entering peripheral mode */
musb_ep_select(musb->mregs, 0);
--
2.9.3


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

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


[PATCH v3 1/3] phy_sun4i_usb: set_mode: Allow using set_mode to force end the current session

2016-09-23 Thread Hans de Goede
The sunxi musb has a bug where sometimes it will generate a babble
error on device disconnect instead of a disconnect irq. When this
happens the musb-controller switches from host mode to device mode
(it clears MUSB_DEVCTL_SESSION and sets MUSB_DEVCTL_BDEVICE) and
gets stuck in this state.

Clearing this requires reporting Vbus low for 200 or more ms, but
on some devices Vbus is simply always high (host-only mode, no Vbus
control).

This commit modifies sun4i_usb_phy_set_mode so that it will force
end the current session when called with the current mode, before this
commit calling set_mode with the current mode was a nop since id_det
would stay the same resulting in the detect_work not doing anything.

This allows the sunxi-musb glue to use sun4i_usb_phy_set_mode to force
end the current session without changing the mode, to fixup the stuck
state after a babble error.

Signed-off-by: Hans de Goede 
---
Changes in v2:
-New patch in v2 of this series replacing the
 "phy-sun4i-usb: Add sun4i_usb_phy_force_session_end() function"
 from v1
Changes in v3:
-Fix dev_info so that it prints the new-mode instead of the old one
---
 drivers/phy/phy-sun4i-usb.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c
index 43c0d98..cbd338d 100644
--- a/drivers/phy/phy-sun4i-usb.c
+++ b/drivers/phy/phy-sun4i-usb.c
@@ -437,25 +437,31 @@ static int sun4i_usb_phy_set_mode(struct phy *_phy, enum 
phy_mode mode)
 {
struct sun4i_usb_phy *phy = phy_get_drvdata(_phy);
struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
+   int new_mode;
 
if (phy->index != 0)
return -EINVAL;
 
switch (mode) {
case PHY_MODE_USB_HOST:
-   data->dr_mode = USB_DR_MODE_HOST;
+   new_mode = USB_DR_MODE_HOST;
break;
case PHY_MODE_USB_DEVICE:
-   data->dr_mode = USB_DR_MODE_PERIPHERAL;
+   new_mode = USB_DR_MODE_PERIPHERAL;
break;
case PHY_MODE_USB_OTG:
-   data->dr_mode = USB_DR_MODE_OTG;
+   new_mode = USB_DR_MODE_OTG;
break;
default:
return -EINVAL;
}
 
-   dev_info(&_phy->dev, "Changing dr_mode to %d\n", (int)data->dr_mode);
+   if (new_mode != data->dr_mode) {
+   dev_info(&_phy->dev, "Changing dr_mode to %d\n", new_mode);
+   data->dr_mode = new_mode;
+   }
+
+   data->id_det = -1; /* Force reprocessing of id */
data->force_session_end = true;
queue_delayed_work(system_wq, >detect, 0);
 
-- 
2.9.3

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


[PATCH v3 3/3] musb: sunxi: Force session end on babble errors in host-mode

2016-09-23 Thread Hans de Goede
The sunxi musb has a bug where sometimes it will generate a babble
error on device disconnect instead of a disconnect irq. When this
happens the musb-controller switches from host mode to device mode
(it clears MUSB_DEVCTL_SESSION and sets MUSB_DEVCTL_BDEVICE) and
gets stuck in this state.

Clearing this requires reporting Vbus low for 200 or more ms, but
on some devices Vbus is simply always high (host-only mode, no Vbus
control).

This commit adds a sunxi_musb_recover() callback which makes
sunxi_musb_work call phy_set_mode with the current mode, which
will force end the current session.

This fixes the musb controller getting stuck in this state on systems
without Vbus control; and also fixes the need to unplug the usb-b ->
usb-a cable to get out of this state on systems with Vbus control.

Signed-off-by: Hans de Goede 
---
Changes in v2:
-Use musb_platform_recover callback instead of using DYI code in the
 interrupt handler
-Call phy_set_mode with the current mode instead of adding a new custom
 sunxi phy callback
---
 drivers/usb/musb/sunxi.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c
index 82eba92..d0be0ea 100644
--- a/drivers/usb/musb/sunxi.c
+++ b/drivers/usb/musb/sunxi.c
@@ -380,6 +380,20 @@ static int sunxi_musb_set_mode(struct musb *musb, u8 mode)
return 0;
 }
 
+static int sunxi_musb_recover(struct musb *musb)
+{
+   struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent);
+
+   /*
+* Schedule a phy_set_mode with the current glue->phy_mode value,
+* this will force end the current session.
+*/
+   set_bit(SUNXI_MUSB_FL_PHY_MODE_PEND, >flags);
+   schedule_work(>work);
+
+   return 0;
+}
+
 /*
  * sunxi musb register layout
  * 0x00 - 0x17 fifo regs, 1 long per fifo
@@ -608,6 +622,7 @@ static const struct musb_platform_ops sunxi_musb_ops = {
.dma_init   = sunxi_musb_dma_controller_create,
.dma_exit   = sunxi_musb_dma_controller_destroy,
.set_mode   = sunxi_musb_set_mode,
+   .recover= sunxi_musb_recover,
.set_vbus   = sunxi_musb_set_vbus,
.pre_root_reset_end = sunxi_musb_pre_root_reset_end,
.post_root_reset_end = sunxi_musb_post_root_reset_end,
-- 
2.9.3

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


[PATCH v3 2/3] musb: sunxi: Remove custom babble handling

2016-09-23 Thread Hans de Goede
The musb core already handles babble interrupts, so the sunxi glue
having its own custom handling is redundant.

Signed-off-by: Hans de Goede 
---
Changes in v2:
-This is a new patch in v2 of this patch series
Changes in v3:
-Improve commit msg
---
 drivers/usb/musb/sunxi.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c
index 1408245..82eba92 100644
--- a/drivers/usb/musb/sunxi.c
+++ b/drivers/usb/musb/sunxi.c
@@ -186,16 +186,6 @@ static irqreturn_t sunxi_musb_interrupt(int irq, void 
*__hci)
if (musb->int_usb)
writeb(musb->int_usb, musb->mregs + SUNXI_MUSB_INTRUSB);
 
-   /*
-* sunxi musb often signals babble on low / full speed device
-* disconnect, without ever raising MUSB_INTR_DISCONNECT, since
-* normally babble never happens treat it as disconnect.
-*/
-   if ((musb->int_usb & MUSB_INTR_BABBLE) && is_host_active(musb)) {
-   musb->int_usb &= ~MUSB_INTR_BABBLE;
-   musb->int_usb |= MUSB_INTR_DISCONNECT;
-   }
-
if ((musb->int_usb & MUSB_INTR_RESET) && !is_host_active(musb)) {
/* ep0 FADDR must be 0 when (re)entering peripheral mode */
musb_ep_select(musb->mregs, 0);
-- 
2.9.3

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


[PATCH V2]usb: dwc2: Clear GUSBCFG.UsbTrdTim before setting

2016-09-23 Thread Pengcheng Li
The USBTRDTIM field needs to be cleared before setting a new value.
Otherwise it will result in an incorrect value if phyif == GUSBCFG_PHYIF8.

Change-Id: Ib3e33cf4fd15ada41dc070ff7b93858daafbd10f
Signed-off-by: Pengcheng Li 
Acked-by: John Youn 
---
 drivers/usb/dwc2/gadget.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index af46adf..9e52e4f 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2531,7 +2531,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg 
*hsotg,
/* keep other bits untouched (so e.g. forced modes are not lost) */
usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
-   GUSBCFG_HNPCAP);
+   GUSBCFG_HNPCAP | GUSBCFG_USBTRDTIM_MASK);
 
/* set the PLL on, remove the HNP/SRP and set the PHY */
val = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
@@ -3413,7 +3413,7 @@ static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg)
/* keep other bits untouched (so e.g. forced modes are not lost) */
usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
-   GUSBCFG_HNPCAP);
+   GUSBCFG_HNPCAP | GUSBCFG_USBTRDTIM_MASK);
 
/* set the PLL on, remove the HNP/SRP and set the PHY */
trdtim = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
-- 
2.9.3

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


Re: [PATCH] usb-serial: translate ezusb_convert

2016-09-23 Thread Ladislav Michl
On Fri, Sep 23, 2016 at 09:59:57AM +0200, Greg KH wrote:
> On Thu, Sep 22, 2016 at 05:54:25PM -0600, Jorge Natz wrote:
> > 
> > ezusb_convert is a script used to convert an Intel HEX firmware file
> > into a set of C arrays for use in header files. Increase the
> > portability of this script by translating it from Perl to a
> > POSIX shell script. Perl is not was widely installed on UNIX machines as
> > is a POSIX-conforming shell, therefore portability of this script, and
> > therefore a small part of the build, should be increased.
> 
> Perl is much more portable than you think, and installed more than you
> think :)

Well, sometimes I have to compile kernel on Windows host with no cygwin,
where Perl is not installed.

> I don't really see the need for this change at all, and oddly, you leave
> the file name with a ".pl" at the end.

I see ezusb_convert.sh helper script filename in the patch...

> So thanks for the patch, but I don't think we need it.

I can also certainly live without it and I'm aware that there are a few
other perl scripts left in tree, but I consider this idea usefull.

ladis (speaking for negligible fraction of users)
--
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: crash by cdc_acm driver in kernels 4.8-rc1/5

2016-09-23 Thread Wim Osterholt
On Thu, Sep 22, 2016 at 04:40:50PM +0200, Oliver Neukum wrote:
> 
> dmesg -c
> echo 9 > /proc/sysrq-trigger
> modprobe cdc_acm
> echo "module cdc_acm +mpf" > /sys/kernel/debug/dynamic_debug/control
> 
> [plug your device in]
> 
> and provide the full output of dmesg after that.

That is not possible under a 4.8 kernel.

'Fixing recursive fault but reboot is needed!' and frozen it is.


Regards, Wim.

--
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/4] ch341 cleanup and parity etc support

2016-09-23 Thread Grigori Goronzy

On 2016-09-15 17:54, Aidan Thornton wrote:

This is an attempt to clean-up and resubmit some patches by Grigori
Goronzy a few months back adding support for parity, frame length, and
2 stop bits to the CH340/1 driver and cleaning up some magic constants.
His original patch series also went on to add RTS/CTS hardware flow
control and some other stuff, but I'm not attempting to resubmit those
patches at this time because they seem to require more work and none of
the hardware I have breaks out the RTS pin.



This series is

Reviewed-by: Grigori Goronzy 

I still haven't gotten around to test this on CH341A, but I see no 
reason for why it wouldn't work.  I'll get back to you when I've tested 
it.


Grigori


Note that unlike his original patch series this is only tested on
CH340G, but they're basically just his original tested-on-CH341A 
patches

with all the magic constant removal moved into the first patch and some
constants renamed, plus a couple of trivial changes per review 
comments.


Aidan Thornton (4):
  USB: ch341: add register and USB request definitions
  USB: ch341: reinitialize chip on reconfiguration
  USB: ch341: add support for parity, frame length, stop bits
  USB: ch341: add debug output for chip version

 drivers/usb/serial/ch341.c | 112 +
+--- 1 file changed, 74 insertions(+), 38 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: g_webcam Isoch high bandwidth transfer

2016-09-23 Thread Felipe Balbi

Hi,

yfw  writes:
>> Here's one that actually compiles, sorry about that.
>
> No worries, I was sleeping ;-)
>
> I will test it out early next week. Thanks.

 meanwhile, how about some instructions on how to test this out myself?
 How are you using g_webcam and what are you running on host side? Got a
 nice list of commands there I can use? I think I can get to bottom of
 this much quicker if I can reproduce it locally ;-)
>>>
>>> On device side:
>>> - first patch g_webcam as in my first email in this thread to enable
>>>   640x480@30fps;
>>> - # modprobe g_webcam streaming_maxpacket=3072
>>> - then run uvc-gadget to feed the YUV frames;
>>> http://git.ideasonboard.org/uvc-gadget.git
>>
>> as is, g_webcam never enumerates to the host. It's calls to
>> usb_function_active() and usb_function_deactivate() are unbalanced. Do
>> you have any other changes to g_webcam?
> With uvc function gadget driver, user daemon uvc-gadget must be started
> before connect to host. Not sure whether g_webcam has same requirement.

f_uvc.c should be handling that by means for usb_function_deactivate().

I'll try keeping cable disconnected until uvc-gadget is running.

>> Also, uvc-gadget.git doesn't compile, had to modify it a bit:
>>
>> -#include "../drivers/usb/gadget/uvc.h"
>> +#include "../drivers/usb/gadget/function/uvc.h"
>>
>> Also fixed a build warning:
>>
>> @@ -732,6 +732,8 @@ int main(int argc, char *argv[])
>> fd_set wfds = fds;
>>
>> ret = select(dev->fd + 1, NULL, , , NULL);
>> +   if (ret < 0)
>> +   return ret;
>> if (FD_ISSET(dev->fd, ))
>> uvc_events_process(dev);
>> if (FD_ISSET(dev->fd, ))
>>
>> Laurent, have you tested g_webcam recently? What's the magic to get it
>> working?
>>
>> Here's what I get out of dmesg:
>>
>> [   58.568380] usb 1-9: new high-speed USB device number 5 using xhci_hcd
>> [   58.738680] usb 1-9: New USB device found, idVendor=1d6b, idProduct=0102
>> [   58.738683] usb 1-9: New USB device strings: Mfr=1, Product=2, 
>> SerialNumber=0
>> [   58.738685] usb 1-9: Product: Webcam gadget
>> [   58.738687] usb 1-9: Manufacturer: Linux Foundation
>> [   58.739133] g_webcam gadget: high-speed config #1: Video
>> [   58.739138] g_webcam gadget: uvc_function_set_alt(0, 0)
>> [   58.739139] g_webcam gadget: reset UVC Control
>> [   58.739149] g_webcam gadget: uvc_function_set_alt(1, 0)
>> [   58.804369] uvcvideo: Found UVC 1.00 device Webcam gadget (1d6b:0102)
>> [   58.804479] g_webcam gadget: uvc_function_set_alt(1, 0)
>> [   64.188459] uvcvideo: UVC non compliance - GET_DEF(PROBE) not supported. 
>> Enabling workaround.
> Looks like you connect your usb device to your usb host port on same
> board. Nice.

yeah, that helps.

> The GET_DEF is handled by user daemon uvc-gadget. It may be related.

okay.

-- 
balbi


signature.asc
Description: PGP signature


Re: g_webcam Isoch high bandwidth transfer

2016-09-23 Thread yfw

Hi Felipe,

On 2016/9/23 15:49, Felipe Balbi wrote:


Hi,

Bin Liu  writes:

+Fengwei Yin per his request.

On Thu, Sep 22, 2016 at 10:48:40PM +0300, Felipe Balbi wrote:


Hi,

Bin Liu  writes:

[...]


Here's one that actually compiles, sorry about that.


No worries, I was sleeping ;-)

I will test it out early next week. Thanks.


meanwhile, how about some instructions on how to test this out myself?
How are you using g_webcam and what are you running on host side? Got a
nice list of commands there I can use? I think I can get to bottom of
this much quicker if I can reproduce it locally ;-)


On device side:
- first patch g_webcam as in my first email in this thread to enable
  640x480@30fps;
- # modprobe g_webcam streaming_maxpacket=3072
- then run uvc-gadget to feed the YUV frames;
http://git.ideasonboard.org/uvc-gadget.git


as is, g_webcam never enumerates to the host. It's calls to
usb_function_active() and usb_function_deactivate() are unbalanced. Do
you have any other changes to g_webcam?

With uvc function gadget driver, user daemon uvc-gadget must be started
before connect to host. Not sure whether g_webcam has same requirement.



Also, uvc-gadget.git doesn't compile, had to modify it a bit:

-#include "../drivers/usb/gadget/uvc.h"
+#include "../drivers/usb/gadget/function/uvc.h"

Also fixed a build warning:

@@ -732,6 +732,8 @@ int main(int argc, char *argv[])
fd_set wfds = fds;

ret = select(dev->fd + 1, NULL, , , NULL);
+   if (ret < 0)
+   return ret;
if (FD_ISSET(dev->fd, ))
uvc_events_process(dev);
if (FD_ISSET(dev->fd, ))

Laurent, have you tested g_webcam recently? What's the magic to get it
working?

Here's what I get out of dmesg:

[   58.568380] usb 1-9: new high-speed USB device number 5 using xhci_hcd
[   58.738680] usb 1-9: New USB device found, idVendor=1d6b, idProduct=0102
[   58.738683] usb 1-9: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[   58.738685] usb 1-9: Product: Webcam gadget
[   58.738687] usb 1-9: Manufacturer: Linux Foundation
[   58.739133] g_webcam gadget: high-speed config #1: Video
[   58.739138] g_webcam gadget: uvc_function_set_alt(0, 0)
[   58.739139] g_webcam gadget: reset UVC Control
[   58.739149] g_webcam gadget: uvc_function_set_alt(1, 0)
[   58.804369] uvcvideo: Found UVC 1.00 device Webcam gadget (1d6b:0102)
[   58.804479] g_webcam gadget: uvc_function_set_alt(1, 0)
[   64.188459] uvcvideo: UVC non compliance - GET_DEF(PROBE) not supported. 
Enabling workaround.

Looks like you connect your usb device to your usb host port on same
board. Nice.

The GET_DEF is handled by user daemon uvc-gadget. It may be related.

Regards
Yin, Fengwei


[   69.307458] uvcvideo: Failed to query (129) UVC probe control : -110 (exp. 
26).
[   69.307459] uvcvideo: Failed to initialize the device (-5).
[   69.307505] usbcore: registered new interface driver uvcvideo
[   69.307506] USB Video Class driver (1.1.1)
[  146.646012] [ cut here ]
[  146.646023] WARNING: CPU: 0 PID: 2616 at drivers/usb/gadget/composite.c:371 
usb_function_activate+0x77/0x80 [libcomposite]
[  146.646024] Modules linked in: uvcvideo g_webcam usb_f_uvc videobuf2_vmalloc 
videobuf2_memops videobuf2_v4l2 videobuf2_core videodev libcomposite kvm_intel 
kvm psmouse e1000e input_leds hid_generic usbhid atkbd irqbypass evdev
[  146.646054] CPU: 0 PID: 2616 Comm: gst-launch-1.0 Not tainted 
4.8.0-rc7-next-20160922-4-gc71031593917-dirty #20
[  146.646055] Hardware name: Intel Corporation Skylake Client platform/Skylake 
Y LPDDR3 RVP3, BIOS SKLSE2R1.R00.B097.B02.1509020030 09/02/2015
[  146.646058]  c9000769bb70
[  146.646059]  8132d415
[  146.646060]  
[  146.646061]  

[  146.646063]  c9000769bbb0
[  146.646063]  8105ec1b
[  146.646064]  01730769bb90
[  146.646066]  ffea
[  146.646070]  88016c03a150
[  146.646072]  0282 88016d793000 c9000769befc
[  146.646077] Call Trace:
[  146.646086]  [] dump_stack+0x68/0x93
[  146.646090]  [] __warn+0xcb/0xf0
[  146.646095]  [] warn_slowpath_null+0x1d/0x20
[  146.646099]  [] usb_function_activate+0x77/0x80 
[libcomposite]
[  146.646105]  [] uvc_function_connect+0x1e/0x40 [usb_f_uvc]
[  146.646110]  [] uvc_v4l2_open+0x6e/0x80 [usb_f_uvc]
[  146.646116]  [] v4l2_open+0xa0/0x100 [videodev]
[  146.646121]  [] chrdev_open+0xa1/0x1d0
[  146.646125]  [] ? cdev_put+0x30/0x30
[  146.646129]  [] do_dentry_open.isra.17+0x150/0x2e0
[  146.646133]  [] vfs_open+0x45/0x60
[  146.646137]  [] path_openat+0x62d/0x1370
[  146.646141]  [] ? putname+0x54/0x60
[  146.646146]  [] do_filp_open+0x7e/0xe0
[  146.646150]  [] ? preempt_count_sub+0x48/0x70
[  146.646154]  [] ? _raw_spin_unlock+0x16/0x30
[  146.646160]  [] ? __alloc_fd+0xc9/0x180
[  146.646164]  [] do_sys_open+0x123/0x200
[  146.646170]  [] 

Re: Strange behavior of CHN bit with dwc3

2016-09-23 Thread Felipe Balbi

Hi,

yfw  writes:
> Hi Felipe,
>
> On 2016/9/23 14:17, Felipe Balbi wrote:
>>
>> Hi,
>>
>> yfw  writes:
 are you using mainline? If you are, capture dwc3 tracepoints. If you're
 not, which kernel are you using?
>>> I am not using the latest kernel. Instead the code base is 3.18 + some usb
>>> patches backported because mainline doesn't support the platform I am using.
>>
>> v3.18 is really, really old. There isn't much I can do to help
>> you. Also, claiming that my patch doesn't work wasn't very nice. There
>> might be a ton of other dependencies that were merged since v3.18.
> Yes. This makes a lot sense. And sorry for claiming your patch not

no harm done :-)

> working too early. Let's wait for the test result from Bin (I suppose
> his test is using the mainline driver).

yeah. I can't get g_webcam to work though (see my other reply). Not sure
if I'm missing something or what.

>> You should really be asking for support from whoever gave you this v3.18
>> kernel. This forum can only help mainline. You're welcome to stick
>> around and try things on your own, but I'll only make sure that mainline
>> works and that's about it ;-)
> Totally understand. I am also trying to replace the current driver with
> the latest one from mainline kernel.

that's probably a good idea. There's a ton of improvements all over the
place since v3.18 (almost 300 patches) in dwc3.

-- 
balbi


signature.asc
Description: PGP signature


Re: Strange behavior of CHN bit with dwc3

2016-09-23 Thread yfw

Hi Felipe,

On 2016/9/23 14:17, Felipe Balbi wrote:


Hi,

yfw  writes:

are you using mainline? If you are, capture dwc3 tracepoints. If you're
not, which kernel are you using?

I am not using the latest kernel. Instead the code base is 3.18 + some usb
patches backported because mainline doesn't support the platform I am using.


v3.18 is really, really old. There isn't much I can do to help
you. Also, claiming that my patch doesn't work wasn't very nice. There
might be a ton of other dependencies that were merged since v3.18.

Yes. This makes a lot sense. And sorry for claiming your patch not
working too early. Let's wait for the test result from Bin (I suppose
his test is using the mainline driver).



You should really be asking for support from whoever gave you this v3.18
kernel. This forum can only help mainline. You're welcome to stick
around and try things on your own, but I'll only make sure that mainline
works and that's about it ;-)

Totally understand. I am also trying to replace the current driver with
the latest one from mainline kernel.

Regards
Yin, Fengwei




--
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: g_webcam Isoch high bandwidth transfer

2016-09-23 Thread Felipe Balbi

Hi,

Bin Liu  writes:
> +Fengwei Yin per his request.
>
> On Thu, Sep 22, 2016 at 10:48:40PM +0300, Felipe Balbi wrote:
>> 
>> Hi,
>> 
>> Bin Liu  writes:
>> 
>> [...]
>> 
>> >> Here's one that actually compiles, sorry about that.
>> >
>> > No worries, I was sleeping ;-)
>> >
>> > I will test it out early next week. Thanks.
>> 
>> meanwhile, how about some instructions on how to test this out myself?
>> How are you using g_webcam and what are you running on host side? Got a
>> nice list of commands there I can use? I think I can get to bottom of
>> this much quicker if I can reproduce it locally ;-)
>
> On device side:
> - first patch g_webcam as in my first email in this thread to enable
>   640x480@30fps;
> - # modprobe g_webcam streaming_maxpacket=3072
> - then run uvc-gadget to feed the YUV frames;
>   http://git.ideasonboard.org/uvc-gadget.git

as is, g_webcam never enumerates to the host. It's calls to
usb_function_active() and usb_function_deactivate() are unbalanced. Do
you have any other changes to g_webcam?

Also, uvc-gadget.git doesn't compile, had to modify it a bit:

-#include "../drivers/usb/gadget/uvc.h"
+#include "../drivers/usb/gadget/function/uvc.h"

Also fixed a build warning:

@@ -732,6 +732,8 @@ int main(int argc, char *argv[])
fd_set wfds = fds;
 
ret = select(dev->fd + 1, NULL, , , NULL);
+   if (ret < 0)
+   return ret;
if (FD_ISSET(dev->fd, ))
uvc_events_process(dev);
if (FD_ISSET(dev->fd, ))

Laurent, have you tested g_webcam recently? What's the magic to get it
working?

Here's what I get out of dmesg:

[   58.568380] usb 1-9: new high-speed USB device number 5 using xhci_hcd
[   58.738680] usb 1-9: New USB device found, idVendor=1d6b, idProduct=0102
[   58.738683] usb 1-9: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[   58.738685] usb 1-9: Product: Webcam gadget
[   58.738687] usb 1-9: Manufacturer: Linux Foundation
[   58.739133] g_webcam gadget: high-speed config #1: Video
[   58.739138] g_webcam gadget: uvc_function_set_alt(0, 0)
[   58.739139] g_webcam gadget: reset UVC Control
[   58.739149] g_webcam gadget: uvc_function_set_alt(1, 0)
[   58.804369] uvcvideo: Found UVC 1.00 device Webcam gadget (1d6b:0102)
[   58.804479] g_webcam gadget: uvc_function_set_alt(1, 0)
[   64.188459] uvcvideo: UVC non compliance - GET_DEF(PROBE) not supported. 
Enabling workaround.
[   69.307458] uvcvideo: Failed to query (129) UVC probe control : -110 (exp. 
26).
[   69.307459] uvcvideo: Failed to initialize the device (-5).
[   69.307505] usbcore: registered new interface driver uvcvideo
[   69.307506] USB Video Class driver (1.1.1)
[  146.646012] [ cut here ]
[  146.646023] WARNING: CPU: 0 PID: 2616 at drivers/usb/gadget/composite.c:371 
usb_function_activate+0x77/0x80 [libcomposite]
[  146.646024] Modules linked in: uvcvideo g_webcam usb_f_uvc videobuf2_vmalloc 
videobuf2_memops videobuf2_v4l2 videobuf2_core videodev libcomposite kvm_intel 
kvm psmouse e1000e input_leds hid_generic usbhid atkbd irqbypass evdev
[  146.646054] CPU: 0 PID: 2616 Comm: gst-launch-1.0 Not tainted 
4.8.0-rc7-next-20160922-4-gc71031593917-dirty #20
[  146.646055] Hardware name: Intel Corporation Skylake Client platform/Skylake 
Y LPDDR3 RVP3, BIOS SKLSE2R1.R00.B097.B02.1509020030 09/02/2015
[  146.646058]  c9000769bb70
[  146.646059]  8132d415
[  146.646060]  
[  146.646061]  

[  146.646063]  c9000769bbb0
[  146.646063]  8105ec1b
[  146.646064]  01730769bb90
[  146.646066]  ffea
[  146.646070]  88016c03a150
[  146.646072]  0282 88016d793000 c9000769befc
[  146.646077] Call Trace:
[  146.646086]  [] dump_stack+0x68/0x93
[  146.646090]  [] __warn+0xcb/0xf0
[  146.646095]  [] warn_slowpath_null+0x1d/0x20
[  146.646099]  [] usb_function_activate+0x77/0x80 
[libcomposite]
[  146.646105]  [] uvc_function_connect+0x1e/0x40 [usb_f_uvc]
[  146.646110]  [] uvc_v4l2_open+0x6e/0x80 [usb_f_uvc]
[  146.646116]  [] v4l2_open+0xa0/0x100 [videodev]
[  146.646121]  [] chrdev_open+0xa1/0x1d0
[  146.646125]  [] ? cdev_put+0x30/0x30
[  146.646129]  [] do_dentry_open.isra.17+0x150/0x2e0
[  146.646133]  [] vfs_open+0x45/0x60
[  146.646137]  [] path_openat+0x62d/0x1370
[  146.646141]  [] ? putname+0x54/0x60
[  146.646146]  [] do_filp_open+0x7e/0xe0
[  146.646150]  [] ? preempt_count_sub+0x48/0x70
[  146.646154]  [] ? _raw_spin_unlock+0x16/0x30
[  146.646160]  [] ? __alloc_fd+0xc9/0x180
[  146.646164]  [] do_sys_open+0x123/0x200
[  146.646170]  [] SyS_open+0x1e/0x20
[  146.646174]  [] entry_SYSCALL_64_fastpath+0x18/0xa8
[  146.646177] ---[ end trace 1a4f7b9817d19b04 ]---
[  146.646180] g_webcam gadget: UVC connect failed with -22
[  146.653808] usb 1-9: USB disconnect, device number 5
[  146.653986] g_webcam gadget: UVC disconnect failed with -110


And 

Re: Strange behavior of CHN bit with dwc3

2016-09-23 Thread Felipe Balbi

Hi,

yfw  writes:
>> are you using mainline? If you are, capture dwc3 tracepoints. If you're
>> not, which kernel are you using?
> I am not using the latest kernel. Instead the code base is 3.18 + some usb
> patches backported because mainline doesn't support the platform I am using.

v3.18 is really, really old. There isn't much I can do to help
you. Also, claiming that my patch doesn't work wasn't very nice. There
might be a ton of other dependencies that were merged since v3.18.

You should really be asking for support from whoever gave you this v3.18
kernel. This forum can only help mainline. You're welcome to stick
around and try things on your own, but I'll only make sure that mainline
works and that's about it ;-)

-- 
balbi


signature.asc
Description: PGP signature