From: peng.fan at nxp.com <peng.fan@nxp.com>
To: u-boot@lists.denx.de
Subject: [PATCH 11/16] usb: fastboot: add super speed support
Date: Wed, 16 Sep 2020 21:25:32 +0800 [thread overview]
Message-ID: <20200916132537.8313-12-peng.fan@nxp.com> (raw)
In-Reply-To: <20200916132537.8313-1-peng.fan@nxp.com>
From: Li Jun <jun.li@nxp.com>
Add super speed EP config.
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/usb/gadget/f_fastboot.c | 47 ++++++++++++++++++++++++++++++---
1 file changed, 44 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index e330456390..c2abdd66a8 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -128,10 +128,45 @@ static struct usb_descriptor_header *fb_hs_function[] = {
NULL,
};
+/* Super speed */
+static struct usb_endpoint_descriptor ss_ep_in = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = USB_DIR_IN,
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ .wMaxPacketSize = cpu_to_le16(1024),
+};
+
+static struct usb_endpoint_descriptor ss_ep_out = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = USB_DIR_OUT,
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ .wMaxPacketSize = cpu_to_le16(1024),
+};
+
+static struct usb_ss_ep_comp_descriptor fb_ss_bulk_comp_desc = {
+ .bLength = sizeof(fb_ss_bulk_comp_desc),
+ .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
+};
+
+static struct usb_descriptor_header *fb_ss_function[] = {
+ (struct usb_descriptor_header *)&interface_desc,
+ (struct usb_descriptor_header *)&ss_ep_in,
+ (struct usb_descriptor_header *)&fb_ss_bulk_comp_desc,
+ (struct usb_descriptor_header *)&ss_ep_out,
+ (struct usb_descriptor_header *)&fb_ss_bulk_comp_desc,
+ NULL,
+};
+
static struct usb_endpoint_descriptor *
fb_ep_desc(struct usb_gadget *g, struct usb_endpoint_descriptor *fs,
- struct usb_endpoint_descriptor *hs)
+ struct usb_endpoint_descriptor *hs,
+ struct usb_endpoint_descriptor *ss)
{
+ if (gadget_is_superspeed(g) && g->speed >= USB_SPEED_SUPER)
+ return ss;
+
if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
return hs;
return fs;
@@ -219,6 +254,12 @@ static int fastboot_bind(struct usb_configuration *c, struct usb_function *f)
f->hs_descriptors = fb_hs_function;
}
+ if (gadget_is_superspeed(gadget)) {
+ ss_ep_in.bEndpointAddress = fs_ep_in.bEndpointAddress;
+ ss_ep_out.bEndpointAddress = fs_ep_out.bEndpointAddress;
+ f->ss_descriptors = fb_ss_function;
+ }
+
s = env_get("serial#");
if (s)
g_dnl_set_serialnumber((char *)s);
@@ -283,7 +324,7 @@ static int fastboot_set_alt(struct usb_function *f,
debug("%s: func: %s intf: %d alt: %d\n",
__func__, f->name, interface, alt);
- d = fb_ep_desc(gadget, &fs_ep_out, &hs_ep_out);
+ d = fb_ep_desc(gadget, &fs_ep_out, &hs_ep_out, &ss_ep_out);
ret = usb_ep_enable(f_fb->out_ep, d);
if (ret) {
puts("failed to enable out ep\n");
@@ -298,7 +339,7 @@ static int fastboot_set_alt(struct usb_function *f,
}
f_fb->out_req->complete = rx_handler_command;
- d = fb_ep_desc(gadget, &fs_ep_in, &hs_ep_in);
+ d = fb_ep_desc(gadget, &fs_ep_in, &hs_ep_in, &ss_ep_in);
ret = usb_ep_enable(f_fb->in_ep, d);
if (ret) {
puts("failed to enable in ep\n");
--
2.28.0
next prev parent reply other threads:[~2020-09-16 13:25 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 13:25 [PATCH 00/16] usb: gadget: update peng.fan at nxp.com
2020-09-16 13:25 ` [PATCH 01/16] usb: gadget: Add ep_config call back to usb_gadget_ops peng.fan at nxp.com
2020-09-16 13:25 ` [PATCH 02/16] usb: gadget: don't change ep name for dwc3 while ep autoconfig peng.fan at nxp.com
2020-09-16 13:25 ` [PATCH 03/16] usb: gadget: OS String support peng.fan at nxp.com
2020-09-16 13:25 ` [PATCH 04/16] usb: gadget: move utf8_to_utf16le to header file peng.fan at nxp.com
2020-09-16 13:25 ` [PATCH 05/16] usb: gadget: OS Feature Descriptors support peng.fan at nxp.com
2020-09-16 13:25 ` [PATCH 06/16] usb: gadget: add WCID support for mfgtool peng.fan at nxp.com
2020-09-16 13:25 ` [PATCH 07/16] usb: gadget: fastboot: add ext properties for WCID peng.fan at nxp.com
2020-09-16 13:25 ` [PATCH 08/16] usb: gadget: set correct usb_configuration for os_desc_config peng.fan at nxp.com
2020-09-16 13:25 ` [PATCH 09/16] usb: gadget: update os_desc_config when add config peng.fan at nxp.com
2020-09-16 13:25 ` [PATCH 10/16] usb: gadget: add super speed support peng.fan at nxp.com
2020-09-16 13:25 ` peng.fan at nxp.com [this message]
2020-09-16 13:25 ` [PATCH 12/16] usb: gadget: dnl: set dnl to be super speed peng.fan at nxp.com
2020-09-16 13:25 ` [PATCH 13/16] usb: composite: force gadget to be USB2 for HS only function peng.fan at nxp.com
2020-09-16 13:25 ` [PATCH 14/16] usb: udc: ci: update speed handling peng.fan at nxp.com
2020-09-16 13:25 ` [PATCH 15/16] usb: gadget: fastboot: use correct max packet size peng.fan at nxp.com
2020-09-16 13:25 ` [PATCH 16/16] usb: gaget: ci: set ep's desc when enable ep peng.fan at nxp.com
2020-10-10 6:00 ` [PATCH 00/16] usb: gadget: update Peng Fan
2021-01-03 10:32 ` Peng Fan
2021-01-23 12:11 ` Lukasz Majewski
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=20200916132537.8313-12-peng.fan@nxp.com \
--to=peng.fan@nxp.com \
--cc=u-boot@lists.denx.de \
/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.