[<prev] [next>] [day] [month] [year] [list]
Message-ID: <8AC53C0500C2C839+20250104154353.93075-1-wangyuli@uniontech.com>
Date: Sat, 4 Jan 2025 23:43:53 +0800
From: WangYuli <wangyuli@...ontech.com>
To: mathias.nyman@...el.com,
gregkh@...uxfoundation.org
Cc: linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org,
niklas.neronin@...ux.intel.com,
quic_wcheng@...cinc.com,
andriy.shevchenko@...ux.intel.com,
michal.pecio@...il.com,
guanwentao@...ontech.com,
zhanjun@...ontech.com,
bigeasy@...utronix.de,
balbi@...com,
sarah.a.sharp@...ux.intel.com,
WangYuli <wangyuli@...ontech.com>,
Xu Rao <raoxu@...ontech.com>
Subject: [PATCH] usb: host: xhci-plat: Assign shared_hcd->rsrc_start
When inserting a USB device, examining hcd->rsrc_start can be
helpful in identifying which hcd is mounted, as the physical
address represented here is typically unique.
The following code snippet demonstrates this:
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
unsigned long long usb_hcd_addr = (unsigned long long)hcd->rsrc_start;
However, this approach has limitations now. For USB hosts with an
MMIO interface, the effectiveness of this method is restricted to
USB 2.0.
Becase commit 3429e91a661e ("usb: host: xhci: add platform driver
support") assigned res->start to hcd->rsrc_start. But
shared_hcd->rsrc_start remains unassigned, which is also necessary
in certain scenarios.
Co-developed-by: Xu Rao <raoxu@...ontech.com>
Signed-off-by: Xu Rao <raoxu@...ontech.com>
Signed-off-by: WangYuli <wangyuli@...ontech.com>
---
drivers/usb/host/xhci-plat.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index e6c9006bd568..56a65ddb7e4c 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -328,6 +328,9 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s
if (usb3_hcd && HCC_MAX_PSA(xhci->hcc_params) >= 4)
usb3_hcd->can_do_streams = 1;
+ xhci->shared_hcd->rsrc_start = hcd->rsrc_start;
+ xhci->shared_hcd->rsrc_len = hcd->rsrc_len;
+
if (xhci->shared_hcd) {
ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
if (ret)
--
2.45.2
Powered by blists - more mailing lists