diff options
author | Nico Huber <nico.huber@secunet.com> | 2012-11-12 16:20:32 +0100 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2012-11-14 17:45:16 +0100 |
commit | 6e711c6a97a9d4122615018121d0d2a37b642ed1 (patch) | |
tree | 745114ff1c6b485f4194818203edea3714cf56ce /payloads | |
parent | aaa212d17d0070850f1dd2195129788acc978a9f (diff) |
libpayload: Add init() function to hci_t and rework uhci_reset()
uhci_reset() differs in semantics compared to the other HCI's reset()
implementations. uhci_reset() does some initialization work after a
controller reset. So move the initialization part to a new function,
uhci_reinit(), which get's exported through a new entry in hci_t:
hci_t.init().
Warning: This breaks code that relies on the current, special,
counterintuitive behaviour of uhci_reset(). If one wants a working host
controller after calling hci_t.reset(), he should call hci_t.init()
afterwards.
Change-Id: Ia7ce80865d12d11157645ce251f77f349f8e3c34
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: http://review.coreboot.org/1851
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'payloads')
-rw-r--r-- | payloads/libpayload/drivers/usb/ehci.c | 5 | ||||
-rw-r--r-- | payloads/libpayload/drivers/usb/ohci.c | 6 | ||||
-rw-r--r-- | payloads/libpayload/drivers/usb/uhci.c | 6 | ||||
-rw-r--r-- | payloads/libpayload/drivers/usb/xhci.c | 6 | ||||
-rw-r--r-- | payloads/libpayload/include/usb/usb.h | 3 |
5 files changed, 26 insertions, 0 deletions
diff --git a/payloads/libpayload/drivers/usb/ehci.c b/payloads/libpayload/drivers/usb/ehci.c index 4fcd5ea952..5f65c5353d 100644 --- a/payloads/libpayload/drivers/usb/ehci.c +++ b/payloads/libpayload/drivers/usb/ehci.c @@ -68,6 +68,10 @@ static void ehci_reset (hci_t *controller) usb_debug("ehci_reset(): reset failed!\n"); } +static void ehci_reinit (hci_t *controller) +{ +} + static int ehci_set_periodic_schedule(ehci_t *ehcic, int enable) { /* Set periodic schedule status. */ @@ -657,6 +661,7 @@ ehci_init (pcidev_t addr) controller->start = ehci_start; controller->stop = ehci_stop; controller->reset = ehci_reset; + controller->init = ehci_reinit; controller->shutdown = ehci_shutdown; controller->bulk = ehci_bulk; controller->control = ehci_control; diff --git a/payloads/libpayload/drivers/usb/ohci.c b/payloads/libpayload/drivers/usb/ohci.c index 51af9504fe..b128029751 100644 --- a/payloads/libpayload/drivers/usb/ohci.c +++ b/payloads/libpayload/drivers/usb/ohci.c @@ -58,6 +58,11 @@ ohci_reset (hci_t *controller) mdelay(10); /* wait 10ms */ } +static void +ohci_reinit (hci_t *controller) +{ +} + #ifdef USB_DEBUG /* Section 4.3.3 */ static const char *completion_codes[] = { @@ -107,6 +112,7 @@ ohci_init (pcidev_t addr) controller->start = ohci_start; controller->stop = ohci_stop; controller->reset = ohci_reset; + controller->init = ohci_reinit; controller->shutdown = ohci_shutdown; controller->bulk = ohci_bulk; controller->control = ohci_control; diff --git a/payloads/libpayload/drivers/usb/uhci.c b/payloads/libpayload/drivers/usb/uhci.c index ab4f7982d1..2eea375bcc 100644 --- a/payloads/libpayload/drivers/usb/uhci.c +++ b/payloads/libpayload/drivers/usb/uhci.c @@ -114,7 +114,11 @@ uhci_reset (hci_t *controller) udelay (500); if (timeout < 0) usb_debug ("Warning: uhci: host controller reset timed out.\n"); +} +static void +uhci_reinit (hci_t *controller) +{ uhci_reg_write32 (controller, FLBASEADD, (u32) virt_to_phys (UHCI_INST (controller)-> framelistptr)); @@ -152,6 +156,7 @@ uhci_init (pcidev_t addr) controller->start = uhci_start; controller->stop = uhci_stop; controller->reset = uhci_reset; + controller->init = uhci_reinit; controller->shutdown = uhci_shutdown; controller->bulk = uhci_bulk; controller->control = uhci_control; @@ -228,6 +233,7 @@ uhci_init (pcidev_t addr) controller->devices[0]->init = uhci_rh_init; controller->devices[0]->init (controller->devices[0]); uhci_reset (controller); + uhci_reinit (controller); return controller; } diff --git a/payloads/libpayload/drivers/usb/xhci.c b/payloads/libpayload/drivers/usb/xhci.c index d5ee134041..2a8bcb448e 100644 --- a/payloads/libpayload/drivers/usb/xhci.c +++ b/payloads/libpayload/drivers/usb/xhci.c @@ -49,6 +49,11 @@ xhci_reset (hci_t *controller) { } +static void +xhci_reinit (hci_t *controller) +{ +} + hci_t * xhci_init (pcidev_t addr) { @@ -68,6 +73,7 @@ xhci_init (pcidev_t addr) controller->start = xhci_start; controller->stop = xhci_stop; controller->reset = xhci_reset; + controller->init = xhci_reinit; controller->shutdown = xhci_shutdown; controller->bulk = xhci_bulk; controller->control = xhci_control; diff --git a/payloads/libpayload/include/usb/usb.h b/payloads/libpayload/include/usb/usb.h index 8dd2304439..8e286b4250 100644 --- a/payloads/libpayload/include/usb/usb.h +++ b/payloads/libpayload/include/usb/usb.h @@ -127,6 +127,9 @@ struct usbdev_hc { /* reset(): Perform a controller reset. The controller needs to be (re)initialized afterwards to work (again). */ void (*reset) (hci_t *controller); + /* init(): Initialize a (previously reset) controller + to a working state. */ + void (*init) (hci_t *controller); /* shutdown(): Stop operation, detach host controller and shutdown this driver instance. After calling shutdown() any other usage of this hci_t* is invalid. */ |