EHCI post reset callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I am developing HCD for MSM USB hardware. The controller is compliant to EHCI.
But we need to initialize non-EHCI registers after controller is reset. This
also include workarounds like disabling streaming mode etc.

Due to this, we can not initialize .start method of struct hc_driver to
ehci_run. This function call ehci_reset (after this hardware register settings
are lost) and continue initialization of controller.

Is it okay to introduce a callback function in ehci_hcd struct that gets called
right after ehci_reset()? I have added this method to ehci_hcd instead of hc_driver
struct thinking that this is more like a silicon quirk.

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 34a928d..b6a5448 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -277,6 +277,15 @@ static int ehci_reset (struct ehci_hcd *ehci)
 	if (ehci_is_TDI(ehci))
 		tdi_reset (ehci);
 
+	/* Some controllers require additional hardware initialization after
+	 * controller reset.
+	 */
+	if (ehci->post_reset) {
+		retval = ehci->post_reset(ehci);
+		if (retval)
+			return retval;
+	}
+
 	if (ehci->debug)
 		dbgp_external_startup();
 
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index bde823f..ad4b0bc 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -131,6 +131,7 @@ struct ehci_hcd {			/* one per controller */
 	unsigned		need_io_watchdog:1;
 	unsigned		broken_periodic:1;
 	unsigned		fs_i_thresh:1;	/* Intel iso scheduling */
+	int			(*post_reset)(struct ehci_hcd *);
 
 	/* required for usb32 quirk */
 	#define OHCI_CTRL_HCFS          (3 << 6)


Thanks,
Pavan
-- 
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux