Revert "usb: xhci: set page size to the xHCI-supported size"
This reverts commit 1c17190880 which is
commit 68c1f1671650b49bbd26e6a65ddcf33f2565efa3 upstream.
It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.
Bug: 161946584
Change-Id: I86a180900b707071e5d8fca2cec1ac304ad075a7
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -1950,6 +1950,7 @@ no_bw:
|
||||
xhci->interrupters = NULL;
|
||||
|
||||
xhci->page_size = 0;
|
||||
xhci->page_shift = 0;
|
||||
xhci->usb2_rhub.bus_state.bus_suspended = 0;
|
||||
xhci->usb3_rhub.bus_state.bus_suspended = 0;
|
||||
}
|
||||
@@ -2372,22 +2373,6 @@ xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xhci_create_secondary_interrupter);
|
||||
|
||||
static void xhci_hcd_page_size(struct xhci_hcd *xhci)
|
||||
{
|
||||
u32 page_size;
|
||||
|
||||
page_size = readl(&xhci->op_regs->page_size) & XHCI_PAGE_SIZE_MASK;
|
||||
if (!is_power_of_2(page_size)) {
|
||||
xhci_warn(xhci, "Invalid page size register = 0x%x\n", page_size);
|
||||
/* Fallback to 4K page size, since that's common */
|
||||
page_size = 1;
|
||||
}
|
||||
|
||||
xhci->page_size = page_size << 12;
|
||||
xhci_dbg_trace(xhci, trace_xhci_dbg_init, "HCD page size set to %iK",
|
||||
xhci->page_size >> 10);
|
||||
}
|
||||
|
||||
int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
|
||||
{
|
||||
struct xhci_interrupter *ir;
|
||||
@@ -2395,7 +2380,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
|
||||
dma_addr_t dma;
|
||||
unsigned int val, val2;
|
||||
u64 val_64;
|
||||
u32 temp;
|
||||
u32 page_size, temp;
|
||||
int i;
|
||||
|
||||
INIT_LIST_HEAD(&xhci->cmd_list);
|
||||
@@ -2404,7 +2389,20 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
|
||||
INIT_DELAYED_WORK(&xhci->cmd_timer, xhci_handle_command_timeout);
|
||||
init_completion(&xhci->cmd_ring_stop_completion);
|
||||
|
||||
xhci_hcd_page_size(xhci);
|
||||
page_size = readl(&xhci->op_regs->page_size);
|
||||
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
|
||||
"Supported page size register = 0x%x", page_size);
|
||||
val = ffs(page_size) - 1;
|
||||
if (val < 16)
|
||||
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
|
||||
"Supported page size of %iK", (1 << (val + 12)) / 1024);
|
||||
else
|
||||
xhci_warn(xhci, "WARN: no supported page size\n");
|
||||
/* Use 4K pages, since that's common and the minimum the HC supports */
|
||||
xhci->page_shift = 12;
|
||||
xhci->page_size = 1 << xhci->page_shift;
|
||||
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
|
||||
"HCD page size set to %iK", xhci->page_size / 1024);
|
||||
|
||||
/*
|
||||
* Program the Number of Device Slots Enabled field in the CONFIG
|
||||
|
||||
@@ -212,9 +212,6 @@ struct xhci_op_regs {
|
||||
#define CONFIG_CIE (1 << 9)
|
||||
/* bits 10:31 - reserved and should be preserved */
|
||||
|
||||
/* bits 15:0 - HCD page shift bit */
|
||||
#define XHCI_PAGE_SIZE_MASK 0xffff
|
||||
|
||||
/**
|
||||
* struct xhci_intr_reg - Interrupt Register Set
|
||||
* @irq_pending: IMAN - Interrupt Management Register. Used to enable
|
||||
@@ -1523,7 +1520,10 @@ struct xhci_hcd {
|
||||
u16 max_interrupters;
|
||||
/* imod_interval in ns (I * 250ns) */
|
||||
u32 imod_interval;
|
||||
u32 page_size;
|
||||
/* 4KB min, 128MB max */
|
||||
int page_size;
|
||||
/* Valid values are 12 to 20, inclusive */
|
||||
int page_shift;
|
||||
/* MSI-X/MSI vectors */
|
||||
int nvecs;
|
||||
/* optional clocks */
|
||||
|
||||
Reference in New Issue
Block a user