libpayload: Tell EHCI to re-enable USB1 controllers
[coreboot.git] / payloads / libpayload / drivers / usb / ehci.c
index 3df0477695aaf57b94b41335cf5c484fca0bc0c7..71fbd7aed7866a6da382833510c25f1c9e235e70 100644 (file)
@@ -34,9 +34,9 @@
 static void dump_td(u32 addr)
 {
        qtd_t *td = phys_to_virt(addr);
-       printf("td at phys(%x): active: %x, halted: %x, data_buf_err: %x\n    babble: %x, xact_err: %x, missed_mframe: %x\n    splitxstate: %x, perr: %x\n\n",
+       debug("td at phys(%x): active: %x, halted: %x, data_buf_err: %x\n    babble: %x, xact_err: %x, missed_mframe: %x\n    splitxstate: %x, perr: %x\n\n",
                addr, td->active, td->halted, td->data_buf_err, td->babble, td->xact_err, td->missed_mframe, td->splitxstate, td->perr);
-       printf("-   cerr: %x, total_len: %x\n\n", td->cerr, td->total_len);
+       debug("-   cerr: %x, total_len: %x\n\n", td->cerr, td->total_len);
 }
 
 static void ehci_start (hci_t *controller)
@@ -56,7 +56,7 @@ static void ehci_reset (hci_t *controller)
 
 static void ehci_shutdown (hci_t *controller)
 {
-
+       EHCI_INST(controller)->operation->configflag = 0;
 }
 
 enum { EHCI_OUT=0, EHCI_IN=1, EHCI_SETUP=2 };
@@ -122,7 +122,7 @@ int wait_for_tds(qtd_t *head)
                if (cur->halted) {
                        printf("ERROR with packet\n");
                        dump_td(virt_to_phys(cur));
-                       printf("-----------------\n");
+                       debug("-----------------\n");
                        return 1;
                }
                if (cur->next_qtd & 1) {
@@ -130,7 +130,7 @@ int wait_for_tds(qtd_t *head)
                }
                if (0) dump_td(virt_to_phys(cur));
                /* helps debugging the TD chain */
-               if (0) printf("\nmoving from %x to %x\n", cur, phys_to_virt(cur->next_qtd));
+               if (0) debug("\nmoving from %x to %x\n", cur, phys_to_virt(cur->next_qtd));
                cur = phys_to_virt(cur->next_qtd);
        }
        return result;
@@ -312,11 +312,11 @@ ehci_init (pcidev_t addr)
        hci_t *controller = new_controller ();
 
        if (!controller)
-               usb_fatal("Could not create USB controller instance.\n");
+               fatal("Could not create USB controller instance.\n");
 
        controller->instance = malloc (sizeof (ehci_t));
        if(!controller->instance)
-               usb_fatal("Not enough memory creating USB controller instance.\n");
+               fatal("Not enough memory creating USB controller instance.\n");
 
 #define PCI_COMMAND 4
 #define PCI_COMMAND_IO 1
@@ -336,6 +336,7 @@ ehci_init (pcidev_t addr)
        controller->create_intr_queue = ehci_create_intr_queue;
        controller->destroy_intr_queue = ehci_destroy_intr_queue;
        controller->poll_intr_queue = ehci_poll_intr_queue;
+       controller->bus_address = addr;
        for (i = 0; i < 128; i++) {
                controller->devices[i] = 0;
        }