Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab4e844e authored by Chandana Kishori Chiluveru's avatar Chandana Kishori Chiluveru
Browse files

Revert "usb: XHCI: Bailout command abort operation upon XHCI remove"



This reverts commit 6e605b252217("usb: XHCI: Bailout command abort
operation upon XHCI remove")as a result, driver do not performing full
handshake timeout when clearing R/S bit. When it is calling xhci_halt()
from xhci_plat_remove() context.

Change-Id: Iebe9381c07cb8d46b2b2daf0958c8c33a996c8af
Signed-off-by: default avatarChandana Kishori Chiluveru <cchiluve@codeaurora.org>
parent d02d62b8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1857,7 +1857,7 @@ int xhci_bus_resume(struct usb_hcd *hcd)

	/* poll for U0 link state complete, both USB2 and USB3 */
	for_each_set_bit(port_index, &bus_state->bus_suspended, BITS_PER_LONG) {
		sret = xhci_handshake(xhci, port_array[port_index], PORT_PLC,
		sret = xhci_handshake(port_array[port_index], PORT_PLC,
				      PORT_PLC, 10 * 1000);
		if (sret) {
			xhci_warn(xhci, "port %d resume PLC timeout\n",
+1 −1
Original line number Diff line number Diff line
@@ -367,7 +367,7 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci, unsigned long flags)
	 * In the future we should distinguish between -ENODEV and -ETIMEDOUT
	 * and try to recover a -ETIMEDOUT with a host controller reset.
	 */
	ret = xhci_handshake(xhci, &xhci->op_regs->cmd_ring,
	ret = xhci_handshake(&xhci->op_regs->cmd_ring,
			CMD_RING_RUNNING, 0, 1000 * 1000);
	if (ret < 0) {
		xhci_err(xhci, "Abort failed to stop command ring: %d\n", ret);
+9 −13
Original line number Diff line number Diff line
@@ -76,8 +76,7 @@ static bool td_on_ring(struct xhci_td *td, struct xhci_ring *ring)
 * handshake done).  There are two failure modes:  "usec" have passed (major
 * hardware flakeout), or the register reads as all-ones (hardware removed).
 */
int xhci_handshake(struct xhci_hcd *xhci,
		void __iomem *ptr, u32 mask, u32 done, int usec)
int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec)
{
	u32	result;

@@ -85,9 +84,6 @@ int xhci_handshake(struct xhci_hcd *xhci,
		result = readl(ptr);
		if (result == ~(u32)0)		/* card removed */
			return -ENODEV;
		/* host removed. Bail out */
		if (xhci->xhc_state & XHCI_STATE_REMOVING)
			return -ENODEV;
		result &= mask;
		if (result == done)
			return 0;
@@ -130,7 +126,7 @@ int xhci_halt(struct xhci_hcd *xhci)
	xhci_dbg_trace(xhci, trace_xhci_dbg_init, "// Halt the HC");
	xhci_quiesce(xhci);

	ret = xhci_handshake(xhci, &xhci->op_regs->status,
	ret = xhci_handshake(&xhci->op_regs->status,
			STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC);
	if (ret) {
		xhci_warn(xhci, "Host halt failed, %d\n", ret);
@@ -165,7 +161,7 @@ int xhci_start(struct xhci_hcd *xhci)
	 * Wait for the HCHalted Status bit to be 0 to indicate the host is
	 * running.
	 */
	ret = xhci_handshake(xhci, &xhci->op_regs->status,
	ret = xhci_handshake(&xhci->op_regs->status,
			STS_HALT, 0, XHCI_MAX_HALT_USEC);
	if (ret == -ETIMEDOUT)
		xhci_err(xhci, "Host took too long to start, "
@@ -220,7 +216,7 @@ int xhci_reset(struct xhci_hcd *xhci)
	if (xhci->quirks & XHCI_INTEL_HOST)
		udelay(1000);

	ret = xhci_handshake(xhci, &xhci->op_regs->command,
	ret = xhci_handshake(&xhci->op_regs->command,
			CMD_RESET, 0, 10 * 1000 * 1000);
	if (ret)
		return ret;
@@ -234,7 +230,7 @@ int xhci_reset(struct xhci_hcd *xhci)
	 * xHCI cannot write to any doorbells or operational registers other
	 * than status until the "Controller Not Ready" flag is cleared.
	 */
	ret = xhci_handshake(xhci, &xhci->op_regs->status,
	ret = xhci_handshake(&xhci->op_regs->status,
			STS_CNR, 0, 10 * 1000 * 1000);

	for (i = 0; i < 2; i++) {
@@ -965,7 +961,7 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)
	/* Some chips from Fresco Logic need an extraordinary delay */
	delay *= (xhci->quirks & XHCI_SLOW_SUSPEND) ? 10 : 1;

	if (xhci_handshake(xhci, &xhci->op_regs->status,
	if (xhci_handshake(&xhci->op_regs->status,
		      STS_HALT, STS_HALT, delay)) {
		xhci_warn(xhci, "WARN: xHC CMD_RUN timeout\n");
		spin_unlock_irq(&xhci->lock);
@@ -981,7 +977,7 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)
	command |= CMD_CSS;
	writel(command, &xhci->op_regs->command);
	xhci->broken_suspend = 0;
	if (xhci_handshake(xhci, &xhci->op_regs->status,
	if (xhci_handshake(&xhci->op_regs->status,
				STS_SAVE, 0, 10 * 1000)) {
	/*
	 * AMD SNPS xHC 3.0 occasionally does not clear the
@@ -1072,7 +1068,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
		 * restore so setting the timeout to 100ms. Xhci specification
		 * doesn't mention any timeout value.
		 */
		if (xhci_handshake(xhci, &xhci->op_regs->status,
		if (xhci_handshake(&xhci->op_regs->status,
			      STS_RESTORE, 0, 100 * 1000)) {
			xhci_warn(xhci, "WARN: xHC restore state timeout\n");
			spin_unlock_irq(&xhci->lock);
@@ -1143,7 +1139,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
	command = readl(&xhci->op_regs->command);
	command |= CMD_RUN;
	writel(command, &xhci->op_regs->command);
	xhci_handshake(xhci, &xhci->op_regs->status, STS_HALT,
	xhci_handshake(&xhci->op_regs->status, STS_HALT,
		  0, 250 * 1000);

	/* step 5: walk topology and initialize portsc,
+1 −2
Original line number Diff line number Diff line
@@ -2026,8 +2026,7 @@ int xhci_sec_event_ring_cleanup(struct usb_hcd *hcd, unsigned int intr_num);

/* xHCI host controller glue */
typedef void (*xhci_get_quirks_t)(struct device *, struct xhci_hcd *);
int xhci_handshake(struct xhci_hcd *xhci,
		void __iomem *ptr, u32 mask, u32 done, int usec);
int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec);
void xhci_quiesce(struct xhci_hcd *xhci);
int xhci_halt(struct xhci_hcd *xhci);
int xhci_start(struct xhci_hcd *xhci);