Linux USB
 help / color / mirror / Atom feed
From: Niklas Neronin <niklas.neronin@linux.intel.com>
To: mathias.nyman@linux.intel.com
Cc: linux-usb@vger.kernel.org,
	Niklas Neronin <niklas.neronin@linux.intel.com>
Subject: [PATCH v3 12/12] usb: xhci: rename PORTSC field macros to xHCI spec abbreviations
Date: Thu,  3 Dec 2026 15:42:44 +0100	[thread overview]
Message-ID: <20261203144244.1680587-13-niklas.neronin@linux.intel.com> (raw)
In-Reply-To: <20261203144244.1680587-1-niklas.neronin@linux.intel.com>

The PORTSC field macros currently use two naming schemes. Some use the
xHCI specification abbreviations (e.g. PORT_CSC, PORT_PEC, PORT_CAS) and
others use driver-specific names (e.g. PORT_CONNECT, PORT_PE, PORT_OC).
The driver-specific names don't follow a consistent pattern, which
makes them harder to search for and to match against the specification.

Rename the remaining driver-specific macros to their xHCI specification
(section 5.4.8) abbreviations:

  PORT_CONNECT     -> PORT_CCS
  PORT_PE          -> PORT_PED
  PORT_OC          -> PORT_OCA
  PORT_RESET       -> PORT_PR
  PORT_POWER       -> PORT_PP
  PORT_LINK_STROBE -> PORT_LWS
  PORT_RC          -> PORT_PRC
  PORT_WKCONN_E    -> PORT_WCE
  PORT_WKDISC_E    -> PORT_WDE
  PORT_WKOC_E      -> PORT_WOE
  PORT_DEV_REMOVE  -> PORT_DR
  PORT_WR          -> PORT_WPR

Each macro name is now the spec abbreviation, so the "(XXX)" suffixes
in the bitfield comments are no longer needed and are dropped.

The dwc3 host glue (drivers/usb/dwc3/host.c) and the early xHCI debug
capability driver (drivers/usb/early/xhci-dbc.c) include xhci-port.h,
so they are updated to the new names as well.

The cdnsp gadget driver has its own copy of these definitions and is not
affected.

Compared objdump -dr output before and after the change: the object code
is identical.

No functional change intended.

Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
---
 drivers/usb/dwc3/host.c         |  2 +-
 drivers/usb/early/xhci-dbc.c    |  4 +-
 drivers/usb/host/xhci-debugfs.c |  2 +-
 drivers/usb/host/xhci-hub.c     | 94 ++++++++++++++++-----------------
 drivers/usb/host/xhci-pci.c     |  2 +-
 drivers/usb/host/xhci-port.h    | 30 +++++------
 drivers/usb/host/xhci-ring.c    |  6 +--
 drivers/usb/host/xhci-tegra.c   |  6 +--
 drivers/usb/host/xhci.c         |  4 +-
 drivers/usb/host/xhci.h         | 24 ++++-----
 10 files changed, 87 insertions(+), 87 deletions(-)

diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index cd1e5204ac3a..f33ca596cde6 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -54,7 +54,7 @@ static void dwc3_power_off_all_roothub_ports(struct dwc3 *dwc)
 		for (i = 1; i <= port_num; i++) {
 			offset = op_regs_base + XHCI_PORTSC_BASE + 0x10 * (i - 1);
 			reg = readl(xhci_regs + offset);
-			reg &= ~PORT_POWER;
+			reg &= ~PORT_PP;
 			writel(reg, xhci_regs + offset);
 		}
 
diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c
index 41118bba9197..ec2efd0e92eb 100644
--- a/drivers/usb/early/xhci-dbc.c
+++ b/drivers/usb/early/xhci-dbc.c
@@ -359,8 +359,8 @@ static void xdbc_do_reset_debug_port(u32 id, u32 count)
 	for (i = id; i < (id + count); i++) {
 		portsc = ops_reg + 0x400 + i * 0x10;
 		val = readl(portsc);
-		if (!(val & PORT_CONNECT))
-			writel(val | PORT_RESET, portsc);
+		if (!(val & PORT_CCS))
+			writel(val | PORT_PR, portsc);
 	}
 }
 
diff --git a/drivers/usb/host/xhci-debugfs.c b/drivers/usb/host/xhci-debugfs.c
index 02729682c7e2..fb4c216253c1 100644
--- a/drivers/usb/host/xhci-debugfs.c
+++ b/drivers/usb/host/xhci-debugfs.c
@@ -367,7 +367,7 @@ static ssize_t xhci_port_write(struct file *file,  const char __user *ubuf,
 		}
 		portsc = xhci_port_state_to_neutral(portsc);
 		FIELD_MODIFY(PORT_PLS_MASK, &portsc, PLS_COMP_MODE);
-		portsc |= PORT_LINK_STROBE;
+		portsc |= PORT_LWS;
 		xhci_portsc_writel(port, portsc);
 		spin_unlock_irqrestore(&xhci->lock, flags);
 	} else {
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 5de1ea5d5454..627b8353c399 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -17,9 +17,9 @@
 #include "xhci.h"
 #include "xhci-trace.h"
 
-#define	PORT_WAKE_BITS	(PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E)
+#define	PORT_WAKE_BITS	(PORT_WOE | PORT_WDE | PORT_WCE)
 #define	PORT_RWC_BITS	(PORT_CSC | PORT_PEC | PORT_WRC | PORT_OCC | \
-			 PORT_RC | PORT_PLC | PORT_PE)
+			 PORT_PRC | PORT_PLC | PORT_PED)
 
 /* Default sublink speed attribute of each lane */
 static u32 ssp_cap_default_ssa[] = {
@@ -302,7 +302,7 @@ static void xhci_usb2_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci,
 		/* If a device is removable, PORTSC reports a 0, same as in the
 		 * hub descriptor DeviceRemovable bits.
 		 */
-		if (portsc & PORT_DEV_REMOVE)
+		if (portsc & PORT_DR)
 			/* This math is hairy because bit 0 of DeviceRemovable
 			 * is reserved, and bit 1 is for port 1, etc.
 			 */
@@ -356,7 +356,7 @@ static void xhci_usb3_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci,
 	/* bit 0 is reserved, bit 1 is for port 1, etc. */
 	for (i = 0; i < ports; i++) {
 		portsc = xhci_portsc_readl(rhub->ports[i]);
-		if (portsc & PORT_DEV_REMOVE)
+		if (portsc & PORT_DR)
 			port_removable |= 1 << (i + 1);
 	}
 
@@ -571,7 +571,7 @@ static void xhci_disable_port(struct xhci_hcd *xhci, struct xhci_port *port)
 	portsc = xhci_port_state_to_neutral(portsc);
 
 	/* Write 1 to disable the port */
-	xhci_portsc_writel(port, portsc | PORT_PE);
+	xhci_portsc_writel(port, portsc | PORT_PED);
 
 	portsc = xhci_portsc_readl(port);
 	xhci_dbg(xhci, "disable port %d-%d, portsc: 0x%x\n",
@@ -586,7 +586,7 @@ static void xhci_clear_port_change_bit(struct xhci_hcd *xhci, u16 wValue, struct
 
 	switch (wValue) {
 	case USB_PORT_FEAT_C_RESET:
-		status = PORT_RC;
+		status = PORT_PRC;
 		port_change_bit = "reset";
 		break;
 	case USB_PORT_FEAT_C_BH_PORT_RESET:
@@ -660,11 +660,11 @@ static void xhci_set_port_power(struct xhci_hcd *xhci, struct xhci_port *port,
 
 	if (on) {
 		/* Power on */
-		xhci_portsc_writel(port, temp | PORT_POWER);
+		xhci_portsc_writel(port, temp | PORT_PP);
 		xhci_portsc_readl(port);
 	} else {
 		/* Power off */
-		xhci_portsc_writel(port, temp & ~PORT_POWER);
+		xhci_portsc_writel(port, temp & ~PORT_PP);
 	}
 
 	spin_unlock_irqrestore(&xhci->lock, *flags);
@@ -802,7 +802,7 @@ void xhci_set_link_state(struct xhci_hcd *xhci, struct xhci_port *port,
 	portsc = xhci_portsc_readl(port);
 	temp = xhci_port_state_to_neutral(portsc);
 	FIELD_MODIFY(PORT_PLS_MASK, &temp, link_state);
-	temp |= PORT_LINK_STROBE;
+	temp |= PORT_LWS;
 	xhci_portsc_writel(port, temp);
 
 	xhci_dbg(xhci, "Set port %d-%d link state, portsc: 0x%x, write 0x%x",
@@ -819,19 +819,19 @@ static void xhci_set_remote_wake_mask(struct xhci_hcd *xhci,
 	temp = xhci_port_state_to_neutral(temp);
 
 	if (wake_mask & USB_PORT_FEAT_REMOTE_WAKE_CONNECT)
-		temp |= PORT_WKCONN_E;
+		temp |= PORT_WCE;
 	else
-		temp &= ~PORT_WKCONN_E;
+		temp &= ~PORT_WCE;
 
 	if (wake_mask & USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT)
-		temp |= PORT_WKDISC_E;
+		temp |= PORT_WDE;
 	else
-		temp &= ~PORT_WKDISC_E;
+		temp &= ~PORT_WDE;
 
 	if (wake_mask & USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT)
-		temp |= PORT_WKOC_E;
+		temp |= PORT_WOE;
 	else
-		temp &= ~PORT_WKOC_E;
+		temp &= ~PORT_WOE;
 
 	xhci_portsc_writel(port, temp);
 }
@@ -929,7 +929,7 @@ static int xhci_handle_usb2_port_link_resume(struct xhci_port *port,
 	xhci = hcd_to_xhci(hcd);
 	portnum = port->hcd_portnum;
 
-	if ((portsc & PORT_RESET) || !(portsc & PORT_PE)) {
+	if ((portsc & PORT_PR) || !(portsc & PORT_PED)) {
 		return -EINVAL;
 	}
 	/* did port event handler already start resume timing? */
@@ -1051,7 +1051,7 @@ static void xhci_get_usb3_port_status(struct xhci_port *port, u32 *status,
 		*status |= USB_PORT_STAT_C_CONFIG_ERROR << 16;
 
 	/* USB3 specific wPortStatus bits */
-	if (portsc & PORT_POWER)
+	if (portsc & PORT_PP)
 		*status |= USB_SS_PORT_STAT_POWER;
 
 	/* no longer suspended or resuming */
@@ -1083,7 +1083,7 @@ static void xhci_get_usb2_port_status(struct xhci_port *port, u32 *status,
 	portnum = port->hcd_portnum;
 
 	/* USB2 wPortStatus bits */
-	if (portsc & PORT_POWER) {
+	if (portsc & PORT_PP) {
 		*status |= USB_PORT_STAT_POWER;
 
 		/* link state is only valid if port is powered */
@@ -1153,25 +1153,25 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, struct xhci_bus_state *bus_
 		status |= USB_PORT_STAT_C_ENABLE << 16;
 	if (portsc & PORT_OCC)
 		status |= USB_PORT_STAT_C_OVERCURRENT << 16;
-	if (portsc & PORT_RC)
+	if (portsc & PORT_PRC)
 		status |= USB_PORT_STAT_C_RESET << 16;
 
 	/* common wPortStatus bits */
-	if (portsc & PORT_CONNECT) {
+	if (portsc & PORT_CCS) {
 		status |= USB_PORT_STAT_CONNECTION;
 		status |= xhci_port_speed(portsc);
 	}
-	if (portsc & PORT_PE)
+	if (portsc & PORT_PED)
 		status |= USB_PORT_STAT_ENABLE;
-	if (portsc & PORT_OC)
+	if (portsc & PORT_OCA)
 		status |= USB_PORT_STAT_OVERCURRENT;
-	if (portsc & PORT_RESET)
+	if (portsc & PORT_PR)
 		status |= USB_PORT_STAT_RESET;
 
 	/* track connect and link error status when hub is polling */
-	if (!(portsc & PORT_RESET)) {
+	if (!(portsc & PORT_PR)) {
 		port->link_inactive = (FIELD_GET(PORT_PLS_MASK, portsc) == PLS_INACTIVE);
-		port->connected = !!(portsc & PORT_CONNECT);
+		port->connected = !!(portsc & PORT_CCS);
 	}
 
 	/* USB2 and USB3 specific bits, including Port Link State */
@@ -1306,7 +1306,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 			 * enabled (PED = '1',PLS < '3') state.
 			 */
 			portsc = xhci_portsc_readl(port);
-			if ((portsc & PORT_PE) == 0 || (portsc & PORT_RESET) ||
+			if ((portsc & PORT_PED) == 0 || (portsc & PORT_PR) ||
 			    FIELD_GET(PORT_PLS_MASK, portsc) >= PLS_U3) {
 				xhci_warn(xhci, "USB core suspending port %d-%d not in U0/U1/U2\n",
 					  hcd->self.busnum, portnum + 1);
@@ -1344,9 +1344,9 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 				 * connection event.
 				 */
 				portsc |= PORT_CSC | PORT_PEC | PORT_WRC |
-					  PORT_OCC | PORT_RC | PORT_PLC |
+					  PORT_OCC | PORT_PRC | PORT_PLC |
 					  PORT_CEC;
-				xhci_portsc_writel(port, portsc | PORT_PE);
+				xhci_portsc_writel(port, portsc | PORT_PED);
 				portsc = xhci_portsc_readl(port);
 				break;
 			}
@@ -1380,7 +1380,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 					break;
 				}
 
-				if ((portsc & PORT_CONNECT)) {
+				if ((portsc & PORT_CCS)) {
 					xhci_warn(xhci, "Can't set compliance mode when port is connected\n");
 					goto error;
 				}
@@ -1393,7 +1393,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 				break;
 			}
 			/* Port must be enabled */
-			if (!(portsc & PORT_PE)) {
+			if (!(portsc & PORT_PED)) {
 				retval = -ENODEV;
 				break;
 			}
@@ -1474,7 +1474,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 			xhci_set_port_power(xhci, port, true, &flags);
 			break;
 		case USB_PORT_FEAT_RESET:
-			portsc |= PORT_RESET;
+			portsc |= PORT_PR;
 			xhci_portsc_writel(port, portsc);
 
 			portsc = xhci_portsc_readl(port);
@@ -1489,7 +1489,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 				 hcd->self.busnum, portnum + 1, portsc);
 			break;
 		case USB_PORT_FEAT_BH_PORT_RESET:
-			portsc |= PORT_WR;
+			portsc |= PORT_WPR;
 			xhci_portsc_writel(port, portsc);
 			portsc = xhci_portsc_readl(port);
 			break;
@@ -1547,10 +1547,10 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 			portsc = xhci_portsc_readl(port);
 			xhci_dbg(xhci, "clear USB_PORT_FEAT_SUSPEND\n");
 			xhci_dbg(xhci, "PORTSC %04x\n", portsc);
-			if (portsc & PORT_RESET)
+			if (portsc & PORT_PR)
 				goto error;
 			if (FIELD_GET(PORT_PLS_MASK, portsc) == PLS_U3) {
-				if ((portsc & PORT_PE) == 0)
+				if ((portsc & PORT_PED) == 0)
 					goto error;
 
 				set_bit(portnum, &bus_state->resuming_ports);
@@ -1674,9 +1674,9 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
 			buf[(i + 1) / 8] |= 1 << (i + 1) % 8;
 			status = 1;
 		}
-		if ((temp & PORT_RC))
+		if ((temp & PORT_PRC))
 			reset_change = true;
-		if (temp & PORT_OC)
+		if (temp & PORT_OCA)
 			status = 1;
 	}
 	if (!status && !reset_change) {
@@ -1746,14 +1746,14 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
 			goto retry;
 		}
 		/* bail out if port detected a over-current condition */
-		if (t1 & PORT_OC) {
+		if (t1 & PORT_OCA) {
 			bus_state->bus_suspended = 0;
 			spin_unlock_irqrestore(&xhci->lock, flags);
 			xhci_dbg(xhci, "Bus suspend bailout, port over-current detected\n");
 			return -EBUSY;
 		}
 		/* suspend ports in U0, or bail out for new connect changes */
-		if ((t1 & PORT_PE) && FIELD_GET(PORT_PLS_MASK, t1) == PLS_U0) {
+		if ((t1 & PORT_PED) && FIELD_GET(PORT_PLS_MASK, t1) == PLS_U0) {
 			if ((t1 & PORT_CSC) && wake_enabled) {
 				bus_state->bus_suspended = 0;
 				spin_unlock_irqrestore(&xhci->lock, flags);
@@ -1763,7 +1763,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
 			xhci_dbg(xhci, "port %d-%d not suspended\n",
 				 hcd->self.busnum, port_index + 1);
 			FIELD_MODIFY(PORT_PLS_MASK, &t2, PLS_U3);
-			t2 |= PORT_LINK_STROBE;
+			t2 |= PORT_LWS;
 			set_bit(port_index, &bus_state->bus_suspended);
 		}
 		/* USB core sets remote wake mask for USB 3.0 hubs,
@@ -1771,12 +1771,12 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
 		 * is enabled, so also enable remote wake here.
 		 */
 		if (wake_enabled) {
-			if (t1 & PORT_CONNECT) {
-				t2 |= PORT_WKOC_E | PORT_WKDISC_E;
-				t2 &= ~PORT_WKCONN_E;
+			if (t1 & PORT_CCS) {
+				t2 |= PORT_WOE | PORT_WDE;
+				t2 &= ~PORT_WCE;
 			} else {
-				t2 |= PORT_WKOC_E | PORT_WKCONN_E;
-				t2 &= ~PORT_WKDISC_E;
+				t2 |= PORT_WOE | PORT_WCE;
+				t2 &= ~PORT_WDE;
 			}
 
 			if ((xhci->quirks & XHCI_U2_DISABLE_WAKE) &&
@@ -1831,7 +1831,7 @@ static bool xhci_port_missing_cas_quirk(struct xhci_port *port)
 	portsc = xhci_portsc_readl(port);
 
 	/* if any of these are set we are not stuck */
-	if (portsc & (PORT_CONNECT | PORT_CAS))
+	if (portsc & (PORT_CCS | PORT_CAS))
 		return false;
 
 	pls = FIELD_GET(PORT_PLS_MASK, portsc);
@@ -1840,7 +1840,7 @@ static bool xhci_port_missing_cas_quirk(struct xhci_port *port)
 
 	/* clear wakeup/change bits, and do a warm port reset */
 	portsc &= ~(PORT_RWC_BITS | PORT_CEC | PORT_WAKE_BITS);
-	portsc |= PORT_WR;
+	portsc |= PORT_WPR;
 	xhci_portsc_writel(port, portsc);
 	/* flush write */
 	xhci_portsc_readl(port);
@@ -1907,7 +1907,7 @@ int xhci_bus_resume(struct usb_hcd *hcd)
 			case PLS_U3:
 				portsc = xhci_port_state_to_neutral(portsc);
 				FIELD_MODIFY(PORT_PLS_MASK, &portsc, next_state);
-				portsc |= PORT_LINK_STROBE;
+				portsc |= PORT_LWS;
 				break;
 			case PLS_RESUME:
 				/* resume already initiated */
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index e71906889b12..6502c2bc92e6 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -941,7 +941,7 @@ static int xhci_pci_poweroff_late(struct usb_hcd *hcd, bool do_wakeup)
 		xhci_dbg(xhci, "port %d-%d in U3 without wakeup, disable it\n",
 			 port->rhub->hcd->self.busnum, port->hcd_portnum + 1);
 		portsc = xhci_port_state_to_neutral(portsc);
-		xhci_portsc_writel(port, portsc | PORT_PE);
+		xhci_portsc_writel(port, portsc | PORT_PED);
 	}
 
 	return 0;
diff --git a/drivers/usb/host/xhci-port.h b/drivers/usb/host/xhci-port.h
index 3cb28394be3f..46975524a7fe 100644
--- a/drivers/usb/host/xhci-port.h
+++ b/drivers/usb/host/xhci-port.h
@@ -9,14 +9,14 @@
 
 /* Port Status and Control (PORTSC) 5.4.8 */
 /* bit 0 - Current Connect Status */
-#define PORT_CONNECT	BIT(0)
+#define PORT_CCS	BIT(0)
 /* bit 1 - Port Enabled/Disabled */
-#define PORT_PE		BIT(1)
+#define PORT_PED	BIT(1)
 /* bit 2 - RsvdZ */
 /* bit 3 - Over-current Active */
-#define PORT_OC		BIT(3)
+#define PORT_OCA	BIT(3)
 /* bit 4 - Port Reset */
-#define PORT_RESET	BIT(4)
+#define PORT_PR		BIT(4)
 /*
  * bits 8:5 - Port Link State, by default '5'.
  * Reading gives the current link PM state of the port.
@@ -38,7 +38,7 @@
 /* Values 12-14 are Reserved */
 #define PLS_RESUME	15
 /* bit 9 - Port Power, see HCC_PPC */
-#define PORT_POWER	BIT(9)
+#define PORT_PP		BIT(9)
 /*
  * bits 13:10 - Port Speed
  * Values defined in xHCI specification 7.2.2.1.1:
@@ -65,7 +65,7 @@
 #define PIC_AMBER	1
 #define PIC_GREEN	2
 /* bit 16 - Port Link State Write Strobe, set this when changing link state */
-#define PORT_LINK_STROBE	BIT(16)
+#define PORT_LWS	BIT(16)
 /* bit 17 - Connect Status Change */
 #define PORT_CSC	BIT(17)
 /* bit 18 - Port Enabled/Disabled Change */
@@ -81,7 +81,7 @@
 /* bit 20 - Over-current Change */
 #define PORT_OCC	BIT(20)
 /* bit 21 - Port Reset Change */
-#define PORT_RC		BIT(21)
+#define PORT_PRC	BIT(21)
 /*
  * bit 22 - Port Link State Change, set on some port link state transitions:
  *  Transition				Reason
@@ -106,18 +106,18 @@
  */
 #define PORT_CAS	BIT(24)
 /* bit 25 - Wake on Connect Enable */
-#define PORT_WKCONN_E	BIT(25)
+#define PORT_WCE	BIT(25)
 /* bit 26 - Wake on Disconnect Enable */
-#define PORT_WKDISC_E	BIT(26)
+#define PORT_WDE	BIT(26)
 /* bit 27 - Wake on Over-current Enable */
-#define PORT_WKOC_E	BIT(27)
+#define PORT_WOE	BIT(27)
 /* bits 29:28 - RsvdZ */
 /* bit 30 - Device Removable, for USB 3.0 roothub emulation */
-#define PORT_DEV_REMOVE	BIT(30)
+#define PORT_DR		BIT(30)
 /* bit 31 - Warm Port Reset, complete when PORT_WRC is '1' */
-#define PORT_WR		BIT(31)
+#define PORT_WPR	BIT(31)
 #define PORT_CHANGE_MASK	(PORT_CSC | PORT_PEC | PORT_WRC | PORT_OCC | \
-				 PORT_RC | PORT_PLC | PORT_CEC)
+				 PORT_PRC | PORT_PLC | PORT_CEC)
 
 /* We mark duplicate entries with -1 */
 #define DUPLICATE_ENTRY ((u8)(-1))
@@ -169,9 +169,9 @@
  * Fields are only defined for eUSB2v2 ports (HCC2_E2V2C = 1),
  * otherwise the whole register is RsvdP.
  */
-/* bits 3:0 - Rx Data Rate (RDR) */
+/* bits 3:0 - Rx Data Rate */
 #define PORT_RDR_MASK           GENMASK(3, 0)
-/* bits 7:4 - Tx Data Rate (TDR) */
+/* bits 7:4 - Tx Data Rate */
 #define PORT_TDR_MASK           GENMASK(7, 4)
 /* bits 31:8 - RsvdP */
 
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 8117e7fe8da2..0b4d41933f16 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2128,9 +2128,9 @@ static void handle_port_status(struct xhci_hcd *xhci, union xhci_trb *event)
 	 * Tag broken links to avoid retries while hub driver sorts it out.
 	 * Link status is not relible while port is in reset.
 	 */
-	if (!(portsc & PORT_RESET)) {
+	if (!(portsc & PORT_PR)) {
 		port->link_inactive = (pls == PLS_INACTIVE);
-		port->connected = !!(portsc & PORT_CONNECT);
+		port->connected = !!(portsc & PORT_CCS);
 	}
 
 	pls = FIELD_GET(PORT_PLS_MASK, portsc);
@@ -2213,7 +2213,7 @@ static void handle_port_status(struct xhci_hcd *xhci, union xhci_trb *event)
 	if (hcd->speed < HCD_USB3) {
 		xhci_test_and_clear_bit(xhci, port, PORT_PLC);
 		if ((xhci->quirks & XHCI_RESET_PLL_ON_DISCONNECT) &&
-		    (portsc & PORT_CSC) && !(portsc & PORT_CONNECT))
+		    (portsc & PORT_CSC) && !(portsc & PORT_CCS))
 			xhci_cavium_reset_phy_quirk(xhci);
 	}
 
diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
index 275d29b50ebd..f25d8e9eb7f5 100644
--- a/drivers/usb/host/xhci-tegra.c
+++ b/drivers/usb/host/xhci-tegra.c
@@ -2033,7 +2033,7 @@ static bool xhci_hub_ports_suspended(struct xhci_hub *hub)
 
 	for (i = 0; i < hub->num_ports; i++) {
 		value = xhci_portsc_readl(hub->ports[i]);
-		if ((value & PORT_PE) == 0)
+		if ((value & PORT_PED) == 0)
 			continue;
 
 		if (FIELD_GET(PORT_PLS_MASK, value) != PLS_U3) {
@@ -2854,7 +2854,7 @@ static int tegra_xhci_hub_control(struct usb_hcd *hcd, u16 type_req, u16 value,
 				return -EPIPE;
 			ports = rhub->ports;
 			portsc = xhci_portsc_readl(ports[port]);
-			if (portsc & PORT_CONNECT)
+			if (portsc & PORT_CCS)
 				tegra_phy_xusb_utmi_pad_power_on(phy);
 		}
 	}
@@ -2873,7 +2873,7 @@ static int tegra_xhci_hub_control(struct usb_hcd *hcd, u16 type_req, u16 value,
 		if ((type_req == ClearPortFeature) && (value == USB_PORT_FEAT_C_CONNECTION)) {
 			ports = rhub->ports;
 			portsc = xhci_portsc_readl(ports[port]);
-			if (!(portsc & PORT_CONNECT)) {
+			if (!(portsc & PORT_CCS)) {
 				/* We don't suspend the PAD while HNP role swap happens on the OTG
 				 * port
 				 */
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 5837ec9fb495..20751f9696b5 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -31,7 +31,7 @@
 #define DRIVER_AUTHOR "Sarah Sharp"
 #define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver"
 
-#define	PORT_WAKE_BITS	(PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E)
+#define	PORT_WAKE_BITS	(PORT_WOE | PORT_WDE | PORT_WCE)
 
 /* Some 0.95 hardware can't handle the chain bit on a Link TRB being cleared */
 static int link_quirk;
@@ -896,7 +896,7 @@ static void xhci_disable_hub_port_wake(struct xhci_hcd *xhci,
 			t2 &= ~PORT_WAKE_BITS;
 
 		/* Don't touch csc bit if connected or connect change is set */
-		if (!(portsc & (PORT_CSC | PORT_CONNECT)))
+		if (!(portsc & (PORT_CSC | PORT_CCS)))
 			t2 |= PORT_CSC;
 
 		if (t1 != t2) {
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 18af4285a688..8db2a1bfc31b 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -2425,37 +2425,37 @@ static inline const char *xhci_decode_portsc(char *str, u32 portsc)
 	ret += sprintf(str + ret, "Link=%s ", xhci_portsc_link_state_string(portsc));
 
 	/* RO/ROS: Read-only */
-	if (portsc & PORT_CONNECT)
+	if (portsc & PORT_CCS)
 		ret += sprintf(str + ret, "CCS ");
-	if (portsc & PORT_OC)
+	if (portsc & PORT_OCA)
 		ret += sprintf(str + ret, "OCA "); /* No set for USB2 ports */
 	if (portsc & PORT_CAS)
 		ret += sprintf(str + ret, "CAS ");
-	if (portsc & PORT_DEV_REMOVE)
+	if (portsc & PORT_DR)
 		ret += sprintf(str + ret, "DR ");
 
 	/* RWS; writing 1 sets the bit, writing 0 clears the bit. */
-	if (portsc & PORT_POWER)
+	if (portsc & PORT_PP)
 		ret += sprintf(str + ret, "PP ");
-	if (portsc & PORT_WKCONN_E)
+	if (portsc & PORT_WCE)
 		ret += sprintf(str + ret, "WCE ");
-	if (portsc & PORT_WKDISC_E)
+	if (portsc & PORT_WDE)
 		ret += sprintf(str + ret, "WDE ");
-	if (portsc & PORT_WKOC_E)
+	if (portsc & PORT_WOE)
 		ret += sprintf(str + ret, "WOE ");
 
 	/* RW; writing 1 sets the bit, writing 0 clears the bit */
-	if (portsc & PORT_LINK_STROBE)
+	if (portsc & PORT_LWS)
 		ret += sprintf(str + ret, "LWS "); /* LWS 0 write is ignored */
 
 	/* RW1S; writing 1 sets the bit, writing 0 has no effect */
-	if (portsc & PORT_RESET)
+	if (portsc & PORT_PR)
 		ret += sprintf(str + ret, "PR ");
-	if (portsc & PORT_WR)
+	if (portsc & PORT_WPR)
 		ret += sprintf(str + ret, "WPR "); /* RsvdZ for USB2 ports */
 
 	/* RW1CS; writing 1 clears the bit, writing 0 has no effect. */
-	if (portsc & PORT_PE)
+	if (portsc & PORT_PED)
 		ret += sprintf(str + ret, "PED ");
 	if (portsc & PORT_CSC)
 		ret += sprintf(str + ret, "CSC ");
@@ -2465,7 +2465,7 @@ static inline const char *xhci_decode_portsc(char *str, u32 portsc)
 		ret += sprintf(str + ret, "WRC "); /* RsvdZ for USB2 ports */
 	if (portsc & PORT_OCC)
 		ret += sprintf(str + ret, "OCC ");
-	if (portsc & PORT_RC)
+	if (portsc & PORT_PRC)
 		ret += sprintf(str + ret, "PRC ");
 	if (portsc & PORT_PLC)
 		ret += sprintf(str + ret, "PLC ");
-- 
2.50.1


  parent reply	other threads:[~2026-12-03 14:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 14:42 [PATCH v3 00/12] usb: xhci: rework xHCI Port macros Niklas Neronin
2026-12-03 14:42 ` [PATCH v3 01/12] usb: xhci: use BIT() for single bit port register flags Niklas Neronin
2026-12-03 14:42 ` [PATCH v3 02/12] usb: xhci: rework Port Speed macros Niklas Neronin
2026-12-03 14:42 ` [PATCH v3 03/12] usb: xhci: rework Port Link State macros Niklas Neronin
2026-12-03 14:59   ` sashiko-bot
2026-12-03 14:42 ` [PATCH v3 04/12] usb: xhci: rework Port Indicator Control macro Niklas Neronin
2026-12-03 14:42 ` [PATCH v3 05/12] usb: xhci: rework USB3 PORTPMSC macros Niklas Neronin
2026-12-03 14:50   ` sashiko-bot
2026-12-03 14:42 ` [PATCH v3 06/12] usb: xhci: rework USB2 " Niklas Neronin
2026-12-03 14:42 ` [PATCH v3 07/12] usb: xhci: rework USB3 PORTLI macros Niklas Neronin
2026-12-03 14:42 ` [PATCH v3 08/12] usb: xhci: rework USB2 " Niklas Neronin
2026-12-03 14:42 ` [PATCH v3 09/12] usb: xhci: document USB3 PORTHLPMC register layout Niklas Neronin
2026-12-03 14:42 ` [PATCH v3 10/12] usb: xhci: rework USB2 PORTHLPMC macros Niklas Neronin
2026-12-03 14:42 ` [PATCH v3 11/12] usb: xhci: update port register bitfield comments for consistency Niklas Neronin
2026-12-03 14:42 ` Niklas Neronin [this message]
2026-12-03 14:54   ` [PATCH v3 12/12] usb: xhci: rename PORTSC field macros to xHCI spec abbreviations sashiko-bot
2026-12-03 14:59 ` [PATCH v3 00/12] usb: xhci: rework xHCI Port macros sashiko-bot

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=20261203144244.1680587-13-niklas.neronin@linux.intel.com \
    --to=niklas.neronin@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    /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