libpayload: Implement usb_exit
authorPatrick Georgi <patrick.georgi@secunet.com>
Fri, 4 Nov 2011 11:06:06 +0000 (12:06 +0100)
committerStefan Reinauer <stefan.reinauer@coreboot.org>
Fri, 4 Nov 2011 21:14:29 +0000 (22:14 +0100)
So far it was empty and never published. It now exists and shuts down
all controllers (esp. EHCI which resets the port routers).

Change-Id: I81e355e8a05778d6397675417b085a094a6f48ee
Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Reviewed-on: http://review.coreboot.org/397
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
payloads/libpayload/drivers/usb/usb.c
payloads/libpayload/drivers/usb/usbinit.c
payloads/libpayload/include/libpayload.h

index 4f423327d5dae0c7f6fde0ba777fc6d2f4f07c8a..995b4c29184ee1085cd4d29eff1aa1293057960a 100644 (file)
@@ -67,6 +67,22 @@ detach_controller (hci_t *controller)
        }
 }
 
+/**
+ * Shut down all controllers
+ */
+int
+usb_exit (void)
+{
+       if (usb_hcs == 0)
+               return 0;
+       hci_t *controller = usb_hcs;
+       while (controller != 0) {
+               controller->shutdown(controller);
+               controller = controller->next;
+       }
+       return 0;
+}
+
 /**
  * Polls all hubs on all USB controllers, to find out about device changes
  */
index 3964197038aaf6fa2941623eaab3b87f60edaa63..8499b82411cea327f865c2bccbf9506e59ecd8ed 100644 (file)
@@ -139,8 +139,3 @@ usb_initialize (void)
        return 0;
 }
 
-int
-usb_exit (void)
-{
-       return 0;
-}
index 80eaaa40b7d18059234d5984f27d3639d2656a83..0e892c80cd3e806a9dae418e063bdf22f06ba118 100644 (file)
@@ -123,6 +123,7 @@ void rtc_read_clock(struct tm *tm);
  * @{
  */
 int usb_initialize(void);
+int usb_exit (void);
 int usbhid_havechar(void);
 int usbhid_getchar(void);
 /** @} */