Re: [PATCH] usb: Enable LPM for USB 2.01+ full-speed devices

2015-03-25 Thread Oliver Neukum
On Wed, 2015-03-25 at 12:23 +0530, rtat...@codeaurora.org wrote:
> From: Rupesh Tatiya 
> 
> USB 2.01+ full-speed devices can have extended descriptor as well
> and can support LPM.

Yes, they in theory can, but what happens if they are actually
asked to do so? On how many devices have you tested this patch?

Regards
Oliver


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


Re: [PATCH] USB: ftdi_sio: Use jtag quirk for SNAP Connect E10

2015-03-25 Thread Johan Hovold
On Mon, Mar 23, 2015 at 08:34:48PM -0500, Doug Goldstein wrote:
> This patch uses the existing CALAO Systems ftdi_8u2232c_probe in order
> to avoid attaching a TTY to the JTAG port as this board is based on the
> CALAO Systems reference design and needs the same fix up.

Thanks for the patch. Could you please provide the full "lsusb -v"
output for the device before I apply it?

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] usb: add OTG 2.0 definition and support into gadget function

2015-03-25 Thread Macpaul Lin
Add OTG 2.0 descriptors and enable the gadget function.
This change has been tested with USB-IF Compliance
PET TEST: OTG-B VBUS.mpet testing item.

Signed-off-by: Macpaul Lin 
---
 drivers/usb/core/Kconfig  |  9 +
 drivers/usb/gadget/composite.c| 12 
 drivers/usb/gadget/legacy/multi.c |  3 +++
 include/uapi/linux/usb/ch9.h  |  3 +++
 4 files changed, 27 insertions(+)

diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index cc0ced0..434ce19 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -55,6 +55,15 @@ config USB_OTG
  Select this only if your board has Mini-AB/Micro-AB
  connector.
 
+config USB_OTG20
+   bool "OTG20 support (EXPERIMENTAL)"
+   depends on USB_OTG
+   default n
+   help
+ This feature is still under developing.
+
+ Select this only if your board support OTG 20's hardware requirements.
+
 config USB_OTG_WHITELIST
bool "Rely on OTG and EH Targeted Peripherals List"
depends on USB
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 13adfd1..2f3d347 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1461,6 +1461,7 @@ composite_setup(struct usb_gadget *gadget, const struct 
usb_ctrlrequest *ctrl)
u16 w_length = le16_to_cpu(ctrl->wLength);
struct usb_function *f = NULL;
u8  endp;
+   struct usb_otg_descriptor   *otg_desc = NULL;
 
/* partial re-init of the response message; the function or the
 * gadget might need to intercept e.g. a control-OUT completion
@@ -1480,6 +1481,17 @@ composite_setup(struct usb_gadget *gadget, const struct 
usb_ctrlrequest *ctrl)
goto unknown;
switch (w_value >> 8) {
 
+#ifdef CONFIG_USB_OTG20
+   case USB_DT_OTG:
+   otg_desc = (struct usb_otg_descriptor *)req->buf;
+   otg_desc->bLength = sizeof(*otg_desc);
+   otg_desc->bDescriptorType = USB_DT_OTG;
+   otg_desc->bmAttributes = USB_OTG_SRP | USB_OTG_HNP;
+   otg_desc->bcdOTG = cpu_to_le16(0x0200);
+   value = min_t(int, w_length,
+   sizeof(struct usb_otg_descriptor));
+   break;
+#endif
case USB_DT_DEVICE:
cdev->desc.bNumConfigurations =
count_configs(cdev, USB_DT_DEVICE);
diff --git a/drivers/usb/gadget/legacy/multi.c 
b/drivers/usb/gadget/legacy/multi.c
index 39d27bb..0f4005e 100644
--- a/drivers/usb/gadget/legacy/multi.c
+++ b/drivers/usb/gadget/legacy/multi.c
@@ -89,6 +89,9 @@ static const struct usb_descriptor_header *otg_desc[] = {
 * it would not be called "OTG" ...
 */
.bmAttributes = USB_OTG_SRP | USB_OTG_HNP,
+#ifdef CONFIG_USB_OTG20
+   .bcdOTG =   cpu_to_le16(0x0200),
+#endif
},
NULL,
 };
diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
index aa33fd1..29e079b 100644
--- a/include/uapi/linux/usb/ch9.h
+++ b/include/uapi/linux/usb/ch9.h
@@ -672,6 +672,9 @@ struct usb_otg_descriptor {
__u8  bDescriptorType;
 
__u8  bmAttributes; /* support for HNP, SRP, etc */
+#ifdef CONFIG_USB_OTG20
+   __le16 bcdOTG; /* Support OTG 2.0 */
+#endif
 } __attribute__ ((packed));
 
 /* from usb_otg_descriptor.bmAttributes */
-- 
1.8.3.2

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


Re: [PATCH v2 00/14] usb: generic resume timeout

2015-03-25 Thread Greg KH
On Thu, Mar 19, 2015 at 11:30:50AM -0500, Felipe Balbi wrote:
> On Mon, Feb 23, 2015 at 12:39:40PM -0600, Felipe Balbi wrote:
> > Hi all,
> > 
> > here's v2 of usb generic timeout patchset. Rebased on
> > v4.0-rc1 and tested on AM437x SK, and BBB.
> > 
> > skipped boards:
> > 
> > . AM57x x15 has pending patches to enable USB
> > . AM437x IDK doesn't pin out USB
> > . DM3730 Overo WaterStorm not booting (probably my crappy power supply)
> > 
> > Felipe Balbi (14):
> >   usb: define a generic USB_RESUME_TIMEOUT macro
> >   usb: host: xhci: use new USB_RESUME_TIMEOUT
> >   usb: host: ehci: use new USB_RESUME_TIMEOUT
> >   usb: host: uhci: use new USB_RESUME_TIMEOUT
> >   usb: musb: use new USB_RESUME_TIMEOUT
> >   usb: host: isp116x: use new USB_RESUME_TIMEOUT
> >   usb: host: fotg210: use new USB_RESUME_TIMEOUT
> >   usb: host: fusbh200: use new USB_RESUME_TIMEOUT
> >   usb: host: oxu210hp: use new USB_RESUME_TIMEOUT
> >   usb: host: r8a66597: use new USB_RESUME_TIMEOUT
> >   usb: host: sl811: use new USB_RESUME_TIMEOUT
> >   usb: dwc2: hcd: use new USB_RESUME_TIMEOUT
> >   usb: isp1760: hcd: use new USB_RESUME_TIMEOUT
> >   usb: core: hub: use new USB_RESUME_TIMEOUT
> 
> hi Greg, do you want me to put this in my tree or will you pick them up
> as patches ?

I don't know anymore, I don't have them in my queue, and I think I took
them already.  If not, feel free to queue them up.

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 v4 0/8] add HNP polling support for usb otg fsm

2015-03-25 Thread Li Jun
On Wed, Mar 25, 2015 at 02:43:43PM +0800, Chen Peter-B29397 wrote:
>  
> > On Wed, Mar 25, 2015 at 02:03:51PM +0800, Peter Chen wrote:
> > >
> > > Hi Jun,
> > >
> > > The above three patches are in Greg's next tree, after I apply your
> > > chipidea fix [1] for pullup dp, it still some other problems for HNP,
> > > am I missing something?
> > >
> > > The procedures to reproduce:
> > >
> > > - Connect USB cable and MicroAB cable between two boards
> > > - Boot up two boards
> > > - load g_mass_storage at B-device side, the enumeration will success,
> > > and A will see a usb mass-storage device
> > > - load g_mass_storage at A-device side
> > > - Do HNP at B side, the HNP will succeed echo 1 >
> > > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
> > > - Do HNP at A side
> > > echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
> > >
> > > The problem has occurred, the A can't be back to host again.
> > >
> > I use your peter-usb-dev branch and did not found the problem, so I need use
> > Greg's tree to try again?
> > 
> 
> No, I first found this problem with my dev tree, then, I rebase the latest 
> Greg next
> tree, this problem still exists.  You can try to use FSL imx6dl sdb as A 
> device and imx6sx sdb
> as B device to reproduce it.
> 

It can work with my i.MX6DL + i.MX6Q SD, but with i.MX6DL + i.MX6SX SDB, I can
reproduce the problem you reported, which triggers a bug in our otg_fsm driver,
I will send out a patch to fix it.

Li Jun

> Peter
--
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/1] usb: chipidea: otg: remove mutex unlock and lock while stop and start role

2015-03-25 Thread Li Jun
Wrongly release mutex lock during otg_statemachine may result in re-enter
otg_statemachine, which is not allowed, we should do next state transtition
after previous one completed.

Signed-off-by: Li Jun 

Hi Peter

This is to fix the problem of HNP you reported after apply my HNP polling
patchset, I verified with i.MX6DL and i.MX6SX SDB and it works ok(with each
one as A or B device).

---
 drivers/usb/chipidea/otg_fsm.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
index 82b1e23..789dd76 100644
--- a/drivers/usb/chipidea/otg_fsm.c
+++ b/drivers/usb/chipidea/otg_fsm.c
@@ -531,7 +531,6 @@ static int ci_otg_start_host(struct otg_fsm *fsm, int on)
 {
struct ci_hdrc  *ci = container_of(fsm, struct ci_hdrc, fsm);
 
-   mutex_unlock(&fsm->lock);
if (on) {
ci_role_stop(ci);
ci_role_start(ci, CI_ROLE_HOST);
@@ -540,7 +539,6 @@ static int ci_otg_start_host(struct otg_fsm *fsm, int on)
hw_device_reset(ci);
ci_role_start(ci, CI_ROLE_GADGET);
}
-   mutex_lock(&fsm->lock);
return 0;
 }
 
