usb: xhci: move enabling of USB 3 device notifications

Relocated the enabling of USB 3.0 device notifications from xhci_mem_init()
to xhci_init(). Introduced xhci_set_dev_notifications() function to handle
the notification settings.

Simplify 'DEV_NOTE_FWAKE' masks by directly using the 'ENABLE_DEV_NOTE'
value (1 << 1) instead of using the 'ENABLE_DEV_NOTE' macro.
Macro 'ENABLE_DEV_NOTE' is removed.

Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20250515135621.335595-10-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Niklas Neronin 2025-05-15 16:56:06 +03:00 committed by Greg Kroah-Hartman
parent 943f7fddaa
commit d41031bc8d
3 changed files with 18 additions and 12 deletions

View File

@ -2419,7 +2419,6 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
struct xhci_interrupter *ir;
struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
dma_addr_t dma;
u32 temp;
/*
* xHCI section 5.4.6 - Device Context array must be
@ -2515,15 +2514,6 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
if (xhci_setup_port_arrays(xhci, flags))
goto fail;
/* Enable USB 3.0 device notifications for function remote wake, which
* is necessary for allowing USB 3.0 devices to do remote wakeup from
* U3 (device suspend).
*/
temp = readl(&xhci->op_regs->dev_notification);
temp &= ~DEV_NOTE_MASK;
temp |= DEV_NOTE_FWAKE;
writel(temp, &xhci->op_regs->dev_notification);
return 0;
fail:

View File

@ -524,6 +524,20 @@ static void xhci_set_doorbell_ptr(struct xhci_hcd *xhci)
"Doorbell array is located at offset 0x%x from cap regs base addr", offset);
}
/*
* Enable USB 3.0 device notifications for function remote wake, which is necessary
* for allowing USB 3.0 devices to do remote wakeup from U3 (device suspend).
*/
static void xhci_set_dev_notifications(struct xhci_hcd *xhci)
{
u32 dev_notf;
dev_notf = readl(&xhci->op_regs->dev_notification);
dev_notf &= ~DEV_NOTE_MASK;
dev_notf |= DEV_NOTE_FWAKE;
writel(dev_notf, &xhci->op_regs->dev_notification);
}
/*
* Initialize memory for HCD and xHC (one-time init).
*
@ -561,6 +575,9 @@ static int xhci_init(struct usb_hcd *hcd)
/* Set Doorbell array pointer */
xhci_set_doorbell_ptr(xhci);
/* Set USB 3.0 device notifications for function remote wake */
xhci_set_dev_notifications(xhci);
/* Initializing Compliance Mode Recovery Data If Needed */
if (xhci_compliance_mode_recovery_timer_quirk_check()) {
xhci->quirks |= XHCI_COMP_MODE_QUIRK;

View File

@ -184,11 +184,10 @@ struct xhci_op_regs {
* notification type that matches a bit set in this bit field.
*/
#define DEV_NOTE_MASK (0xffff)
#define ENABLE_DEV_NOTE(x) (1 << (x))
/* Most of the device notification types should only be used for debug.
* SW does need to pay attention to function wake notifications.
*/
#define DEV_NOTE_FWAKE ENABLE_DEV_NOTE(1)
#define DEV_NOTE_FWAKE (1 << 1)
/* CRCR - Command Ring Control Register - cmd_ring bitmasks */
/* bit 0 - Cycle bit indicates the ownership of the command ring */