From patchwork Fri Nov 27 14:05:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 334003 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 979F6C2D0E4 for ; Fri, 27 Nov 2020 14:06:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 33A9821D7A for ; Fri, 27 Nov 2020 14:06:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="VJ0TiIZe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730699AbgK0OGJ (ORCPT ); Fri, 27 Nov 2020 09:06:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:46380 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727653AbgK0OGI (ORCPT ); Fri, 27 Nov 2020 09:06:08 -0500 Received: from localhost (82-217-20-185.cable.dynamic.v4.ziggo.nl [82.217.20.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8097D206CA; Fri, 27 Nov 2020 14:06:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606485968; bh=l+ML/gM0MaklgpBNcmLG6VwzDWRbhWmTWpVYK6fwplg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VJ0TiIZeoIC+p9dPdQWKararEE9+orC9K+1k178hP/rXqGVfMD+HcTGMBVgsliARI w5fmQJJXykd2jLE0+ps2z8H4LIbC0eGuefWay1vVaNjsPXHV5Cm2a1/D6UyjdK0u5M yl/QiyMzQAwMZPaDrbZmiEuYeV93nVLAHnqhwclQ= From: Greg Kroah-Hartman To: balbi@kernel.org Cc: peter.chen@nxp.com, willmcvicker@google.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, EJ Hsu , stable , Greg Kroah-Hartman Subject: [PATCH v2 1/5] USB: gadget: f_rndis: fix bitrate for SuperSpeed and above Date: Fri, 27 Nov 2020 15:05:55 +0100 Message-Id: <20201127140559.381351-2-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201127140559.381351-1-gregkh@linuxfoundation.org> References: <20201127140559.381351-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Will McVicker Align the SuperSpeed Plus bitrate for f_rndis to match f_ncm's ncm_bitrate defined by commit 1650113888fe ("usb: gadget: f_ncm: add SuperSpeed descriptors for CDC NCM"). Cc: Felipe Balbi Cc: EJ Hsu Cc: Peter Chen Cc: stable Signed-off-by: Will McVicker Signed-off-by: Greg Kroah-Hartman Reviewed-by: Peter Chen --- drivers/usb/gadget/function/f_rndis.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c index 9534c8ab62a8..0739b05a0ef7 100644 --- a/drivers/usb/gadget/function/f_rndis.c +++ b/drivers/usb/gadget/function/f_rndis.c @@ -87,8 +87,10 @@ static inline struct f_rndis *func_to_rndis(struct usb_function *f) /* peak (theoretical) bulk transfer rate in bits-per-second */ static unsigned int bitrate(struct usb_gadget *g) { + if (gadget_is_superspeed(g) && g->speed >= USB_SPEED_SUPER_PLUS) + return 4250000000U; if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER) - return 13 * 1024 * 8 * 1000 * 8; + return 3750000000U; else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) return 13 * 512 * 8 * 1000 * 8; else From patchwork Fri Nov 27 14:05:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 334002 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A96F1C63798 for ; Fri, 27 Nov 2020 14:06:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49DC4206CA for ; Fri, 27 Nov 2020 14:06:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="uKqGebrh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730787AbgK0OGQ (ORCPT ); Fri, 27 Nov 2020 09:06:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:46580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727653AbgK0OGQ (ORCPT ); Fri, 27 Nov 2020 09:06:16 -0500 Received: from localhost (82-217-20-185.cable.dynamic.v4.ziggo.nl [82.217.20.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 317E320679; Fri, 27 Nov 2020 14:06:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606485975; bh=i1+M8KofmfCwcU8zE89Sq3P7NWZVu/Ox8h4dUwxC2kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uKqGebrhcgDDIrrp8TSuYWEzD9Smik+hPN9iTfZaFWMA+nauI87Xt9/EWSx4HcQp1 +y73N5VMw+QbwBVj+WNup+AsM7pZlJ8nxlrqhP8MXfnL85w8z8WBnrOJsqHaC3wkwR Eu6oRm+LTDVMXM1oVPp7cbnsiNlldJy4rJhIxhj4= From: Greg Kroah-Hartman To: balbi@kernel.org Cc: peter.chen@nxp.com, willmcvicker@google.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "taehyun.cho" , stable , Greg Kroah-Hartman Subject: [PATCH v2 2/5] USB: gadget: f_acm: add support for SuperSpeed Plus Date: Fri, 27 Nov 2020 15:05:56 +0100 Message-Id: <20201127140559.381351-3-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201127140559.381351-1-gregkh@linuxfoundation.org> References: <20201127140559.381351-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: "taehyun.cho" Setup the SuperSpeed Plus descriptors for f_acm. This allows the gadget to work properly without crashing at SuperSpeed rates. Cc: Felipe Balbi Cc: stable Signed-off-by: taehyun.cho Signed-off-by: Will McVicker Reviewed-by: Peter Chen Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/function/f_acm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c index 46647bfac2ef..349945e064bb 100644 --- a/drivers/usb/gadget/function/f_acm.c +++ b/drivers/usb/gadget/function/f_acm.c @@ -686,7 +686,7 @@ acm_bind(struct usb_configuration *c, struct usb_function *f) acm_ss_out_desc.bEndpointAddress = acm_fs_out_desc.bEndpointAddress; status = usb_assign_descriptors(f, acm_fs_function, acm_hs_function, - acm_ss_function, NULL); + acm_ss_function, acm_ss_function); if (status) goto fail; From patchwork Fri Nov 27 14:05:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 334001 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C6B0C64E90 for ; Fri, 27 Nov 2020 14:06:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 08B3520679 for ; Fri, 27 Nov 2020 14:06:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="x3Cow3j4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730837AbgK0OGX (ORCPT ); Fri, 27 Nov 2020 09:06:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:46698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730811AbgK0OGW (ORCPT ); Fri, 27 Nov 2020 09:06:22 -0500 Received: from localhost (82-217-20-185.cable.dynamic.v4.ziggo.nl [82.217.20.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 335DF206CA; Fri, 27 Nov 2020 14:06:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606485980; bh=SyQYbFVWej1dCizjJLkWeWMarU7Ofwrc9xiAS6qec0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x3Cow3j4D1FvqGayo0yxGjgkg8Q0TKe2kR1nqvRYCl0dIoJofAcro9e/2TAINP7W2 pLW4fN/uHzJwQiEjMpJ9tusAHL6jUnT//TAh1NsPNjX5FfVUSsN1JGg0iFkCIwIlcl TdYOpWZGwEseYW9STd4kzjPkhAkG/YZyDGzosFPw= From: Greg Kroah-Hartman To: balbi@kernel.org Cc: peter.chen@nxp.com, willmcvicker@google.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "taehyun.cho" , stable , Greg Kroah-Hartman Subject: [PATCH v2 4/5] USB: gadget: f_fs: add SuperSpeed Plus support Date: Fri, 27 Nov 2020 15:05:58 +0100 Message-Id: <20201127140559.381351-5-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201127140559.381351-1-gregkh@linuxfoundation.org> References: <20201127140559.381351-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: "taehyun.cho" Setup the descriptors for SuperSpeed Plus for f_fs. This allows the gadget to work properly without crashing at SuperSpeed rates. Cc: Felipe Balbi Cc: stable Signed-off-by: taehyun.cho Signed-off-by: Will McVicker Reviewed-by: Peter Chen Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/function/f_fs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 046f770a76da..a34a7c96a1ab 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -1327,6 +1327,7 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code, struct usb_endpoint_descriptor *desc; switch (epfile->ffs->gadget->speed) { + case USB_SPEED_SUPER_PLUS: case USB_SPEED_SUPER: desc_idx = 2; break; @@ -3222,6 +3223,10 @@ static int _ffs_func_bind(struct usb_configuration *c, func->function.os_desc_n = c->cdev->use_os_string ? ffs->interfaces_count : 0; + if (likely(super)) { + func->function.ssp_descriptors = + usb_copy_descriptors(func->function.ss_descriptors); + } /* And we're done */ ffs_event_add(ffs, FUNCTIONFS_BIND); return 0;