@@ -548,12 +546,10 @@ static int ci_otg_start_gadget(struct otg_fsm *fsm, int 
on)
 {
struct ci_hdrc  *ci = container_of(fsm, struct ci_hdrc, fsm);
 
-   mutex_unlock(&fsm->lock);
if (on)
usb_gadget_vbus_connect(&ci->gadget);
else
usb_gadget_vbus_disconnect(&ci->gadget);
-   mutex_lock(&fsm->lock);
 
return 0;
 }
-- 
1.9.1

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


Re: [PATCH] usb: add OTG 2.0 definition and support into gadget function

2015-03-25 Thread Li Jun
On Wed, Mar 25, 2015 at 06:04:17PM +0800, Macpaul Lin wrote:
> Add OTG 2.0 descriptors and enable the gadget function.
> This change has been tested with USB-IF Compliance
> PET TEST: OTG-B VBUS.mpet testing item.
> 
> Signed-off-by: Macpaul Lin 
> ---
>  drivers/usb/core/Kconfig  |  9 +
>  drivers/usb/gadget/composite.c| 12 
>  drivers/usb/gadget/legacy/multi.c |  3 +++
>  include/uapi/linux/usb/ch9.h  |  3 +++
>  4 files changed, 27 insertions(+)
> 
> diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
> index cc0ced0..434ce19 100644
> --- a/drivers/usb/core/Kconfig
> +++ b/drivers/usb/core/Kconfig
> @@ -55,6 +55,15 @@ config USB_OTG
> Select this only if your board has Mini-AB/Micro-AB
> connector.
>  
> +config USB_OTG20
> + bool "OTG20 support (EXPERIMENTAL)"
> + depends on USB_OTG
> + default n
> + help
> +   This feature is still under developing.
> +
> +   Select this only if your board support OTG 20's hardware requirements.
> +
>  config USB_OTG_WHITELIST
>   bool "Rely on OTG and EH Targeted Peripherals List"
>   depends on USB
> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index 13adfd1..2f3d347 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -1461,6 +1461,7 @@ composite_setup(struct usb_gadget *gadget, const struct 
> usb_ctrlrequest *ctrl)
>   u16 w_length = le16_to_cpu(ctrl->wLength);
>   struct usb_function *f = NULL;
>   u8  endp;
> + struct usb_otg_descriptor   *otg_desc = NULL;
>  
>   /* partial re-init of the response message; the function or the
>* gadget might need to intercept e.g. a control-OUT completion
> @@ -1480,6 +1481,17 @@ composite_setup(struct usb_gadget *gadget, const 
> struct usb_ctrlrequest *ctrl)
>   goto unknown;
>   switch (w_value >> 8) {
>  
> +#ifdef CONFIG_USB_OTG20
> + case USB_DT_OTG:
> + otg_desc = (struct usb_otg_descriptor *)req->buf;
> + otg_desc->bLength = sizeof(*otg_desc);
> + otg_desc->bDescriptorType = USB_DT_OTG;
> + otg_desc->bmAttributes = USB_OTG_SRP | USB_OTG_HNP;

Response with both HNP and SRP enabled anyway if OTG 2.0? Actually these
capabilities depend on controller.

Li Jun
> + otg_desc->bcdOTG = cpu_to_le16(0x0200);
> + value = min_t(int, w_length,
> + sizeof(struct usb_otg_descriptor));
> + break;
> +#endif
>   case USB_DT_DEVICE:
>   cdev->desc.bNumConfigurations =
>   count_configs(cdev, USB_DT_DEVICE);
> diff --git a/drivers/usb/gadget/legacy/multi.c 
> b/drivers/usb/gadget/legacy/multi.c
> index 39d27bb..0f4005e 100644
> --- a/drivers/usb/gadget/legacy/multi.c
> +++ b/drivers/usb/gadget/legacy/multi.c
> @@ -89,6 +89,9 @@ static const struct usb_descriptor_header *otg_desc[] = {
>* it would not be called "OTG" ...
>*/
>   .bmAttributes = USB_OTG_SRP | USB_OTG_HNP,
> +#ifdef   CONFIG_USB_OTG20
> + .bcdOTG =   cpu_to_le16(0x0200),
> +#endif
>   },
>   NULL,
>  };
> diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
> index aa33fd1..29e079b 100644
> --- a/include/uapi/linux/usb/ch9.h
> +++ b/include/uapi/linux/usb/ch9.h
> @@ -672,6 +672,9 @@ struct usb_otg_descriptor {
>   __u8  bDescriptorType;
>  
>   __u8  bmAttributes; /* support for HNP, SRP, etc */
> +#ifdef   CONFIG_USB_OTG20
> + __le16 bcdOTG; /* Support OTG 2.0 */
> +#endif
>  } __attribute__ ((packed));
>  
>  /* from usb_otg_descriptor.bmAttributes */
> -- 
> 1.8.3.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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: add OTG 2.0 definition and support into gadget function

2015-03-25 Thread Peter Chen
 
> 
> Add OTG 2.0 descriptors and enable the gadget function.
> This change has been tested with USB-IF Compliance PET TEST: OTG-B
> VBUS.mpet testing item.
> 
> Signed-off-by: Macpaul Lin 
> ---
>  drivers/usb/core/Kconfig  |  9 +
>  drivers/usb/gadget/composite.c| 12 
>  drivers/usb/gadget/legacy/multi.c |  3 +++
>  include/uapi/linux/usb/ch9.h  |  3 +++
>  4 files changed, 27 insertions(+)
> 
> diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index
> cc0ced0..434ce19 100644
> --- a/drivers/usb/core/Kconfig
> +++ b/drivers/usb/core/Kconfig
> @@ -55,6 +55,15 @@ config USB_OTG
> Select this only if your board has Mini-AB/Micro-AB
> connector.
> 
> +config USB_OTG20
> + bool "OTG20 support (EXPERIMENTAL)"
> + depends on USB_OTG
> + default n
> + help
> +   This feature is still under developing.
> +
> +   Select this only if your board support OTG 20's hardware requirements.
> +
>  config USB_OTG_WHITELIST
>   bool "Rely on OTG and EH Targeted Peripherals List"
>   depends on USB
> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index 13adfd1..2f3d347 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -1461,6 +1461,7 @@ composite_setup(struct usb_gadget *gadget, const
> struct usb_ctrlrequest *ctrl)
>   u16 w_length = le16_to_cpu(ctrl->wLength);
>   struct usb_function *f = NULL;
>   u8  endp;
> + struct usb_otg_descriptor   *otg_desc = NULL;
> 
>   /* partial re-init of the response message; the function or the
>* gadget might need to intercept e.g. a control-OUT completion @@ -
> 1480,6 +1481,17 @@ composite_setup(struct usb_gadget *gadget, const struct
> usb_ctrlrequest *ctrl)
>   goto unknown;
>   switch (w_value >> 8) {
> 
> +#ifdef CONFIG_USB_OTG20
> + case USB_DT_OTG:
> + otg_desc = (struct usb_otg_descriptor *)req->buf;
> + otg_desc->bLength = sizeof(*otg_desc);
> + otg_desc->bDescriptorType = USB_DT_OTG;
> + otg_desc->bmAttributes = USB_OTG_SRP |
> USB_OTG_HNP;
> + otg_desc->bcdOTG = cpu_to_le16(0x0200);
> + value = min_t(int, w_length,
> + sizeof(struct usb_otg_descriptor));
> + break;
> +#endif

How about add gadget_is_otg20 to do it?
The udc driver can decide it if it supports otg v1.3 or otg v2.0.

>   case USB_DT_DEVICE:
>   cdev->desc.bNumConfigurations =
>   count_configs(cdev, USB_DT_DEVICE); diff --git
> a/drivers/usb/gadget/legacy/multi.c b/drivers/usb/gadget/legacy/multi.c
> index 39d27bb..0f4005e 100644
> --- a/drivers/usb/gadget/legacy/multi.c
> +++ b/drivers/usb/gadget/legacy/multi.c
> @@ -89,6 +89,9 @@ static const struct usb_descriptor_header *otg_desc[] = {
>* it would not be called "OTG" ...
>*/
>   .bmAttributes = USB_OTG_SRP |
> USB_OTG_HNP,
> +#ifdef   CONFIG_USB_OTG20
> + .bcdOTG =   cpu_to_le16(0x0200),
> +#endif
>   },
>   NULL,
>  };
> diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h index
> aa33fd1..29e079b 100644
> --- a/include/uapi/linux/usb/ch9.h
> +++ b/include/uapi/linux/usb/ch9.h
> @@ -672,6 +672,9 @@ struct usb_otg_descriptor {
>   __u8  bDescriptorType;
> 
>   __u8  bmAttributes; /* support for HNP, SRP, etc */
> +#ifdef   CONFIG_USB_OTG20
> + __le16 bcdOTG; /* Support OTG 2.0 */
> +#endif
>  } __attribute__ ((packed));
> 
>  /* from usb_otg_descriptor.bmAttributes */
> --
> 1.8.3.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in the 
> body
> of a message to majord...@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html
--
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: ftdi_sio: Use jtag quirk for SNAP Connect E10

2015-03-25 Thread Doug Goldstein
On Wed, Mar 25, 2015 at 3:44 AM, Johan Hovold  wrote:
> On Mon, Mar 23, 2015 at 08:34:48PM -0500, Doug Goldstein wrote:
>> This patch uses the existing CALAO Systems ftdi_8u2232c_probe in order
>> to avoid attaching a TTY to the JTAG port as this board is based on the
>> CALAO Systems reference design and needs the same fix up.
>
> Thanks for the patch. Could you please provide the full "lsusb -v"
> output for the device before I apply it?
>
> Thanks,
> Johan

