Commit 5625207d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'usb-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
 "Here are some small reverts and fixes for USB drivers for issues that
  came up during the 5.16-rc1 merge window.

  These include:

   - two reverts of xhci and USB core patches that are causing problems
     in many systems.

   - xhci 3.1 enumeration delay fix for systems that were having
     problems.

  All three of these have been in linux-next all week with no reported
  issues"

* tag 'usb-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  xhci: Fix USB 3.1 enumeration issues by increasing roothub power-on-good delay
  Revert "usb: core: hcd: Add support for deferring roothub registration"
  Revert "xhci: Set HCD flag to defer primary roothub registration"
parents debe436e e1959faf
...@@ -2795,7 +2795,6 @@ int usb_add_hcd(struct usb_hcd *hcd, ...@@ -2795,7 +2795,6 @@ int usb_add_hcd(struct usb_hcd *hcd,
{ {
int retval; int retval;
struct usb_device *rhdev; struct usb_device *rhdev;
struct usb_hcd *shared_hcd;
if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) { if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) {
hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev); hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev);
...@@ -2956,26 +2955,13 @@ int usb_add_hcd(struct usb_hcd *hcd, ...@@ -2956,26 +2955,13 @@ int usb_add_hcd(struct usb_hcd *hcd,
goto err_hcd_driver_start; goto err_hcd_driver_start;
} }
/* starting here, usbcore will pay attention to the shared HCD roothub */
shared_hcd = hcd->shared_hcd;
if (!usb_hcd_is_primary_hcd(hcd) && shared_hcd && HCD_DEFER_RH_REGISTER(shared_hcd)) {
retval = register_root_hub(shared_hcd);
if (retval != 0)
goto err_register_root_hub;
if (shared_hcd->uses_new_polling && HCD_POLL_RH(shared_hcd))
usb_hcd_poll_rh_status(shared_hcd);
}
/* starting here, usbcore will pay attention to this root hub */ /* starting here, usbcore will pay attention to this root hub */
if (!HCD_DEFER_RH_REGISTER(hcd)) { retval = register_root_hub(hcd);
retval = register_root_hub(hcd); if (retval != 0)
if (retval != 0) goto err_register_root_hub;
goto err_register_root_hub;
if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) if (hcd->uses_new_polling && HCD_POLL_RH(hcd))
usb_hcd_poll_rh_status(hcd); usb_hcd_poll_rh_status(hcd);
}
return retval; return retval;
...@@ -3013,7 +2999,6 @@ EXPORT_SYMBOL_GPL(usb_add_hcd); ...@@ -3013,7 +2999,6 @@ EXPORT_SYMBOL_GPL(usb_add_hcd);
void usb_remove_hcd(struct usb_hcd *hcd) void usb_remove_hcd(struct usb_hcd *hcd)
{ {
struct usb_device *rhdev = hcd->self.root_hub; struct usb_device *rhdev = hcd->self.root_hub;
bool rh_registered;
dev_info(hcd->self.controller, "remove, state %x\n", hcd->state); dev_info(hcd->self.controller, "remove, state %x\n", hcd->state);
...@@ -3024,7 +3009,6 @@ void usb_remove_hcd(struct usb_hcd *hcd) ...@@ -3024,7 +3009,6 @@ void usb_remove_hcd(struct usb_hcd *hcd)
dev_dbg(hcd->self.controller, "roothub graceful disconnect\n"); dev_dbg(hcd->self.controller, "roothub graceful disconnect\n");
spin_lock_irq (&hcd_root_hub_lock); spin_lock_irq (&hcd_root_hub_lock);
rh_registered = hcd->rh_registered;
hcd->rh_registered = 0; hcd->rh_registered = 0;
spin_unlock_irq (&hcd_root_hub_lock); spin_unlock_irq (&hcd_root_hub_lock);
...@@ -3034,8 +3018,7 @@ void usb_remove_hcd(struct usb_hcd *hcd) ...@@ -3034,8 +3018,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
cancel_work_sync(&hcd->died_work); cancel_work_sync(&hcd->died_work);
mutex_lock(&usb_bus_idr_lock); mutex_lock(&usb_bus_idr_lock);
if (rh_registered) usb_disconnect(&rhdev); /* Sets rhdev to NULL */
usb_disconnect(&rhdev); /* Sets rhdev to NULL */
mutex_unlock(&usb_bus_idr_lock); mutex_unlock(&usb_bus_idr_lock);
/* /*
......
...@@ -257,7 +257,6 @@ static void xhci_common_hub_descriptor(struct xhci_hcd *xhci, ...@@ -257,7 +257,6 @@ static void xhci_common_hub_descriptor(struct xhci_hcd *xhci,
{ {
u16 temp; u16 temp;
desc->bPwrOn2PwrGood = 10; /* xhci section 5.4.9 says 20ms max */
desc->bHubContrCurrent = 0; desc->bHubContrCurrent = 0;
desc->bNbrPorts = ports; desc->bNbrPorts = ports;
...@@ -292,6 +291,7 @@ static void xhci_usb2_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, ...@@ -292,6 +291,7 @@ static void xhci_usb2_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci,
desc->bDescriptorType = USB_DT_HUB; desc->bDescriptorType = USB_DT_HUB;
temp = 1 + (ports / 8); temp = 1 + (ports / 8);
desc->bDescLength = USB_DT_HUB_NONVAR_SIZE + 2 * temp; desc->bDescLength = USB_DT_HUB_NONVAR_SIZE + 2 * temp;
desc->bPwrOn2PwrGood = 10; /* xhci section 5.4.8 says 20ms */
/* The Device Removable bits are reported on a byte granularity. /* The Device Removable bits are reported on a byte granularity.
* If the port doesn't exist within that byte, the bit is set to 0. * If the port doesn't exist within that byte, the bit is set to 0.
...@@ -344,6 +344,7 @@ static void xhci_usb3_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, ...@@ -344,6 +344,7 @@ static void xhci_usb3_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci,
xhci_common_hub_descriptor(xhci, desc, ports); xhci_common_hub_descriptor(xhci, desc, ports);
desc->bDescriptorType = USB_DT_SS_HUB; desc->bDescriptorType = USB_DT_SS_HUB;
desc->bDescLength = USB_DT_SS_HUB_SIZE; desc->bDescLength = USB_DT_SS_HUB_SIZE;
desc->bPwrOn2PwrGood = 50; /* usb 3.1 may fail if less than 100ms */
/* header decode latency should be zero for roothubs, /* header decode latency should be zero for roothubs,
* see section 4.23.5.2. * see section 4.23.5.2.
......
...@@ -692,7 +692,6 @@ int xhci_run(struct usb_hcd *hcd) ...@@ -692,7 +692,6 @@ int xhci_run(struct usb_hcd *hcd)
if (ret) if (ret)
xhci_free_command(xhci, command); xhci_free_command(xhci, command);
} }
set_bit(HCD_FLAG_DEFER_RH_REGISTER, &hcd->flags);
xhci_dbg_trace(xhci, trace_xhci_dbg_init, xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"Finished xhci_run for USB2 roothub"); "Finished xhci_run for USB2 roothub");
......
...@@ -124,7 +124,6 @@ struct usb_hcd { ...@@ -124,7 +124,6 @@ struct usb_hcd {
#define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */ #define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */
#define HCD_FLAG_DEAD 6 /* controller has died? */ #define HCD_FLAG_DEAD 6 /* controller has died? */
#define HCD_FLAG_INTF_AUTHORIZED 7 /* authorize interfaces? */ #define HCD_FLAG_INTF_AUTHORIZED 7 /* authorize interfaces? */
#define HCD_FLAG_DEFER_RH_REGISTER 8 /* Defer roothub registration */
/* The flags can be tested using these macros; they are likely to /* The flags can be tested using these macros; they are likely to
* be slightly faster than test_bit(). * be slightly faster than test_bit().
...@@ -135,7 +134,6 @@ struct usb_hcd { ...@@ -135,7 +134,6 @@ struct usb_hcd {
#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) #define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
#define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING)) #define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING))
#define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD)) #define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD))
#define HCD_DEFER_RH_REGISTER(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEFER_RH_REGISTER))
/* /*
* Specifies if interfaces are authorized by default * Specifies if interfaces are authorized by default
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment