mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] usb: xhci-pci: Add TUSB73x0 definitions
@ 2026-10-09 12:51 Fabio Estevam
  2026-10-09 15:30 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2026-10-09 12:51 UTC (permalink / raw)
  To: mathias.nyman
  Cc: gregkh, bhelgaas, linux-usb, linux-kernel, linux-pci, Fabio Estevam

Instead of hard-coding the TUSB73X0 PCI ID, USB_CTRL register address
and the PWRON_POLARITY, introduce definitions for them to make the code
easier to read.

No functional change.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
Changes since v2:
- Move the TUSB73x0 PCI device ID to the shared PCI ID header and use it
  in pci-quirks.c too, as suggested by Sashiko.

Changes since v1:
- None. Only sent it as a standalone patch instead of part
  of a series.

 drivers/usb/host/pci-quirks.c | 3 ++-
 drivers/usb/host/xhci-pci.c   | 9 +++++++--
 include/linux/pci_ids.h       | 1 +
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index ba158d63bb8b..f670e7aab984 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -1189,7 +1189,8 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev)
 	val = readl(base + ext_cap_offset);
 
 	/* Auto handoff never worked for these devices. Force it and continue */
-	if ((pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241) ||
+	if ((pdev->vendor == PCI_VENDOR_ID_TI &&
+	     pdev->device == PCI_DEVICE_ID_TI_TUSB73X0) ||
 			(pdev->vendor == PCI_VENDOR_ID_RENESAS
 			 && pdev->device == 0x0014)) {
 		val = (val | XHCI_HC_OS_OWNED) & ~XHCI_HC_BIOS_OWNED;
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index a8889081ae82..54b76e2bddd2 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -28,6 +28,9 @@
 #define SPARSE_DISABLE_BIT	17
 #define SPARSE_CNTL_ENABLE	0xC12C
 
+#define TUSB73X0_USB_CTRL			0xe0
+#define TUSB73X0_PWRON_POLARITY			BIT(22)
+
 /* Device for a quirk */
 #define PCI_VENDOR_ID_FRESCO_LOGIC		0x1b73
 #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK		0x1000
@@ -479,7 +482,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 	    pdev->device == PCI_DEVICE_ID_ASMEDIA_3042_XHCI)
 		xhci->quirks |= XHCI_RESET_ON_RESUME;
 
-	if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241)
+	if (pdev->vendor == PCI_VENDOR_ID_TI &&
+	    pdev->device == PCI_DEVICE_ID_TI_TUSB73X0)
 		xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7;
 
 	if ((pdev->vendor == PCI_VENDOR_ID_BROADCOM ||
@@ -678,7 +682,8 @@ int xhci_pci_common_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	dma_set_max_seg_size(&dev->dev, UINT_MAX);
 
 	if (device_property_read_bool(&dev->dev, "ti,pwron-active-high"))
-		pci_clear_and_set_config_dword(dev, 0xE0, 0, 1 << 22);
+		pci_clear_and_set_config_dword(dev, TUSB73X0_USB_CTRL, 0,
+					       TUSB73X0_PWRON_POLARITY);
 
 	return 0;
 
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 0693e4532a68..030c86dd6d67 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -889,6 +889,7 @@
 #define PCI_DEVICE_ID_TI_XX12		0x8039
 #define PCI_DEVICE_ID_TI_XX12_FM	0x803b
 #define PCI_DEVICE_ID_TI_XIO2000A	0x8231
+#define PCI_DEVICE_ID_TI_TUSB73X0	0x8241
 #define PCI_DEVICE_ID_TI_1130		0xac12
 #define PCI_DEVICE_ID_TI_1031		0xac13
 #define PCI_DEVICE_ID_TI_1131		0xac15
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] usb: xhci-pci: Add TUSB73x0 definitions
  2026-10-09 12:51 [PATCH v3] usb: xhci-pci: Add TUSB73x0 definitions Fabio Estevam
@ 2026-10-09 15:30 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2026-10-09 15:30 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: mathias.nyman, gregkh, bhelgaas, linux-usb, linux-kernel, linux-pci

On Fri, Oct 09, 2026 at 09:51:54AM -0300, Fabio Estevam wrote:
> Instead of hard-coding the TUSB73X0 PCI ID, USB_CTRL register address
> and the PWRON_POLARITY, introduce definitions for them to make the code
> easier to read.
> 
> No functional change.
> 
> Signed-off-by: Fabio Estevam <festevam@gmail.com>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>	# pci_ids.h

> ---
> Changes since v2:
> - Move the TUSB73x0 PCI device ID to the shared PCI ID header and use it
>   in pci-quirks.c too, as suggested by Sashiko.
> 
> Changes since v1:
> - None. Only sent it as a standalone patch instead of part
>   of a series.
> 
>  drivers/usb/host/pci-quirks.c | 3 ++-
>  drivers/usb/host/xhci-pci.c   | 9 +++++++--
>  include/linux/pci_ids.h       | 1 +
>  3 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
> index ba158d63bb8b..f670e7aab984 100644
> --- a/drivers/usb/host/pci-quirks.c
> +++ b/drivers/usb/host/pci-quirks.c
> @@ -1189,7 +1189,8 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev)
>  	val = readl(base + ext_cap_offset);
>  
>  	/* Auto handoff never worked for these devices. Force it and continue */
> -	if ((pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241) ||
> +	if ((pdev->vendor == PCI_VENDOR_ID_TI &&
> +	     pdev->device == PCI_DEVICE_ID_TI_TUSB73X0) ||
>  			(pdev->vendor == PCI_VENDOR_ID_RENESAS
>  			 && pdev->device == 0x0014)) {
>  		val = (val | XHCI_HC_OS_OWNED) & ~XHCI_HC_BIOS_OWNED;
> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index a8889081ae82..54b76e2bddd2 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -28,6 +28,9 @@
>  #define SPARSE_DISABLE_BIT	17
>  #define SPARSE_CNTL_ENABLE	0xC12C
>  
> +#define TUSB73X0_USB_CTRL			0xe0
> +#define TUSB73X0_PWRON_POLARITY			BIT(22)
> +
>  /* Device for a quirk */
>  #define PCI_VENDOR_ID_FRESCO_LOGIC		0x1b73
>  #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK		0x1000
> @@ -479,7 +482,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
>  	    pdev->device == PCI_DEVICE_ID_ASMEDIA_3042_XHCI)
>  		xhci->quirks |= XHCI_RESET_ON_RESUME;
>  
> -	if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241)
> +	if (pdev->vendor == PCI_VENDOR_ID_TI &&
> +	    pdev->device == PCI_DEVICE_ID_TI_TUSB73X0)
>  		xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7;
>  
>  	if ((pdev->vendor == PCI_VENDOR_ID_BROADCOM ||
> @@ -678,7 +682,8 @@ int xhci_pci_common_probe(struct pci_dev *dev, const struct pci_device_id *id)
>  	dma_set_max_seg_size(&dev->dev, UINT_MAX);
>  
>  	if (device_property_read_bool(&dev->dev, "ti,pwron-active-high"))
> -		pci_clear_and_set_config_dword(dev, 0xE0, 0, 1 << 22);
> +		pci_clear_and_set_config_dword(dev, TUSB73X0_USB_CTRL, 0,
> +					       TUSB73X0_PWRON_POLARITY);
>  
>  	return 0;
>  
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index 0693e4532a68..030c86dd6d67 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -889,6 +889,7 @@
>  #define PCI_DEVICE_ID_TI_XX12		0x8039
>  #define PCI_DEVICE_ID_TI_XX12_FM	0x803b
>  #define PCI_DEVICE_ID_TI_XIO2000A	0x8231
> +#define PCI_DEVICE_ID_TI_TUSB73X0	0x8241
>  #define PCI_DEVICE_ID_TI_1130		0xac12
>  #define PCI_DEVICE_ID_TI_1031		0xac13
>  #define PCI_DEVICE_ID_TI_1131		0xac15
> -- 
> 2.43.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-09 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-09 12:51 [PATCH v3] usb: xhci-pci: Add TUSB73x0 definitions Fabio Estevam
2026-10-09 15:30 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®