[Cbe-oss-dev] [PATCH 4/5] usb: Add new EHCI post_reset hook

Geoff Levand geoff at infradead.org
Tue Nov 15 13:43:57 EST 2011


Add a new optional platform hook post_reset to the ehci_hcd structure.
If this post_reset pointer has been initialized the ehci-hcd core will
call the post_reset routine after any CMD_RESET or CMD_LRESET command
is written to the HC.  Platform drivers can use this hook to do post
reset work-arounds.

Signed-off-by: Geoff Levand <geoff at infradead.org>
---
 drivers/usb/host/ehci-hcd.c |    6 ++++++
 drivers/usb/host/ehci.h     |    3 +++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 4ff0b7e..114f558 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -283,6 +283,9 @@ static int ehci_reset (struct ehci_hcd *ehci)
 	retval = handshake (ehci, &ehci->regs->command,
 			    CMD_RESET, 0, 250 * 1000);
 
+	if (ehci->post_reset)
+		ehci->post_reset(ehci);
+
 	if (ehci->has_hostpc) {
 		ehci_writel(ehci, USBMODE_EX_HC | USBMODE_EX_VBPS,
 			(u32 __iomem *)(((u8 *)ehci->regs) + USBMODE_EX));
@@ -728,6 +731,9 @@ static int ehci_run (struct usb_hcd *hcd)
 	ehci_writel(ehci, ehci->command, &ehci->regs->command);
 	dbg_cmd (ehci, "init", ehci->command);
 
+	if (ehci->post_reset)
+		ehci->post_reset(ehci);
+
 	/*
 	 * Start, enabling full USB 2.0 functionality ... usb 1.1 devices
 	 * are explicitly handed to companion controller(s), so no TT is
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 0a5fda7..23e6186 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -148,6 +148,9 @@ struct ehci_hcd {			/* one per controller */
 	unsigned		has_synopsys_hc_bug:1; /* Synopsys HC */
 	unsigned		frame_index_bug:1; /* MosChip (AKA NetMos) */
 
+	/* perform post CMD_RESET and CMD_LRESET work-arounds */
+	void	(*post_reset) (struct ehci_hcd *ehci);
+
 	/* required for usb32 quirk */
 	#define OHCI_CTRL_HCFS          (3 << 6)
 	#define OHCI_USB_OPER           (2 << 6)
-- 
1.7.4.1




More information about the cbe-oss-dev mailing list