Johan,

This is the "lsusb -v" of the device in question.

Bus 002 Device 114: ID 0403:6010 Future Technology Devices
International, Ltd FT2232C Dual USB-UART/FIFO IC
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize0 8
  idVendor   0x0403 Future Technology Devices International, Ltd
  idProduct  0x6010 FT2232C Dual USB-UART/FIFO IC
  bcdDevice5.00
  iManufacturer   1 Synapse
  iProduct2 SNAP Connect E10
  iSerial 0
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   55
bNumInterfaces  2
bConfigurationValue 1
iConfiguration  0
bmAttributes 0x80
  (Bus Powered)
MaxPower  500mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   2
  bInterfaceClass   255 Vendor Specific Class
  bInterfaceSubClass255 Vendor Specific Subclass
  bInterfaceProtocol255 Vendor Specific Protocol
  iInterface  2 SNAP Connect E10
  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 0x02  EP 2 OUT
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0040  1x 64 bytes
bInterval   0
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber1
  bAlternateSetting   0
  bNumEndpoints   2
  bInterfaceClass   255 Vendor Specific Class
  bInterfaceSubClass255 Vendor Specific Subclass
  bInterfaceProtocol255 Vendor Specific Protocol
  iInterface  2 SNAP Connect E10
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83  EP 3 IN
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0040  1x 64 bytes
bInterval   0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x04  EP 4 OUT
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0040  1x 64 bytes
bInterval   0
Device Status: 0x
  (Bus Powered)


I'm game for a better way of avoiding having a tty bound to the first
interface. I've been trying to figure out if I can do it via udev as
well but have had no luck there.

-- 
Doug Goldstein
--
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: Errata for Freescale root-hub TT?

2015-03-25 Thread Alan Stern
On Wed, 25 Mar 2015, Peter Chen wrote:

