Commit b8c8fc6a authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'for-usb-next-2013-12-02' of...

Merge tag 'for-usb-next-2013-12-02' of git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci into usb-next

Sarah writes:

xhci: Cleanup for 3.14: Sparse fixes, replace xhci_read/write, misc

Hi Greg,

Here's fifteen patches for 3.14.  They include some non-urgent cleanups,
and the patches to replace the xhci_read/write variants with standard
read/write calls.  As you asked, the big endian fixes are being queued for
3.14 and they aren't marked for stable.

This also includes a couple of streams fixes, but not the full set from
Hans.  (I'll test those later this week.)  The goal is to get both the
xHCI driver streams support and the UAS driver fixed up for 3.14.  We
don't want to mark the fixes for stable, as all the code changes are
really too big for stable.

Please queue for 3.14.

Sarah Sharp
parents 6ce4eac1 7dd09a1a
...@@ -32,7 +32,7 @@ void xhci_dbg_regs(struct xhci_hcd *xhci) ...@@ -32,7 +32,7 @@ void xhci_dbg_regs(struct xhci_hcd *xhci)
xhci_dbg(xhci, "// xHCI capability registers at %p:\n", xhci_dbg(xhci, "// xHCI capability registers at %p:\n",
xhci->cap_regs); xhci->cap_regs);
temp = xhci_readl(xhci, &xhci->cap_regs->hc_capbase); temp = readl(&xhci->cap_regs->hc_capbase);
xhci_dbg(xhci, "// @%p = 0x%x (CAPLENGTH AND HCIVERSION)\n", xhci_dbg(xhci, "// @%p = 0x%x (CAPLENGTH AND HCIVERSION)\n",
&xhci->cap_regs->hc_capbase, temp); &xhci->cap_regs->hc_capbase, temp);
xhci_dbg(xhci, "// CAPLENGTH: 0x%x\n", xhci_dbg(xhci, "// CAPLENGTH: 0x%x\n",
...@@ -44,13 +44,13 @@ void xhci_dbg_regs(struct xhci_hcd *xhci) ...@@ -44,13 +44,13 @@ void xhci_dbg_regs(struct xhci_hcd *xhci)
xhci_dbg(xhci, "// xHCI operational registers at %p:\n", xhci->op_regs); xhci_dbg(xhci, "// xHCI operational registers at %p:\n", xhci->op_regs);
temp = xhci_readl(xhci, &xhci->cap_regs->run_regs_off); temp = readl(&xhci->cap_regs->run_regs_off);
xhci_dbg(xhci, "// @%p = 0x%x RTSOFF\n", xhci_dbg(xhci, "// @%p = 0x%x RTSOFF\n",
&xhci->cap_regs->run_regs_off, &xhci->cap_regs->run_regs_off,
(unsigned int) temp & RTSOFF_MASK); (unsigned int) temp & RTSOFF_MASK);
xhci_dbg(xhci, "// xHCI runtime registers at %p:\n", xhci->run_regs); xhci_dbg(xhci, "// xHCI runtime registers at %p:\n", xhci->run_regs);
temp = xhci_readl(xhci, &xhci->cap_regs->db_off); temp = readl(&xhci->cap_regs->db_off);
xhci_dbg(xhci, "// @%p = 0x%x DBOFF\n", &xhci->cap_regs->db_off, temp); xhci_dbg(xhci, "// @%p = 0x%x DBOFF\n", &xhci->cap_regs->db_off, temp);
xhci_dbg(xhci, "// Doorbell array at %p:\n", xhci->dba); xhci_dbg(xhci, "// Doorbell array at %p:\n", xhci->dba);
} }
...@@ -61,7 +61,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci) ...@@ -61,7 +61,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci)
xhci_dbg(xhci, "xHCI capability registers at %p:\n", xhci->cap_regs); xhci_dbg(xhci, "xHCI capability registers at %p:\n", xhci->cap_regs);
temp = xhci_readl(xhci, &xhci->cap_regs->hc_capbase); temp = readl(&xhci->cap_regs->hc_capbase);
xhci_dbg(xhci, "CAPLENGTH AND HCIVERSION 0x%x:\n", xhci_dbg(xhci, "CAPLENGTH AND HCIVERSION 0x%x:\n",
(unsigned int) temp); (unsigned int) temp);
xhci_dbg(xhci, "CAPLENGTH: 0x%x\n", xhci_dbg(xhci, "CAPLENGTH: 0x%x\n",
...@@ -69,7 +69,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci) ...@@ -69,7 +69,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci)
xhci_dbg(xhci, "HCIVERSION: 0x%x\n", xhci_dbg(xhci, "HCIVERSION: 0x%x\n",
(unsigned int) HC_VERSION(temp)); (unsigned int) HC_VERSION(temp));
temp = xhci_readl(xhci, &xhci->cap_regs->hcs_params1); temp = readl(&xhci->cap_regs->hcs_params1);
xhci_dbg(xhci, "HCSPARAMS 1: 0x%x\n", xhci_dbg(xhci, "HCSPARAMS 1: 0x%x\n",
(unsigned int) temp); (unsigned int) temp);
xhci_dbg(xhci, " Max device slots: %u\n", xhci_dbg(xhci, " Max device slots: %u\n",
...@@ -79,7 +79,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci) ...@@ -79,7 +79,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci)
xhci_dbg(xhci, " Max ports: %u\n", xhci_dbg(xhci, " Max ports: %u\n",
(unsigned int) HCS_MAX_PORTS(temp)); (unsigned int) HCS_MAX_PORTS(temp));
temp = xhci_readl(xhci, &xhci->cap_regs->hcs_params2); temp = readl(&xhci->cap_regs->hcs_params2);
xhci_dbg(xhci, "HCSPARAMS 2: 0x%x\n", xhci_dbg(xhci, "HCSPARAMS 2: 0x%x\n",
(unsigned int) temp); (unsigned int) temp);
xhci_dbg(xhci, " Isoc scheduling threshold: %u\n", xhci_dbg(xhci, " Isoc scheduling threshold: %u\n",
...@@ -87,7 +87,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci) ...@@ -87,7 +87,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci)
xhci_dbg(xhci, " Maximum allowed segments in event ring: %u\n", xhci_dbg(xhci, " Maximum allowed segments in event ring: %u\n",
(unsigned int) HCS_ERST_MAX(temp)); (unsigned int) HCS_ERST_MAX(temp));
temp = xhci_readl(xhci, &xhci->cap_regs->hcs_params3); temp = readl(&xhci->cap_regs->hcs_params3);
xhci_dbg(xhci, "HCSPARAMS 3 0x%x:\n", xhci_dbg(xhci, "HCSPARAMS 3 0x%x:\n",
(unsigned int) temp); (unsigned int) temp);
xhci_dbg(xhci, " Worst case U1 device exit latency: %u\n", xhci_dbg(xhci, " Worst case U1 device exit latency: %u\n",
...@@ -95,14 +95,14 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci) ...@@ -95,14 +95,14 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci)
xhci_dbg(xhci, " Worst case U2 device exit latency: %u\n", xhci_dbg(xhci, " Worst case U2 device exit latency: %u\n",
(unsigned int) HCS_U2_LATENCY(temp)); (unsigned int) HCS_U2_LATENCY(temp));
temp = xhci_readl(xhci, &xhci->cap_regs->hcc_params); temp = readl(&xhci->cap_regs->hcc_params);
xhci_dbg(xhci, "HCC PARAMS 0x%x:\n", (unsigned int) temp); xhci_dbg(xhci, "HCC PARAMS 0x%x:\n", (unsigned int) temp);
xhci_dbg(xhci, " HC generates %s bit addresses\n", xhci_dbg(xhci, " HC generates %s bit addresses\n",
HCC_64BIT_ADDR(temp) ? "64" : "32"); HCC_64BIT_ADDR(temp) ? "64" : "32");
/* FIXME */ /* FIXME */
xhci_dbg(xhci, " FIXME: more HCCPARAMS debugging\n"); xhci_dbg(xhci, " FIXME: more HCCPARAMS debugging\n");
temp = xhci_readl(xhci, &xhci->cap_regs->run_regs_off); temp = readl(&xhci->cap_regs->run_regs_off);
xhci_dbg(xhci, "RTSOFF 0x%x:\n", temp & RTSOFF_MASK); xhci_dbg(xhci, "RTSOFF 0x%x:\n", temp & RTSOFF_MASK);
} }
...@@ -110,7 +110,7 @@ static void xhci_print_command_reg(struct xhci_hcd *xhci) ...@@ -110,7 +110,7 @@ static void xhci_print_command_reg(struct xhci_hcd *xhci)
{ {
u32 temp; u32 temp;
temp = xhci_readl(xhci, &xhci->op_regs->command); temp = readl(&xhci->op_regs->command);
xhci_dbg(xhci, "USBCMD 0x%x:\n", temp); xhci_dbg(xhci, "USBCMD 0x%x:\n", temp);
xhci_dbg(xhci, " HC is %s\n", xhci_dbg(xhci, " HC is %s\n",
(temp & CMD_RUN) ? "running" : "being stopped"); (temp & CMD_RUN) ? "running" : "being stopped");
...@@ -128,7 +128,7 @@ static void xhci_print_status(struct xhci_hcd *xhci) ...@@ -128,7 +128,7 @@ static void xhci_print_status(struct xhci_hcd *xhci)
{ {
u32 temp; u32 temp;
temp = xhci_readl(xhci, &xhci->op_regs->status); temp = readl(&xhci->op_regs->status);
xhci_dbg(xhci, "USBSTS 0x%x:\n", temp); xhci_dbg(xhci, "USBSTS 0x%x:\n", temp);
xhci_dbg(xhci, " Event ring is %sempty\n", xhci_dbg(xhci, " Event ring is %sempty\n",
(temp & STS_EINT) ? "not " : ""); (temp & STS_EINT) ? "not " : "");
...@@ -163,7 +163,7 @@ static void xhci_print_ports(struct xhci_hcd *xhci) ...@@ -163,7 +163,7 @@ static void xhci_print_ports(struct xhci_hcd *xhci)
for (j = 0; j < NUM_PORT_REGS; ++j) { for (j = 0; j < NUM_PORT_REGS; ++j) {
xhci_dbg(xhci, "%p port %s reg = 0x%x\n", xhci_dbg(xhci, "%p port %s reg = 0x%x\n",
addr, names[j], addr, names[j],
(unsigned int) xhci_readl(xhci, addr)); (unsigned int) readl(addr));
addr++; addr++;
} }
} }
...@@ -177,7 +177,7 @@ void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num) ...@@ -177,7 +177,7 @@ void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num)
u64 temp_64; u64 temp_64;
addr = &ir_set->irq_pending; addr = &ir_set->irq_pending;
temp = xhci_readl(xhci, addr); temp = readl(addr);
if (temp == XHCI_INIT_VALUE) if (temp == XHCI_INIT_VALUE)
return; return;
...@@ -187,28 +187,28 @@ void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num) ...@@ -187,28 +187,28 @@ void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num)
(unsigned int)temp); (unsigned int)temp);
addr = &ir_set->irq_control; addr = &ir_set->irq_control;
temp = xhci_readl(xhci, addr); temp = readl(addr);
xhci_dbg(xhci, " %p: ir_set.control = 0x%x\n", addr, xhci_dbg(xhci, " %p: ir_set.control = 0x%x\n", addr,
(unsigned int)temp); (unsigned int)temp);
addr = &ir_set->erst_size; addr = &ir_set->erst_size;
temp = xhci_readl(xhci, addr); temp = readl(addr);
xhci_dbg(xhci, " %p: ir_set.erst_size = 0x%x\n", addr, xhci_dbg(xhci, " %p: ir_set.erst_size = 0x%x\n", addr,
(unsigned int)temp); (unsigned int)temp);
addr = &ir_set->rsvd; addr = &ir_set->rsvd;
temp = xhci_readl(xhci, addr); temp = readl(addr);
if (temp != XHCI_INIT_VALUE) if (temp != XHCI_INIT_VALUE)
xhci_dbg(xhci, " WARN: %p: ir_set.rsvd = 0x%x\n", xhci_dbg(xhci, " WARN: %p: ir_set.rsvd = 0x%x\n",
addr, (unsigned int)temp); addr, (unsigned int)temp);
addr = &ir_set->erst_base; addr = &ir_set->erst_base;
temp_64 = xhci_read_64(xhci, addr); temp_64 = readq(addr);
xhci_dbg(xhci, " %p: ir_set.erst_base = @%08llx\n", xhci_dbg(xhci, " %p: ir_set.erst_base = @%08llx\n",
addr, temp_64); addr, temp_64);
addr = &ir_set->erst_dequeue; addr = &ir_set->erst_dequeue;
temp_64 = xhci_read_64(xhci, addr); temp_64 = readq(addr);
xhci_dbg(xhci, " %p: ir_set.erst_dequeue = @%08llx\n", xhci_dbg(xhci, " %p: ir_set.erst_dequeue = @%08llx\n",
addr, temp_64); addr, temp_64);
} }
...@@ -219,12 +219,12 @@ void xhci_print_run_regs(struct xhci_hcd *xhci) ...@@ -219,12 +219,12 @@ void xhci_print_run_regs(struct xhci_hcd *xhci)
int i; int i;
xhci_dbg(xhci, "xHCI runtime registers at %p:\n", xhci->run_regs); xhci_dbg(xhci, "xHCI runtime registers at %p:\n", xhci->run_regs);
temp = xhci_readl(xhci, &xhci->run_regs->microframe_index); temp = readl(&xhci->run_regs->microframe_index);
xhci_dbg(xhci, " %p: Microframe index = 0x%x\n", xhci_dbg(xhci, " %p: Microframe index = 0x%x\n",
&xhci->run_regs->microframe_index, &xhci->run_regs->microframe_index,
(unsigned int) temp); (unsigned int) temp);
for (i = 0; i < 7; ++i) { for (i = 0; i < 7; ++i) {
temp = xhci_readl(xhci, &xhci->run_regs->rsvd[i]); temp = readl(&xhci->run_regs->rsvd[i]);
if (temp != XHCI_INIT_VALUE) if (temp != XHCI_INIT_VALUE)
xhci_dbg(xhci, " WARN: %p: Rsvd[%i] = 0x%x\n", xhci_dbg(xhci, " WARN: %p: Rsvd[%i] = 0x%x\n",
&xhci->run_regs->rsvd[i], &xhci->run_regs->rsvd[i],
...@@ -412,7 +412,7 @@ void xhci_dbg_cmd_ptrs(struct xhci_hcd *xhci) ...@@ -412,7 +412,7 @@ void xhci_dbg_cmd_ptrs(struct xhci_hcd *xhci)
{ {
u64 val; u64 val;
val = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); val = readq(&xhci->op_regs->cmd_ring);
xhci_dbg(xhci, "// xHC command ring deq ptr low bits + flags = @%08x\n", xhci_dbg(xhci, "// xHC command ring deq ptr low bits + flags = @%08x\n",
lower_32_bits(val)); lower_32_bits(val));
xhci_dbg(xhci, "// xHC command ring deq ptr high bits = @%08x\n", xhci_dbg(xhci, "// xHC command ring deq ptr high bits = @%08x\n",
......
This diff is collapsed.
This diff is collapsed.
...@@ -295,9 +295,9 @@ void xhci_ring_cmd_db(struct xhci_hcd *xhci) ...@@ -295,9 +295,9 @@ void xhci_ring_cmd_db(struct xhci_hcd *xhci)
return; return;
xhci_dbg(xhci, "// Ding dong!\n"); xhci_dbg(xhci, "// Ding dong!\n");
xhci_writel(xhci, DB_VALUE_HOST, &xhci->dba->doorbell[0]); writel(DB_VALUE_HOST, &xhci->dba->doorbell[0]);
/* Flush PCI posted writes */ /* Flush PCI posted writes */
xhci_readl(xhci, &xhci->dba->doorbell[0]); readl(&xhci->dba->doorbell[0]);
} }
static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) static int xhci_abort_cmd_ring(struct xhci_hcd *xhci)
...@@ -313,14 +313,13 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) ...@@ -313,14 +313,13 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci)
return 0; return 0;
} }
temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); temp_64 = readq(&xhci->op_regs->cmd_ring);
if (!(temp_64 & CMD_RING_RUNNING)) { if (!(temp_64 & CMD_RING_RUNNING)) {
xhci_dbg(xhci, "Command ring had been stopped\n"); xhci_dbg(xhci, "Command ring had been stopped\n");
return 0; return 0;
} }
xhci->cmd_ring_state = CMD_RING_STATE_ABORTED; xhci->cmd_ring_state = CMD_RING_STATE_ABORTED;
xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, writeq(temp_64 | CMD_RING_ABORT, &xhci->op_regs->cmd_ring);
&xhci->op_regs->cmd_ring);
/* Section 4.6.1.2 of xHCI 1.0 spec says software should /* Section 4.6.1.2 of xHCI 1.0 spec says software should
* time the completion od all xHCI commands, including * time the completion od all xHCI commands, including
...@@ -427,7 +426,7 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, ...@@ -427,7 +426,7 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci,
if ((ep_state & EP_HALT_PENDING) || (ep_state & SET_DEQ_PENDING) || if ((ep_state & EP_HALT_PENDING) || (ep_state & SET_DEQ_PENDING) ||
(ep_state & EP_HALTED)) (ep_state & EP_HALTED))
return; return;
xhci_writel(xhci, DB_VALUE(ep_index, stream_id), db_addr); writel(DB_VALUE(ep_index, stream_id), db_addr);
/* The CPU has better things to do at this point than wait for a /* The CPU has better things to do at this point than wait for a
* write-posting flush. It'll get there soon enough. * write-posting flush. It'll get there soon enough.
*/ */
...@@ -1655,7 +1654,7 @@ static void handle_device_notification(struct xhci_hcd *xhci, ...@@ -1655,7 +1654,7 @@ static void handle_device_notification(struct xhci_hcd *xhci,
u32 slot_id; u32 slot_id;
struct usb_device *udev; struct usb_device *udev;
slot_id = TRB_TO_SLOT_ID(event->generic.field[3]); slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->generic.field[3]));
if (!xhci->devs[slot_id]) { if (!xhci->devs[slot_id]) {
xhci_warn(xhci, "Device Notification event for " xhci_warn(xhci, "Device Notification event for "
"unused slot %u\n", slot_id); "unused slot %u\n", slot_id);
...@@ -1739,7 +1738,7 @@ static void handle_port_status(struct xhci_hcd *xhci, ...@@ -1739,7 +1738,7 @@ static void handle_port_status(struct xhci_hcd *xhci,
faked_port_index = find_faked_portnum_from_hw_portnum(hcd, xhci, faked_port_index = find_faked_portnum_from_hw_portnum(hcd, xhci,
port_id); port_id);
temp = xhci_readl(xhci, port_array[faked_port_index]); temp = readl(port_array[faked_port_index]);
if (hcd->state == HC_STATE_SUSPENDED) { if (hcd->state == HC_STATE_SUSPENDED) {
xhci_dbg(xhci, "resume root hub\n"); xhci_dbg(xhci, "resume root hub\n");
usb_hcd_resume_root_hub(hcd); usb_hcd_resume_root_hub(hcd);
...@@ -1748,7 +1747,7 @@ static void handle_port_status(struct xhci_hcd *xhci, ...@@ -1748,7 +1747,7 @@ static void handle_port_status(struct xhci_hcd *xhci,
if ((temp & PORT_PLC) && (temp & PORT_PLS_MASK) == XDEV_RESUME) { if ((temp & PORT_PLC) && (temp & PORT_PLS_MASK) == XDEV_RESUME) {
xhci_dbg(xhci, "port resume event for port %d\n", port_id); xhci_dbg(xhci, "port resume event for port %d\n", port_id);
temp1 = xhci_readl(xhci, &xhci->op_regs->command); temp1 = readl(&xhci->op_regs->command);
if (!(temp1 & CMD_RUN)) { if (!(temp1 & CMD_RUN)) {
xhci_warn(xhci, "xHC is not running.\n"); xhci_warn(xhci, "xHC is not running.\n");
goto cleanup; goto cleanup;
...@@ -2831,7 +2830,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) ...@@ -2831,7 +2830,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
spin_lock(&xhci->lock); spin_lock(&xhci->lock);
/* Check if the xHC generated the interrupt, or the irq is shared */ /* Check if the xHC generated the interrupt, or the irq is shared */
status = xhci_readl(xhci, &xhci->op_regs->status); status = readl(&xhci->op_regs->status);
if (status == 0xffffffff) if (status == 0xffffffff)
goto hw_died; goto hw_died;
...@@ -2853,16 +2852,16 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) ...@@ -2853,16 +2852,16 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
* Write 1 to clear the interrupt status. * Write 1 to clear the interrupt status.
*/ */
status |= STS_EINT; status |= STS_EINT;
xhci_writel(xhci, status, &xhci->op_regs->status); writel(status, &xhci->op_regs->status);
/* FIXME when MSI-X is supported and there are multiple vectors */ /* FIXME when MSI-X is supported and there are multiple vectors */
/* Clear the MSI-X event interrupt status */ /* Clear the MSI-X event interrupt status */
if (hcd->irq) { if (hcd->irq) {
u32 irq_pending; u32 irq_pending;
/* Acknowledge the PCI interrupt */ /* Acknowledge the PCI interrupt */
irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); irq_pending = readl(&xhci->ir_set->irq_pending);
irq_pending |= IMAN_IP; irq_pending |= IMAN_IP;
xhci_writel(xhci, irq_pending, &xhci->ir_set->irq_pending); writel(irq_pending, &xhci->ir_set->irq_pending);
} }
if (xhci->xhc_state & XHCI_STATE_DYING) { if (xhci->xhc_state & XHCI_STATE_DYING) {
...@@ -2871,9 +2870,8 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) ...@@ -2871,9 +2870,8 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
/* Clear the event handler busy flag (RW1C); /* Clear the event handler busy flag (RW1C);
* the event ring should be empty. * the event ring should be empty.
*/ */
temp_64 = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue); temp_64 = readq(&xhci->ir_set->erst_dequeue);
xhci_write_64(xhci, temp_64 | ERST_EHB, writeq(temp_64 | ERST_EHB, &xhci->ir_set->erst_dequeue);
&xhci->ir_set->erst_dequeue);
spin_unlock(&xhci->lock); spin_unlock(&xhci->lock);
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -2885,7 +2883,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) ...@@ -2885,7 +2883,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
*/ */
while (xhci_handle_event(xhci) > 0) {} while (xhci_handle_event(xhci) > 0) {}
temp_64 = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue); temp_64 = readq(&xhci->ir_set->erst_dequeue);
/* If necessary, update the HW's version of the event ring deq ptr. */ /* If necessary, update the HW's version of the event ring deq ptr. */
if (event_ring_deq != xhci->event_ring->dequeue) { if (event_ring_deq != xhci->event_ring->dequeue) {
deq = xhci_trb_virt_to_dma(xhci->event_ring->deq_seg, deq = xhci_trb_virt_to_dma(xhci->event_ring->deq_seg,
...@@ -2900,7 +2898,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) ...@@ -2900,7 +2898,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
/* Clear the event handler busy flag (RW1C); event ring is empty. */ /* Clear the event handler busy flag (RW1C); event ring is empty. */
temp_64 |= ERST_EHB; temp_64 |= ERST_EHB;
xhci_write_64(xhci, temp_64, &xhci->ir_set->erst_dequeue); writeq(temp_64, &xhci->ir_set->erst_dequeue);
spin_unlock(&xhci->lock); spin_unlock(&xhci->lock);
...@@ -3931,7 +3929,7 @@ int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags, ...@@ -3931,7 +3929,7 @@ int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags,
if (ret) if (ret)
return ret; return ret;
start_frame = xhci_readl(xhci, &xhci->run_regs->microframe_index); start_frame = readl(&xhci->run_regs->microframe_index);
start_frame &= 0x3fff; start_frame &= 0x3fff;
urb->start_frame = start_frame; urb->start_frame = start_frame;
......
...@@ -116,12 +116,12 @@ DECLARE_EVENT_CLASS(xhci_log_event, ...@@ -116,12 +116,12 @@ DECLARE_EVENT_CLASS(xhci_log_event,
__field(u64, dma) __field(u64, dma)
__field(u32, status) __field(u32, status)
__field(u32, flags) __field(u32, flags)
__dynamic_array(__le32, trb, 4) __dynamic_array(u8, trb, sizeof(struct xhci_generic_trb))
), ),
TP_fast_assign( TP_fast_assign(
__entry->va = trb_va; __entry->va = trb_va;
__entry->dma = le64_to_cpu(((u64)ev->field[1]) << 32 | __entry->dma = ((u64)le32_to_cpu(ev->field[1])) << 32 |
ev->field[0]); le32_to_cpu(ev->field[0]);
__entry->status = le32_to_cpu(ev->field[2]); __entry->status = le32_to_cpu(ev->field[2]);
__entry->flags = le32_to_cpu(ev->field[3]); __entry->flags = le32_to_cpu(ev->field[3]);
memcpy(__get_dynamic_array(trb), trb_va, memcpy(__get_dynamic_array(trb), trb_va,
......
This diff is collapsed.
...@@ -28,6 +28,17 @@ ...@@ -28,6 +28,17 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/usb/hcd.h> #include <linux/usb/hcd.h>
/*
* Registers should always be accessed with double word or quad word accesses.
*
* Some xHCI implementations may support 64-bit address pointers. Registers
* with 64-bit address pointers should be written to with dword accesses by
* writing the low dword first (ptr[0]), then the high dword (ptr[1]) second.
* xHCI implementations that do not support 64-bit address pointers will ignore
* the high dword, and write order is irrelevant.
*/
#include <asm-generic/io-64-nonatomic-lo-hi.h>
/* Code sharing between pci-quirks and xhci hcd */ /* Code sharing between pci-quirks and xhci hcd */
#include "xhci-ext-caps.h" #include "xhci-ext-caps.h"
#include "pci-quirks.h" #include "pci-quirks.h"
...@@ -752,7 +763,7 @@ struct xhci_stream_ctx { ...@@ -752,7 +763,7 @@ struct xhci_stream_ctx {
}; };
/* Stream Context Types (section 6.4.1) - bits 3:1 of stream ctx deq ptr */ /* Stream Context Types (section 6.4.1) - bits 3:1 of stream ctx deq ptr */
#define SCT_FOR_CTX(p) (((p) << 1) & 0x7) #define SCT_FOR_CTX(p) (((p) & 0x7) << 1)
/* Secondary stream array type, dequeue pointer is to a transfer ring */ /* Secondary stream array type, dequeue pointer is to a transfer ring */
#define SCT_SEC_TR 0 #define SCT_SEC_TR 0
/* Primary stream array type, dequeue pointer is to a transfer ring */ /* Primary stream array type, dequeue pointer is to a transfer ring */
...@@ -1595,47 +1606,6 @@ static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci) ...@@ -1595,47 +1606,6 @@ static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci)
#define xhci_warn_ratelimited(xhci, fmt, args...) \ #define xhci_warn_ratelimited(xhci, fmt, args...) \
dev_warn_ratelimited(xhci_to_hcd(xhci)->self.controller , fmt , ## args) dev_warn_ratelimited(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
/* TODO: copied from ehci.h - can be refactored? */
/* xHCI spec says all registers are little endian */
static inline unsigned int xhci_readl(const struct xhci_hcd *xhci,
__le32 __iomem *regs)
{
return readl(regs);
}
static inline void xhci_writel(struct xhci_hcd *xhci,
const unsigned int val, __le32 __iomem *regs)
{
writel(val, regs);
}
/*
* Registers should always be accessed with double word or quad word accesses.
*
* Some xHCI implementations may support 64-bit address pointers. Registers
* with 64-bit address pointers should be written to with dword accesses by
* writing the low dword first (ptr[0]), then the high dword (ptr[1]) second.
* xHCI implementations that do not support 64-bit address pointers will ignore
* the high dword, and write order is irrelevant.
*/
static inline u64 xhci_read_64(const struct xhci_hcd *xhci,
__le64 __iomem *regs)
{
__u32 __iomem *ptr = (__u32 __iomem *) regs;
u64 val_lo = readl(ptr);
u64 val_hi = readl(ptr + 1);
return val_lo + (val_hi << 32);
}
static inline void xhci_write_64(struct xhci_hcd *xhci,
const u64 val, __le64 __iomem *regs)
{
__u32 __iomem *ptr = (__u32 __iomem *) regs;
u32 val_lo = lower_32_bits(val);
u32 val_hi = upper_32_bits(val);
writel(val_lo, ptr);
writel(val_hi, ptr + 1);
}
static inline int xhci_link_trb_quirk(struct xhci_hcd *xhci) static inline int xhci_link_trb_quirk(struct xhci_hcd *xhci)
{ {
return xhci->quirks & XHCI_LINK_TRB_QUIRK; return xhci->quirks & XHCI_LINK_TRB_QUIRK;
......
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