changeset 9827:2d174a95bf15 onnv_117

6769365 USB should power down during suspend
author Vincent Wang <Vincent.Wang@Sun.COM>
date Tue, 09 Jun 2009 11:56:20 +0800
parents 592e4591c22c
children 31dba366f03d
files usr/src/uts/common/io/usb/hcd/ehci/ehci_util.c usr/src/uts/common/io/usb/hcd/uhci/uhci.c
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/usb/hcd/ehci/ehci_util.c	Mon Jun 08 19:55:25 2009 -0700
+++ b/usr/src/uts/common/io/usb/hcd/ehci/ehci_util.c	Tue Jun 09 11:56:20 2009 +0800
@@ -2060,11 +2060,17 @@
 	if (ehcip->ehci_polled_kbd_count == 0 || force_ehci_off != 0) {
 		Set_OpReg(ehci_command,
 		    Get_OpReg(ehci_command) & ~EHCI_CMD_HOST_CTRL_RUN);
+
+		drv_usecwait(EHCI_RESET_TIMEWAIT);
 	}
 
 	/* Set host controller soft state to suspend */
 	ehcip->ehci_hc_soft_state = EHCI_CTLR_SUSPEND_STATE;
 
+	/* Reset the host controller. This can poweroff downstream ports */
+	Set_OpReg(ehci_command,
+	    Get_OpReg(ehci_command) | EHCI_CMD_HOST_CTRL_RESET);
+
 	mutex_exit(&ehcip->ehci_int_mutex);
 
 	return (DDI_SUCCESS);
--- a/usr/src/uts/common/io/usb/hcd/uhci/uhci.c	Mon Jun 08 19:55:25 2009 -0700
+++ b/usr/src/uts/common/io/usb/hcd/uhci/uhci.c	Tue Jun 09 11:56:20 2009 +0800
@@ -898,6 +898,16 @@
 	/* Set host controller soft state to suspend */
 	uhcip->uhci_hc_soft_state = UHCI_CTLR_SUSPEND_STATE;
 
+	/* Reset the host controller. This can poweroff downstream ports */
+	Set_OpReg16(USBCMD, USBCMD_REG_GBL_RESET);
+
+	/* Wait 10ms for reset to complete */
+	mutex_exit(&uhcip->uhci_int_mutex);
+	delay(drv_usectohz(UHCI_RESET_DELAY));
+	mutex_enter(&uhcip->uhci_int_mutex);
+
+	Set_OpReg16(USBCMD, 0);
+
 	mutex_exit(&uhcip->uhci_int_mutex);
 
 	return (USB_SUCCESS);