> > > How do you know the frame has filled already at that time? The software
> > > makes sure it fills frame in time before next time frame?
> > 
> > I'm not sure I understand the question.
> > 
> > The USB analyzer log showed something like this (this is a rough 
> > approximation because I didn't keep the original analyzer output file):
> > 
> > Timestamp   Transaction
> > s.mmm uuu
> > ---
> > 0.000 000   SOF
> > 0.000 030   Isoc OUT
> > 0.000 091   Isoc OUT
> > 0.000 162   Isoc OUT
> > 0.000 224   Isoc OUT
> > 0.001 000   SOF
> > 
> > In this example, there are 4 OUT transfers taking about 290 us and then
> > nothing else for the rest of the frame.
> > 
> > I also know, from looking at the "periodic" file in the EHCI debugfs 
> > directory, that each frame was linked to 8 siTDs:
> > 
> > siTD OUT, Smask = 0x01, Cmask = 0x00, transfer length = 64
> > siTD OUT, Smask = 0x01, Cmask = 0x00, transfer length = 64
> > siTD OUT, Smask = 0x02, Cmask = 0x00, transfer length = 64
> > siTD OUT, Smask = 0x02, Cmask = 0x00, transfer length = 64
> > siTD IN,  Smask = 0x04, Cmask = 0x70, transfer length = 64
> > siTD IN,  Smask = 0x04, Cmask = 0x70, transfer length = 64
> > siTD IN,  Smask = 0x08, Cmask = 0xe0, transfer length = 64
> > siTD IN,  Smask = 0x08, Cmask = 0xe0, transfer length = 64
> > 
> 
> I did not debug too many for Host ISOC, I just want to make sure the
> siTD is ready before the controller read it? 

Yes, all the siTDs were ready before the controller read them.  I know
because it worked perfectly when I used a high-speed hub instead of a
full-speed hub.

> Does it fail at the beginning or running several cycles?

The isochronous streams did not all start at the same time.  First one
isoc-OUT stream started, then the second stream, then the third stream,
then the fourth stream.  After that, the isoc-IN streams started, one
by one.

The controller worked okay up until the time the isoc-IN streams began.  
Before that, it transmitted the OUT packets correctly.  After the
isoc-IN streams started, the controller sometimes transmitted only the
four OUT packets (like in the example above), sometimes a mixture of
OUT and IN packets, and sometimes only one or two IN packets.  The
behavior was very erratic.

Alan Stern

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


[PATCH] HID: add HP OEM mouse to quirk ALWAYS_POLL

2015-03-25 Thread Oliver Neukum
This mouse needs QUIRK_ALWAYS_POLL

Signed-off-by: Oliver Neukum 
CC: sta...@vger.kernel.org
---
 drivers/hid/hid-ids.h   | 3 +++
 drivers/hid/usbhid/hid-quirks.c | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 9c47867..7ace715 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -459,6 +459,9 @@
 #define USB_DEVICE_ID_UGCI_FLYING  0x0020
 #define USB_DEVICE_ID_UGCI_FIGHTING0x0030
 
+#define USB_VENDOR_ID_HP   0x03f0
+#define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE   0x0a4a
+
 #define USB_VENDOR_ID_HUION0x256c
 #define USB_DEVICE_ID_HUION_TABLET 0x006e
 
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index a821277..fe6c60d 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -78,6 +78,7 @@ static const struct hid_blacklist {
{ USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, 
HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, 
HID_QUIRK_NOGET },
+   { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE, 
HID_QUIRK_ALWAYS_POLL },
{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, 
HID_QUIRK_ALWAYS_POLL },
{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, 
HID_QUIRK_NO_INIT_REPORTS },
-- 
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: Delivery Status Notification (Failure)

2015-03-25 Thread Alan Stern
On Tue, 24 Mar 2015, Cristian wrote:

> Hello Developers of linux USB:
> 
> My report:
> https://bugzilla.kernel.org/show_bug.cgi?id=95441

I read your bugzilla entry.  It doesn't say what the problem is.  All 
it does is list a few lines from the kernel log (and output from 
lspci).

Alan Stern

PS: The $SUBJECT line of your email is not very useful.  I didn't 
change it for this reply, but you might want to change it if you 
continue this thread.

--
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: ftdi_sio: Use jtag quirk for SNAP Connect E10

2015-03-25 Thread Johan Hovold
On Wed, Mar 25, 2015 at 08:51:26AM -0500, Doug Goldstein wrote:
> On Wed, Mar 25, 2015 at 3:44 AM, Johan Hovold  wrote:
> > On Mon, Mar 23, 2015 at 08:34:48PM -0500, Doug Goldstein wrote:
> >> This patch uses the existing CALAO Systems ftdi_8u2232c_probe in order
> >> to avoid attaching a TTY to the JTAG port as this board is based on the
> >> CALAO Systems reference design and needs the same fix up.
> >
> > Thanks for the patch. Could you please provide the full "lsusb -v"
> > output for the device before I apply it?

> This is the "lsusb -v" of the device in question.

Thanks for the info.

> I'm game for a better way of avoiding having a tty bound to the first
> interface. I've been trying to figure out if I can do it via udev as
> well but have had no luck there.

I'm afraid there's not much else we can do as long as people keep
reusing the default chip IDs.

Patch now applied after I cleaned up the existing logic somewhat.

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] hid: add quirk for PIXART OEM mouse used by HP

2015-03-25 Thread Oliver Neukum
This mouse is also known under other IDs. It
needs the quirk or will disconnect in runlevel 1 or 3.

Signed-off-by: Oliver Neukum 
CC: sta...@vger.kernel.org
---
 drivers/hid/hid-ids.h   | 1 +
 drivers/hid/usbhid/hid-quirks.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 7ace715..7fe5590 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -461,6 +461,7 @@
 
 #define USB_VENDOR_ID_HP   0x03f0
 #define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE   0x0a4a
+#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE 0x134a
 
 #define USB_VENDOR_ID_HUION0x256c
 #define USB_DEVICE_ID_HUION_TABLET 0x006e
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index fe6c60d..4e3ae9f 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -79,6 +79,7 @@ static const struct hid_blacklist {
{ USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, 
HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, 
HID_QUIRK_NOGET },
{ USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE, 
HID_QUIRK_ALWAYS_POLL },
+   { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, 
HID_QUIRK_ALWAYS_POLL },
{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, 
HID_QUIRK_ALWAYS_POLL },
{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, 
HID_QUIRK_NO_INIT_REPORTS },
-- 
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] hid: add quirk for PIXART OEM mouse used by HP

2015-03-25 Thread Jiri Kosina
On Wed, 25 Mar 2015, Oliver Neukum wrote:

> This mouse is also known under other IDs. It
> needs the quirk or will disconnect in runlevel 1 or 3.
> 
> Signed-off-by: Oliver Neukum 
> CC: sta...@vger.kernel.org

What tree is this against? I don't have USB_VENDOR_ID_HP in my tree.

> ---
>  drivers/hid/hid-ids.h   | 1 +
>  drivers/hid/usbhid/hid-quirks.c | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index 7ace715..7fe5590 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -461,6 +461,7 @@
>  
>  #define USB_VENDOR_ID_HP 0x03f0
>  #define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE 0x0a4a
> +#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE   0x134a
>  
>  #define USB_VENDOR_ID_HUION  0x256c
>  #define USB_DEVICE_ID_HUION_TABLET   0x006e
> diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
> index fe6c60d..4e3ae9f 100644
> --- a/drivers/hid/usbhid/hid-quirks.c
> +++ b/drivers/hid/usbhid/hid-quirks.c
> @@ -79,6 +79,7 @@ static const struct hid_blacklist {
>   { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, 
> HID_QUIRK_NO_INIT_REPORTS },
>   { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, 
> HID_QUIRK_NOGET },
>   { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE, 
> HID_QUIRK_ALWAYS_POLL },
> + { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, 
> HID_QUIRK_ALWAYS_POLL },
>   { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, 
> HID_QUIRK_ALWAYS_POLL },
>   { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
>   { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, 
> HID_QUIRK_NO_INIT_REPORTS },

-- 
Jiri Kosina
SUSE Labs
--
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] hid: add quirk for PIXART OEM mouse used by HP

2015-03-25 Thread Jiri Kosina
On Wed, 25 Mar 2015, Jiri Kosina wrote:

> > This mouse is also known under other IDs. It
> > needs the quirk or will disconnect in runlevel 1 or 3.
> > 
> > Signed-off-by: Oliver Neukum 
> > CC: sta...@vger.kernel.org
> 
> What tree is this against? I don't have USB_VENDOR_ID_HP in my tree.

Ah, okay, got your previous patch only now, as it wasn't ordered in the 
series. I am applying both now.

> 
> > ---
> >  drivers/hid/hid-ids.h   | 1 +
> >  drivers/hid/usbhid/hid-quirks.c | 1 +
> >  2 files changed, 2 insertions(+)
> > 
> > diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> > index 7ace715..7fe5590 100644
> > --- a/drivers/hid/hid-ids.h
> > +++ b/drivers/hid/hid-ids.h
> > @@ -461,6 +461,7 @@
> >  
> >  #define USB_VENDOR_ID_HP   0x03f0
> >  #define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE   0x0a4a
> > +#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE 0x134a
> >  
> >  #define USB_VENDOR_ID_HUION0x256c
> >  #define USB_DEVICE_ID_HUION_TABLET 0x006e
> > diff --git a/drivers/hid/usbhid/hid-quirks.c 
> > b/drivers/hid/usbhid/hid-quirks.c
> > index fe6c60d..4e3ae9f 100644
> > --- a/drivers/hid/usbhid/hid-quirks.c
> > +++ b/drivers/hid/usbhid/hid-quirks.c
> > @@ -79,6 +79,7 @@ static const struct hid_blacklist {
> > { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, 
> > HID_QUIRK_NO_INIT_REPORTS },
> > { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, 
> > HID_QUIRK_NOGET },
> > { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE, 
> > HID_QUIRK_ALWAYS_POLL },
> > +   { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, 
> > HID_QUIRK_ALWAYS_POLL },
> > { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, 
> > HID_QUIRK_ALWAYS_POLL },
> > { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
> > { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, 
> > HID_QUIRK_NO_INIT_REPORTS },

-- 
Jiri Kosina
SUSE Labs
--
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: add OTG 2.0 definition and support into gadget function

2015-03-25 Thread Macpaul Lin
Hi Peter,

2015-03-25 19:59 GMT+08:00 Peter Chen :

>> +config USB_OTG20
>> + bool "OTG20 support (EXPERIMENTAL)"
...
>> +   Select this only if your board support OTG 20's hardware 
>> requirements.
...
>> +#ifdef CONFIG_USB_OTG20
>> + case USB_DT_OTG:
>> + otg_desc = (struct usb_otg_descriptor *)req->buf;
>> + otg_desc->bLength = sizeof(*otg_desc);
>> + otg_desc->bDescriptorType = USB_DT_OTG;
>> + otg_desc->bmAttributes = USB_OTG_SRP |
>> USB_OTG_HNP;
>> + otg_desc->bcdOTG = cpu_to_le16(0x0200);
>> + value = min_t(int, w_length,
>> + sizeof(struct usb_otg_descriptor));
>> + break;
>> +#endif
>
> How about add gadget_is_otg20 to do it?
> The udc driver can decide it if it supports otg v1.3 or otg v2.0.

To use a flexible determine method like gadget_is_otg20() will be good
and could reduce #ifdef macro.
But then we need to declare 2 usb_otg_descriptor structures in the
headers file with only 2 bytes difference.
Also, the OTG 20 supports should be adapted with OTG-A compliance
test, too, when the other upcoming patches.
Hence I choose this kind of macro with "experiment" label for avoiding
get other devices or drivers been affected.

I'll change the code to gadget_is_otg20() but I have no idea how to
configure PET device into OTG 1.3 mode to
test correctness when the code and hardware is running at OTG 1.3 mode.
Thanks. :)

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


RE: [PATCH] usb: musb: add softconnect for host mode

2015-03-25 Thread Liu, Bin
Hi,

> -Original Message-
> From: Tal Shorer [mailto:tal.sho...@gmail.com]
> Sent: Tuesday, March 24, 2015 4:50 PM
> To: Liu, Bin
> Cc: linux-usb@vger.kernel.org; Balbi, Felipe
> Subject: Re: [PATCH] usb: musb: add softconnect for host mode
> 
> Mostly out of curiosity, why a debugfs interface and not an attribute in 
> sysfs?

The use case of MUSB products which has the USB device permanently mounted is 
not that often, so putting this interface into debugfs gives most cases which 
do not need it a chance to disable it.

Regards,
-Bin. 


[PATCH 4/4] usb: legacy/multi add supports OTG 2.0

2015-03-25 Thread Macpaul Lin
add supports OTG 2.0 for multi.c

Signed-off-by: Macpaul Lin 
---
 drivers/usb/gadget/legacy/multi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/gadget/legacy/multi.c 
b/drivers/usb/gadget/legacy/multi.c
index 39d27bb..0f4005e 100644
--- a/drivers/usb/gadget/legacy/multi.c
+++ b/drivers/usb/gadget/legacy/multi.c
@@ -89,6 +89,9 @@ static const struct usb_descriptor_header *otg_desc[] = {
 * it would not be called "OTG" ...
 */
.bmAttributes = USB_OTG_SRP | USB_OTG_HNP,
+#ifdef CONFIG_USB_OTG20
+   .bcdOTG =   cpu_to_le16(0x0200),
+#endif
},
NULL,
 };
-- 
1.8.3.2

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


[PATCH 3/4] usb: add options to identify the capabilities of OTG devices

2015-03-25 Thread Macpaul Lin
Add independent options for identify the capabilities of
ADP/SRP/HNP feature for OTG devices.

Signed-off-by: Macpaul Lin 
---
 drivers/usb/gadget/composite.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 13adfd1..57a7205 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1461,6 +1461,7 @@ composite_setup(struct usb_gadget *gadget, const struct 
usb_ctrlrequest *ctrl)
u16 w_length = le16_to_cpu(ctrl->wLength);
struct usb_function *f = NULL;
u8  endp;
+   struct usb_otg_descriptor   *otg_desc = NULL;
 
/* partial re-init of the response message; the function or the
 * gadget might need to intercept e.g. a control-OUT completion
@@ -1480,6 +1481,21 @@ composite_setup(struct usb_gadget *gadget, const struct 
usb_ctrlrequest *ctrl)
goto unknown;
switch (w_value >> 8) {
 
+   case USB_DT_OTG:
+   otg_desc = (struct usb_otg_descriptor *)req->buf;
+   otg_desc->bLength = sizeof(*otg_desc);
+   otg_desc->bDescriptorType = USB_DT_OTG;
+   if (gadget->adp_support)
+   otg_desc->bmAttributes |= USB_OTG_ADP;
+   if (gadget->hnp_support)
+   otg_desc->bmAttributes |= USB_OTG_HNP;
+   if (gadget->srp_support)
+   otg_desc->bmAttributes |= USB_OTG_SRP;
+   if (gadget_is_otg20(gadget))
+   otg_desc->bcdOTG = cpu_to_le16(0x0200);
+   value = min_t(int, w_length,
+   sizeof(struct usb_otg_descriptor));
+   break;
case USB_DT_DEVICE:
cdev->desc.bNumConfigurations =
count_configs(cdev, USB_DT_DEVICE);
-- 
1.8.3.2

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


[PATCH 2/4] usb: add ADP, HNP, and SRP feature options to gadget structure.

2015-03-25 Thread Macpaul Lin
Add ADP, HNP, and SRP feature options to gadget structure.

Signed-off-by: Macpaul Lin 
---
 include/linux/usb/gadget.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index e598677..d6d8454 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -514,6 +514,12 @@ struct usb_gadget_ops {
  * gadget driver must provide a USB OTG descriptor.
  * @is_otg20: True if the USB hardware supports OTG 2.0 specification.
  * The gadget driver must provide USB OTG 2.0 descriptor.
+ * @adp_support: OTG device feature flag, indicating that the device
+ * supports ADP at this port.
+ * @hnp_support: OTG device feature flag, indicating that the device
+ * supports HNP at this port.
+ * @srp_support: OTG device feature flag, indicating that the device
+ * supports SRP at this port.
  * @is_a_peripheral: False unless is_otg, the "A" end of a USB cable
  * is in the Mini-AB jack, and HNP has been used to switch roles
  * so that the "A" device currently acts as A-Peripheral, not A-Host.
@@ -562,6 +568,9 @@ struct usb_gadget {
unsignedsg_supported:1;
unsignedis_otg:1;
unsignedis_otg20:1;
+   unsignedadp_support:1;
+   unsignedhnp_support:1;
+   unsignedsrp_support:1;
unsignedis_a_peripheral:1;
unsignedb_hnp_enable:1;
unsigneda_hnp_support:1;
-- 
1.8.3.2

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


[PATCH 1/4] usb: introduce OTG 2.0 related kernel feature and API.

2015-03-25 Thread Macpaul Lin
Introduce kernel feature CONFIG_USB_OTG20 and related
gadget_is_otg20() API for supporting OTG20 compliant
drivers.
This patch also updated usb_otg_descritpor.

Signed-off-by: Macpaul Lin 
---
 drivers/usb/core/Kconfig |  9 +
 include/linux/usb/gadget.h   | 24 
 include/uapi/linux/usb/ch9.h |  3 +++
 3 files changed, 36 insertions(+)

diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index cc0ced0..7fdda5f 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -55,6 +55,15 @@ config USB_OTG
  Select this only if your board has Mini-AB/Micro-AB
  connector.
 
+config USB_OTG20
+   bool "OTG20 support (EXPERIMENTAL)"
+   depends on USB_OTG
+   default n
+   help
+ This feature is still under developing.
+
+ Select this only if your board support OTG 20's hardware requirements.
+
 config USB_OTG_WHITELIST
bool "Rely on OTG and EH Targeted Peripherals List"
depends on USB
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index e2f00fd..e598677 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -512,6 +512,8 @@ struct usb_gadget_ops {
  * @sg_supported: true if we can handle scatter-gather
  * @is_otg: True if the USB device port uses a Mini-AB jack, so that the
  * gadget driver must provide a USB OTG descriptor.
+ * @is_otg20: True if the USB hardware supports OTG 2.0 specification.
+ * The gadget driver must provide USB OTG 2.0 descriptor.
  * @is_a_peripheral: False unless is_otg, the "A" end of a USB cable
  * is in the Mini-AB jack, and HNP has been used to switch roles
  * so that the "A" device currently acts as A-Peripheral, not A-Host.
@@ -559,6 +561,7 @@ struct usb_gadget {
 
unsignedsg_supported:1;
unsignedis_otg:1;
+   unsignedis_otg20:1;
unsignedis_a_peripheral:1;
unsignedb_hnp_enable:1;
unsigneda_hnp_support:1;
@@ -634,6 +637,23 @@ static inline int gadget_is_otg(struct usb_gadget *g)
 }
 
 /**
+ * gadget_is_otg20 - return true iff the hardware is OTG 2.0-ready
+ * @g: controller that might supports OTG 2.0 specification.
+ *
+ * This is a runtime test, since kernels with a USB-OTG stack sometimes
+ * run on boards which only supports OTG 1.3,
+ */
+static inline int gadget_is_otg20(struct usb_gadget *g)
+{
+#ifdef CONFIG_USB_OTG20
+   return g->is_otg20;
+#else
+   return 0;
+#endif
+}
+
+
+/**
  * usb_gadget_frame_number - returns the current frame number
  * @gadget: controller that reports the frame number
  *
@@ -832,6 +852,10 @@ static inline int usb_gadget_disconnect(struct usb_gadget 
*gadget)
  * having called usb_gadget_disconnect(), and the USB host stack has
  * initialized.
  *
+ * If gadget->is_otg20 is true, the gadget driver must provide an OTG 2.0
+ * descriptor during enumeration, and related behavior must compliant with
+ * OTG 2.0 specificaiton.
+ *
  * Drivers use hardware-specific knowledge to configure the usb hardware.
  * endpoint addressing is only one of several hardware characteristics that
  * are in descriptors the ep0 implementation returns from setup() calls.
diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
index aa33fd1..8963a5f 100644
--- a/include/uapi/linux/usb/ch9.h
+++ b/include/uapi/linux/usb/ch9.h
@@ -672,6 +672,9 @@ struct usb_otg_descriptor {
__u8  bDescriptorType;
 
__u8  bmAttributes; /* support for HNP, SRP, etc */
+#ifdef CONFIG_USB_OTG20
+   __le16 bcdOTG;  /* Support OTG 2.0 */
+#endif
 } __attribute__ ((packed));
 
 /* from usb_otg_descriptor.bmAttributes */
-- 
1.8.3.2

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


[PATCH] usbnet: Fix tx_bytes statistic running backward in cdc_ncm

2015-03-25 Thread Bjørn Mork
From: Ben Hutchings 

cdc_ncm disagrees with usbnet about how much framing overhead should
be counted in the tx_bytes statistics, and tries 'fix' this by
decrementing tx_bytes on the transmit path.  But statistics must never
be decremented except due to roll-over; this will thoroughly confuse
user-space.  Also, tx_bytes is only incremented by usbnet in the
completion path.

Fix this by requiring drivers that set FLAG_MULTI_FRAME to set a
tx_bytes delta along with the tx_packets count.

Fixes: beeecd42c3b4 ("net: cdc_ncm/cdc_mbim: adding NCM protocol statistics")
Signed-off-by: Ben Hutchings 
Signed-off-by: Bjørn Mork 
---
This should really go to stable-3.19 and 4.0, but since it depends on
6588af614e7b ("usbnet: Fix tx_packets stat for FLAG_MULTI_FRAME drivers")
already in net-next, then I guess it is net-next for this patch as well.

Thanks Ben, for fixing this.

Bjørn

 drivers/net/usb/asix_common.c |  2 +-
 drivers/net/usb/cdc_ncm.c |  7 +++
 drivers/net/usb/sr9800.c  |  2 +-
 drivers/net/usb/usbnet.c  | 16 +---
 include/linux/usb/usbnet.h|  6 --
 5 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index 724a9b50df7a..75d6f26729a3 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -189,7 +189,7 @@ struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct 
sk_buff *skb,
skb_put(skb, sizeof(padbytes));
}
 
