linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <felipe.balbi@linux.intel.com>
To: Mathias Nyman <mathias.nyman@linux.intel.com>,
	gregkh@linuxfoundation.org
Cc: stern@rowland.harvard.edu, linux-usb@vger.kernel.org
Subject: [1/2] USB: Add support to store lane count used by USB 3.2
Date: Tue, 13 Mar 2018 17:29:21 +0200	[thread overview]
Message-ID: <87efko56zy.fsf@linux.intel.com> (raw)

Hi,

Mathias Nyman <mathias.nyman@linux.intel.com> writes:

> USB 3.2 specification adds Dual-lane support, doubling the maximum
> SuperSpeedPlus data rate from 10Gbps to 20Gbps.
>
> Dual-lane takes into use a second set of rx and tx wires/pins in the
> Type-C cable and connector.
>
> Add a "lanes" variable to struct usb_device to store the numer of lanes
> in use. Number of lanes can be read using the extended port status hub
> request that was introduced in USB 3.1.
>
> Extended port status rx and tx lane count are zero based, maximum
> lanes supported by usb 3.2 is 2 (dual lane).
> If extended port status is not available then default to one lane.
>
> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
> ---
>  drivers/usb/core/hub.c | 6 ++++++
>  include/linux/usb.h    | 2 ++
>  2 files changed, 8 insertions(+)
>
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index c5c1f6c..853516d 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -2742,6 +2742,12 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
>  	if (!udev)
>  		return 0;
>  
> +	if (hub_is_superspeedplus(hub->hdev))
> +		udev->lanes = ((ext_portstatus &
> +				USB_EXT_PORT_STAT_RX_LANES) >> 8) + 1;

should this be udev->rx_lanes instead? We have macros for both TX and RX
lanes:

#define USB_EXT_PORT_STAT_RX_SPEED_ID	0x0000000f
#define USB_EXT_PORT_STAT_TX_SPEED_ID	0x000000f0
#define USB_EXT_PORT_STAT_RX_LANES	0x00000f00
#define USB_EXT_PORT_STAT_TX_LANES	0x0000f000

             reply	other threads:[~2018-03-13 15:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13 15:29 Felipe Balbi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-03-13 15:53 [1/2] USB: Add support to store lane count used by USB 3.2 Mathias Nyman
2018-03-13 15:27 Mathias Nyman

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=87efko56zy.fsf@linux.intel.com \
    --to=felipe.balbi@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.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 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).