From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.13 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796309008; b=XJ6IK6gLqgOSukQGA6SEXymLSfqgEwcccegvO24Ras3R2JKEPavdwVbpNY4XHwhKrPMi bshpV6Fs4czMoA6ksd70gVyQRNpYKoaWQqhufMI5p70pZ04BZ08Wwtw5NOyJ4jOinl/QN vJof8nS4prma8QxtUrPDIT+DWgvr/QdWD2dTYZPxHh+I9CSn9smcqQnABX14a9aqjYz7O zO0eDBvbhWP40kWnSmoDUcgoEJMCTXtwkP7eE55S+cjij+33zv4Sq10FdWVFE2qcY08uq D96EuE3qWU58XuelJ1EUB7fZy52mVtUL5o3/B6Vf1oDYdGIQr+hGVgKFL3mJMFlzptQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796309008; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=lkbuQ3Rn+fU+CiHSdATsSgc4x132qbsmSWBYhBzQdg4=; b=NpwvdxIvnW2k8mtUiEsmOTUujJF16XNZ5/VPEU8IimLI3znIIet1gc3Z/BmP5j8/aOOS YafUWfzQp2nSEw39CIqJDrTTo1nkCtj06yPdoU5IX2VAWXF4plzamrAvhYNts8uvWBtlC 3OP0bl1LfYpv0O8yX2zzoXsZSANKcBemmi8Rmwoo76T1ITz1xyhiTC+hj4L9KkRu4xv0K J2eiLMvhkhSxFaybf2SPZO61gEd66QcS3PPzBUdswnpRBE6NfIt0j8X8lkmncBBVswSZZ vQXZSyiXuCmbkQWHjh5tv4KWM9QTkyuuvNlJ8O/HKUjYAIp+zvesboknTqmPcuKFWYw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=UxWgrFO+; arc=none smtp.remote-ip=198.175.65.13 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AC98606A322 for ; Thu, 3 Dec 2026 14:43:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8AC98606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=UxWgrFO+ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796309009; x=1827845009; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lkbuQ3Rn+fU+CiHSdATsSgc4x132qbsmSWBYhBzQdg4=; b=UxWgrFO+SQlO8eMjThj7VQPgDb6FxUP/TCheGYq9USr3BjD9A/r4htCv 6zBnDJU1uq9PcAQBtw2HWcE3G2bIch9xRmZ+ltzp922D2lsAiIME5/05j MBIIFBLRUnNPqDWdcVBqqzYZp9Icil+8zRq/1GFApADOjulAFsmfMB6I4 FvOn53sCWfyg2OlQJnEU0BAIKOt86Jr/C3At4WgpYkXVYrlcGUABv2CF8 TYiDI3bZx++VaPduNrUEePTUkjVaFjDOuGax8SeE3gITnEfK79xW2dUXC W1VPZTPlcU76hjByYQiaZXL9bil42nouWZBy1dAufWe9/YWrtY27j/3aq w==; X-CSE-ConnectionGUID: kL8TrQ8hRDurp2pggwSpyQ== X-CSE-MsgGUID: KtL7qNR4QFeXXF7INcD/0g== X-IronPort-AV: E=McAfee;i="6800,10657,11984"; a="5182621" X-IronPort-AV: E=Sophos;i="6.29,248,1794902400"; d="scan'208";a="5182621" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 06:43:29 -0800 X-CSE-ConnectionGUID: VujD52J4QGK8hnWcXU0p+g== X-CSE-MsgGUID: tQ6+zS1iRTCXZTqy+GBauA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,248,1794902400"; d="scan'208";a="14024136" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa001.jf.intel.com with ESMTP; 03 Dec 2026 06:43:28 -0800 Received: by black.igk.intel.com (Postfix, from userid 1058) id B6EE1A1; Thu, 03 Dec 2026 15:43:26 +0100 (CET) From: Niklas Neronin To: mathias.nyman@linux.intel.com Cc: linux-usb@vger.kernel.org, Niklas Neronin Subject: [PATCH v3 05/12] usb: xhci: rework USB3 PORTPMSC macros Date: Thu, 3 Dec 2026 15:42:37 +0100 Message-ID: <20261203144244.1680587-6-niklas.neronin@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20261203144244.1680587-1-niklas.neronin@linux.intel.com> References: <20261203144244.1680587-1-niklas.neronin@linux.intel.com> X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Replace the PORT_U1_TIMEOUT() and PORT_U2_TIMEOUT() helpers with GENMASK() based field masks, and use FIELD_MODIFY() to update the U1/U2 Timeout fields. While at it, update the PORTPMSC comments to match xHCI 5.4.9.1: - document the valid, reserved and infinite U1/U2 Timeout values - add the Force Link PM Accept (FLA) bit and RsvdP bits 31:17 - drop the "Bits 24:31 for port testing" note, which applies to the USB2 PORTPMSC register, not the USB3 one No functional change. Signed-off-by: Niklas Neronin --- drivers/usb/host/xhci-hub.c | 6 ++---- drivers/usb/host/xhci-port.h | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index db492ac33016..58d18a1c3064 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -1499,8 +1499,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, timeout = (wIndex & 0xff00) >> 8; portpmsc = readl(&port->port_reg->portpmsc); - portpmsc &= ~PORT_U1_TIMEOUT_MASK; - portpmsc |= PORT_U1_TIMEOUT(timeout); + FIELD_MODIFY(PORT_U1_TIMEOUT_MASK, &portpmsc, timeout); writel(portpmsc, &port->port_reg->portpmsc); break; case USB_PORT_FEAT_U2_TIMEOUT: @@ -1509,8 +1508,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, timeout = (wIndex & 0xff00) >> 8; portpmsc = readl(&port->port_reg->portpmsc); - portpmsc &= ~PORT_U2_TIMEOUT_MASK; - portpmsc |= PORT_U2_TIMEOUT(timeout); + FIELD_MODIFY(PORT_U2_TIMEOUT_MASK, &portpmsc, timeout); writel(portpmsc, &port->port_reg->portpmsc); break; case USB_PORT_FEAT_TEST: diff --git a/drivers/usb/host/xhci-port.h b/drivers/usb/host/xhci-port.h index 40e403a46b20..fc87d4cacfbe 100644 --- a/drivers/usb/host/xhci-port.h +++ b/drivers/usb/host/xhci-port.h @@ -116,16 +116,19 @@ /* We mark duplicate entries with -1 */ #define DUPLICATE_ENTRY ((u8)(-1)) -/* Port Power Management Status and Control - port_power_base bitmasks */ -/* Inactivity timer value for transitions into U1, in microseconds. - * Timeout can be up to 127us. 0xFF means an infinite timeout. +/* USB3 Port Power Management Status and Control (PORTPMSC) 5.4.9.1 */ +/* + * bits 7:0 - U1 Timeout, inactivity timer value for transitions into U1. + * Timeout can be 0 to 127us, in 1us increments and 0xff is infinite timeout. */ -#define PORT_U1_TIMEOUT(p) ((p) & 0xff) -#define PORT_U1_TIMEOUT_MASK 0xff -/* Inactivity timer value for transitions into U2 */ -#define PORT_U2_TIMEOUT(p) (((p) & 0xff) << 8) -#define PORT_U2_TIMEOUT_MASK (0xff << 8) -/* Bits 24:31 for port testing */ +#define PORT_U1_TIMEOUT_MASK GENMASK(7, 0) +/* + * bits 15:8 - U2 Timeout, inactivity timer value for transitions into U2. + * Timeout can be 0 to 65024us, in 256us increments and 0xff is infinite timeout. + */ +#define PORT_U2_TIMEOUT_MASK GENMASK(15, 8) +/* bit 16 - Force Link PM Accept (FLA) */ +/* bits 31:17 - RsvdP */ /* USB2 Protocol PORTSPMSC */ #define PORT_L1S_MASK 7 -- 2.50.1