-   usbnet_set_skb_tx_stats(skb, 1);
+   usbnet_set_skb_tx_stats(skb, 1, 0);
return skb;
 }
 
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 70cbea551139..c3e4da9e79ca 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1177,13 +1177,12 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct 
sk_buff *skb, __le32 sign)
ctx->tx_overhead += skb_out->len - ctx->tx_curr_frame_payload;
ctx->tx_ntbs++;
 
-   /* usbnet has already counted all the framing overhead.
+   /* usbnet will count all the framing overhead by default.
 * Adjust the stats so that the tx_bytes counter show real
 * payload data instead.
 */
-   dev->net->stats.tx_bytes -= skb_out->len - ctx->tx_curr_frame_payload;
-
-   usbnet_set_skb_tx_stats(skb_out, n);
+   usbnet_set_skb_tx_stats(skb_out, n,
+   ctx->tx_curr_frame_payload - skb_out->len);
 
return skb_out;
 
diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c
index 7650cdc8fe6b..953de13267df 100644
--- a/drivers/net/usb/sr9800.c
+++ b/drivers/net/usb/sr9800.c
@@ -144,7 +144,7 @@ static struct sk_buff *sr_tx_fixup(struct usbnet *dev, 
struct sk_buff *skb,
skb_put(skb, sizeof(padbytes));
}
 
-   usbnet_set_skb_tx_stats(skb, 1);
+   usbnet_set_skb_tx_stats(skb, 1, 0);
return skb;
 }
 
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 0f3ff285f6a1..57ae1973 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1346,9 +1346,19 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
} else
urb->transfer_flags |= URB_ZERO_PACKET;
}
-   entry->length = urb->transfer_buffer_length = length;
-   if (!(info->flags & FLAG_MULTI_PACKET))
-   usbnet_set_skb_tx_stats(skb, 1);
+   urb->transfer_buffer_length = length;
+
+   if (info->flags & FLAG_MULTI_PACKET) {
+   /* Driver has set number of packets and a length delta.
+* Calculate the complete length and ensure that it's
+* positive.
+*/
+   entry->length += length;
+   if (WARN_ON_ONCE(entry->length <= 0))
+   entry->length = length;
+   } else {
+   usbnet_set_skb_tx_stats(skb, 1, length);
+   }
 
spin_lock_irqsave(&dev->txq.lock, flags);
retval = usb_autopm_get_interface_async(dev->intf);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index ff3fb2bd0e90..6e0ce8c7b8cb 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -227,7 +227,7 @@ struct skb_data {   /* skb->cb is one of these */
struct urb  *urb;
struct usbnet   *dev;
enum skb_state  state;
-   size_t  length;
+   longlength;
unsigned long   packets;
 };
 
@@ -235,11 +235,13 @@ struct skb_data { /* skb->cb is one of these */
  * tx_fixup method before returning an skb.
  */
 static inline void
-usbnet_set_skb_tx_stats(struct sk_buff *skb, unsigned long packets)
+usbnet_set_skb_tx_stats(struct sk_buff *skb,
+   unsigned long packets, long bytes_delta)
 {
struct skb_data *entry = (struct skb_data *) skb->cb;
 
entry->packets = packets;
+   entry->length = bytes_delta;
 }
 
 e

[PATCH] Documentation: usb: serial: fixed how to provide vendor and product id

2015-03-25 Thread Marek Belisko
From: "H. Nikolaus Schaller" 

While trying to test the Pyra GSM/GPS/3G module I had reconfigured
the USB interface by mistake and therefore needed to run a different
USB driver than CSC-ACM. It turned out that I need the "usbserial" driver.

This file is an official description how to use it:
Documentation/usb/usb-serial.txt

But it is outdated. The parameters vendor= and product= are no longer
available since ca. 3.12 which means that documentation is lagging behind
quite some time.

Here was the solution:

https://bbs.archlinux.org/viewtopic.php?id=175499

  insmod usbserial vendor=0x product=0x

becomes (first  is vendor, second is product)

  modprobe usbserial
  echo   >/sys/bus/usb-serial/drivers/generic/new_id

This patch changes the documentation file as needed.

Signed-off-by: H. Nikolaus Schaller 
---
 Documentation/usb/usb-serial.txt | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/Documentation/usb/usb-serial.txt b/Documentation/usb/usb-serial.txt
index 947fa62..9f184d8 100644
--- a/Documentation/usb/usb-serial.txt
+++ b/Documentation/usb/usb-serial.txt
@@ -466,11 +466,13 @@ Generic Serial driver
   is required of your device is that it has at least one bulk in endpoint,
   or one bulk out endpoint. 
   
-  To enable the generic driver to recognize your device, build the driver
-  as a module and load it by the following invocation:
-   insmod usbserial vendor=0x product=0x
-  where the  is replaced with the hex representation of your device's
-  vendor id and product id.
+  To enable the generic driver to recognize your device, configure
+  USB_SERIAL_GENERIC=y and build the driver as a module. Then load it by the
+  following invocation:
+   modprobe usbserial
+   echo   >/sys/bus/usb-serial/drivers/generic/new_id
+  where the the first  is replaced with the hex representation of your
+  device's vendor id and the second  by the product id.
 
   This driver has been successfully used to connect to the NetChip USB
   development board, providing a way to develop USB firmware without
-- 
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/1] usb: musb: dsps: fix build on i386 when COMPILE_TEST is set

