xhci features for usb-next
Subsystems (2)
cover xhci features for usb-next
Hi Greg
New xhci features for 5.19
Major change is support for xHC with just one roothub.
Thanks
Mathias
Heiner Kallweit (5):
xhci: factor out parts of xhci_gen_setup()
xhci: prepare for operation w/o shared hcd
usb: host: xhci-plat: create shared hcd after having added main hcd
usb: host: xhci-plat: prepare operation w/o shared hcd
usb: host: xhci-plat: omit shared hcd if either root hub has no ports
Mathias Nyman (4):
xhci: use generic command timer for stop endpoint commands.
xhci: prevent U2 link power state if Intel tier policy prevented U1
xhci: Remove quirk for over 10 year old evaluation hardware
xhci: Allow host runtime PM as default for Intel Alder Lake N xHCI
drivers/usb/host/xhci-hub.c | 3 +- drivers/usb/host/xhci-mem.c | 23 ++--- drivers/usb/host/xhci-pci.c | 5 +- drivers/usb/host/xhci-plat.c | 46 ++++++---- drivers/usb/host/xhci-ring.c | 144 ++++++++--------------------- drivers/usb/host/xhci.c | 173 +++++++++++++++++++---------------- drivers/usb/host/xhci.h | 30 +++++- 7 files changed, 199 insertions(+), 225 deletions(-)
Signature · 1 line
2.25.1
PATCH 2/9 xhci: prepare for operation w/o shared hcd
From: Heiner Kallweit <[email protected]>
This patch prepares xhci for the following scenario:
- If either of the root hubs has no ports, then omit shared hcd
- Main hcd can be USB3 if there are no USB2 ports
--- drivers/usb/host/xhci-hub.c | 3 ++- drivers/usb/host/xhci-mem.c | 11 ++++---- drivers/usb/host/xhci.c | 53 ++++++++++++++++++++++++------------- drivers/usb/host/xhci.h | 26 ++++++++++++++++++ 4 files changed, 68 insertions(+), 25 deletions(-)
drivers/usb/host/xhci-hub.c +2 -1
@@ -707,6 +707,7 @@ static int xhci_enter_test_mode(struct xhci_hcd *xhci, u16 test_mode, u16 wIndex, unsigned long *flags) __must_hold(&xhci->lock) { + struct usb_hcd *usb3_hcd = xhci_get_usb3_hcd(xhci);int i, retval;/* Disable all Device Slots */
@@ -727,7 +728,7 @@ static int xhci_enter_test_mode(struct xhci_hcd *xhci,xhci_dbg (xhci,"Disable all port (PP = 0)\n" );/* Power off USB3 ports*/ for (i =0 ; i < xhci->usb3_rhub.num_ports; i++) -xhci_set_port_power (xhci, xhci->shared_hcd, i, false, flags); +xhci_set_port_power (xhci, usb3_hcd, i, false, flags);/* Power off USB2 ports*/ for (i =0 ; i < xhci->usb2_rhub.num_ports; i++)xhci_set_port_power (xhci, xhci->main_hcd, i, false, flags);
drivers/usb/host/xhci-mem.c +6 -5
@@ -1072,7 +1072,7 @@ static u32 xhci_find_real_port_number(struct xhci_hcd *xhci,struct usb_hcd *hcd;if (udev->speed >=USB_SPEED_SUPER ) - hcd = xhci->shared_hcd; + hcd =xhci_get_usb3_hcd (xhci);else hcd = xhci->main_hcd;
@@ -2362,10 +2362,11 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags) xhci->usb2_rhub.num_ports =USB_MAXCHILDREN ; } -/* -* Note we could have all USB 3.0 ports, or all USB 2.0 ports. -* Not sure how the USB core will handle a hub with no ports... -*/ +if (!xhci->usb2_rhub.num_ports) +xhci_info (xhci,"USB2 root hub has no ports\n" ); + +if (!xhci->usb3_rhub.num_ports) +xhci_info (xhci,"USB3 root hub has no ports\n" );xhci_create_rhub_port_array (xhci, &xhci->usb2_rhub, flags);xhci_create_rhub_port_array (xhci, &xhci->usb3_rhub, flags);
drivers/usb/host/xhci.c +34 -19
151 lines not on this page · raw message
drivers/usb/host/xhci.h +26 -0
@@ -1911,6 +1911,8 @@ struct xhci_hcd { unsigned hw_lpm_support:1;/* Broken Suspend flag for SNPS Suspend resume issue */ unsigned broken_suspend:1; +/* Indicates that omitting hcd is supported if root hub has no ports */ + unsigned allow_single_roothub:1;/* cached usb2 extened protocol capabilites */ u32 *ext_caps;unsigned int num_ext_caps;
@@ -1966,6 +1968,30 @@ static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci)return xhci->main_hcd; } +static inline struct usb_hcd *xhci_get_usb3_hcd (struct xhci_hcd *xhci) +{ +if (xhci->shared_hcd) +return xhci->shared_hcd; + +if (!xhci->usb2_rhub.num_ports) +return xhci->main_hcd; + +return NULL ; +} + +static inline bool xhci_hcd_is_usb3 (struct usb_hcd *hcd) +{ +struct xhci_hcd *xhci =hcd_to_xhci (hcd); + +return hcd ==xhci_get_usb3_hcd (xhci); +} + +static inline bool xhci_has_one_roothub (struct xhci_hcd *xhci) +{ +return xhci->allow_single_roothub && + (!xhci->usb2_rhub.num_ports || !xhci->usb3_rhub.num_ports); +} + #define xhci_dbg(xhci, fmt, args...) \ dev_dbg(xhci_to_hcd(xhci)->self.controller , fmt , ## args) #define xhci_err(xhci, fmt, args...) \
Signature · 1 line
2.25.1
PATCH 1/9 xhci: factor out parts of xhci_gen_setup()
In reply to Mathias NymanFrom: Heiner Kallweit <[email protected]>
Factoring out parts of xhci_gen_setup() has two motivations:
- When adding functionaliy to omit shared hcd if not needed in a subsequent patch, we'll have to call xhci_hcd_init_usb3_data() from two places.
- It reduces size of xhci_gen_setup() and makes it better readable.
--- drivers/usb/host/xhci.c | 104 +++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 50 deletions(-)
drivers/usb/host/xhci.c +54 -50
@@ -5207,6 +5207,57 @@ static int xhci_get_frame(struct usb_hcd *hcd)return readl (&xhci->run_regs->microframe_index) >>3 ; } +static void xhci_hcd_init_usb2_data (struct xhci_hcd *xhci,struct usb_hcd *hcd) +{ + xhci->usb2_rhub.hcd = hcd; + hcd->speed =HCD_USB2 ; + hcd->self.root_hub->speed =USB_SPEED_HIGH ; +/* +* USB 2.0 roothub under xHCI has an integrated TT, +* (rate matching hub) as opposed to having an OHCI/UHCI +* companion controller. +*/ + hcd->has_tt =1 ; +} + +static void xhci_hcd_init_usb3_data (struct xhci_hcd *xhci,struct usb_hcd *hcd) +{ +unsigned int minor_rev; + +/* +* Early xHCI 1.1 spec did not mention USB 3.1 capable hosts +* should return 0x31 for sbrn, or that the minor revision +* is a two digit BCD containig minor and sub-minor numbers. +* This was later clarified in xHCI 1.2. +* +* Some USB 3.1 capable hosts therefore have sbrn 0x30, and +* minor revision set to 0x1 instead of 0x10. +*/ +if (xhci->usb3_rhub.min_rev ==0x1 ) + minor_rev =1 ; +else + minor_rev = xhci->usb3_rhub.min_rev /0x10 ; + +switch (minor_rev) { +case 2 : + hcd->speed =HCD_USB32 ; + hcd->self.root_hub->speed =USB_SPEED_SUPER_PLUS ; + hcd->self.root_hub->rx_lanes =2 ; + hcd->self.root_hub->tx_lanes =2 ; + hcd->self.root_hub->ssp_rate = USB_SSP_GEN_2x2; +break ; +case 1 : + hcd->speed =HCD_USB31 ; + hcd->self.root_hub->speed =USB_SPEED_SUPER_PLUS ; + hcd->self.root_hub->ssp_rate = USB_SSP_GEN_2x1; +break ; + } +xhci_info (xhci,"Host supports USB 3.%x %sSuperSpeed\n" , + minor_rev, minor_rev ?"Enhanced " :"" ); + + xhci->usb3_rhub.hcd = hcd; +} +int xhci_gen_setup (struct usb_hcd *hcd,xhci_get_quirks_t get_quirks) {struct xhci_hcd *xhci;
@@ -5215,7 +5266,6 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)* quirks */ struct device *dev = hcd->self.sysdev; -unsigned int minor_rev;int retval;/* Accept arbitrarily long scatter-gather lists */
@@ -5230,60 +5280,14 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) xhci =hcd_to_xhci (hcd);if (usb_hcd_is_primary_hcd (hcd)) { - xhci->main_hcd = hcd; - xhci->usb2_rhub.hcd = hcd; -/* Mark the first roothub as being USB 2.0. -* The xHCI driver will register the USB 3.0 roothub. -*/ - hcd->speed =HCD_USB2 ; - hcd->self.root_hub->speed =USB_SPEED_HIGH ; -/* -* USB 2.0 roothub under xHCI has an integrated TT, -* (rate matching hub) as opposed to having an OHCI/UHCI -* companion controller. -*/ - hcd->has_tt =1 ; +xhci_hcd_init_usb2_data (xhci, hcd); }else { -/* -* Early xHCI 1.1 spec did not mention USB 3.1 capable hosts -* should return 0x31 for sbrn, or that the minor revision -* is a two digit BCD containig minor and sub-minor numbers. -* This was later clarified in xHCI 1.2. -* -* Some USB 3.1 capable hosts therefore have sbrn 0x30, and -* minor revision set to 0x1 instead of 0x10. -*/ -if (xhci->usb3_rhub.min_rev ==0x1 ) - minor_rev =1 ; -else - minor_rev = xhci->usb3_rhub.min_rev /0x10 ; - -switch (minor_rev) { -case 2 : - hcd->speed =HCD_USB32 ; - hcd->self.root_hub->speed =USB_SPEED_SUPER_PLUS ; - hcd->self.root_hub->rx_lanes =2 ; - hcd->self.root_hub->tx_lanes =2 ; - hcd->self.root_hub->ssp_rate = USB_SSP_GEN_2x2; -break ; -case 1 : - hcd->speed =HCD_USB31 ; - hcd->self.root_hub->speed =USB_SPEED_SUPER_PLUS ; - hcd->self.root_hub->ssp_rate = USB_SSP_GEN_2x1; -break ; - } -xhci_info (xhci,"Host supports USB 3.%x %sSuperSpeed\n" , - minor_rev, - minor_rev ?"Enhanced " :"" ); - - xhci->usb3_rhub.hcd = hcd; -/* xHCI private pointer was set in xhci_pci_probe for the second -* registered roothub. -*/ +xhci_hcd_init_usb3_data (xhci, hcd);return 0 ; }mutex_init (&xhci->mutex); + xhci->main_hcd = hcd; xhci->cap_regs = hcd->regs; xhci->op_regs = hcd->regs +HC_LENGTH (readl (&xhci->cap_regs->hc_capbase));
Signature · 1 line
2.25.1
PATCH 4/9 usb: host: xhci-plat: prepare operation w/o shared hcd
In reply to Mathias NymanFrom: Heiner Kallweit <[email protected]>
This patch prepares xhci-plat for the following scenario
- If either of the root hubs has no ports, then omit shared hcd
- Main hcd can be USB3 if there are no USB2 ports
--- drivers/usb/host/xhci-plat.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-)
drivers/usb/host/xhci-plat.c +18 -13
@@ -180,7 +180,7 @@ static int xhci_plat_probe(struct platform_device *pdev)struct device *sysdev, *tmpdev;struct xhci_hcd *xhci;struct resource *res; -struct usb_hcd *hcd; +struct usb_hcd *hcd, *usb3_hcd;int ret;int irq;struct xhci_plat_priv *priv =NULL ;
@@ -327,21 +327,26 @@ static int xhci_plat_probe(struct platform_device *pdev)if (ret) goto disable_usb_phy; - xhci->shared_hcd =__usb_create_hcd (driver, sysdev, &pdev->dev, -dev_name (&pdev->dev), hcd); -if (!xhci->shared_hcd) { - ret = -ENOMEM ; - goto dealloc_usb2_hcd; - } +if (!xhci_has_one_roothub (xhci)) { + xhci->shared_hcd =__usb_create_hcd (driver, sysdev, &pdev->dev, +dev_name (&pdev->dev), hcd); +if (!xhci->shared_hcd) { + ret = -ENOMEM ; + goto dealloc_usb2_hcd; + } - xhci->shared_hcd->tpl_support = hcd->tpl_support; + xhci->shared_hcd->tpl_support = hcd->tpl_support; + } -if (HCC_MAX_PSA (xhci->hcc_params) >=4 ) - xhci->shared_hcd->can_do_streams =1 ; + usb3_hcd =xhci_get_usb3_hcd (xhci); +if (usb3_hcd &&HCC_MAX_PSA (xhci->hcc_params) >=4 ) + usb3_hcd->can_do_streams =1 ; - ret =usb_add_hcd (xhci->shared_hcd, irq,IRQF_SHARED ); -if (ret) - goto put_usb3_hcd; +if (xhci->shared_hcd) { + ret =usb_add_hcd (xhci->shared_hcd, irq,IRQF_SHARED ); +if (ret) + goto put_usb3_hcd; + }device_enable_async_suspend (&pdev->dev);pm_runtime_put_noidle (&pdev->dev);
Signature · 1 line
2.25.1
PATCH 3/9 usb: host: xhci-plat: create shared hcd after having added main hcd
In reply to Mathias NymanFrom: Heiner Kallweit <[email protected]>
This patch is in preparation of an extension where in case of a root hub with no ports no shared hcd will be created. Whether one of the root hubs has no ports we figure our in usb_add_hcd() for the primary hcd. Therefore create the shared hcd only after this call.
--- drivers/usb/host/xhci-plat.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-)
drivers/usb/host/xhci-plat.c +16 -13
@@ -283,12 +283,6 @@ static int xhci_plat_probe(struct platform_device *pdev)device_set_wakeup_capable (&pdev->dev, true); xhci->main_hcd = hcd; - xhci->shared_hcd =__usb_create_hcd (driver, sysdev, &pdev->dev, -dev_name (&pdev->dev), hcd); -if (!xhci->shared_hcd) { - ret = -ENOMEM ; - goto disable_clk; - }/* imod_interval is the interrupt moderation value in nanoseconds. */ xhci->imod_interval =40000 ;
@@ -313,16 +307,16 @@ static int xhci_plat_probe(struct platform_device *pdev)if (IS_ERR (hcd->usb_phy)) { ret =PTR_ERR (hcd->usb_phy);if (ret == -EPROBE_DEFER ) - goto put_usb3_hcd; + goto disable_clk; hcd->usb_phy =NULL ; }else { ret =usb_phy_init (hcd->usb_phy);if (ret) - goto put_usb3_hcd; + goto disable_clk; } hcd->tpl_support =of_usb_host_tpl_support (sysdev->of_node); - xhci->shared_hcd->tpl_support = hcd->tpl_support; +if (priv && (priv->quirks &XHCI_SKIP_PHY_INIT )) hcd->skip_phy_initialization =1 ;
@@ -333,12 +327,21 @@ static int xhci_plat_probe(struct platform_device *pdev)if (ret) goto disable_usb_phy; + xhci->shared_hcd =__usb_create_hcd (driver, sysdev, &pdev->dev, +dev_name (&pdev->dev), hcd); +if (!xhci->shared_hcd) { + ret = -ENOMEM ; + goto dealloc_usb2_hcd; + } + + xhci->shared_hcd->tpl_support = hcd->tpl_support; +if (HCC_MAX_PSA (xhci->hcc_params) >=4 ) xhci->shared_hcd->can_do_streams =1 ; ret =usb_add_hcd (xhci->shared_hcd, irq,IRQF_SHARED );if (ret) - goto dealloc_usb2_hcd; + goto put_usb3_hcd;device_enable_async_suspend (&pdev->dev);pm_runtime_put_noidle (&pdev->dev);
@@ -352,15 +355,15 @@ static int xhci_plat_probe(struct platform_device *pdev)return 0 ; +put_usb3_hcd: +usb_put_hcd (xhci->shared_hcd); + dealloc_usb2_hcd:usb_remove_hcd (hcd); disable_usb_phy:usb_phy_shutdown (hcd->usb_phy); -put_usb3_hcd: -usb_put_hcd (xhci->shared_hcd); - disable_clk:clk_disable_unprepare (xhci->clk);
Signature · 1 line
2.25.1
PATCH 5/9 usb: host: xhci-plat: omit shared hcd if either root hub has no ports
In reply to Mathias NymanFrom: Heiner Kallweit <[email protected]>
Activate the just added extension for xhci-plat and omit the shared hcd if either of the root hubs has no ports.
--- drivers/usb/host/xhci-plat.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/host/xhci-plat.c +2 -0
@@ -245,6 +245,8 @@ static int xhci_plat_probe(struct platform_device *pdev) xhci =hcd_to_xhci (hcd); + xhci->allow_single_roothub =1 ; +/* * Not all platforms have clks so it is not an error if the * clock do not exist.
Signature · 1 line
2.25.1
PATCH 6/9 xhci: use generic command timer for stop endpoint commands.
In reply to Mathias NymanThe 'stop endpoint' command timer was started when a 'stop endpoint' command was added to the command queue.
This can trigger unwanted timeouts if there are several pending commands in the queue that xHC needs to handle first.
The generic command timer, which was added later than the 'stop endpoint' timeout timer, times each command currently being handled by xHC hardware.
A timed out stop endpoint command was treated as a more severe issue than other failed commands, so the separate stop endpoint timer was left unchanged.
Use the generic command timer for stop endpoint commands. Identify if the timed out command was a stop endpoint command in the generic handler, and treat it with the same severity as earlier.
--- drivers/usb/host/xhci-mem.c | 12 +--- drivers/usb/host/xhci-ring.c | 107 +++++++++++------------------------ drivers/usb/host/xhci.c | 7 +-- drivers/usb/host/xhci.h | 2 - 4 files changed, 37 insertions(+), 91 deletions(-)
drivers/usb/host/xhci-mem.c +2 -10
@@ -782,14 +782,6 @@ void xhci_free_stream_info(struct xhci_hcd *xhci,/***************** Device context manipulation *************************/ -static void xhci_init_endpoint_timer (struct xhci_hcd *xhci, -struct xhci_virt_ep *ep) -{ -timer_setup (&ep->stop_cmd_timer, xhci_stop_endpoint_command_watchdog, -0 ); - ep->xhci = xhci; -} -static void xhci_free_tt_info (struct xhci_hcd *xhci,struct xhci_virt_device *virt_dev,int slot_id)
@@ -994,11 +986,11 @@ int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id,xhci_dbg (xhci,"Slot %d input ctx = 0x%llx (dma)\n" , slot_id, (unsigned long long )dev->in_ctx->dma); -/* Initialize the cancellation list and watchdog timers for each ep */ +/* Initialize the cancellation and bandwidth list for each ep */ for (i =0 ; i <31 ; i++) { dev->eps[i].ep_index = i; dev->eps[i].vdev = dev; -xhci_init_endpoint_timer (xhci, &dev->eps[i]); + dev->eps[i].xhci = xhci;INIT_LIST_HEAD (&dev->eps[i].cancelled_td_list);INIT_LIST_HEAD (&dev->eps[i].bw_endpoint_list); }
drivers/usb/host/xhci-ring.c +34 -73
151 lines not on this page · raw message
drivers/usb/host/xhci.c +1 -6
@@ -1872,9 +1872,6 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) goto done; } ep->ep_state |=EP_STOP_CMD_PENDING ; - ep->stop_cmd_timer.expires = jiffies + -XHCI_STOP_EP_CMD_TIMEOUT *HZ ; -add_timer (&ep->stop_cmd_timer);xhci_queue_stop_endpoint (xhci, command, urb->dev->slot_id, ep_index,0 );xhci_ring_cmd_db (xhci);
@@ -3984,10 +3981,8 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)trace_xhci_free_dev (slot_ctx);/* Stop any wayward timer functions (which may grab the lock) */ -for (i =0 ; i <31 ; i++) { +for (i =0 ; i <31 ; i++) virt_dev->eps[i].ep_state &= ~EP_STOP_CMD_PENDING ; -del_timer_sync (&virt_dev->eps[i].stop_cmd_timer); - } virt_dev->udev =NULL ;xhci_disable_slot (xhci, udev->slot_id);xhci_free_virt_device (xhci, udev->slot_id);
drivers/usb/host/xhci.h +0 -2
@@ -948,8 +948,6 @@ struct xhci_virt_ep {#define EP_CLEARING_TT (1 << 8)/* ---- Related to URB cancellation ---- */ struct list_head cancelled_td_list; -/* Watchdog timer for stop endpoint command to cancel URBs */ -struct timer_list stop_cmd_timer;struct xhci_hcd *xhci;/* Dequeue pointer and dequeue segment for a submitted Set TR Dequeue * command. We'll need to update the ring's dequeue segment and dequeue
Signature · 1 line
2.25.1
PATCH 7/9 xhci: prevent U2 link power state if Intel tier policy prevented U1
In reply to Mathias NymanDon't enable U1 or U2 Link powermanagenet (LPM) states for USB3 devices connected to tier 2 or further hubs.
For unknown reasons we previously only prevented U1.
Be consistent, and prevent both U1/U2 states if tier policy doesn't allow LPM.
Also check the tier policy a bit earlier, and return if U1/U2 is not allowed. This avoids unnecessary xhci MEL commands.
--- drivers/usb/host/xhci.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/usb/host/xhci.c +4 -7
@@ -4886,9 +4886,6 @@ static int xhci_check_intel_tier_policy(struct usb_device *udev,struct usb_device *parent;unsigned int num_hubs; -if (state ==USB3_LPM_U2 ) -return 0 ; -/* Don't enable U1 if the device is on a 2nd tier hub or lower. */ for (parent = udev->parent, num_hubs =0 ; parent->parent; parent = parent->parent)
@@ -4897,7 +4894,7 @@ static int xhci_check_intel_tier_policy(struct usb_device *udev,if (num_hubs <2 )return 0 ; -dev_dbg (&udev->dev,"Disabling U1 link state for device" +dev_dbg (&udev->dev,"Disabling U1/U2 link state for device" " below second-tier hub.\n" );dev_dbg (&udev->dev,"Plug device into first-tier hub " "to decrease power consumption.\n" );
@@ -4938,9 +4935,6 @@ static u16 xhci_calculate_lpm_timeout(struct usb_hcd *hcd,return timeout; } -if (xhci_check_tier_policy (xhci, udev, state) <0 ) -return timeout; -/* Gather some information about the currently installed configuration * and alternate interface settings. */
@@ -5047,6 +5041,9 @@ static int xhci_enable_usb3_lpm_timeout(struct usb_hcd *hcd, !xhci->devs[udev->slot_id])return USB3_LPM_DISABLED ; +if (xhci_check_tier_policy (xhci, udev, state) <0 ) +return USB3_LPM_DISABLED ; + hub_encoded_timeout =xhci_calculate_lpm_timeout (hcd, udev, state); mel =calculate_max_exit_latency (udev, state, hub_encoded_timeout);if (mel <0 ) {
Signature · 1 line
2.25.1
PATCH 8/9 xhci: Remove quirk for over 10 year old evaluation hardware
In reply to Mathias NymanThe XHCI_RESET_EP_QUIRK was added in 2009 to support prototype xHC hardware from Fresco Logic that needed an additional configure endpoint command after a reset endpoint.
That hardware should not have made it to the market. Now, 13 years later its about time we get rid of it.
quirk was added in commit ac9d8fe7c6a8 ("USB: xhci: Add quirk for Fresco Logic xHCI hardware.")
Print a debug message about the removed quirk if against all odds we run into this controller.
--- drivers/usb/host/xhci-pci.c | 3 +-- drivers/usb/host/xhci-ring.c | 37 +++++------------------------------- drivers/usb/host/xhci.h | 2 +- 3 files changed, 7 insertions(+), 35 deletions(-)
drivers/usb/host/xhci-pci.c +1 -2
@@ -129,8 +129,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) pdev->revision == 0x0) { xhci->quirks |=XHCI_RESET_EP_QUIRK ;xhci_dbg_trace (xhci, trace_xhci_dbg_quirks, -"QUIRK: Fresco Logic xHC needs configure" -" endpoint cmd after reset endpoint" ); +"XHCI_RESET_EP_QUIRK for this evaluation HW is deprecated" ); }if (pdev->device ==PCI_DEVICE_ID_FRESCO_LOGIC_PDK && pdev->revision ==0x4 ) {
drivers/usb/host/xhci-ring.c +5 -32
@@ -1426,8 +1426,6 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id,/* Cleanup cancelled TDs as ep is stopped. May queue a Set TR Deq cmd */ xhci_invalidate_cancelled_tds (ep); -if (xhci->quirks &XHCI_RESET_EP_QUIRK ) -xhci_dbg (xhci,"Note: Removed workaround to queue config ep for this hw" );/* Clear our internal halted state */ ep->ep_state &= ~EP_HALTED ;
@@ -1471,17 +1469,13 @@ static void xhci_handle_cmd_config_ep(struct xhci_hcd *xhci, int slot_id,struct xhci_input_control_ctx *ctrl_ctx;struct xhci_ep_ctx *ep_ctx;unsigned int ep_index; -unsigned int ep_state; -u32 add_flags, drop_flags; +u32 add_flags;/* -* Configure endpoint commands can come from the USB core -* configuration or alt setting changes, or because the HW -* needed an extra configure endpoint command after a reset -* endpoint command or streams were being configured. -* If the command was for a halted endpoint, the xHCI driver -* is not waiting on the configure endpoint command. +* Configure endpoint commands can come from the USB core configuration +* or alt setting changes, or when streams were being configured. */ + virt_dev = xhci->devs[slot_id];if (!virt_dev)return ;
@@ -1492,34 +1486,13 @@ static void xhci_handle_cmd_config_ep(struct xhci_hcd *xhci, int slot_id, } add_flags =le32_to_cpu (ctrl_ctx->add_flags); - drop_flags =le32_to_cpu (ctrl_ctx->drop_flags); +/* Input ctx add_flags are the endpoint index plus one */ ep_index =xhci_last_valid_endpoint (add_flags) -1 ; ep_ctx =xhci_get_ep_ctx (xhci, virt_dev->out_ctx, ep_index);trace_xhci_handle_cmd_config_ep (ep_ctx); -/* A usb_set_interface() call directly after clearing a halted -* condition may race on this quirky hardware. Not worth -* worrying about, since this is prototype hardware. Not sure -* if this will work for streams, but streams support was -* untested on this prototype. -*/ -if (xhci->quirks &XHCI_RESET_EP_QUIRK && - ep_index != (unsigned int )-1 && - add_flags -SLOT_FLAG == drop_flags) { - ep_state = virt_dev->eps[ep_index].ep_state; -if (!(ep_state &EP_HALTED )) -return ; -xhci_dbg_trace (xhci, trace_xhci_dbg_quirks, -"Completed config ep cmd - " -"last ep index = %d, state = %d" , - ep_index, ep_state); -/* Clear internal halted state and restart ring(s) */ - virt_dev->eps[ep_index].ep_state &= ~EP_HALTED ; -ring_doorbell_for_active_rings (xhci, slot_id, ep_index); -return ; - }return ; }
drivers/usb/host/xhci.h +1 -1
@@ -1846,7 +1846,7 @@ struct xhci_hcd {#define XHCI_STATE_REMOVING (1 << 2)unsigned long long quirks;#define XHCI_LINK_TRB_QUIRK BIT_ULL(0) -#define XHCI_RESET_EP_QUIRK BIT_ULL(1) +#define XHCI_RESET_EP_QUIRK BIT_ULL(1)/* Deprecated */ #define XHCI_NEC_HOST BIT_ULL(2)#define XHCI_AMD_PLL_FIX BIT_ULL(3)#define XHCI_SPURIOUS_SUCCESS BIT_ULL(4)
Signature · 1 line
2.25.1
PATCH 9/9 xhci: Allow host runtime PM as default for Intel Alder Lake N xHCI
In reply to Mathias NymanAlder Lake N TCSS xHCI needs to be runtime suspended whenever possible to allow the TCSS hardware block to enter D3 and thus save energy
--- drivers/usb/host/xhci-pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/host/xhci-pci.c +2 -0
@@ -59,6 +59,7 @@#define PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI 0x9a13#define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI 0x1138#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI 0x461e +#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI 0x464e#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI 0x51ed#define PCI_DEVICE_ID_AMD_RENOIR_XHCI 0x1639
@@ -267,6 +268,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) pdev->device ==PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI || pdev->device ==PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI || pdev->device ==PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI || + pdev->device ==PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI || pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI)) xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW;
Signature · 1 line
2.25.1