All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tanya Brokhman" <tlinder@codeaurora.org>
To: 'Sebastian Andrzej Siewior' <bigeasy@linutronix.de>
Cc: gregkh@suse.de, linux-arm-msm@vger.kernel.org, balbi@ti.com,
	ablay@codeaurora.org,
	"'open list:USB GADGET/PERIPH...'" <linux-usb@vger.kernel.org>,
	'open list' <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 5/5 v5] usb:gadget: Add SuperSpeed support to the Gadget Framework
Date: Thu, 14 Apr 2011 10:36:42 +0300	[thread overview]
Message-ID: <002a01cbfa76$b5567c20$20037460$@org> (raw)
In-Reply-To: <20110411175917.GE4018@linutronix.de>

Hi Sebastian,

> >+/* Default endpoint companion descriptor */
> >+static struct usb_ss_ep_comp_descriptor default_ep_comp_desc = {
> >+		.bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
> >+		.bLength = 0x06,
> sizeof() ?
> 
> >+		.bMaxBurst = 0, /* the default is we don't support bursting
> */
> >+		.bmAttributes = 0, /* 2^0 streams supported */
> >+		.wBytesPerInterval = 0,
> It is already 0 :) It makes sense to set to 0 if you want to point out
> something specific.


Just wanted all the values to be visible/specified. When reading the code
one can forget that wBytesPerInterval field is a part of this descriptor.
Since these are default values I thought that this "reminder" is better.

> >+	ss_cap->bLength = USB_DT_USB_SS_CAP_SIZE;
> >+	ss_cap->bDescriptorType = USB_DT_DEVICE_CAPABILITY;
> >+	ss_cap->bDevCapabilityType = USB_SS_CAP_TYPE;
> >+	ss_cap->bmAttributes = 0; /* LTM is not supported yet */
> 
> Who's fault is it? Isn't this always supported by the SS-udc?


I didn't find anything in the USB30 Spec that mentions that LTM support is
required from all SS-UDCs. 
We're working on a SS-UDC at the moment and we decide that LTM support will
be added later on. 
My guess is that when we do add this support we'll add some sort of a cb
from the UDC to set this value according to.

> >@@ -903,18 +1162,28 @@ composite_setup(struct usb_gadget *gadget,
> const struct usb_ctrlrequest *ctrl)
> > 		case USB_DT_DEVICE:
> > 			cdev->desc.bNumConfigurations =
> > 				count_configs(cdev, USB_DT_DEVICE);
> >+			cdev->desc.bMaxPacketSize0 =
> >+				cdev->gadget->ep0->maxpacket;
> >+			if (gadget->speed >= USB_SPEED_SUPER)
> there is something after super speed?

Not at the moment but I believe might be in the future :-)

> >@@ -1107,8 +1441,11 @@ composite_unbind(struct usb_gadget *gadget)
> > 				DBG(cdev, "unbind function '%s'/%p\n",
> > 						f->name, f);
> > 				f->unbind(c, f);
> >-				/* may free memory for "f" */
> > 			}
> >+			/* Free memory allocated for ss descriptors */
> >+			if (f->ss_desc_allocated && f->ss_descriptors)
> 
> check for  f->ss_descriptors is not required since kfree(null) is fine.
> However this does no fly. f->unbind() will free the memmory of f. So
> moving the comment does not delay the de-allocation :)
> The comment is should probably use "will" instead of "may" since all
> gadgets I checked do this.
> The conditional allocation/free of the ss descriptor is kind of nasty.
> Wouldn't it be better to add create_ss_descriptors() for every gadget
> driver that needs it? This isn't that much. And in unbind you could
> always free all three of them using one function like
> free_all_descritpors().

