From: Felipe Balbi <balbi@ti.com>
To: Tatyana Brokhman <tlinder@codeaurora.org>
Cc: greg@kroah.com, linux-usb@vger.kernel.org,
linux-arm-msm@vger.kernel.org, balbi@ti.com,
ablay@codeaurora.org, open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v9 4/7] usb:gadget: Add SuperSpeed support to the Gadget Framework
Date: Mon, 9 May 2011 12:19:10 +0300 [thread overview]
Message-ID: <20110509091904.GE1254@legolas.emea.dhcp.ti.com> (raw)
In-Reply-To: <1304853414-10234-5-git-send-email-tlinder@codeaurora.org>
On Sun, May 08, 2011 at 02:16:45PM +0300, Tatyana Brokhman wrote:
> This patch adds the SuperSpeed functionality to the gadget framework.
> Support for new SuperSpeed BOS descriptor was added.
> Support for SET_FEATURE and GET_STATUS requests in SuperSpeed mode was
> added.
>
> Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
>
> ---
> drivers/usb/gadget/Kconfig | 11 ++
> drivers/usb/gadget/composite.c | 234 ++++++++++++++++++++++++++++++++++++---
> drivers/usb/gadget/epautoconf.c | 7 +-
> include/linux/usb/ch9.h | 2 -
> include/linux/usb/composite.h | 16 +++
> include/linux/usb/gadget.h | 34 ++++++
> 6 files changed, 284 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
> index 4c02b9f..4c4ba47 100644
> --- a/drivers/usb/gadget/Kconfig
> +++ b/drivers/usb/gadget/Kconfig
> @@ -623,6 +623,17 @@ config USB_GADGET_DUALSPEED
> Means that gadget drivers should include extra descriptors
> and code to handle dual-speed controllers.
>
> +config USB_GADGET_SUPERSPEED
> + boolean "Gadget operating in Super Speed"
> + depends on USB_GADGET
> + depends on USB_GADGET_DUALSPEED
> + help
> + Enabling this feature enables Super Speed support in the Gadget
> + driver. It means that gadget drivers should provide extra (SuperSpeed)
> + descriptors to the host.
> + For composite devices: if SuperSpeed descriptors weren't supplied by
> + the FD, they will be automatically generated with default values.
> +
> #
> # USB Gadget Drivers
> #
> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index b94e573..a622af5 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -129,6 +129,9 @@ int config_ep_by_speed(struct usb_gadget *g,
> struct usb_endpoint_descriptor *chosen_desc = NULL;
> struct usb_descriptor_header **speed_desc = NULL;
>
> + struct usb_ss_ep_comp_descriptor *comp_desc = NULL;
> + int want_comp_desc = 0;
> +
> struct usb_descriptor_header **d_spd; /* cursor for speed desc */
>
> if (!g || !f || !_ep)
> @@ -136,6 +139,13 @@ int config_ep_by_speed(struct usb_gadget *g,
>
> /* select desired speed */
> switch (g->speed) {
> + case USB_SPEED_SUPER:
> + if (gadget_is_superspeed(g)) {
> + speed_desc = f->ss_descriptors;
> + want_comp_desc = 1;
> + break;
> + }
> + /* else: Fall trough */
> case USB_SPEED_HIGH:
> if (gadget_is_dualspeed(g)) {
> speed_desc = f->hs_descriptors;
> @@ -157,7 +167,31 @@ ep_found:
> /* commit results */
> _ep->maxpacket = le16_to_cpu(chosen_desc->wMaxPacketSize);
> _ep->desc = chosen_desc;
> -
> + _ep->comp_desc = NULL;
> + _ep->maxburst = 0;
> + _ep->mult = 0;
> + if (want_comp_desc) {
> + /*
> + * Companion descriptor should follow EP descriptor
> + * USB 3.0 spec, #9.6.7
> + */
> + comp_desc = (struct usb_ss_ep_comp_descriptor *)*(++d_spd);
> + if (!comp_desc ||
> + (comp_desc->bDescriptorType != USB_DT_SS_ENDPOINT_COMP))
> + return -EIO;
> + _ep->comp_desc = comp_desc;
> + if (g->speed == USB_SPEED_SUPER) {
> + int xfer_type = _ep->bEndpointAddress &
> + USB_ENDPOINT_XFERTYPE_MASK ;
how about something liks:
switch (usb_endpoint_type(_ep->desc) {
case USB_ENDPOINT_XFER_BULK:
case USB_ENDPOINT_XFER_INT:
_ep->maxburst = comp_desc->bMaxBurst;
break;
case USB_ENDPOINT_XFER_ISOC:
_ep->mult = comp_desc->bmAttributes & 0x03;
break;
default:
/* nothing to do for control endpoints */
break;
}
--
balbi
next prev parent reply other threads:[~2011-05-09 9:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-08 11:16 [PATCH v9 0/7] usb gadget: Add SuperSpeed support to the Gadget Framework Tatyana Brokhman
2011-05-08 11:16 ` [PATCH v9 1/7] usb: Add usb_endpoint_descriptor to be part of the struct usb_ep Tatyana Brokhman
2011-05-08 11:16 ` [PATCH v9 2/7] usb: Configure endpoint according to gadget speed Tatyana Brokhman
2011-05-08 11:16 ` [PATCH v9 3/7] usb: Modify existing gadget drivers to use config_ep_by_speed() instead of ep_choose Tatyana Brokhman
2011-05-08 11:16 ` [PATCH v9 4/7] usb:gadget: Add SuperSpeed support to the Gadget Framework Tatyana Brokhman
2011-05-09 9:19 ` Felipe Balbi [this message]
2011-05-11 13:00 ` Tanya Brokhman
[not found] ` <1304853414-10234-1-git-send-email-tlinder-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-05-08 11:16 ` [PATCH v9 5/7] usb: Add streams support to the gadget framework Tatyana Brokhman
2011-05-09 9:25 ` Felipe Balbi
2011-05-11 13:29 ` Tanya Brokhman
2011-05-11 20:54 ` Felipe Balbi
2011-05-08 11:16 ` [PATCH v9 6/7] usb:gadget: Introduce usb_generate_ss_descriptors() Tatyana Brokhman
2011-05-08 11:16 ` [PATCH v9 7/7] usb: Adding SuperSpeed support to dummy_hcd Tatyana Brokhman
2011-05-09 17:49 ` Sebastian Andrzej Siewior
2011-05-10 11:24 ` Sergei Shtylyov
2011-05-12 5:19 ` Tanya Brokhman
2011-05-12 14:45 ` Alan Stern
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=20110509091904.GE1254@legolas.emea.dhcp.ti.com \
--to=balbi@ti.com \
--cc=ablay@codeaurora.org \
--cc=greg@kroah.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=tlinder@codeaurora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).