2015-03-25 Thread Tony Lindgren
Commit 3e457371f436 ("usb: musb: Fix fifo reads for dm816x with musb_dsps")
fixed a USB error on dm816x, but introduced a new build error on i386
when COMPILE_TEST is set:

drivers/usb/musb/musb_dsps.c: In function ‘dsps_read_fifo32’:
drivers/usb/musb/musb_dsps.c:624:3: error: implicit declaration of function
‘readsl’ [-Werror=implicit-function-declaration]
readsl(fifo, dst, len >> 2);

Let's fix this by using ioread32_rep() instead of readsl() as that's
more portable.

Fixes: 3e457371f436 ("usb: musb: Fix fifo reads for dm816x with musb_dsps")
Reported-by: Fengguang Wu 
Cc: Bin Liu 
Cc: Brian Hutchinson 
Cc: George Cherian 
Cc: Sergei Shtylyov 
Signed-off-by: Tony Lindgren 
---
 drivers/usb/musb/musb_dsps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 2c0750e..8e089c1 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -661,7 +661,7 @@ static void dsps_read_fifo32(struct musb_hw_ep *hw_ep, u16 
len, u8 *dst)
void __iomem *fifo = hw_ep->fifo;
 
if (len >= 4) {
-   readsl(fifo, dst, len >> 2);
+   ioread32_rep(fifo, dst, len >> 2);
dst += len & ~0x03;
len &= 0x03;
}
-- 
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 1/3] phy: core: Add devm_of_phy_get_by_index to phy-core

2015-03-25 Thread Kishon Vijay Abraham I
Hi,

On Saturday 21 March 2015 02:59 AM, Arun Ramamurthy wrote:
> 
> 
> On 15-03-20 02:26 PM, Dmitry Torokhov wrote:
>> Hi Arun,
>>
>> On Fri, Mar 20, 2015 at 02:07:08PM -0700, Arun Ramamurthy wrote:
>>> Adding devm_of_phy_get_by_index to get phys by supplying an index
>>> and not a phy name when multiple phys are declared

I think a bit more explanation on why get_by_index is needed here.
>>>
>>> Reviewed-by: Ray Jui 
>>> Reviewed-by: Scott Branden 
>>> Signed-off-by: Arun Ramamurthy 
>>> ---
>>>   drivers/phy/phy-core.c  | 30 ++
>>>   include/linux/phy/phy.h |  2 ++
>>>   2 files changed, 32 insertions(+)
>>>
>>> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
>>> index a12d353..0c03876 100644
>>> --- a/drivers/phy/phy-core.c
>>> +++ b/drivers/phy/phy-core.c
>>> @@ -622,6 +622,36 @@ struct phy *devm_of_phy_get(struct device *dev, struct
>>> device_node *np,
>>>   EXPORT_SYMBOL_GPL(devm_of_phy_get);
>>>
>>>   /**
>>> + * devm_of_phy_get_by_index() - lookup and obtain a reference to a phy by
>>> index.
>>> + * @dev: device that requests this phy
>>> + * @np: node containing the phy
>>> + * @index: index of the phy
>>> + *
>>> + * Gets the phy using _of_phy_get(), and associates a device with it using
>>> + * devres. On driver detach, release function is invoked on the devres 
>>> data,
>>> + * then, devres data is freed.
>>> + *
>>> + */
>>> +struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node
>>> *np,
>>> + int index)
>>> +{
>>> +struct phy **ptr, *phy;
>>> +
>>> +ptr = devres_alloc(devm_phy_release, sizeof(*ptr), GFP_KERNEL);
>>> +if (!ptr)
>>> +return ERR_PTR(-ENOMEM);
>>> +
>>> +phy = _of_phy_get(np, index);
>>> +if (!IS_ERR(phy)) {
>>> +*ptr = phy;
>>> +devres_add(dev, ptr);
>>> +} else {
>>> +devres_free(ptr);
>>> +}
>>> +
>>> +return phy;
>>> +}
>>
>> You want EXPORT_SYMBOL_GPL(devm_of_phy_get_by_index); here.

Also update the Documentation/phy.txt.

-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 1/3] phy: core: Add devm_of_phy_get_by_index to phy-core

2015-03-25 Thread Arun Ramamurthy



On 15-03-25 03:03 PM, Kishon Vijay Abraham I wrote:

Hi,

On Saturday 21 March 2015 02:59 AM, Arun Ramamurthy wrote:



On 15-03-20 02:26 PM, Dmitry Torokhov wrote:

Hi Arun,

On Fri, Mar 20, 2015 at 02:07:08PM -0700, Arun Ramamurthy wrote:

Adding devm_of_phy_get_by_index to get phys by supplying an index
and not a phy name when multiple phys are declared


I think a bit more explanation on why get_by_index is needed here.
Thanks Kison. Can you be more specific? I am unsure of what more I can 
explain here.


Reviewed-by: Ray Jui 
Reviewed-by: Scott Branden 
Signed-off-by: Arun Ramamurthy 
---
   drivers/phy/phy-core.c  | 30 ++
   include/linux/phy/phy.h |  2 ++
   2 files changed, 32 insertions(+)

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index a12d353..0c03876 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -622,6 +622,36 @@ struct phy *devm_of_phy_get(struct device *dev, struct
device_node *np,
   EXPORT_SYMBOL_GPL(devm_of_phy_get);

   /**
+ * devm_of_phy_get_by_index() - lookup and obtain a reference to a phy by
index.
+ * @dev: device that requests this phy
+ * @np: node containing the phy
+ * @index: index of the phy
+ *
+ * Gets the phy using _of_phy_get(), and associates a device with it using
+ * devres. On driver detach, release function is invoked on the devres data,
+ * then, devres data is freed.
+ *
+ */
+struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node
*np,
+ int index)
+{
+struct phy **ptr, *phy;
+
+ptr = devres_alloc(devm_phy_release, sizeof(*ptr), GFP_KERNEL);
+if (!ptr)
+return ERR_PTR(-ENOMEM);
+
+phy = _of_phy_get(np, index);
+if (!IS_ERR(phy)) {
+*ptr = phy;
+devres_add(dev, ptr);
+} else {
+devres_free(ptr);
+}
+
+return phy;
+}


You want EXPORT_SYMBOL_GPL(devm_of_phy_get_by_index); here.


Also update the Documentation/phy.txt.


Ok will do.

-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


[PATCH RESEND] phy: exynos5-usbdrd: Add to support for Exynos5433 SoC

2015-03-25 Thread Jaewon Kim
This patch adds driver data to support for Exynos5433 SoC.
The Exynos5433 has one USB3.0 Host and USB3.0 DRD(Dual Role Device).
Exynos5433 is simplar to Eyxnos7 but Exynos5433 have
one more USB3.0 Host controller.

Signed-off-by: Jaewon Kim 
Tested-by: Chanwoo Choi 
---
 .../devicetree/bindings/phy/samsung-phy.txt|3 ++-
 drivers/phy/phy-exynos5-usbdrd.c   |   10 ++
 include/linux/mfd/syscon/exynos5-pmu.h |3 +++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt 
b/Documentation/devicetree/bindings/phy/samsung-phy.txt
index 91e38cf..60c6f2a 100644
--- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
+++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
@@ -128,6 +128,7 @@ Required properties:
 - compatible : Should be set to one of the following supported values:
- "samsung,exynos5250-usbdrd-phy" - for exynos5250 SoC,
- "samsung,exynos5420-usbdrd-phy" - for exynos5420 SoC.
+   - "samsung,exynos5433-usbdrd-phy" - for exynos5433 SoC.
- "samsung,exynos7-usbdrd-phy" - for exynos7 SoC.
 - reg : Register offset and length of USB DRD PHY register set;
 - clocks: Clock IDs array as required by the controller
@@ -139,7 +140,7 @@ Required properties:
   PHY operations, associated by phy name. It is used to
   determine bit values for clock settings register.
   For Exynos5420 this is given as 'sclk_usbphy30' in CMU.
-   - optional clocks: Exynos7 SoC has now following additional
+   - optional clocks: Exynos5433 & Exynos7 SoC has now following additional
   gate clocks available:
   - phy_pipe: for PIPE3 phy
   - phy_utmi: for UTMI+ phy
diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c
index e2a0be7..d72ef15 100644
--- a/drivers/phy/phy-exynos5-usbdrd.c
+++ b/drivers/phy/phy-exynos5-usbdrd.c
@@ -624,6 +624,13 @@ static const struct exynos5_usbdrd_phy_drvdata 
exynos5250_usbdrd_phy = {
.has_common_clk_gate= true,
 };
 
+static const struct exynos5_usbdrd_phy_drvdata exynos5433_usbdrd_phy = {
+   .phy_cfg= phy_cfg_exynos5,
+   .pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL,
+   .pmu_offset_usbdrd1_phy = EXYNOS5433_USBHOST30_PHY_CONTROL,
+   .has_common_clk_gate= false,
+};
+
 static const struct exynos5_usbdrd_phy_drvdata exynos7_usbdrd_phy = {
.phy_cfg= phy_cfg_exynos5,
.pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL,
@@ -638,6 +645,9 @@ static const struct of_device_id 
exynos5_usbdrd_phy_of_match[] = {
.compatible = "samsung,exynos5420-usbdrd-phy",
.data = &exynos5420_usbdrd_phy
}, {
+   .compatible = "samsung,exynos5433-usbdrd-phy",
+   .data = &exynos5433_usbdrd_phy
+   }, {
.compatible = "samsung,exynos7-usbdrd-phy",
.data = &exynos7_usbdrd_phy
},
diff --git a/include/linux/mfd/syscon/exynos5-pmu.h 
b/include/linux/mfd/syscon/exynos5-pmu.h
index 00ef24b..9352adc 100644
--- a/include/linux/mfd/syscon/exynos5-pmu.h
+++ b/include/linux/mfd/syscon/exynos5-pmu.h
@@ -36,6 +36,9 @@
 #define EXYNOS5420_MTCADC_PHY_CONTROL  (0x724)
 #define EXYNOS5420_DPTX_PHY_CONTROL(0x728)
 
+/* Exynos5433 specific register definitions */
+#define EXYNOS5433_USBHOST30_PHY_CONTROL   (0x728)
+
 #define EXYNOS5_PHY_ENABLE BIT(0)
 
 #define EXYNOS5_MIPI_PHY_S_RESETN  BIT(1)
-- 
1.7.9.5

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


[PATCH v2] usb: introduce OTG 2.0 related kernel feature and API.

2015-03-25 Thread Macpaul Lin
Introduce kernel feature CONFIG_USB_OTG20 and related
gadget_is_otg20() API for supporting OTG20 compliant
drivers.
This patch also updated usb_otg_descritpor.

Signed-off-by: Macpaul Lin 
---
 drivers/usb/core/Kconfig |  9 +
 include/linux/usb/gadget.h   | 24 
 include/uapi/linux/usb/ch9.h |  4 
 3 files changed, 37 insertions(+)

changes for v2:
 - Add USB_OTG_ADP definition in ch9.h

diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index cc0ced0..7fdda5f 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -55,6 +55,15 @@ config USB_OTG
  Select this only if your board has Mini-AB/Micro-AB
  connector.
 
+config USB_OTG20
+   bool "OTG20 support (EXPERIMENTAL)"
+   depends on USB_OTG
+   default n
+   help
+ This feature is still under developing.
+
+ Select this only if your board support OTG 20's hardware requirements.
+
 config USB_OTG_WHITELIST
bool "Rely on OTG and EH Targeted Peripherals List"
depends on USB
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index e2f00fd..e598677 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -512,6 +512,8 @@ struct usb_gadget_ops {
  * @sg_supported: true if we can handle scatter-gather
  * @is_otg: True if the USB device port uses a Mini-AB jack, so that the
  * gadget driver must provide a USB OTG descriptor.
+ * @is_otg20: True if the USB hardware supports OTG 2.0 specification.
+ * The gadget driver must provide USB OTG 2.0 descriptor.
  * @is_a_peripheral: False unless is_otg, the "A" end of a USB cable
  * is in the Mini-AB jack, and HNP has been used to switch roles
  * so that the "A" device currently acts as A-Peripheral, not A-Host.
@@ -559,6 +561,7 @@ struct usb_gadget {
 
unsignedsg_supported:1;
unsignedis_otg:1;
+   unsignedis_otg20:1;
unsignedis_a_peripheral:1;
unsignedb_hnp_enable:1;
unsigneda_hnp_support:1;
@@ -634,6 +637,23 @@ static inline int gadget_is_otg(struct usb_gadget *g)
 }
 
 /**
+ * gadget_is_otg20 - return true iff the hardware is OTG 2.0-ready
+ * @g: controller that might supports OTG 2.0 specification.
+ *
+ * This is a runtime test, since kernels with a USB-OTG stack sometimes
+ * run on boards which only supports OTG 1.3,
+ */
+static inline int gadget_is_otg20(struct usb_gadget *g)
+{
+#ifdef CONFIG_USB_OTG20
+   return g->is_otg20;
+#else
+   return 0;
+#endif
+}
+
+
+/**
  * usb_gadget_frame_number - returns the current frame number
  * @gadget: controller that reports the frame number
  *
@@ -832,6 +852,10 @@ static inline int usb_gadget_disconnect(struct usb_gadget 
*gadget)
  * having called usb_gadget_disconnect(), and the USB host stack has
  * initialized.
  *
+ * If gadget->is_otg20 is true, the gadget driver must provide an OTG 2.0
+ * descriptor during enumeration, and related behavior must compliant with
+ * OTG 2.0 specificaiton.
+ *
  * Drivers use hardware-specific knowledge to configure the usb hardware.
  * endpoint addressing is only one of several hardware characteristics that
  * are in descriptors the ep0 implementation returns from setup() calls.
diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
index aa33fd1..aaabdca 100644
--- a/include/uapi/linux/usb/ch9.h
+++ b/include/uapi/linux/usb/ch9.h
@@ -672,11 +672,15 @@ struct usb_otg_descriptor {
__u8  bDescriptorType;
 
__u8  bmAttributes; /* support for HNP, SRP, etc */
+#ifdef CONFIG_USB_OTG20
+   __le16 bcdOTG;  /* Support OTG 2.0 */
+#endif
 } __attribute__ ((packed));
 
 /* from usb_otg_descriptor.bmAttributes */
 #define USB_OTG_SRP(1 << 0)
 #define USB_OTG_HNP(1 << 1)/* swap host/device roles */
+#define USB_OTG_ADP(1 << 2)/* support ADP */
 
 /*-*/
 
-- 
1.8.3.2

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


RE: [PATCH 1/1] usb: chipidea: otg: remove mutex unlock and lock while stop and start role

2015-03-25 Thread Peter Chen
 
> 
> This is to fix the problem of HNP you reported after apply my HNP polling
> patchset, I verified with i.MX6DL and i.MX6SX SDB and it works ok(with each
> one as A or B device).
> 
> ---
>  drivers/usb/chipidea/otg_fsm.c | 4 
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
> index 82b1e23..789dd76 100644
> --- a/drivers/usb/chipidea/otg_fsm.c
> +++ b/drivers/usb/chipidea/otg_fsm.c
> @@ -531,7 +531,6 @@ static int ci_otg_start_host(struct otg_fsm *fsm, int on)
> {
>   struct ci_hdrc  *ci = container_of(fsm, struct ci_hdrc, fsm);
> 
> - mutex_unlock(&fsm->lock);
>   if (on) {
>   ci_role_stop(ci);
>   ci_role_start(ci, CI_ROLE_HOST);
> @@ -540,7 +539,6 @@ static int ci_otg_start_host(struct otg_fsm *fsm, int on)
>   hw_device_reset(ci);
>   ci_role_start(ci, CI_ROLE_GADGET);
>   }
> - mutex_lock(&fsm->lock);
>   return 0;
>  }
> 

What is intention you added before?

Peter

> @@ -548,12 +546,10 @@ static int ci_otg_start_gadget(struct otg_fsm *fsm, int
> on)  {
>   struct ci_hdrc  *ci = container_of(fsm, struct ci_hdrc, fsm);
> 
> - mutex_unlock(&fsm->lock);
>   if (on)
>   usb_gadget_vbus_connect(&ci->gadget);
>   else
>   usb_gadget_vbus_disconnect(&ci->gadget);
> - mutex_lock(&fsm->lock);
> 
>   return 0;
>  }
> --
> 1.9.1

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


Re: [PATCH RESEND] phy: exynos5-usbdrd: Add to support for Exynos5433 SoC

2015-03-25 Thread Vivek Gautam
On Thu, Mar 26, 2015 at 7:48 AM, Jaewon Kim  wrote:
> This patch adds driver data to support for Exynos5433 SoC.
> The Exynos5433 has one USB3.0 Host and USB3.0 DRD(Dual Role Device).
> Exynos5433 is simplar to Eyxnos7 but Exynos5433 have
> one more USB3.0 Host controller.
>
> Signed-off-by: Jaewon Kim 
> Tested-by: Chanwoo Choi 
> ---

Patch looks good to me.

Reviewed-by: Vivek Gautam 

>  .../devicetree/bindings/phy/samsung-phy.txt|3 ++-
>  drivers/phy/phy-exynos5-usbdrd.c   |   10 ++
>  include/linux/mfd/syscon/exynos5-pmu.h |3 +++
>  3 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt 
> b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> index 91e38cf..60c6f2a 100644
> --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> @@ -128,6 +128,7 @@ Required properties:
>  - compatible : Should be set to one of the following supported values:
> - "samsung,exynos5250-usbdrd-phy" - for exynos5250 SoC,
> - "samsung,exynos5420-usbdrd-phy" - for exynos5420 SoC.
> +   - "samsung,exynos5433-usbdrd-phy" - for exynos5433 SoC.
> - "samsung,exynos7-usbdrd-phy" - for exynos7 SoC.
>  - reg : Register offset and length of USB DRD PHY register set;
>  - clocks: Clock IDs array as required by the controller
> @@ -139,7 +140,7 @@ Required properties:
>PHY operations, associated by phy name. It is used to
>determine bit values for clock settings register.
>For Exynos5420 this is given as 'sclk_usbphy30' in CMU.
> -   - optional clocks: Exynos7 SoC has now following additional
> +   - optional clocks: Exynos5433 & Exynos7 SoC has now following 
> additional
>gate clocks available:
>- phy_pipe: for PIPE3 phy
>- phy_utmi: for UTMI+ phy
> diff --git a/drivers/phy/phy-exynos5-usbdrd.c 
> b/drivers/phy/phy-exynos5-usbdrd.c
> index e2a0be7..d72ef15 100644
> --- a/drivers/phy/phy-exynos5-usbdrd.c
> +++ b/drivers/phy/phy-exynos5-usbdrd.c
> @@ -624,6 +624,13 @@ static const struct exynos5_usbdrd_phy_drvdata 
> exynos5250_usbdrd_phy = {
> .has_common_clk_gate= true,
>  };
>
> +static const struct exynos5_usbdrd_phy_drvdata exynos5433_usbdrd_phy = {
> +   .phy_cfg= phy_cfg_exynos5,
> +   .pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL,
> +   .pmu_offset_usbdrd1_phy = EXYNOS5433_USBHOST30_PHY_CONTROL,
> +   .has_common_clk_gate= false,
> +};
> +
>  static const struct exynos5_usbdrd_phy_drvdata exynos7_usbdrd_phy = {
> .phy_cfg= phy_cfg_exynos5,
> .pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL,
> @@ -638,6 +645,9 @@ static const struct of_device_id 
> exynos5_usbdrd_phy_of_match[] = {
> .compatible = "samsung,exynos5420-usbdrd-phy",
> .data = &exynos5420_usbdrd_phy
> }, {
> +   .compatible = "samsung,exynos5433-usbdrd-phy",
> +   .data = &exynos5433_usbdrd_phy
> +   }, {
> .compatible = "samsung,exynos7-usbdrd-phy",
> .data = &exynos7_usbdrd_phy
> },
> diff --git a/include/linux/mfd/syscon/exynos5-pmu.h 
> b/include/linux/mfd/syscon/exynos5-pmu.h
> index 00ef24b..9352adc 100644
> --- a/include/linux/mfd/syscon/exynos5-pmu.h
> +++ b/include/linux/mfd/syscon/exynos5-pmu.h
> @@ -36,6 +36,9 @@
>  #define EXYNOS5420_MTCADC_PHY_CONTROL  (0x724)
>  #define EXYNOS5420_DPTX_PHY_CONTROL(0x728)
>
> +/* Exynos5433 specific register definitions */
> +#define EXYNOS5433_USBHOST30_PHY_CONTROL   (0x728)
> +
>  #define EXYNOS5_PHY_ENABLE BIT(0)
>
>  #define EXYNOS5_MIPI_PHY_S_RESETN  BIT(1)
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 
> in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Best Regards
Vivek Gautam
Samsung R&D Institute, Bangalore
India
--
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/1] usb: chipidea: otg: remove mutex unlock and lock while stop and start role

2015-03-25 Thread Li Jun
On Thu, Mar 26, 2015 at 11:50:11AM +0800, Chen Peter-B29397 wrote:
>  
> > 
> > This is to fix the problem of HNP you reported after apply my HNP polling
> > patchset, I verified with i.MX6DL and i.MX6SX SDB and it works ok(with each
> > one as A or B device).
> > 
> > ---
> >  drivers/usb/chipidea/otg_fsm.c | 4 
> >  1 file changed, 4 deletions(-)
> > 
> > diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
> > index 82b1e23..789dd76 100644
> > --- a/drivers/usb/chipidea/otg_fsm.c
> > +++ b/drivers/usb/chipidea/otg_fsm.c
> > @@ -531,7 +531,6 @@ static int ci_otg_start_host(struct otg_fsm *fsm, int 
> > on)
> > {
> > struct ci_hdrc  *ci = container_of(fsm, struct ci_hdrc, fsm);
> > 
> > -   mutex_unlock(&fsm->lock);
> > if (on) {
> > ci_role_stop(ci);
> > ci_role_start(ci, CI_ROLE_HOST);
> > @@ -540,7 +539,6 @@ static int ci_otg_start_host(struct otg_fsm *fsm, int 
> > on)
> > hw_device_reset(ci);
> > ci_role_start(ci, CI_ROLE_GADGET);
> > }
> > -   mutex_lock(&fsm->lock);
> > return 0;
> >  }
> > 
> 
> What is intention you added before?
> 

not to sleep with the lock hold, actually it's not a problem.

Li Jun
> Peter
> 
> > @@ -548,12 +546,10 @@ static int ci_otg_start_gadget(struct otg_fsm *fsm, 
> > int
> > on)  {
> > struct ci_hdrc  *ci = container_of(fsm, struct ci_hdrc, fsm);
> > 
> > -   mutex_unlock(&fsm->lock);
> > if (on)
> > usb_gadget_vbus_connect(&ci->gadget);
> > else
> > usb_gadget_vbus_disconnect(&ci->gadget);
> > -   mutex_lock(&fsm->lock);
> > 
> > return 0;
> >  }
> > --
> > 1.9.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] usb: chipidea: otg: remove mutex unlock and lock while stop and start role