You're right in your observation that the above is not the best way to
handle this. I've re-designed this a bit in the next version. 
We don't want to create ss descriptors for all of the gadget drivers
automatically. First of all because this way all of the gadget drivers will
be forced to operate over SS connection if such is available. The purpose of
the  function->ss_not_capable flag was to allow a gadget driver to force
HS/LS connection even if SS is available. 
Anyway this two flags (ss_not_capable and ss_desc_allocated) were replaced
by another flag (function->generate_ss_desc) that should be set to true by
any gadget driver that wishes ss descriptors to be automatically generated
for it.
We discussed this with Felipe and came to a conclusion that this function
(create_ss_descriptors()) will be taken out to a different patch that won't
be merged into the mainline, just posted on the mailing list to help
developers in early stages of their work. 
In the long run the better approach is that each gadget driver that wishes
to operate in ss connection speed should provide his own ss descriptors with
values that are suitable for it.


Best regards,
Tanya Brokhman
Consultant for Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum

WARNING: multiple messages have this Message-ID (diff)
From: "Tanya Brokhman" <tlinder@codeaurora.org>
To: "'Sebastian Andrzej Siewior'" <bigeasy@linutronix.de>
Cc: <gregkh@suse.de>, <linux-arm-msm@vger.kernel.org>, <balbi@ti.com>,
	<ablay@codeaurora.org>,
	"'open list:USB GADGET/PERIPH...'" <linux-usb@vger.kernel.org>,
	"'open list'" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 5/5 v5] usb:gadget: Add SuperSpeed support to the Gadget Framework
Date: Thu, 14 Apr 2011 10:36:42 +0300	[thread overview]
Message-ID: <002a01cbfa76$b5567c20$20037460$@org> (raw)
In-Reply-To: <20110411175917.GE4018@linutronix.de>

Hi Sebastian,

> >+/* Default endpoint companion descriptor */
> >+static struct usb_ss_ep_comp_descriptor default_ep_comp_desc = {
> >+		.bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
> >+		.bLength = 0x06,
> sizeof() ?
> 
> >+		.bMaxBurst = 0, /* the default is we don't support bursting
> */
> >+		.bmAttributes = 0, /* 2^0 streams supported */
> >+		.wBytesPerInterval = 0,
> It is already 0 :) It makes sense to set to 0 if you want to point out
> something specific.


Just wanted all the values to be visible/specified. When reading the code
one can forget that wBytesPerInterval field is a part of this descriptor.
Since these are default values I thought that this "reminder" is better.

> >+	ss_cap->bLength = USB_DT_USB_SS_CAP_SIZE;
> >+	ss_cap->bDescriptorType = USB_DT_DEVICE_CAPABILITY;
> >+	ss_cap->bDevCapabilityType = USB_SS_CAP_TYPE;
> >+	ss_cap->bmAttributes = 0; /* LTM is not supported yet */
> 
> Who's fault is it? Isn't this always supported by the SS-udc?


I didn't find anything in the USB30 Spec that mentions that LTM support is
required from all SS-UDCs. 
We're working on a SS-UDC at the moment and we decide that LTM support will
be added later on. 
My guess is that when we do add this support we'll add some sort of a cb
from the UDC to set this value according to.

> >@@ -903,18 +1162,28 @@ composite_setup(struct usb_gadget *gadget,
> const struct usb_ctrlrequest *ctrl)
> > 		case USB_DT_DEVICE:
> > 			cdev->desc.bNumConfigurations =
> > 				count_configs(cdev, USB_DT_DEVICE);
> >+			cdev->desc.bMaxPacketSize0 =
> >+				cdev->gadget->ep0->maxpacket;
> >+			if (gadget->speed >= USB_SPEED_SUPER)
> there is something after super speed?

Not at the moment but I believe might be in the future :-)

> >@@ -1107,8 +1441,11 @@ composite_unbind(struct usb_gadget *gadget)
> > 				DBG(cdev, "unbind function '%s'/%p\n",
> > 						f->name, f);
> > 				f->unbind(c, f);
> >-				/* may free memory for "f" */
> > 			}
> >+			/* Free memory allocated for ss descriptors */
> >+			if (f->ss_desc_allocated && f->ss_descriptors)
> 
> check for  f->ss_descriptors is not required since kfree(null) is fine.
> However this does no fly. f->unbind() will free the memmory of f. So
> moving the comment does not delay the de-allocation :)
> The comment is should probably use "will" instead of "may" since all
> gadgets I checked do this.
> The conditional allocation/free of the ss descriptor is kind of nasty.
> Wouldn't it be better to add create_ss_descriptors() for every gadget
> driver that needs it? This isn't that much. And in unbind you could
> always free all three of them using one function like
> free_all_descritpors().

