All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Thinh.Nguyen@synopsys.com, linux-usb@vger.kernel.org,
	Alan Stern <stern@rowland.harvard.edu>,
	Eugeniu Rosca <erosca@de.adit-jv.com>,
	Hardik Gajjar <hgajjar@de.adit-jv.com>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Oliver Neukum <oneukum@suse.com>
Subject: [PATCH v2 2/8] usb: core: hub: Remove port_speed_is_ssp()
Date: Wed, 03 Feb 2021 20:10:41 -0800	[thread overview]
Message-ID: <bdcf64decc6fef34feda9c0cbf370cbc0284b719.1612410491.git.Thinh.Nguyen@synopsys.com> (raw)
In-Reply-To: <cover.1612410491.git.Thinh.Nguyen@synopsys.com>

The get_port_ssp_rate() can replace port_speed_is_ssp(). If the port
speed is detected to be in gen2x1, gen1x2, or gen2x2, then the port is
operating at SuperSpeed Plus.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
 Changes in v2:
 - None

 drivers/usb/core/hub.c | 31 +------------------------------
 1 file changed, 1 insertion(+), 30 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index e78b2dd7801a..823470607d58 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2744,33 +2744,6 @@ static enum usb_ssp_rate get_port_ssp_rate(struct usb_device *hdev,
 	return USB_SSP_GEN_UNKNOWN;
 }
 
-/*
- * Return 1 if port speed is SuperSpeedPlus, 0 otherwise
- * check it from the link protocol field of the current speed ID attribute.
- * current speed ID is got from ext port status request. Sublink speed attribute
- * table is returned with the hub BOS SSP device capability descriptor
- */
-static int port_speed_is_ssp(struct usb_device *hdev, int speed_id)
-{
-	int ssa_count;
-	u32 ss_attr;
-	int i;
-	struct usb_ssp_cap_descriptor *ssp_cap = hdev->bos->ssp_cap;
-
-	if (!ssp_cap)
-		return 0;
-
-	ssa_count = le32_to_cpu(ssp_cap->bmAttributes) &
-		USB_SSP_SUBLINK_SPEED_ATTRIBS;
-
-	for (i = 0; i <= ssa_count; i++) {
-		ss_attr = le32_to_cpu(ssp_cap->bmSublinkSpeedAttr[i]);
-		if (speed_id == (ss_attr & USB_SSP_SUBLINK_SPEED_SSID))
-			return !!(ss_attr & USB_SSP_SUBLINK_SPEED_LP);
-	}
-	return 0;
-}
-
 /* Returns 1 if @hub is a WUSB root hub, 0 otherwise */
 static unsigned hub_is_wusb(struct usb_hub *hub)
 {
@@ -2934,9 +2907,7 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
 	}
 	if (hub_is_wusb(hub))
 		udev->speed = USB_SPEED_WIRELESS;
-	else if (hub_is_superspeedplus(hub->hdev) &&
-		 port_speed_is_ssp(hub->hdev, ext_portstatus &
-				   USB_EXT_PORT_STAT_RX_SPEED_ID))
+	else if (udev->ssp_rate != USB_SSP_GEN_UNKNOWN)
 		udev->speed = USB_SPEED_SUPER_PLUS;
 	else if (hub_is_superspeed(hub->hdev))
 		udev->speed = USB_SPEED_SUPER;
-- 
2.28.0


  parent reply	other threads:[~2021-02-04  4:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04  4:10 [PATCH v2 0/8] usb: Check for genXxY on host Thinh Nguyen
2021-02-04  4:10 ` [PATCH v2 1/8] usb: core: Track SuperSpeed Plus GenXxY Thinh Nguyen
2021-02-04  4:10 ` Thinh Nguyen [this message]
2021-02-04  4:10 ` [PATCH v2 3/8] usb: core: hub: Print speed name based on ssp rate Thinh Nguyen
2021-03-10  8:37   ` Mathias Nyman
2021-03-11  3:46     ` Thinh Nguyen
2021-02-04  4:10 ` [PATCH v2 4/8] usb: core: sysfs: Check for SSP rate in speed attr Thinh Nguyen
2021-02-04  4:11 ` [PATCH v2 5/8] usb: xhci: Init root hub SSP rate Thinh Nguyen
2021-02-04  4:11 ` [PATCH v2 6/8] usb: xhci: Fix port minor revision Thinh Nguyen
2021-02-04  4:11 ` [PATCH v2 7/8] usb: xhci: Rewrite xhci_create_usb3_bos_desc() Thinh Nguyen
2021-03-09 11:47   ` Mathias Nyman
2021-03-09 19:32     ` Thinh Nguyen
2021-03-10  8:28       ` Mathias Nyman
2021-02-04  4:11 ` [PATCH v2 8/8] usb: xhci: Remove unused function Thinh Nguyen

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=bdcf64decc6fef34feda9c0cbf370cbc0284b719.1612410491.git.Thinh.Nguyen@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=erosca@de.adit-jv.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavoars@kernel.org \
    --cc=hgajjar@de.adit-jv.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.com \
    --cc=stern@rowland.harvard.edu \
    /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.