2015-03-25 Thread Peter Chen
On Thu, Mar 26, 2015 at 01:36:19PM +0800, Li Jun wrote:
> On Thu, Mar 26, 2015 at 11:50:11AM +0800, Chen Peter-B29397 wrote:
> >  
> > > 
> > > This is to fix the problem of HNP you reported after apply my HNP polling
> > > patchset, I verified with i.MX6DL and i.MX6SX SDB and it works ok(with 
> > > each
> > > one as A or B device).
> > > 
> > > ---
> > >  drivers/usb/chipidea/otg_fsm.c | 4 
> > >  1 file changed, 4 deletions(-)
> > > 
> > > diff --git a/drivers/usb/chipidea/otg_fsm.c 
> > > b/drivers/usb/chipidea/otg_fsm.c
> > > index 82b1e23..789dd76 100644
> > > --- a/drivers/usb/chipidea/otg_fsm.c
> > > +++ b/drivers/usb/chipidea/otg_fsm.c
> > > @@ -531,7 +531,6 @@ static int ci_otg_start_host(struct otg_fsm *fsm, int 
> > > on)
> > > {
> > >   struct ci_hdrc  *ci = container_of(fsm, struct ci_hdrc, fsm);
> > > 
> > > - mutex_unlock(&fsm->lock);
> > >   if (on) {
> > >   ci_role_stop(ci);
> > >   ci_role_start(ci, CI_ROLE_HOST);
> > > @@ -540,7 +539,6 @@ static int ci_otg_start_host(struct otg_fsm *fsm, int 
> > > on)
> > >   hw_device_reset(ci);
> > >   ci_role_start(ci, CI_ROLE_GADGET);
> > >   }
> > > - mutex_lock(&fsm->lock);
> > >   return 0;
> > >  }
> > > 
> > 
> > What is intention you added before?
> > 
> 
> not to sleep with the lock hold, actually it's not a problem.
> 
> Li Jun
> > Peter
> > 
> > > @@ -548,12 +546,10 @@ static int ci_otg_start_gadget(struct otg_fsm *fsm, 
> > > int
> > > on)  {
> > >   struct ci_hdrc  *ci = container_of(fsm, struct ci_hdrc, fsm);
> > > 
> > > - mutex_unlock(&fsm->lock);
> > >   if (on)
> > >   usb_gadget_vbus_connect(&ci->gadget);
> > >   else
> > >   usb_gadget_vbus_disconnect(&ci->gadget);
> > > - mutex_lock(&fsm->lock);
> > > 
> > >   return 0;
> > >  }
> > > --
> > > 1.9.1
> > 

Need to Cc:  #vx.y+

-- 

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 4/4] usb: legacy/multi add supports OTG 2.0

2015-03-25 Thread Li Jun
On Thu, Mar 26, 2015 at 03:38:38AM +0800, Macpaul Lin wrote:
> add supports OTG 2.0 for multi.c
> 
> Signed-off-by: Macpaul Lin 
> ---
>  drivers/usb/gadget/legacy/multi.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/gadget/legacy/multi.c 
> b/drivers/usb/gadget/legacy/multi.c
> index 39d27bb..0f4005e 100644
> --- a/drivers/usb/gadget/legacy/multi.c
> +++ b/drivers/usb/gadget/legacy/multi.c
> @@ -89,6 +89,9 @@ static const struct usb_descriptor_header *otg_desc[] = {
>* it would not be called "OTG" ...
>*/
>   .bmAttributes = USB_OTG_SRP | USB_OTG_HNP,

After you introduce some flags for controller to decide if HNP/SRP/ADP can be
supported, this setting in all gadget drivers should be override according to 
those
flags too, otherwise there will be possible mismatch between the OTG descriptor
within config(like above setting) and the response for getting OTG descriptor
request(your patch 3 does in composite.c).

Li Jun
> +#ifdef   CONFIG_USB_OTG20
> + .bcdOTG =   cpu_to_le16(0x0200),
> +#endif
>   },
>   NULL,
>  };
> -- 
> 1.8.3.2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html