You're right in your observation that the above is not the best way to
handle this. I've re-designed this a bit in the next version. 
We don't want to create ss descriptors for all of the gadget drivers
automatically. First of all because this way all of the gadget drivers will
be forced to operate over SS connection if such is available. The purpose of
the  function->ss_not_capable flag was to allow a gadget driver to force
HS/LS connection even if SS is available. 
Anyway this two flags (ss_not_capable and ss_desc_allocated) were replaced
by another flag (function->generate_ss_desc) that should be set to true by
any gadget driver that wishes ss descriptors to be automatically generated
for it.
We discussed this with Felipe and came to a conclusion that this function
(create_ss_descriptors()) will be taken out to a different patch that won't
be merged into the mainline, just posted on the mailing list to help
developers in early stages of their work. 
In the long run the better approach is that each gadget driver that wishes
to operate in ss connection speed should provide his own ss descriptors with
values that are suitable for it.


Best regards,
Tanya Brokhman
Consultant for Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum





  parent reply	other threads:[~2011-04-14  7:35 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23  8:04 [PATCH 5/5 v5] usb:gadget: Add SuperSpeed support to the Gadget Framework Tatyana Brokhman
2011-03-23  8:04 ` Tatyana Brokhman
     [not found] ` <1300867498-20997-1-git-send-email-tlinder-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-03-25 13:41   ` Felipe Balbi
2011-03-25 13:41     ` Felipe Balbi
2011-03-28  8:45     ` Tanya Brokhman
2011-03-28  8:45       ` Tanya Brokhman
2011-03-28  8:54       ` Felipe Balbi
2011-03-28  9:15         ` Tanya Brokhman
2011-03-28  9:15           ` Tanya Brokhman
2011-04-11 17:59   ` Sebastian Andrzej Siewior
2011-04-11 17:59     ` Sebastian Andrzej Siewior
2011-04-12 19:34     ` Sebastian Andrzej Siewior
2011-04-12 19:34       ` [PATCH 2/5] usb/gadget: rename bos to get_bos_descr in composite Sebastian Andrzej Siewior
2011-04-12 19:34       ` [PATCH 3/5] usb/gadget: rename create_ss_descriptors() to usb_create_ss_descriptors() Sebastian Andrzej Siewior
2011-04-12 19:34       ` [PATCH 4/5] usb/gadget: don't deploy SS descriptors if SS is not enabled Sebastian Andrzej Siewior
2011-04-13 10:46         ` Sergei Shtylyov
     [not found]           ` <4DA57F0F.1090609-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
2011-04-13 10:56             ` Sebastian Andrzej Siewior
2011-04-13 10:56               ` Sebastian Andrzej Siewior
2011-04-13 10:59               ` Michal Nazarewicz
     [not found]       ` <1302636896-12717-1-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2011-04-12 19:34         ` [PATCH 1/5] usb/gadget: cleanup of "Add SuperSpeed support to the Gadget Framework" Sebastian Andrzej Siewior
2011-04-12 19:34           ` Sebastian Andrzej Siewior
2011-04-13  8:17           ` Felipe Balbi
2011-04-12 19:34         ` [PATCH 5/5] usb/gadget: don't auto-create SS descriptors if HS are avilable Sebastian Andrzej Siewior
2011-04-12 19:34           ` Sebastian Andrzej Siewior
2011-04-13 11:12       ` [PATCH 5/5 v5] usb:gadget: Add SuperSpeed support to the Gadget Framework Tanya Brokhman
2011-04-13 11:12         ` Tanya Brokhman
2011-04-14  7:36     ` Tanya Brokhman [this message]
2011-04-14  7:36       ` Tanya Brokhman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002a01cbfa76$b5567c20$20037460$@org' \
    --to=tlinder@codeaurora.org \
    --cc=ablay@codeaurora.org \
    --cc=balbi@ti.com \
    --cc=bigeasy@linutronix.de \
    --cc=gregkh@suse.de \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.